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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9134503 | # coding: utf-8
import argparse
import queue
from parser.JavBusConst import jav_base_url
from parser.JavBusVideoDetailParser import JavbusVideoParser
def main( start_page, end_page, thread_num):
# 构建页面队列
page_queue = queue.Queue()
video_url = jav_base_url+'page/page_num'
for page in range(start_page,... | null | main.py | main.py | py | 1,116 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "queue.Queue",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "parser.JavBusConst.jav_base_url",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "parser.JavBusVideoDetailParser.JavbusVideoParser",
"line_number": 18,
"usage_type": "call"
... |
134548536 | """empty message
Revision ID: fb613e0c66de
Revises:
Create Date: 2020-11-19 09:53:51.077166
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'fb613e0c66de'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | null | migrations/versions/fb613e0c66de_.py | fb613e0c66de_.py | py | 1,404 | python | en | code | null | code-starcoder2 | 66 | [
{
"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... |
204646373 | from django.shortcuts import render
from .models import Receipts,Sales
import datetime
from brands.models import BrandModel
from payment.models import PaymentModel
from customers.models import Customer
from requirements import success,error
from rest_framework import generics
from rest_framework.permissions import IsAu... | null | backend/Himalaya/receipts/views.py | views.py | py | 6,014 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "rest_framework.pagination.PageNumberPagination",
"line_number": 26,
"usage_type": "name"
},
{
"api_name": "rest_framework.views.APIView",
"line_number": 26,
"usage_type": "name"
},
{
"api_name": "models.Receipts.objects.all",
"line_number": 27,
"usage_type"... |
444456060 | import os
import logging
from glob import glob
from PhDAlgorithm.run import WholeAlgorithm
def run_to_hot_image(path):
mtl_filename = glob(os.path.join(path, '*_MTL.txt'))[0]
boap_filename = os.path.join(path, 'Merged_BOAp.tif')
output_basename = os.path.basename(mtl_filename).replace('_MTL.txt', '')
... | null | Seg/run_to_hot_image.py | run_to_hot_image.py | py | 885 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "glob.glob",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "os.path.join",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 10,
"usage_type": "attribute"
},
{
"api_name": "os.path.join",
"line_number":... |
339735184 | # utils.py
import requests
import socket
from datetime import datetime
def getlocal_public_ip():
try:
retval = None
response = requests.get("http://members.3322.org/dyndns/getip")
if response.status_code == requests.codes.ok:
retval = response.content.decode('utf8').strip();
... | null | src/utils.py | utils.py | py | 952 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "requests.get",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "requests.codes",
"line_number": 11,
"usage_type": "attribute"
},
{
"api_name": "socket.gethostbyname",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "datetime.dateti... |
259164766 | import csv
from django.core.management.base import BaseCommand
from django.utils.text import slugify
from phones.models import Phone
class Command(BaseCommand):
def add_arguments(self, parser):
pass
def handle(self, *args, **options):
with open('phones.csv', 'r') as csvfile:
ph... | null | phones/management/commands/import_phones.py | import_phones.py | py | 866 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "django.core.management.base.BaseCommand",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "csv.reader",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "phones.models.Phone",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": ... |
495186969 | import requests
# Api key
AUTH_KEY = ""
# API endpoint
URL = "https://mashape-community-urban-dictionary.p.rapidapi.com/define"
# request header
headers = {"x-rapidapi-key": AUTH_KEY}
def define(phrase, i=0):
"""Returns the 'i'th definition for the given phrase
if i is not given, returns the top_resu... | null | urbanDict.py | urbanDict.py | py | 1,580 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "requests.get",
"line_number": 23,
"usage_type": "call"
}
] |
17408403 | import vtk
import pydicom
import glob
# Start by loading some data.
PathDicom = "F:/MRI Brain Scan/Series 8/"
def DicomInfo(pathDicom):
filelist = glob.glob(pathDicom + "*.dcm")
filename = filelist[0]
dataset = pydicom.dcmread(filename)
# Normal mode:
print()
print("Filename.........:", fi... | null | dicomreader/scratch.py | scratch.py | py | 4,757 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "glob.glob",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "pydicom.dcmread",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "vtk.vtkDICOMImageReader",
"line_number": 39,
"usage_type": "call"
},
{
"api_name": "vtk.vtkMatrix4x4",
... |
301032280 | from django.shortcuts import render, redirect
from django.http import HttpResponseRedirect, HttpResponseRedirect
from .models import TodoItem
def todoView(request):
all_todo_items = TodoItem.objects.all()
return render(request, 'todo.html',
{'all_items':all_todo_items})
def addTodo(request):
new_i... | null | startup/views.py | views.py | py | 592 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "models.TodoItem.objects.all",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "models.TodoItem.objects",
"line_number": 6,
"usage_type": "attribute"
},
{
"api_name": "models.TodoItem",
"line_number": 6,
"usage_type": "name"
},
{
"api_name": ... |
181216977 | import pandas as pd
from lightfm.data import Dataset
from lightfm.evaluation import auc_score
from lightfm import LightFM
import re
import numpy as np
import pickle
from collections import OrderedDict
test = pd.read_csv('~/test.csv')
mapping = pd.read_csv('~/mapping.csv')
with open('~/model.pickle', 'rb') ... | null | recommender.py | recommender.py | py | 1,962 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "pandas.read_csv",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "pandas.read_csv",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "pickle.load",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "pickle.load",
"line_n... |
350417925 | # -*- coding: utf-8 -*-
from miniframe import kernels
from miniframe.BIGgp import BIGgp
from miniframe.BIGgp import isposdef
from miniframe.BIGgp import scale
from miniframe.means import Constant, Linear, Keplerian
import sys
import numpy as np
import emcee
import matplotlib.pyplot as pl
from matplotlib.ticker import... | null | big-frame/tests.py | tests.py | py | 7,165 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "numpy.array",
"line_number": 25,
"usage_type": "call"
},
{
"api_name": "numpy.random.uniform",
"line_number": 25,
"usage_type": "call"
},
{
"api_name": "numpy.random",
"line_number": 25,
"usage_type": "attribute"
},
{
"api_name": "numpy.exp",
"l... |
319293832 | from enum import Enum
import numpy as np
import scipy.stats as stat
import math as math
import InputData as Data
import scr.MarkovClasses as MarkovCls
import scr.RandomVariantGenerators as Random
import scr.ProbDistParEst as Est
class HealthStats(Enum):
""" health states of patients with HIV """
C... | null | ParameterClasses.py | ParameterClasses.py | py | 5,746 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "enum.Enum",
"line_number": 11,
"usage_type": "name"
},
{
"api_name": "enum.Enum",
"line_number": 20,
"usage_type": "name"
},
{
"api_name": "InputData.DELTA_T",
"line_number": 33,
"usage_type": "attribute"
},
{
"api_name": "InputData.DISCOUNT",
"... |
229248815 | import re
import shlex
import pytz
import json
from datetime import datetime
from pathlib import Path
from launchy import Launchy
from aiohttp.web import json_response
from aiofile import AIOFile, Writer
from .app import logger
from .molior.configuration import Configuration
from .model.project import Project
from .... | null | molior/tools.py | tools.py | py | 7,940 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "aiohttp.web.json_response",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "json.dumps",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "app.logger.info",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "app.logger",
... |
540485385 | import time, json
import random
import threading
import numpy as np
from bs4 import BeautifulSoup
from selenium import webdriver
def save_json(data, filename):
with open(filename, 'w') as outfile:
json.dump(data, outfile)
def scroll(driver, timeout):
last_height = driver.execute_script("return documen... | null | webscraping/user_scrap.py | user_scrap.py | py | 4,637 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "json.dump",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "time.time",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "time.time",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "time.time",
"line_number": 22,
... |
170039686 | import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
from atomBroker import AtomBroker
from cbMarian.mainWidget import MainWidget
from cbMarian.poller import Poller
from cbMarian.productBroker import ProductBroker
if __name__ == "__main__":
app = QApplication(sys.argv)
# myProducts = [("LTC-EUR"... | null | atomPoller.py | atomPoller.py | py | 768 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "PyQt5.QtWidgets.QApplication",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "sys.argv",
"line_number": 11,
"usage_type": "attribute"
},
{
"api_name": "atomBroker.AtomBroker",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "atom... |
319402653 | from flask import render_template,url_for,abort,request,redirect
from . import main
from app import create_app
from ..models import User,Pitch,Comment
from .forms import UpdateProfile, CommentForm
from flask_login import login_required, current_user
from .. import db,photos
import datetime
# import markdown2
@main.rout... | null | app/main/views.py | views.py | py | 2,546 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "flask.render_template",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "models.Pitch.get_pitch",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "models.Pitch",
"line_number": 19,
"usage_type": "name"
},
{
"api_name": "flask.reque... |
605022572 | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 12 10:04:05 2019
@author: Lxiao217
"""
import cv2
#读取图像
fnames = ['img{}.jpg'.format(i+1) for i in range(8)]
for fname in fnames:
img = cv2.imread(fname)
cv2.imshow(fname, img)
cv2.waitKey() | null | openCV/Chapter3/OpenCVChapter2.py | OpenCVChapter2.py | py | 258 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "cv2.imread",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "cv2.imshow",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "cv2.waitKey",
"line_number": 13,
"usage_type": "call"
}
] |
270315718 | # -*- coding: utf-8 -*-
from PIL import Image, ImageDraw, ImageFont
import subprocess
import os
import optparse
import codecs
cwd = os.path.dirname(os.path.abspath(__file__))
voidwav = cwd + "/usr/Void.wav"
subtemp = cwd + "/subtemp.png"
parser = optparse.OptionParser()
parser.add_option('-i', '--input',
... | null | gensub.py | gensub.py | py | 3,497 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "os.path.dirname",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 8,
"usage_type": "attribute"
},
{
"api_name": "os.path.abspath",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "optparse.OptionParser",
... |
20846137 | # Create your views here.
from django.shortcuts import render
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.status import *
from django.views.generic.base import TemplateView
from .serializers import *
class DataView(viewsets.ViewSet):
def list(self, request... | null | api/views.py | views.py | py | 1,413 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "rest_framework.viewsets.ViewSet",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "rest_framework.viewsets",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "rest_framework.response.Response",
"line_number": 17,
"usage_type": "call"
... |
147600280 | import sqlite3
conn = sqlite3.connect("mydatabse.db")
cursor=conn.cursor()
print ("listing all reco")
f=open("dbtocsv1.csv","a")
for row in cursor.execute("select * from books"):
f.write(",".join(map(lambda x:str(x),row)) + "\n")
#using map to convert all field into strings
f.close()
conn.close()
| null | 3rdDay/Exc12.py | Exc12.py | py | 309 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "sqlite3.connect",
"line_number": 2,
"usage_type": "call"
}
] |
603130663 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2015 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# 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
#
# ht... | null | ansible/action_plugins/warning.py | warning.py | py | 1,511 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "ansible.utils.parse_kv",
"line_number": 38,
"usage_type": "call"
},
{
"api_name": "ansible.utils",
"line_number": 38,
"usage_type": "name"
},
{
"api_name": "ansible.errors.AnsibleError",
"line_number": 40,
"usage_type": "call"
},
{
"api_name": "ansi... |
30905454 | #!/usr/bin/python
import feedparser
from Tkinter import *
class App:
def __init__(self, master):
frame = Frame(master)
frame.pack(side=BOTTOM)
scrollbar = Scrollbar(master)
scrollbar.pack(side=RIGHT,fill=Y)
f = feedparser.parse("http://coolshell.cn/feed")
... | null | languages/python/thinkinpython/test.py | test.py | py | 1,167 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "feedparser.parse",
"line_number": 12,
"usage_type": "call"
}
] |
207237932 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 19 19:38:33 2018
@author: emrecemaksu
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
maaslar = pd.read_csv('maaslar.... | null | maaslar/maas_0/maaslar.py | maaslar.py | py | 867 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "pandas.read_csv",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "sklearn.linear_model.LinearRegression",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot.scatter",
"line_number": 24,
"usage_type": "call"
},
{
"a... |
62529745 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# __author__ = 'Arthur|http://wingedwhitetiger.com/'
import os
import maya.cmds as mc
from toolkitTool.tap4fun.config import assetDict
from toolkitLib import exocortexAlembic, mayaPlugin, mayaReference
reload(mayaReference)
reload(exocortexAlembic)
reload(assetDict)
def imp... | null | WitToolkit/Maya/2017/scripts/python/toolkitTool/tap4fun/scriptTemplates/importLgtFile.py | importLgtFile.py | py | 4,140 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "toolkitLib.mayaReference",
"line_number": 10,
"usage_type": "argument"
},
{
"api_name": "toolkitLib.exocortexAlembic",
"line_number": 11,
"usage_type": "argument"
},
{
"api_name": "toolkitTool.tap4fun.config.assetDict",
"line_number": 12,
"usage_type": "arg... |
67117652 | """
RPyC client that sends the exec_shell_cmd to the server to add the job with the scheduler.
Usage:
python at.py <TIME STRING>
example:
python at.py 9:30 PM Tue
"""
import sys
import time
from time import sleep
from dateutil import parser
import rpyc
if len(sys.argv) < 2:
print('Usage python at.py ... | null | at.py | at.py | py | 878 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "sys.argv",
"line_number": 16,
"usage_type": "attribute"
},
{
"api_name": "sys.argv",
"line_number": 19,
"usage_type": "attribute"
},
{
"api_name": "dateutil.parser.parse",
"line_number": 22,
"usage_type": "call"
},
{
"api_name": "dateutil.parser",
... |
451046595 | #!/usr/bin/env python3
import sys
import urllib.request
import json
class LibraryAPI:
"""
## INPUT
latitude : geometry parameter (ex 137)
longtitude : geometry parameter (ex 35)
isbn : 10 or 13 digit number (ex 4577002086)
library_search_num : how many library result you want to get... | null | LibraryAPIUtil/library_api_util.py | library_api_util.py | py | 4,015 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "urllib.request.parse.urlencode",
"line_number": 72,
"usage_type": "call"
},
{
"api_name": "urllib.request.parse",
"line_number": 72,
"usage_type": "attribute"
},
{
"api_name": "urllib.request",
"line_number": 72,
"usage_type": "name"
},
{
"api_name"... |
298952191 |
import logging
import pandas as pd
from typing import Union
from gen_utils import set_logger_defaults
logger = logging.getLogger(__name__)
set_logger_defaults(logger)
def check_missing_pcts(df:Union[pd.DataFrame, pd.Series]) -> None:
if isinstance(df, pd.Series):
if df.name is None:
df.name... | null | model/monitors.py | monitors.py | py | 619 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "logging.getLogger",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "gen_utils.set_logger_defaults",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "typing.Union",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "pandas.Da... |
150144905 | from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
from django.views.decorators.csrf import csrf_exempt
# Create your views here.
tasks = [
{
'id': 1,
'title': u'Buy groceries',
'description': u'Milk, Cheese, Pizza, Fruit, Tylenol',
'done': False
... | null | backend/api/views.py | views.py | py | 1,395 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "django.http.JsonResponse",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "django.http.HttpResponse",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "django.http.HttpResponse",
"line_number": 27,
"usage_type": "call"
},
{
"api_na... |
424708405 | import cv2
import numpy as np
import datetime
from PIL import ImageFont, ImageDraw, Image
## 함수 선언 영역
## 영상 간의 차이나는 부분 표시이미지, 차이나는 픽셀 객수를 리턴하는 함수
def get_diff_image(frame_a, frame_b, frame_c, threshold):
# 세 개의 모든 프레임을 회식으로 전환
frame_a_gray = cv2.cvtColor(frame_a, cv2.COLOR_BGR2GRAY)
frame_b_gray = cv2.cvtC... | null | OpenCV/opencv_mov07.py | opencv_mov07.py | py | 3,410 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "cv2.cvtColor",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "cv2.COLOR_BGR2GRAY",
"line_number": 10,
"usage_type": "attribute"
},
{
"api_name": "cv2.cvtColor",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "cv2.COLOR_BGR2GRAY"... |
356061602 | # -*- coding: utf-8 -*-
from django.contrib import admin
from ..models import Collection
#
# Admin: Collection
#
class CollectionAdmin(admin.ModelAdmin):
fieldsets = [
['Podstawowe informacje', {
'fields': ['producer', 'name', 'target_url']
}],
['Grafiki', {
... | null | src/apro/allegro_pots/admin/collections.py | collections.py | py | 724 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "django.contrib.admin.ModelAdmin",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "django.contrib.admin",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "django.contrib.admin.site.register",
"line_number": 30,
"usage_type": "call"
... |
646320330 | from contextlib import contextmanager
from threading import Semaphore
from fastapi import HTTPException
class RequestLimiter:
def __init__(self, limit):
self.semaphore = Semaphore(limit - 1)
@contextmanager
def run(self):
acquired = self.semaphore.acquire(blocking=False)
if not a... | null | haystack/rest_api/controller/utils.py | utils.py | py | 522 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "threading.Semaphore",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "fastapi.HTTPException",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "contextlib.contextmanager",
"line_number": 11,
"usage_type": "name"
}
] |
123084017 | import numpy as np
import json
import pdb
import csv
import random
from tqdm import tqdm, trange
import pandas as pd
import os
import subprocess
def extract_players(path_to_data_dir, shots, corresponding_moments):
PATH_TO_DATA_DIR = path_to_data_dir
NUM_PREVIOUS_EVENTS = 0 # because the moments encompass eno... | null | DataCleaning/ExtractPlayers.py | ExtractPlayers.py | py | 3,379 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "csv.writer",
"line_number": 25,
"usage_type": "call"
},
{
"api_name": "os.path.exists",
"line_number": 34,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 34,
"usage_type": "attribute"
},
{
"api_name": "subprocess.call",
"line_nu... |
398881401 | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 8 09:28:37 2015
@author: mints
"""
from scipy import constants as c
# All in CGS units!
G = c.G*1e3
K = c.k*1e7 # Boltzmann erg/K
c = 3e10 # in cm/s, speed of light
H_nu = 6.626e-27 # erg*s
PARSEC = 3.0857e18 # in cm
# SUN!
R_sun = 6.963e10 #in cm
M_sun = 2e33 #... | null | constants.py | constants.py | py | 326 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "scipy.constants.G",
"line_number": 11,
"usage_type": "attribute"
},
{
"api_name": "scipy.constants",
"line_number": 11,
"usage_type": "name"
},
{
"api_name": "scipy.constants.k",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "scipy.c... |
535545689 | """ file_service.py
Provides the means to save and load a file.
"""
from subprocess import Popen
import os
import sys
# All plugins should import the crunchy plugin API via interface.py
from src.interface import config, plugin, SubElement, python_version, u_print
try:
from config import local_browser_root
excep... | null | crunchy/src/plugins/file_service.py | file_service.py | py | 14,806 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "config.local_browser_root",
"line_number": 15,
"usage_type": "name"
},
{
"api_name": "src.interface.python_version",
"line_number": 17,
"usage_type": "name"
},
{
"api_name": "src.interface.plugin",
"line_number": 50,
"usage_type": "name"
},
{
"api_n... |
464209768 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import asyncio
import logging
logging.basicConfig(level=logging.INFO)
from orm import create_pool,destory_pool
from models import User,next_id
async def test():
await create_pool(loop=loop,host='127.0.0.1',port=3306,user='www',passwd='www',db='awesome')
# 测试coun... | null | awesome-python3-webapp/www/orm_test.py | orm_test.py | py | 1,703 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "logging.basicConfig",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "logging.INFO",
"line_number": 6,
"usage_type": "attribute"
},
{
"api_name": "orm.create_pool",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "models.User.findN... |
638389165 | __author__ = 'ssm'
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
import redis
'''
input : paper's [title, keywords, abstract], centroids
output: key phrases + weights
1.[title, abstract] (input:sorted by tfidf, pick top 10)
[keywords] if available
[title, abstract] | [keywords]
2. ad... | null | classify/extract_keyword.py | extract_keyword.py | py | 6,677 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "numpy.fromstring",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "numpy.float32",
"line_number": 29,
"usage_type": "attribute"
},
{
"api_name": "numpy.array",
"line_number": 35,
"usage_type": "call"
},
{
"api_name": "numpy.linalg.norm",
... |
447678085 | from superdesk import get_resource_service
from bson import ObjectId
def expand_contact_info(contacts):
"""
Given an item it will scan any event contacts, look them up and return the expanded values
:param item:
:return: Array of expanded contacts
"""
remove_contact_fields = {'_etag', '_type'... | null | server/planning/output_formatters/utils.py | utils.py | py | 1,042 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "superdesk.get_resource_service",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "bson.ObjectId",
"line_number": 18,
"usage_type": "call"
}
] |
52312256 | """empty message
Revision ID: 5aa3a6390175
Revises: None
Create Date: 2016-07-07 21:15:05.087334
"""
# revision identifiers, used by Alembic.
revision = '5aa3a6390175'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###... | null | migrations/versions/5aa3a6390175_.py | 5aa3a6390175_.py | py | 779 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "alembic.op.add_column",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "alembic.op",
"line_number": 19,
"usage_type": "name"
},
{
"api_name": "sqlalchemy.Column",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "sqlalchemy.String"... |
471333305 | import pandas as pd
import matplotlib.pyplot as plt
import math
data = pd.read_csv("mpg.csv")
data["liters"] = (round(data['displacement'] / 61.024, 1))
usa = data[data.origin == "usa"]
japan = data[data.origin =="japan"]
corr = data.corr()['mpg'][:]
print (corr)
print ('As you can see displacement, wieght and lite... | null | ClassAct11.py | ClassAct11.py | py | 1,574 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "pandas.read_csv",
"line_number": 5,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot.plot",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot",
"line_number": 20,
"usage_type": "name"
},
{
"api_name": "matplotlib.py... |
578715583 | from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Activation, Dropout, Flatten
from keras.layers import Convolution2D, MaxPooling2D
from keras.optimizers import SGD, RMSprop
from keras.utils import np_utils
from keras.regularizers import l1, l2
import numpy as np
impor... | null | mnist_cnn.py | mnist_cnn.py | py | 2,149 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "keras.datasets.mnist.load_data",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "keras.datasets.mnist",
"line_number": 21,
"usage_type": "name"
},
{
"api_name": "keras.utils.np_utils.to_categorical",
"line_number": 37,
"usage_type": "call"
},
... |
561030471 | import os
import sys
import itertools
from Bio import Alphabet, SeqIO
from Bio.Seq import Seq
from Bio.SeqFeature import SeqFeature, FeatureLocation
from Bio.SeqRecord import SeqRecord
import re
from legacy_molbio import DNA
class ApeFile(object):
'''Class for operations on .ape files, which are single SeqRecords ... | null | apefile.py | apefile.py | py | 8,480 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "itertools.cycle",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "sys.stderr",
"line_number": 23,
"usage_type": "attribute"
},
{
"api_name": "legacy_molbio.DNA",
"line_number": 24,
"usage_type": "argument"
},
{
"api_name": "Bio.SeqRecord.S... |
311853924 | """
Tests for lookups of elemental data
"""
import pytest
from basis_set_exchange import lut
_all_elements = list(range(1, 119))
_all_am = list(range(1, 13))
@pytest.mark.parametrize('Z', _all_elements)
def test_element_data(Z):
# Cycle through the elements and check that
# the info returned from the functi... | null | basis_set_exchange/tests/test_lut.py | test_lut.py | py | 1,095 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "basis_set_exchange.lut.element_data_from_Z",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "basis_set_exchange.lut",
"line_number": 16,
"usage_type": "name"
},
{
"api_name": "basis_set_exchange.lut.element_data_from_sym",
"line_number": 19,
"usag... |
323284715 | import unittest
import requests
from db.utils import create_tables
from tests import delete_test_locations, add_test_locations, add_reservations, root_url
class TestReservationsHandler(unittest.TestCase):
@classmethod
def setUpClass(cls):
super(TestReservationsHandler, cls).setUpClass()
crea... | null | tests/test_reservation_handlers.py | test_reservation_handlers.py | py | 1,145 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "unittest.TestCase",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "db.utils.create_tables",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "tests.delete_test_locations",
"line_number": 14,
"usage_type": "call"
},
{
"api_name... |
562325413 | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
from django.test.client import Client
class SimpleTest(TestCase):
def test_basic_addition(self):
... | null | encuestas/tests.py | tests.py | py | 2,560 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "django.test.TestCase",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "django.test.TestCase",
"line_number": 20,
"usage_type": "name"
},
{
"api_name": "django.test.client.Client",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "d... |
142309125 | """
url = http://www.fxfdcw.com/searchhouse.asp
city : 阜新
CO_INDEX : 106
author: 程纪文
"""
from backup.crawler_base import Crawler
from backup.comm_info import Comm, Building, House
import re, requests
from lxml import etree
from lib.log import LogHandler
co_index = '106'
city = '阜新'
log = LogHandler('fuxin_106')
clas... | null | hilder_gv/crawler2/fuxin_106.py | fuxin_106.py | py | 4,149 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "lib.log.LogHandler",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "backup.crawler_base.Crawler",
"line_number": 17,
"usage_type": "name"
},
{
"api_name": "requests.post",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "lxml.etr... |
316080525 | ###---------------------------------------------------------------------
## The Argorithm about Cacluation of Distortion, Python version
# Author: Yibo
# Date: 2020 July
#=========Word Explain
#RCS =Relative Coordinates System
#map = the theoretical point position
#v= virtual ,means include negative number
#spot= the... | null | dt.py | dt.py | py | 30,085 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "cv2.FONT_HERSHEY_SIMPLEX",
"line_number": 33,
"usage_type": "attribute"
},
{
"api_name": "const.DEBUG",
"line_number": 63,
"usage_type": "attribute"
},
{
"api_name": "const.DEBUG",
"line_number": 129,
"usage_type": "attribute"
},
{
"api_name": "PIL.... |
487045709 | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 26 20:30:16 2018
@author: as
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Create the Data set
dataset = pd.read_csv('breast-cancer-wisconsin.data.csv')
X = dataset.iloc[:,[1,2]].values
Y = dataset.iloc[:,-1].values
# Create training set
... | null | Part 3 - Classification/Section 14 - Logistic Regression/Logistic Regression on Breast Cancer.py | Logistic Regression on Breast Cancer.py | py | 1,798 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "pandas.read_csv",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "sklearn.cross_validation.train_test_split",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "sklearn.preprocessing.StandardScaler",
"line_number": 23,
"usage_type": "call"
... |
268680631 | from django.template.loader import render_to_string
from django.utils.html import mark_safe
from wagtail.core import hooks
class FrontPanel:
template = None
max_cols = 1
max_rows = 1
min_rows = 1
min_cols = 1
pos_x = 1
pos_y = 1
title = ''
desc = ''
identifier = 'rai.basefrontp... | null | rai/panels/base.py | base.py | py | 2,184 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "django.utils.html.mark_safe",
"line_number": 41,
"usage_type": "call"
},
{
"api_name": "django.template.loader.render_to_string",
"line_number": 41,
"usage_type": "call"
},
{
"api_name": "wagtail.core.hooks.register",
"line_number": 47,
"usage_type": "call"... |
592590034 | """Koodous API class."""
import os
from http import HTTPStatus
from io import BytesIO
from itertools import count
from typing import Optional, Union, Iterator, Dict, Any
from datetime import datetime
import requests
from koodous.constants import KOODOUS_API_URL, KOODOUS_API_ENDPOINTS
from koodous.exceptions import Ap... | null | koodous/api.py | api.py | py | 20,695 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "typing.Dict",
"line_number": 26,
"usage_type": "name"
},
{
"api_name": "requests.request",
"line_number": 36,
"usage_type": "call"
},
{
"api_name": "requests.Response",
"line_number": 28,
"usage_type": "attribute"
},
{
"api_name": "typing.Optional",... |
226799029 | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
import os, yaml
class BasePage(object):
'''所有Page的基类'''
__iframe_... | null | AutomationTesting/pages/basepage.py | basepage.py | py | 4,506 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "selenium.webdriver.common.by.By.XPATH",
"line_number": 10,
"usage_type": "attribute"
},
{
"api_name": "selenium.webdriver.common.by.By",
"line_number": 10,
"usage_type": "name"
},
{
"api_name": "selenium.webdriver.common.keys.Keys.ENTER",
"line_number": 40,
... |
124952264 | import findspark
findspark.init()
from pyspark import SparkConf,SparkContext
from pyspark.streaming import StreamingContext
from pyspark.sql import Row,SQLContext
import sys
import requests
from operator import add
def process_rdd(time, rdd):
try:
rdd = rdd.filter(lambda x: x[0]!='')
row_rdd = rd... | null | adminmgr/media/code/A3/task3/BD_0980_1528_1600_qgTnQpY.py | BD_0980_1528_1600_qgTnQpY.py | py | 1,186 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "findspark.init",
"line_number": 2,
"usage_type": "call"
},
{
"api_name": "pyspark.sql.Row",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "sys.exc_info",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "pyspark.SparkConf",
"l... |
338001256 | # -*- coding: utf-8 -*-
import os
import pickle
import html
from datetime import date
from datetime import datetime
from jinja2 import Template
from zipfile import ZipFile, ZIP_DEFLATED
check_days = [
date(year=2010, month=3, day=6),
date(year=2009, month=10, day=16),
]
class LjRecord(object):
def __in... | null | backup.py | backup.py | py | 4,368 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "datetime.date",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "datetime.date",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "html.unescape",
"line_number": 42,
"usage_type": "call"
},
{
"api_name": "html.unescape",
"line_n... |
419088700 | """
http://nbviewer.ipython.org/github/ucsd-scientific-python/user-group/blob/master/presentations/20131016/hierarchical_clustering_heatmaps_gridspec.ipynb
"""
import os
import re
import sys
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import numpy as np
import scipy.spat... | null | src/heatmap/southern_cores_heatmap.py | southern_cores_heatmap.py | py | 4,612 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "os.path.expanduser",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 18,
"usage_type": "attribute"
},
{
"api_name": "pandas.read_csv",
"line_number": 25,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot.rcP... |
345976327 | from sklearn import datasets, preprocessing
from sklearn.linear_model import LinearRegression
from sklearn.neural_network import MLPRegressor
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor
from sklearn.svm import SVR
from sklearn.model_selection import train_test_split
from sklearn.prepro... | null | .ipynb_checkpoints/submit_python_compare_models-checkpoint.py | submit_python_compare_models-checkpoint.py | py | 4,270 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "time.time",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "pandas.read_csv",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "pandas.get_dummies",
"line_number": 80,
"usage_type": "call"
},
{
"api_name": "pandas.get_dummies",
... |
477520864 | '''
Helper functions to interact with data and files
'''
import numpy as np
import matplotlib.pyplot as plt
import rasterio
import glob
def fn_list(thisDir, fn_pattern):
'''
Function that returns a sorted list of filenames based on a regex pattern in specified directory
'''
fns=[]
for f in ... | null | contributors/jakidxav/data_tools.py | data_tools.py | py | 3,921 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "glob.glob",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "rasterio.open",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot.subplots",
"line_number": 42,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot"... |
94027549 | # encoding=utf-8
from functional import seq
def process_line(line):
if ',tablespoons,' in line:
return line.replace(',tablespoons,', ',tablespoon,')
if ',teaspoons,' in line:
return line.replace(',teaspoons,', ',teaspoon,')
if ',cups,' in line:
return line.replace(',cups,', ',cup,'... | null | test/dataset_modification_replace_v1_fix.py | dataset_modification_replace_v1_fix.py | py | 3,809 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "functional.seq.open",
"line_number": 59,
"usage_type": "call"
},
{
"api_name": "functional.seq",
"line_number": 59,
"usage_type": "name"
}
] |
643204031 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Test script for "nuSTORMPrdStrght" class
========================================
Assumes python path includes nuSim code.
Script starts by testing built in methods. Then a soak test with a set
of reference plots.
"""
import os
import numpy as np
import mat... | null | 02-Tests/nuSTORMPrdStrghtTst.py | nuSTORMPrdStrghtTst.py | py | 3,503 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "os.getenv",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "os.path.join",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 28,
"usage_type": "attribute"
},
{
"api_name": "nuSTORMPrdStrght.nuSTORMPrdStrght... |
149880366 | """The WaveBlocks Project
Sample wavepackets at the nodes of a given grid and save
the results back to the given simulation data file.
@author: R. Bourquin
@copyright: Copyright (C) 2010, 2011, 2012, 2013 R. Bourquin
@license: Modified BSD License
"""
import argparse
from WaveBlocksND import IOManager
from WaveBloc... | null | src/scripts/ComputeEvaluateWavepacketsEigen.py | ComputeEvaluateWavepacketsEigen.py | py | 2,161 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "argparse.ArgumentParser",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "WaveBlocksND.GlobalDefaults.file_resultdatafile",
"line_number": 23,
"usage_type": "attribute"
},
{
"api_name": "WaveBlocksND.GlobalDefaults",
"line_number": 23,
"usage_type... |
456005295 | # flySwat.py
# A game to swat flies
#
# Name: Daeshaun Morrison
# Date: 11/4/2020
import pygame
from random import randint
# Initialize all that Pygame provides
pygame.init()
pygame.mixer.init() # Enables sound effects
# Global constants:
WIDTH = 1000
HEIGHT = 600
FLY_COUNT = 10
DELTA = 2... | null | lab11/lab11 - Extra Credit/flySwat.py | flySwat.py | py | 8,846 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "pygame.init",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "pygame.mixer.init",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "pygame.mixer",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "pygame.sprite",
"... |
55841193 | import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import os
# Import MNIST data
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data", one_hot=True)
lr = 0.01
epochs = 10... | null | autoencoder/autoencoder.py | autoencoder.py | py | 3,288 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "tensorflow.examples.tutorials.mnist.input_data.read_data_sets",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "tensorflow.examples.tutorials.mnist.input_data",
"line_number": 10,
"usage_type": "name"
},
{
"api_name": "tensorflow.placeholder",
"line_n... |
138695337 | # Embedded file name: lib.coginvasion.hood.TTHoodAI
"""
Filename: TTHoodAI.py
Created by: blach (20Dec14)
"""
import ToonHoodAI
from direct.directnotify.DirectNotifyGlobal import directNotify
from lib.coginvasion.globals import CIGlobals
from lib.coginvasion.cogtropolis import DistributedCityCartAI
class TTHoodA... | null | lib/coginvasion/hood/TTHoodAI.py | TTHoodAI.py | py | 1,242 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "ToonHoodAI.ToonHoodAI",
"line_number": 13,
"usage_type": "attribute"
},
{
"api_name": "direct.directnotify.DirectNotifyGlobal.directNotify.newCategory",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "direct.directnotify.DirectNotifyGlobal.directNotify",
... |
54920938 | import glob
import math
import re
import PyPDF2
import matplotlib.pyplot as plt
import nltk
from matplotlib.backends.backend_pdf import PdfPages
from wordcloud import WordCloud
def read_from_pdf(pdf_name):
global words, wordFile, isInFile
file = open(pdf_name, "rb")
pdf_reader = PyPDF2.PdfFileReader(file... | null | main.py | main.py | py | 3,249 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "PyPDF2.PdfFileReader",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "re.sub",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "re.sub",
"line_number": 38,
"usage_type": "call"
},
{
"api_name": "nltk.download",
"line_number":... |
113801708 | import json
import sys
from functools import reduce
from form_blocks import form_blocks
import cfg
class VarRange:
def __init__(self, lb, ub, bounds):
self.lb = lb # bool for "is lower bounded"
self.ub = ub
self.lower_bound = None
self.upper_bound = None
if lb and ub:
... | null | eba33_lesson4/interval_analysis.py | interval_analysis.py | py | 6,311 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "form_blocks.form_blocks",
"line_number": 145,
"usage_type": "call"
},
{
"api_name": "cfg.block_map",
"line_number": 146,
"usage_type": "call"
},
{
"api_name": "cfg.add_terminators",
"line_number": 147,
"usage_type": "call"
},
{
"api_name": "cfg.edge... |
507910206 | from pyueye import ueye
import numpy as np
import cv2
import ctypes
class UEYECamera:
def __init__(self, pathToParameterSets, fps):
self.hCam = ueye.HIDS(0)
self.sInfo = ueye.SENSORINFO()
self.cInfo = ueye.CAMINFO()
self.pcImageMemory = ueye.c_mem_p()
self.M... | null | IDS_Camera/UEYECamera.py | UEYECamera.py | py | 8,515 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "pyueye.ueye.HIDS",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "pyueye.ueye",
"line_number": 11,
"usage_type": "name"
},
{
"api_name": "pyueye.ueye.SENSORINFO",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "pyueye.ueye",
... |
477454688 | from __future__ import unicode_literals
import os
from sqlalchemy import create_engine, MetaData
from sqlalchemy.ext.declarative import ( declarative_base
, _declarative_constructor
)
from sqlalchemy.orm import sessionmaker, scoped_session
... | null | gittip/orm/__init__.py | __init__.py | py | 1,273 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "sqlalchemy.ext.declarative._declarative_constructor",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "os.environ",
"line_number": 28,
"usage_type": "attribute"
},
{
"api_name": "sqlalchemy.create_engine",
"line_number": 29,
"usage_type": "call"
... |
174765612 | '''
Reference : https://ieeexplore.ieee.org/document/4147155
Implement : tensorflow 2.0, numpy, keras 2.0+,
Created by JunWoo Kim,
Date : 2019.4.3
'''
# Until line 138, implement by numpy array
import tensorflow as tf
from tensorflow.keras import datasets, layers, models
import os
import cv2
import matplotlib.pyplot ... | null | 1. capstone/1. Crawler/animalface_detection.py | animalface_detection.py | py | 4,207 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "os.listdir",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "os.path.join",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 24,
"usage_type": "attribute"
},
{
"api_name": "os.path.join",
"line_number"... |
144029006 | from datetime import datetime
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget, QMessageBox, QDateEdit
from config import dateFormat
from requestBuilder import RequestBuilder
from ui.convertedUi.authorAddingForm import Ui_authorAddingForm
class AuthorAddingForm(QWidget, Ui_authorAddingForm):
def _... | null | authorAddingForm.py | authorAddingForm.py | py | 1,954 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "PyQt5.QtWidgets.QWidget",
"line_number": 10,
"usage_type": "name"
},
{
"api_name": "ui.convertedUi.authorAddingForm.Ui_authorAddingForm",
"line_number": 10,
"usage_type": "name"
},
{
"api_name": "PyQt5.QtCore.Qt.WindowCloseButtonHint",
"line_number": 12,
"u... |
246574889 | import json
from urllib.request import Request, urlopen
BASE_URL = "http://api.dirble.com/v2/"
# Default parameters
PAGE = 0
PER_PAGE = 20
OFFSET = 0
class ImageThumb(object):
def __init__(self, **kwargs):
self.url = kwargs.get("url")
class StationImage(object):
def __init__(self, **kwargs):
... | null | dirble_wrapper/dirble_wrapper.py | dirble_wrapper.py | py | 3,774 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "urllib.request.urlopen",
"line_number": 54,
"usage_type": "call"
},
{
"api_name": "urllib.request.Request",
"line_number": 58,
"usage_type": "call"
},
{
"api_name": "json.dumps",
"line_number": 58,
"usage_type": "call"
},
{
"api_name": "json.loads",... |
312829910 | from django.conf.urls import patterns, include, url
from propertyapp import views
from django.contrib import admin
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'propertylist.views.home', name='h... | null | propertylist/propertylist/urls.py | urls.py | py | 901 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "django.conf.urls.patterns",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "django.conf.urls.url",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "django.conf.urls.include",
"line_number": 17,
"usage_type": "call"
},
{
"api_name":... |
205036860 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import OrderedDict
import numpy
import h5py
from theanolm.parsing import utterance_from_line
from theanolm.exceptions import IncompatibleStateError, InputError
class Vocabulary(object):
"""Word or Class Vocabulary
Vocabulary class provides a map... | null | theanolm/vocabulary.py | vocabulary.py | py | 21,074 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "collections.OrderedDict",
"line_number": 42,
"usage_type": "call"
},
{
"api_name": "numpy.random.multinomial",
"line_number": 100,
"usage_type": "call"
},
{
"api_name": "numpy.random",
"line_number": 100,
"usage_type": "attribute"
},
{
"api_name": "... |
153027679 | #!/usr/bin/python
# -*- codding: utf-8 -*-
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
from common.execute_command import write_one_parameter
# url : https://awscli.amazonaws.com/v2/documentation/api/latest/reference/comprehendmedical/detect-entities-v2.html
if __n... | null | comprehendmedical_write_1/entities-v2_detect.py | entities-v2_detect.py | py | 936 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "sys.path.append",
"line_number": 5,
"usage_type": "call"
},
{
"api_name": "sys.path",
"line_number": 5,
"usage_type": "attribute"
},
{
"api_name": "os.path.dirname",
"line_number": 5,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number... |
580468588 | from django.contrib import admin
from django.urls import path
from . import views
from django.conf.urls import url, include
from django.conf import settings
from django.conf.urls.static import static
from django.views.static import serve
from rest_framework.urlpatterns import format_suffix_patterns
urlpatterns = [
... | null | Student/urls.py | urls.py | py | 3,761 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "django.urls.path",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "django.urls.path",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "django.urls.path",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "django.urls.path",... |
114833642 |
# Library imports
import cv2
import numpy as np
import time
import datetime
# System imports
from control.control import Control
from system_manager.constants import Constants
class Planning(Constants):
def __init__(self):
super().__init__()
self.left_box=[]
... | null | src/planning/path_plan.py | path_plan.py | py | 15,392 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "system_manager.constants.Constants",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "cv2.circle",
"line_number": 36,
"usage_type": "call"
},
{
"api_name": "cv2.line",
"line_number": 37,
"usage_type": "call"
},
{
"api_name": "cv2.circle",
... |
343773896 | import random
import json
import gym
from gym import spaces
import pandas as pd
import numpy as np
MAX_ACCOUNT_BALANCE = 2147483647
MAX_NUM_SHARES = 2147483647
MAX_SHARE_PRICE = 5000
MAX_VOLUME = 1000e8
MAX_AMOUNT = 3e10
MAX_OPEN_POSITIONS = 5
MAX_STEPS = 20000
MAX_DAY_CHANGE = 1
INITIAL_ACCOUNT_BALANCE = 10000
DATA... | null | rlenv/StockTradingEnv0.py | StockTradingEnv0.py | py | 12,384 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "gym.Env",
"line_number": 33,
"usage_type": "attribute"
},
{
"api_name": "gym.spaces.Discrete",
"line_number": 49,
"usage_type": "call"
},
{
"api_name": "gym.spaces",
"line_number": 49,
"usage_type": "name"
},
{
"api_name": "gym.spaces.Box",
"lin... |
597314530 | # Dependencies
import tweepy
import json
import time
#added line to make a new line no reason
# Twitter API Keys
consumer_key = 'sabuUUyKD7AGfaTzurpRGmdYP'
consumer_secret = 'DJTqZcwS74QjkpY9uJ08X6Ahn2eHLCyhuaEwrM0AvDaK5MDXtB'
access_token = '801373896649752576-hW9RPhvqpZ8BCOS0kpZfCwLIulOP7wu'
access_token_secret = 'c... | null | ChatterBot.py | ChatterBot.py | py | 682 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "tweepy.OAuthHandler",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "tweepy.API",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "tweepy.parsers.JSONParser",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "tweepy.parse... |
209124497 | import keras, numpy as np, json, time
from keras.models import model_from_json, Model
import tensorflow as tf
from keras import backend as K
from keras import optimizers
def digest(lst):
if not isinstance(lst, list):
lst = [lst]
return [np.mean(w*w) for w in lst]
class ML_Keras_FitWorker:
def... | null | striped/ml/keras_backend.py | keras_backend.py | py | 7,023 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "numpy.mean",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "tensorflow.ConfigProto",
"line_number": 35,
"usage_type": "call"
},
{
"api_name": "tensorflow.Session",
"line_number": 38,
"usage_type": "call"
},
{
"api_name": "keras.backend.se... |
365375616 | # Import the relevant libraries
# Data manipulation
import pandas as pd
import numpy as np
# Save files
import pickle
# Machine Learning models
from xgboost import XGBClassifier
from sklearn.experimental import enable_halving_search_cv
from sklearn.model_selection import HalvingGridSearchCV
# import
x_train = pd.re... | null | hyper_parameter.py | hyper_parameter.py | py | 1,329 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "pandas.read_csv",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "pandas.read_csv",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "xgboost.XGBClassifier",
"line_number": 34,
"usage_type": "call"
},
{
"api_name": "sklearn.model_s... |
611508303 | from datetime import datetime
def converterData(data):
#intervalo = intervalo.split('-')
data = data.strip()
'''if 'January' in data:
data = data.replace('January', '01')
elif 'February' in data:
data = data.replace('February', '02')
elif 'March' in data:
data = data.replac... | null | conversaoData.py | conversaoData.py | py | 2,623 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "datetime.datetime.strptime",
"line_number": 33,
"usage_type": "call"
},
{
"api_name": "datetime.datetime",
"line_number": 33,
"usage_type": "name"
}
] |
557859336 | from keras.datasets import imdb
import numpy as np
from keras import models
from keras import layers
from keras.utils import to_categorical
import matplotlib.pyplot as plt
def decode_world(encode_world):
word_index = imdb.get_word_index()
reverse_word_index = dict([(value,key) for (key,value) in word_index.it... | null | keras_model/base_function.py | base_function.py | py | 1,521 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "keras.datasets.imdb.get_word_index",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "keras.datasets.imdb",
"line_number": 10,
"usage_type": "name"
},
{
"api_name": "numpy.zeros",
"line_number": 16,
"usage_type": "call"
}
] |
402029409 | import seaborn as sns
import matplotlib.pyplot as pyplot
sns.set()
# Tips is in-built dataset
tips = sns.load_dataset("tips")
sns.catplot(x="day",
y="total_bill",
hue="smoker",
kind="swarm",
data=tips)
pyplot.show()
| null | 08-visualization/sns_example2.py | sns_example2.py | py | 268 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "seaborn.set",
"line_number": 4,
"usage_type": "call"
},
{
"api_name": "seaborn.load_dataset",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "seaborn.catplot",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot.show"... |
4462756 | import torch
import torch.nn as nn
from gan.spectral_normalization import SpectralNorm
class Discriminator(nn.Module):
def __init__(self, input_channels=3):
super(Discriminator, self).__init__()
#Hint: Hint: Apply spectral normalization to convolutional layers. Input to SpectralNorm should be your... | null | assignment4/gan/models.py | models.py | py | 3,374 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "torch.nn.Module",
"line_number": 5,
"usage_type": "attribute"
},
{
"api_name": "torch.nn",
"line_number": 5,
"usage_type": "name"
},
{
"api_name": "gan.spectral_normalization.SpectralNorm",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "t... |
409353914 | from .apiclasstemplate import APIClassTemplate
import logging
class IKEv1IpsecProposals(APIClassTemplate):
"""
The IKEv1IpsecProposals Object in the FMC.
"""
URL_SUFFIX = '/object/ikev1ipsecproposals'
REQUIRED_FOR_POST = ['name', 'espEncryption', 'espHash']
VALID_FOR_ENCRYPTION = ['DES', '3DE... | null | fmcapi/api_objects/ikev1ipsecproposals.py | ikev1ipsecproposals.py | py | 1,583 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "apiclasstemplate.APIClassTemplate",
"line_number": 5,
"usage_type": "name"
},
{
"api_name": "logging.debug",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "logging.debug",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "logging.... |
636452260 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
## @file canvas.py
# Simple helper module to get ROOT TCanvas
# @date 2012-02-15
# @author Vanya BELYAEV Ivan.Belyaevitep.ru
# =============================================================... | null | ostap/plotting/canvas.py | canvas.py | py | 27,999 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "ostap.logger.logger.getLogger",
"line_number": 33,
"usage_type": "call"
},
{
"api_name": "ostap.logger.logger.getLogger",
"line_number": 34,
"usage_type": "call"
},
{
"api_name": "ostap.plotting.makestyles.canvas_width",
"line_number": 48,
"usage_type": "na... |
110260078 | from django.shortcuts import render
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
import json
from pymongo import MongoClient
from konlpy.tag import *
from konlpy.jvm import init_jvm
import jpype
#6월 20일 한국어 처리해서 장고에서 왕이름만 뽑아내는 것 까지 성공한 소스
#DB와의 커넥션을 얻기 위해서 사용 하는 함수
def g... | null | keyboard2/backup/back_vies_6_20.py | back_vies_6_20.py | py | 2,097 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "pymongo.MongoClient",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "jpype.isJVMStarted",
"line_number": 34,
"usage_type": "call"
},
{
"api_name": "jpype.attachThreadToJVM",
"line_number": 35,
"usage_type": "call"
},
{
"api_name": "django... |
307629555 | #! -*- coding: utf8 -*-
import re
import time
from datetime import datetime
from . import RED_PATH, SQL_PATH, CHANNEL_IDMAP
from . import MasterTransactService
KEY_PATTERN = re.compile('ict://(?P<channel>\w+)/words/(?P<word>.+)')
class Service(MasterTransactService) :
def __init__(self, red_path, sql_path) :
sup... | null | services/transaction_words.py | transaction_words.py | py | 5,463 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "re.compile",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "datetime.datetime.fromtimestamp",
"line_number": 77,
"usage_type": "call"
},
{
"api_name": "datetime.datetime",
"line_number": 77,
"usage_type": "name"
},
{
"api_name": "datetime... |
626694267 | # -*- coding: utf-8 -*-
'''
raise a port for executing GPIO functions
'''
from flask import Flask ,request
import RPi.GPIO as GPIO
import picamera
import time
import threading
from get_app import get_main_func
GPIO.setmode(GPIO.BCM)
led_pin = 4
GPIO.setup(led_pin, GPIO.OUT)
valve_pin = 17
GPIO.setup(valve_pin, GPIO... | null | flask_port.py | flask_port.py | py | 838 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "RPi.GPIO.setmode",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "RPi.GPIO",
"line_number": 15,
"usage_type": "name"
},
{
"api_name": "RPi.GPIO.BCM",
"line_number": 15,
"usage_type": "attribute"
},
{
"api_name": "RPi.GPIO.setup",
"lin... |
209837322 | '''
Created on Mar 4, 2015
@author: wangshiyuan
'''
# Sort a linked list in O(n log n) time using constant space complexity.
from common.listnode import ListNode
class Solution:
# @param head, a ListNode
# @return a ListNode
def sortList(self, head):
if not head or not head.next:
retur... | null | s/sort_list.py | sort_list.py | py | 1,298 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "common.listnode.ListNode",
"line_number": 31,
"usage_type": "call"
},
{
"api_name": "common.listnode.ListNode",
"line_number": 51,
"usage_type": "call"
},
{
"api_name": "common.listnode.ListNode",
"line_number": 52,
"usage_type": "call"
}
] |
132922265 | # -*- coding: UTF-8 -*-
import logging.handlers
from settings import LOG_FILE_NAME,LOG_LEVEL
import os
const = {
"INFO":logging.INFO,
"DEBUG":logging.DEBUG,
"ERROR":logging.ERROR,
"WARNING":logging.WARNING,
"CRITICAL":logging.CRITICAL
}
class Logger(logging.Logger):
def __init__(self, filenam... | null | log.py | log.py | py | 1,749 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "logging.handlers.INFO",
"line_number": 8,
"usage_type": "attribute"
},
{
"api_name": "logging.handlers",
"line_number": 8,
"usage_type": "name"
},
{
"api_name": "logging.handlers.DEBUG",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "... |
9573344 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import tinymce.models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id'... | null | blog/migrations/0001_initial.py | 0001_initial.py | py | 1,403 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "django.db.migrations.Migration",
"line_number": 8,
"usage_type": "attribute"
},
{
"api_name": "django.db.migrations",
"line_number": 8,
"usage_type": "name"
},
{
"api_name": "django.db.migrations.CreateModel",
"line_number": 14,
"usage_type": "call"
},
... |
263719757 | '''
Created on 3 Aug 2014
@author: ankur
'''
import logging
from ondelabs.copilot.dao.DiskDAO import DiskDAO
from ondelabs.copilot.model.Classes import Classes
from ondelabs.copilot.model.Lexicon import Lexicon
from ondelabs.copilot.model.TextClassType import TextClassType
from ondelabs.copilot.model.TrainingData imp... | null | ondelabs/copilot/dao/DiskTrainingDAO.py | DiskTrainingDAO.py | py | 1,797 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "ondelabs.copilot.dao.DiskDAO.DiskDAO",
"line_number": 15,
"usage_type": "name"
},
{
"api_name": "ondelabs.copilot.model.Lexicon.Lexicon",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "ondelabs.copilot.model.Classes.Classes",
"line_number": 22,
"... |
600895299 | import re
from io import StringIO
from contextlib import redirect_stdout
import gym
import nle
from nle.nethack.actions import Command, MiscAction
from collections import deque
from nle_toolbox.bot.skeleton import Skeleton
from nle_toolbox.wrappers.replay import ReplayToFile, Replay
from nle_toolbox.utils.obs impor... | null | nle_toolbox/__main__.py | __main__.py | py | 3,166 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "nle_toolbox.utils.obs.BLStats",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "contextlib.redirect_stdout",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "io.StringIO",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "... |
314648907 | #! /usr/bin/env python3
import re
import itertools
def solve():
abcde = read()
s = sum_array_can_make_with(abcde, 3)
print(s[2])
def read():
return list(map(int, re.split('\W+', input().strip())))[ : 5]
def sum_array_can_make_with(array, n):
"""
>>> sum_array_can_make_with([1, 2, 3, 4, 5], 3... | null | atcoder/ABC/ABC028/C.py | C.py | py | 657 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "re.split",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "itertools.combinations",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "doctest.testmod",
"line_number": 30,
"usage_type": "call"
}
] |
96363893 | """Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the
License. A copy of the License is located at
http://aws.amazon.com/apache2.0/
or in the "license" file accompanyi... | null | src/autotrail/layer2/trail.py | trail.py | py | 39,467 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "autotrail.layer1.trail.AutoTrailException",
"line_number": 36,
"usage_type": "name"
},
{
"api_name": "signal.signal",
"line_number": 45,
"usage_type": "call"
},
{
"api_name": "signal.SIGINT",
"line_number": 45,
"usage_type": "attribute"
},
{
"api_na... |
460322442 | import os
from cv2 import cv2
import numpy as np
import math
import random
import Main
import Preprocess
import PossibleChar
kNN = cv2.ml.KNearest_create()
# constants for checkIfPossibleChar, this checks one possible char only (does not compare to another char)
MIN_PIXEL_WIDTH = 1
MIN_PIXEL_HEIGHT = 1
MIN_ASPECT_R... | null | DetectChars.py | DetectChars.py | py | 12,030 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "cv2.cv2.ml.KNearest_create",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "cv2.cv2.ml",
"line_number": 11,
"usage_type": "attribute"
},
{
"api_name": "cv2.cv2",
"line_number": 11,
"usage_type": "name"
},
{
"api_name": "numpy.loadtxt",
... |
101027636 | from numpy import array, inf, ndarray, zeros
from ortools.linear_solver.pywraplp import Solver
def max_revenue_lp(price: ndarray, n: int = None):
price = price[1:]
if n is None:
n = price.size
solver = Solver('rod-cutting', Solver.SCIP_MIXED_INTEGER_PROGRAMMING)
x = [solver.IntVar(0, n // i... | null | algo/dp/rodCutting.py | rodCutting.py | py | 3,086 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "numpy.ndarray",
"line_number": 5,
"usage_type": "name"
},
{
"api_name": "ortools.linear_solver.pywraplp.Solver",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "ortools.linear_solver.pywraplp.Solver.SCIP_MIXED_INTEGER_PROGRAMMING",
"line_number": 11,
... |
614765940 | import torch
import torch.nn as nn
import copy
import numpy as np
import pandas as pd
import sys
import os
import sklearn
import sklearn.metrics as metric
from skmultilearn import dataset
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split
from Utils import Ea... | null | BR/train.py | train.py | py | 7,924 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "sys.path.append",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "sys.path",
"line_number": 14,
"usage_type": "attribute"
},
{
"api_name": "os.path.dirname",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_num... |
241284058 | import numpy as np
import pandas as pd
import networkx as nx
from networkx.algorithms import community
from networkx.algorithms.community.quality import modularity
from collections import defaultdict
from collections import Counter
from analysis_scripts import compute_analytics, graph_loader, projected_graph, rings, me... | null | graphdescriptors/get_descriptors.py | get_descriptors.py | py | 3,637 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "argparse.ArgumentParser",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "analysis_scripts.graph_loader.read_lines",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "analysis_scripts.graph_loader",
"line_number": 19,
"usage_type": "name"
... |
254874111 | #!/usr/bin/env python
# coding: utf-8
import pandas as pd
import numpy as np
import re, os, gc
import lunarcalendar
import src.kpi.kpis_computation as kpis
import src.kpi.KPI_formalization_com as kpi_stats
import src.forecaster.utilitaires as util
import src.forecaster.modelil as mod
from scipy import stats
from func... | null | archive/IL_Brand_Model_panel_RF_0630_49.py | IL_Brand_Model_panel_RF_0630_49.py | py | 35,228 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "warnings.filterwarnings",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "collections.namedtuple",
"line_number": 78,
"usage_type": "call"
},
{
"api_name": "pandas.read_csv",
"line_number": 129,
"usage_type": "call"
},
{
"api_name": "panda... |
79811275 | #!/usr/bin/python3
import argparse, json, logging, os, pwd, re, sys
from requests.auth import HTTPDigestAuth
from marklogic import MarkLogic
from marklogic.models.host import Host
from marklogic.models.forest import Forest
from marklogic.connection import Connection
from marklogic.exceptions import *
class CreateFor... | null | examples/create-forests.py | create-forests.py | py | 5,987 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "marklogic.connection.Connection",
"line_number": 33,
"usage_type": "call"
},
{
"api_name": "requests.auth.HTTPDigestAuth",
"line_number": 34,
"usage_type": "call"
},
{
"api_name": "marklogic.MarkLogic",
"line_number": 35,
"usage_type": "call"
},
{
"... |
642845999 | import csv
import os
import uuid
from os import path
from flask import current_app as app
from filelock import FileLock
from app.main import db
from app.main.config import upload_location, prequal_id_counter_lock_file, prequal_id_counter_file
from app.main.model.campaign import Campaign
def _set_latest_prequal_id(v... | null | app/main/tasks/campaign.py | campaign.py | py | 4,812 | python | en | code | null | code-starcoder2 | 66 | [
{
"api_name": "filelock.FileLock",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "app.main.config.prequal_id_counter_lock_file",
"line_number": 15,
"usage_type": "argument"
},
{
"api_name": "app.main.config.prequal_id_counter_file",
"line_number": 17,
"usage_ty... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.