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
223956255
############################################################################## # Copyright 2016-2017 Rigetti Computing # # 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...
null
pyquil/qpu.py
qpu.py
py
3,938
python
en
code
null
code-starcoder2
83
[ { "api_name": "pyquil.api.JobConnection", "line_number": 30, "usage_type": "name" }, { "api_name": "pyquil.quil.Program", "line_number": 52, "usage_type": "argument" }, { "api_name": "pyquil.api.validate_run_items", "line_number": 54, "usage_type": "call" }, { "ap...
405086906
from pyspark.sql import SparkSession import pyspark.sql.functions as F f = open('stage1.txt', 'w') spark = SparkSession \ .builder \ .appName("Python Spark Machine Learning Example") \ .config("spark.sql.shuffle.partitions", "32") \ .getOrCreate() # rev_data = "s3://assignment2-video-dvd/amazon_rev...
null
mingkai_workspace/stage1.py
stage1.py
py
2,355
python
en
code
null
code-starcoder2
83
[ { "api_name": "pyspark.sql.SparkSession.builder.appName", "line_number": 7, "usage_type": "call" }, { "api_name": "pyspark.sql.SparkSession.builder", "line_number": 7, "usage_type": "attribute" }, { "api_name": "pyspark.sql.SparkSession", "line_number": 7, "usage_type": "...
573445582
import threading from queue import Queue import requests from lxml import etree import time import json import Url_List import Build_Request import ParseHomePage import Parse_Each_Community import random #import QWidget_SHIT import Get_Subway_latlng import DataBase_Connect #存放采集线程的列表 g_crawl_list=[] g...
null
job_of_python/ershoufang/New_Ver/Thread_TEST_2.py
Thread_TEST_2.py
py
6,135
python
en
code
null
code-starcoder2
83
[ { "api_name": "threading.Thread", "line_number": 22, "usage_type": "attribute" }, { "api_name": "Build_Request.build_request", "line_number": 45, "usage_type": "call" }, { "api_name": "threading.Thread", "line_number": 57, "usage_type": "attribute" }, { "api_name"...
300548484
import logging from datetime import datetime import redis from src.models import User, Block from src.utils.db_session import get_db from src.challenges.connect_verified_challenge import connect_verified_challenge_manager from src.challenges.challenge_event_bus import ChallengeEventBus, ChallengeEvent from src.utils.c...
null
discovery-provider/tests/test_connect_verified_challenge.py
test_connect_verified_challenge.py
py
1,721
python
en
code
null
code-starcoder2
83
[ { "api_name": "src.utils.config.shared_config", "line_number": 11, "usage_type": "name" }, { "api_name": "logging.getLogger", "line_number": 12, "usage_type": "call" }, { "api_name": "redis.Redis.from_url", "line_number": 16, "usage_type": "call" }, { "api_name": ...
647275301
import cx_Oracle import plotly.plotly as py import plotly.graph_objs as go connection = cx_Oracle.connect("system", '123456', 'DESKTOP-R9NH18C/xe') cursor = connection.cursor() cursor.execute("""select buyer_id, order_amount from buyers""") data = [] for i in cursor: data.append(i) sum = 0 for i in ra...
null
km61/Kulish_Oleh/dz 3 Oleh Kulish/N2.py
N2.py
py
764
python
en
code
null
code-starcoder2
83
[ { "api_name": "cx_Oracle.connect", "line_number": 4, "usage_type": "call" }, { "api_name": "plotly.graph_objs.Pie", "line_number": 32, "usage_type": "call" }, { "api_name": "plotly.graph_objs", "line_number": 32, "usage_type": "name" }, { "api_name": "plotly.plotl...
436792873
from collections import deque N = 100005 gr = [[] for i in range(N)] # Function to add edge def add_edge(u, v): gr[u].append(v) gr[v].append(u) # Function to return the minimum path # from 0th node to the (n - 1)th node def dijkstra(n): # To check whether an edge is visited # or not and to keep di...
null
min_moves/min_moves.py
min_moves.py
py
2,030
python
en
code
null
code-starcoder2
83
[ { "api_name": "collections.deque", "line_number": 30, "usage_type": "call" } ]
371262987
# coding=utf-8 import multiprocessing # The socket to bind # 绑定的Socket地址 bind = "0.0.0.0:8090" # The maximum number of pending connections backlog = 2048 # The number of worker processes for handling requests # 处理请求的worker总数,一般设置为 2-4 ${cup_cores} workers = multiprocessing.cpu_count() * 2 + 1 # The type of workers ...
null
etc/gunicorn/config.wisdom_brain.py
config.wisdom_brain.py
py
2,185
python
en
code
null
code-starcoder2
83
[ { "api_name": "multiprocessing.cpu_count", "line_number": 13, "usage_type": "call" }, { "api_name": "multiprocessing.cpu_count", "line_number": 21, "usage_type": "call" } ]
112139386
# generator of binomial random variable import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set_style('whitegrid') from scipy.stats import uniform, binom # settings step = 10000 n = 10 p = 0.4 # subroutine def gen_binomial(n, p): U = uniform(loc = 0, scale = 1).rvs(size = ...
null
4_3_generating_binomial_random_variables.py
4_3_generating_binomial_random_variables.py
py
1,186
python
en
code
null
code-starcoder2
83
[ { "api_name": "seaborn.set_style", "line_number": 6, "usage_type": "call" }, { "api_name": "scipy.stats.uniform", "line_number": 16, "usage_type": "call" }, { "api_name": "numpy.append", "line_number": 32, "usage_type": "call" }, { "api_name": "numpy.arange", ...
74222046
import random from itertools import cycle from time import sleep import numpy as np from exceptions import AlreadyBusyException class TicTacToe(object): def __init__(self): self.pieces = ["X", "O"] self.starting_piece = '' self.player_piece_choice = '' self.busy_spots = [] ...
null
main.py
main.py
py
5,225
python
en
code
null
code-starcoder2
83
[ { "api_name": "numpy.array", "line_number": 17, "usage_type": "call" }, { "api_name": "random.choice", "line_number": 24, "usage_type": "call" }, { "api_name": "exceptions.AlreadyBusyException", "line_number": 38, "usage_type": "call" }, { "api_name": "time.sleep"...
231737068
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
null
azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/token_information.py
token_information.py
py
1,259
python
en
code
null
code-starcoder2
83
[ { "api_name": "msrest.serialization.Model", "line_number": 15, "usage_type": "name" } ]
633684366
from flask import Flask, request, redirect, url_for, render_template from flask_sqlalchemy import SQLAlchemy from flask_login import login_user, LoginManager, UserMixin, logout_user, login_required, current_user from werkzeug.security import check_password_hash from datetime import datetime app = Flask(__name__) app.c...
null
flask_app.py
flask_app.py
py
8,694
python
en
code
null
code-starcoder2
83
[ { "api_name": "flask.Flask", "line_number": 7, "usage_type": "call" }, { "api_name": "flask_sqlalchemy.SQLAlchemy", "line_number": 15, "usage_type": "call" }, { "api_name": "flask_login.LoginManager", "line_number": 18, "usage_type": "call" }, { "api_name": "flask...
236896422
# uncompyle6 version 3.7.4 # Python bytecode 3.6 (3379) # Decompiled from: Python 3.6.9 (default, Apr 18 2020, 01:56:04) # [GCC 8.4.0] # Embedded file name: build/bdist.macosx-10.13-x86_64/egg/Obsidian/ddspider.py # Compiled at: 2018-01-07 08:54:27 # Size of source mod 2**32: 2731 bytes import time, scrapy from Obsidi...
null
pycfiles/Obsidian-1.2-py3.6/ddspider.cpython-36.py
ddspider.cpython-36.py
py
2,978
python
en
code
null
code-starcoder2
83
[ { "api_name": "logging.basicConfig", "line_number": 13, "usage_type": "call" }, { "api_name": "logging.NOTSET", "line_number": 13, "usage_type": "attribute" }, { "api_name": "scrapy.Spider", "line_number": 15, "usage_type": "name" }, { "api_name": "scrapy.http.Req...
13146964
import json from typing import Iterable, Set, Union import pkg_resources name = "stopwordsiso" STOPWORDS_FILE = pkg_resources.resource_filename(name, "stopwords-iso.json") # All language code is ISO 639-1 _stopwords_all = {} with open(STOPWORDS_FILE) as json_data: _stopwords_all = json.load(json_data) _langs ...
null
python/stopwordsiso/__init__.py
__init__.py
py
1,006
python
en
code
null
code-starcoder2
83
[ { "api_name": "pkg_resources.resource_filename", "line_number": 8, "usage_type": "call" }, { "api_name": "json.load", "line_number": 14, "usage_type": "call" }, { "api_name": "typing.Set", "line_number": 19, "usage_type": "name" }, { "api_name": "typing.Union", ...
599829907
# python3 import sys from collections import namedtuple Answer = namedtuple('answer_type', 'i j len') class SubstringCompare: _prime1 = 10**9+7 _prime2 = 10**9+9 _multiplier = 263 def __init__(self, s, t): self.s = s self.t = t self.hashes1_s = [0]*(len(self.s)+1) self.hashes2_s = [0]*(len(self.s)+1) ...
null
c2/week3_hash_tables/5_longest_common_substring/common_substring.py
common_substring.py
py
4,298
python
en
code
null
code-starcoder2
83
[ { "api_name": "collections.namedtuple", "line_number": 6, "usage_type": "call" }, { "api_name": "sys.stdin.readlines", "line_number": 113, "usage_type": "call" }, { "api_name": "sys.stdin", "line_number": 113, "usage_type": "attribute" } ]
263303978
from typing import List class Solution: def minCostClimbingStairs(self, cost: List[int]) -> int: cost.append(0) dp = [0] * len(cost) dp[0] = cost[0] dp[1] = cost[1] for i in range(2, len(cost)): dp[i] = cost[i] + min(dp[i-1], dp[i-2]) return dp[-1] if ...
null
coding_everyday/lc500+/lc746/MinCostClimbingStairs.py
MinCostClimbingStairs.py
py
480
python
en
code
null
code-starcoder2
83
[ { "api_name": "typing.List", "line_number": 5, "usage_type": "name" } ]
601968510
import tensorflow as tf from tensorflow import keras import numpy as np import matplotlib.pyplot as plt import nltk import json import math def computeTF(word_dict, doc): tf_dict = {} doc_words_count = len(doc) for word, count in word_dict.items(): tf_dict[word] = count / float(doc_words_count) ...
null
review classifcation/TF-IDF/data_preprocessing.py
data_preprocessing.py
py
1,337
python
en
code
null
code-starcoder2
83
[ { "api_name": "math.log10", "line_number": 24, "usage_type": "call" }, { "api_name": "nltk.word_tokenize", "line_number": 46, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 55, "usage_type": "call" } ]
524378613
############################################################################## # AnnotatePartsReader.py # https://github.com/DigiLog-N/DigiLog-N # Copyright 2020 Canvass Labs, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # Y...
null
digilog_n/AnnotatePartsReader.py
AnnotatePartsReader.py
py
4,976
python
en
code
null
code-starcoder2
83
[ { "api_name": "digilog_n.PlasmaReader.PlasmaReader", "line_number": 30, "usage_type": "name" }, { "api_name": "pyarrow.plasma.connect", "line_number": 32, "usage_type": "call" }, { "api_name": "pyarrow.plasma", "line_number": 32, "usage_type": "name" }, { "api_nam...
162199093
from datetime import datetime import requests url = 'http://127.0.0.1:8000/rest/boards/2/' today = datetime.now().strftime('%Y-%m-%d %H:%M:%S') data = { 'title':'수정됨2', 'contents':'수정됨2', 'userid':'수정됨2', 'regdate':today } res = requests.put(url, data=data) print(res) print(res.text)
null
restapi/updateboard.py
updateboard.py
py
333
python
en
code
null
code-starcoder2
83
[ { "api_name": "datetime.datetime.now", "line_number": 7, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 7, "usage_type": "name" }, { "api_name": "requests.put", "line_number": 12, "usage_type": "call" } ]
344901954
from PyQt5 import QtCore, QtGui, QtWidgets from pyqtgraph import PlotWidget """ A class made for creating the GUI layout in an application made for a bachelor project. The class is made using the Qt framework. """ class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainW...
null
App/mainwindow.py
mainwindow.py
py
32,017
python
en
code
null
code-starcoder2
83
[ { "api_name": "PyQt5.QtWidgets.QWidget", "line_number": 15, "usage_type": "call" }, { "api_name": "PyQt5.QtWidgets", "line_number": 15, "usage_type": "name" }, { "api_name": "PyQt5.QtWidgets.QGridLayout", "line_number": 18, "usage_type": "call" }, { "api_name": "P...
311194292
import traceback import pytest from utils3.data.printer import print_tree, Layout class Employee: def __init__(self, fullname, function, head=None): self.team = [] self.fullname = fullname self.function = function if head: head.team.append(self) def __str__(self):...
null
utils3/tests/test_printer.py
test_printer.py
py
1,521
python
en
code
null
code-starcoder2
83
[ { "api_name": "pytest.fixture", "line_number": 19, "usage_type": "call" }, { "api_name": "utils3.data.printer.print_tree", "line_number": 35, "usage_type": "call" }, { "api_name": "utils3.data.printer.Layout.LR", "line_number": 35, "usage_type": "attribute" }, { "...
591239831
import zlib, base64 from xpathmodel import XPathModel, autoconstruct, validate_regexp _RE_CLASSNAME = r"[a-zA-Z][a-zA-Z0-9_]*" _RE_METHODNAME = _RE_CLASSNAME class CodeContainer(XPathModel): "Code blocks as sub-elements." DEFAULT_NAMESPACE=u"local" _attr_language = u"./@language" _attr_code_type =...
null
tags/0.3.3/src/slow/model/code_model.py
code_model.py
py
1,535
python
en
code
null
code-starcoder2
83
[ { "api_name": "xpathmodel.XPathModel", "line_number": 8, "usage_type": "name" }, { "api_name": "zlib.decompress", "line_number": 20, "usage_type": "call" }, { "api_name": "base64.b64decode", "line_number": 20, "usage_type": "call" }, { "api_name": "base64.b64encod...
403291799
import re import json import os from functools import wraps import kokkoro from kokkoro.typing import * from kokkoro import logger, KokkoroBot from kokkoro import priv, log, typing, trigger from kokkoro.msg_handler import EventInterface # service management _loaded_services: Dict[str, "Service"] = {} # {name: servic...
null
kokkoro/service.py
service.py
py
8,460
python
en
code
null
code-starcoder2
83
[ { "api_name": "re.compile", "line_number": 14, "usage_type": "call" }, { "api_name": "os.path.expanduser", "line_number": 15, "usage_type": "call" }, { "api_name": "os.path", "line_number": 15, "usage_type": "attribute" }, { "api_name": "os.makedirs", "line_nu...
424096014
from flask import ( Blueprint, flash, g, redirect, render_template, request, url_for ) from twittoff.auth import login_required from twittoff.db import get_db from twittoff.twitter import ( db_add_handle, TweetPackage, update_tweets, get_current_handles ) from twittoff.forms import AddHandleForm, AnalyzeHandle...
null
twittoff-application/twittoff/home.py
home.py
py
2,036
python
en
code
null
code-starcoder2
83
[ { "api_name": "flask.Blueprint", "line_number": 13, "usage_type": "call" }, { "api_name": "twittoff.forms.AddHandleForm", "line_number": 22, "usage_type": "call" }, { "api_name": "twittoff.forms.AnalyzeHandlesForm", "line_number": 23, "usage_type": "call" }, { "ap...
237835642
import torch from transformers import RobertaForTokenClassification from torchcrf import CRF from src.utils.mapper import configmapper @configmapper.map("models", "roberta_crf_token") class RobertaLSTMCRF(RobertaForTokenClassification): def __init__(self, config, lstm_hidden_size, lstm_layers): super().__...
null
src/models/roberta_crf_token.py
roberta_crf_token.py
py
1,994
python
en
code
null
code-starcoder2
83
[ { "api_name": "transformers.RobertaForTokenClassification", "line_number": 8, "usage_type": "name" }, { "api_name": "torch.nn.LSTM", "line_number": 11, "usage_type": "call" }, { "api_name": "torch.nn", "line_number": 11, "usage_type": "attribute" }, { "api_name": ...
607685942
""" Unit Test for PDF """ import numpy as np from math import sqrt import matplotlib.pyplot as plt from packages.Constants import PI, EV2J, AMU, K2J, EON_MASS from scipy.stats import maxwell from numpy.random import normal, uniform, randint #################################################################### #######...
null
tests/pdf/Maxwell3D_Distribution.py
Maxwell3D_Distribution.py
py
3,239
python
en
code
null
code-starcoder2
83
[ { "api_name": "packages.Constants.EV2J", "line_number": 18, "usage_type": "name" }, { "api_name": "packages.Constants.EON_MASS", "line_number": 19, "usage_type": "name" }, { "api_name": "math.sqrt", "line_number": 20, "usage_type": "call" }, { "api_name": "scipy.s...
479898578
import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from tqdm import tqdm from nltk import word_tokenize from nltk.corpus import stopwords stop_words = stopwords.words('english') from keras.layers.core import Dense, Activation, Dropout from sklearn import preprocessin...
null
yun/yuan.py
yuan.py
py
6,949
python
en
code
null
code-starcoder2
83
[ { "api_name": "nltk.corpus.stopwords.words", "line_number": 7, "usage_type": "call" }, { "api_name": "nltk.corpus.stopwords", "line_number": 7, "usage_type": "name" }, { "api_name": "pandas.read_csv", "line_number": 37, "usage_type": "call" }, { "api_name": "panda...
436359197
#!/usr/bin/env python from flask.ext.script import Manager, Server, prompt_bool from flask.ext.migrate import Migrate, MigrateCommand from app import app, db # configure your app migrate = Migrate(app, db) manager = Manager(app) manager.add_command("runserver", Server()) manager.add_command("db", MigrateCommand) @m...
null
manager.py
manager.py
py
721
python
en
code
null
code-starcoder2
83
[ { "api_name": "flask.ext.migrate.Migrate", "line_number": 9, "usage_type": "call" }, { "api_name": "app.app", "line_number": 9, "usage_type": "argument" }, { "api_name": "app.db", "line_number": 9, "usage_type": "argument" }, { "api_name": "flask.ext.script.Manage...
647809955
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 15 16:31:45 2020 @author: Yesh """ import os #os.chdir('/Users/Yesh/Documents/BDRAD/chest_ct_projects/lung_nodule_slice_localizer') import numpy as np import pandas as pd import time import argparse from stl import mesh import sys sys.path.append...
null
localize_with_slicenum.py
localize_with_slicenum.py
py
10,138
python
en
code
null
code-starcoder2
83
[ { "api_name": "sys.path.append", "line_number": 19, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 19, "usage_type": "attribute" }, { "api_name": "numpy.random.seed", "line_number": 23, "usage_type": "call" }, { "api_name": "numpy.random", "l...
510513107
import json import requests import time get_url = "https://cc.the-morpheus.de/challenges/3/" post_url = "https://cc.the-morpheus.de/solutions/3/" d = json.loads(requests.get(get_url).text) def remove_items(k): times = [] for _ in range(1000000): l = d["list"][:] start = time.time() wh...
null
Challenge_3/benchmark.py
benchmark.py
py
808
python
en
code
null
code-starcoder2
83
[ { "api_name": "json.loads", "line_number": 8, "usage_type": "call" }, { "api_name": "requests.get", "line_number": 8, "usage_type": "call" }, { "api_name": "time.time", "line_number": 14, "usage_type": "call" }, { "api_name": "time.time", "line_number": 19, ...
290212761
# -*- coding: utf-8 -*- from django.contrib import admin from settings import MEDIA_URL from models import News class NewsAdmin(admin.ModelAdmin): list_display = ('title', 'slug_title', 'pub_date', 'show', 'icon', ) list_filter = ('pub_date', 'show', ) search_fields = ('title', 'preview', 'content', ) def ic...
null
apps/news/admin.py
admin.py
py
1,043
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.contrib.admin.ModelAdmin", "line_number": 9, "usage_type": "attribute" }, { "api_name": "django.contrib.admin", "line_number": 9, "usage_type": "name" }, { "api_name": "sorl.thumbnail.get_thumbnail", "line_number": 18, "usage_type": "call" }, { ...
239210407
import numpy import matplotlib.pyplot as plt def PixelPoints (picList, NUM): #picList will be unraveled numpy array of intensity values #create certain pixels to iterate through pix1 = 720*260+260 #pixel in middle, will add more later, maybe randomize? y=[0]*400 x=[0]*400 #do we want average or time s...
null
HetPhaseCam/quick_test.py
quick_test.py
py
1,119
python
en
code
null
code-starcoder2
83
[ { "api_name": "numpy.ravel", "line_number": 13, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 13, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.plot", "line_number": 18, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", ...
33448501
import re from setuptools import setup def readme(): with open("README.md", encoding="utf-8") as f: return f.read() def get_version(verbose=1, filename="quantumdataset/version.py"): """Extract version information from source code""" with open(filename) as f: ln = f.readline() m...
null
extra/setup.py
setup.py
py
1,381
python
en
code
null
code-starcoder2
83
[ { "api_name": "re.search", "line_number": 16, "usage_type": "call" }, { "api_name": "setuptools.setup", "line_number": 23, "usage_type": "call" } ]
378556735
import json import logging import os import pytesseract as ts from bottle import request from ocr.api import FileType from ocr.api import LangType from ocr.api import ProtocolType from ocr.api import RecognitionMixin from ocr.api import optImageForOCR from ocr.api import run_tesseract from ocr.common.base import Base...
null
ocr/api/recognition.py
recognition.py
py
14,798
python
en
code
null
code-starcoder2
83
[ { "api_name": "logging.getLogger", "line_number": 17, "usage_type": "call" }, { "api_name": "ocr.api.FileType.PNG", "line_number": 20, "usage_type": "attribute" }, { "api_name": "ocr.api.FileType", "line_number": 20, "usage_type": "name" }, { "api_name": "ocr.api....
459099327
import json # 1.读取普通文本文件的内容 def read_text_file(file:str): """ 读取指定文件中的内容 :param file: 文件地址 :return: 文件中的内容 """ try: with open(file,encoding="utf-8")as f: return f.read() except FileNotFoundError: return "" # 2.读取json文件中的内容 def read_json_file(file:str): """ ...
null
Python1808/第一阶段/day13-类和对象/Filemanager1.py
Filemanager1.py
py
1,045
python
en
code
null
code-starcoder2
83
[ { "api_name": "json.load", "line_number": 23, "usage_type": "call" }, { "api_name": "json.dump", "line_number": 38, "usage_type": "call" } ]
169117424
from django.shortcuts import render from .models import Category, Tag, Post from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger def home(request): p = request.GET.get('page', '') posts_list = Post.objects.all() categories = Category.objects.all() tags = Tag.objects.all() pagin...
null
blog/views.py
views.py
py
2,103
python
en
code
null
code-starcoder2
83
[ { "api_name": "models.Post.objects.all", "line_number": 8, "usage_type": "call" }, { "api_name": "models.Post.objects", "line_number": 8, "usage_type": "attribute" }, { "api_name": "models.Post", "line_number": 8, "usage_type": "name" }, { "api_name": "models.Cate...
246339818
import torchvision.models as models import torch import torch.nn as nn ''' model = models.vgg16(pretrained=True) x = torch.randn((1,3,256,256)) model.features.parameters() output = model.features(x) for i in model.features[0].parameters(): print(i) print(i.shape) ''' class VGG16_extractor(nn.Module): d...
null
loss.py
loss.py
py
2,976
python
en
code
null
code-starcoder2
83
[ { "api_name": "torch.nn.Module", "line_number": 17, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 17, "usage_type": "name" }, { "api_name": "torchvision.models.vgg16", "line_number": 21, "usage_type": "call" }, { "api_name": "torchvision.mo...
241092064
# -*- coding: utf-8 -*- """ Created on Thu Jun 20 01:20:49 2013 @author: adnan """ from sklearn import datasets from sklearn import neighbors #loading dataset iris = datasets.load_iris() # we can found instances and class labels as iris.data and iris.target #classifier building stage knn = neighbors.KNeighborsCla...
null
KNN.py
KNN.py
py
468
python
en
code
null
code-starcoder2
83
[ { "api_name": "sklearn.datasets.load_iris", "line_number": 13, "usage_type": "call" }, { "api_name": "sklearn.datasets", "line_number": 13, "usage_type": "name" }, { "api_name": "sklearn.neighbors.KNeighborsClassifier", "line_number": 18, "usage_type": "call" }, { ...
402105880
"""empty message Revision ID: 2791c8a34d3d Revises: Create Date: 2018-10-16 22:39:34.570705 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '2791c8a34d3d' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gene...
null
Project/migrations/versions/2791c8a34d3d_.py
2791c8a34d3d_.py
py
8,496
python
en
code
null
code-starcoder2
83
[ { "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...
437433612
""" Implementation of DDPG - Deep Deterministic Policy Gradient Algorithm and hyperparameter details can be found here: http://arxiv.org/pdf/1509.02971v2.pdf The algorithm is tested on the Pendulum-v0 OpenAI gym task and developed with tflearn + Tensorflow Author: Patrick Emami """ import tensorflow as tf fro...
null
src/reinforcement/lstm_ddpg_dynamic/lstm_ddpg.py
lstm_ddpg.py
py
26,139
python
en
code
null
code-starcoder2
83
[ { "api_name": "tensorflow.get_default_session", "line_number": 43, "usage_type": "call" }, { "api_name": "tensorflow.variable_scope", "line_number": 55, "usage_type": "call" }, { "api_name": "tensorflow.trainable_variables", "line_number": 57, "usage_type": "call" }, ...
329572884
#!/usr/env/python # -*- coding: utf-8 -*- ''' Script to listen on a given port for UDP packets sent by a Forza Motorsport 7 "data out" stream and write the data to a TSV file. Copyright (c) 2018 Morten Wang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated do...
null
data2tsv.py
data2tsv.py
py
2,865
python
en
code
null
code-starcoder2
83
[ { "api_name": "socket.socket", "line_number": 46, "usage_type": "call" }, { "api_name": "socket.AF_INET", "line_number": 46, "usage_type": "attribute" }, { "api_name": "socket.SOCK_DGRAM", "line_number": 46, "usage_type": "attribute" }, { "api_name": "logging.info...
185573312
from django import forms from django.contrib.auth import models from django.db.models.base import Model from employee.models import * from django.contrib.auth.models import User # EMPLoYEE class EmployeeCreateForm(forms.ModelForm): image = forms.ImageField(widget=forms.FileInput(attrs={'onchange':'previewImage(this)...
null
src/employee/forms.py
forms.py
py
903
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.forms.ModelForm", "line_number": 9, "usage_type": "attribute" }, { "api_name": "django.forms", "line_number": 9, "usage_type": "name" }, { "api_name": "django.forms.ImageField", "line_number": 10, "usage_type": "call" }, { "api_name": "django...
307540120
import hackbright_app from flask import Flask, render_template, request, redirect app = Flask(__name__) @app.route("/") def get_github(): return render_template("get_github.html") @app.route("/add_student") def add_student(): return render_template("add_student.html") @app.route("/add_project") def add_proj...
null
webapp.py
webapp.py
py
2,278
python
en
code
null
code-starcoder2
83
[ { "api_name": "flask.Flask", "line_number": 4, "usage_type": "call" }, { "api_name": "flask.render_template", "line_number": 8, "usage_type": "call" }, { "api_name": "flask.render_template", "line_number": 12, "usage_type": "call" }, { "api_name": "flask.render_te...
559715585
#!/usr/bin/env python # -*- coding: utf-8 -*- import urllib.request import urllib.parse import re from http.server import BaseHTTPRequestHandler, HTTPServer import User import hebChatbot import simplejson import json from States import States import Options_to_classes # TODO a class for global variables like that Reset...
null
hebChatbot/server.py
server.py
py
7,356
python
en
code
null
code-starcoder2
83
[ { "api_name": "http.server.BaseHTTPRequestHandler", "line_number": 23, "usage_type": "name" }, { "api_name": "User.User", "line_number": 41, "usage_type": "call" }, { "api_name": "User.User", "line_number": 42, "usage_type": "call" }, { "api_name": "urllib.request...
428378418
import pytest class TestBreweryApi: def test_status_code(self, client_brewery): res = client_brewery.get_brewery_list() assert res.status_code == 200, 'Сервис не доступен' @pytest.mark.parametrize('by_name', ['cooper', 'Co']) def test_get_list_by_id(self, client_brewery, by_name): ...
null
api_tests/tests/test_brewery_api.py
test_brewery_api.py
py
1,814
python
en
code
null
code-starcoder2
83
[ { "api_name": "pytest.mark.parametrize", "line_number": 10, "usage_type": "call" }, { "api_name": "pytest.mark", "line_number": 10, "usage_type": "attribute" }, { "api_name": "pytest.mark.parametrize", "line_number": 16, "usage_type": "call" }, { "api_name": "pyte...
599606148
# -*- coding: utf-8 -*- import cv2 import numpy as np def BGR2GRAY(img): b = img[:, :, 0].copy() g = img[:, :, 1].copy() r = img[:, :, 2].copy() out = 0.2126*r + 0.7152*g + 0.0722*b out = out.astype(np.uint8) return out def L4N(img): tag = 0 grid = img.copy() for j in range...
null
Question_51_60/Labeling 8 Neighborhood.py
Labeling 8 Neighborhood.py
py
1,222
python
en
code
null
code-starcoder2
83
[ { "api_name": "numpy.uint8", "line_number": 12, "usage_type": "attribute" }, { "api_name": "numpy.zeros", "line_number": 28, "usage_type": "call" }, { "api_name": "numpy.uint8", "line_number": 28, "usage_type": "attribute" }, { "api_name": "cv2.imread", "line_...
403990143
from dataprepare import Data # from model import CaptionGenerator from config import Config import tensorflow as tf import os import numpy as np from tqdm import tqdm from newmodel import RCNNMODEL import pydicom from PIL import Image import cv2 import scipy import scipy.misc datapath1 = '/home/wangqiuli/Data/liver_...
null
Code/livercancer2/testmain.py
testmain.py
py
1,885
python
en
code
null
code-starcoder2
83
[ { "api_name": "dataprepare.Data", "line_number": 18, "usage_type": "call" }, { "api_name": "os.listdir", "line_number": 27, "usage_type": "call" }, { "api_name": "numpy.mgrid", "line_number": 36, "usage_type": "attribute" }, { "api_name": "numpy.vstack", "line...
584412315
# Dijisktra implementation using adjacency list & priority queue from collections import defaultdict import heapq def print_res(dist): print("\n\nFinal Result :: ") print("Vertex Distance from source") for i in range(len(dist)): print(i, "\t\t", dist[i]) def print_step(u, ...
null
Graph/adj_list.py
adj_list.py
py
1,287
python
en
code
null
code-starcoder2
83
[ { "api_name": "heapq.heapify", "line_number": 26, "usage_type": "call" }, { "api_name": "heapq.heappop", "line_number": 31, "usage_type": "call" }, { "api_name": "heapq.heappush", "line_number": 38, "usage_type": "call" }, { "api_name": "collections.defaultdict", ...
594541778
# -*- coding: utf-8 -*- from __future__ import unicode_literals from datetime import datetime from fabric.state import env from fabric.context_managers import cd from fabric.operations import sudo, local # settings servers = { "production": { "env.server_type": "production", "env.hosts": ["corp...
null
fabfile.py
fabfile.py
py
1,588
python
en
code
null
code-starcoder2
83
[ { "api_name": "datetime.datetime.now", "line_number": 29, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 29, "usage_type": "name" }, { "api_name": "datetime.datetime.now", "line_number": 30, "usage_type": "call" }, { "api_name": "datetim...
503667437
"""Tests for the Airthings BLE integration.""" from __future__ import annotations from unittest.mock import patch from airthings_ble import AirthingsBluetoothDeviceData, AirthingsDevice from homeassistant.components.bluetooth.models import BluetoothServiceInfoBleak from tests.components.bluetooth import generate_ad...
null
tests/components/airthings_ble/__init__.py
__init__.py
py
2,833
python
en
code
null
code-starcoder2
83
[ { "api_name": "unittest.mock.patch", "line_number": 15, "usage_type": "call" }, { "api_name": "homeassistant.components.bluetooth.models.BluetoothServiceInfoBleak", "line_number": 21, "usage_type": "name" }, { "api_name": "unittest.mock.patch", "line_number": 23, "usage_t...
569925843
import argparse import itertools import re from pathlib import Path from typing import Any from typing import Dict from typing import Generator from typing import Optional from typing import Sequence from typing import Set from typing import Tuple from pre_commit_dbt.check_script_has_no_table_name import has_table_nam...
null
pre_commit_dbt/replace_script_table_names.py
replace_script_table_names.py
py
3,668
python
en
code
null
code-starcoder2
83
[ { "api_name": "typing.Dict", "line_number": 21, "usage_type": "name" }, { "api_name": "typing.Any", "line_number": 21, "usage_type": "name" }, { "api_name": "typing.Set", "line_number": 21, "usage_type": "name" }, { "api_name": "typing.Generator", "line_number...
393327512
from googleapiclient.errors import HttpError from googleapiclient.discovery import build from pathlib import Path import time import progressbar import hashlib def apicall(req): sleep_time = 2 tries = 0 resp = None while resp == None: try: resp = req.execute() except HttpEr...
null
gdrove/helpers.py
helpers.py
py
3,036
python
en
code
null
code-starcoder2
83
[ { "api_name": "googleapiclient.errors.HttpError", "line_number": 16, "usage_type": "name" }, { "api_name": "time.sleep", "line_number": 24, "usage_type": "call" }, { "api_name": "googleapiclient.discovery.build", "line_number": 37, "usage_type": "call" }, { "api_n...
254156597
import os import docx from docx import Document from docx.shared import Inches import xml.etree.ElementTree as ET from lxml import etree from xml.dom import minidom import json document = Document('demo.docx') #print('document') #print(document.inline_shapes) #print(document.sections) #print(document.part._rels) #for...
null
docReader.py
docReader.py
py
2,095
python
en
code
null
code-starcoder2
83
[ { "api_name": "docx.Document", "line_number": 10, "usage_type": "call" }, { "api_name": "lxml.etree.fromstring", "line_number": 40, "usage_type": "call" }, { "api_name": "lxml.etree", "line_number": 40, "usage_type": "name" }, { "api_name": "xml.dom.minidom.parseS...
398907847
import matplotlib.pyplot as plt import torch import numpy as np class MultimodalHeteroToy(): def __init__(self, N=100, M=2, name=str): # Make toy dataset self.N = N # number of data set self.M = M # number of modality self.X_train = torch.linspace(0, np.pi * 2, self.N)[:, None] ...
null
ToyPrograms/multimodal_hetero_toyprogram.py
multimodal_hetero_toyprogram.py
py
2,669
python
en
code
null
code-starcoder2
83
[ { "api_name": "torch.linspace", "line_number": 11, "usage_type": "call" }, { "api_name": "numpy.pi", "line_number": 11, "usage_type": "attribute" }, { "api_name": "torch.stack", "line_number": 20, "usage_type": "call" }, { "api_name": "torch.linspace", "line_n...
200225306
''' Created on Sep 8, 2018 @author: fxua ''' import keras.initializers as initializers from keras.models import Sequential from keras.layers import Dense from keras.layers import Dropout from keras import regularizers from keras.models import model_from_yaml from modules.basics.conf.generalconf import gGeneralConfig f...
null
py_ml/modules/mlengine_cores/dnncomm/dnncreator.py
dnncreator.py
py
4,308
python
en
code
null
code-starcoder2
83
[ { "api_name": "keras.regularizers.l1", "line_number": 22, "usage_type": "attribute" }, { "api_name": "keras.regularizers", "line_number": 22, "usage_type": "name" }, { "api_name": "keras.regularizers.l2", "line_number": 23, "usage_type": "attribute" }, { "api_name...
209351851
# -*- coding: utf-8 -*- """ Created on Fri Aug 7 15:37:30 2020 @author: chenlei """ from collections import namedtuple from pandas import DataFrame, Timestamp from detect_anoms import detect_anoms from data_utils import format_timestamp,get_gran,time_range from data_correction import data_correction,data_merge # fro...
null
detect_df.py
detect_df.py
py
13,914
python
en
code
null
code-starcoder2
83
[ { "api_name": "collections.namedtuple", "line_number": 20, "usage_type": "call" }, { "api_name": "data_utils.format_timestamp", "line_number": 35, "usage_type": "call" }, { "api_name": "data_utils.time_range", "line_number": 36, "usage_type": "call" }, { "api_name...
227745437
import json from py42.clients.alertrules.cloud_share import CloudShareClient class TestCloudShareClient(object): def test_get_by_id_posts_to_correct_endpoint_for_cloudshare_type( self, mock_session ): alert_rule_client = CloudShareClient(mock_session, u"tenant-id") alert_rule_client.g...
null
tests/clients/alertrules/test_cloudshare.py
test_cloudshare.py
py
653
python
en
code
null
code-starcoder2
83
[ { "api_name": "py42.clients.alertrules.cloud_share.CloudShareClient", "line_number": 10, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 14, "usage_type": "call" } ]
430071240
from flask import Flask, render_template, request, redirect from modelos import * app = Flask(__name__) @app.route('/', methods=['GET', 'POST']) @db_session def index(): if request.method == 'POST': tarea = request.form.get('tarea') if tarea: t = Tarea(texto=tarea) contexto = {'t...
null
clase05/flask_continuacion.py
flask_continuacion.py
py
935
python
en
code
null
code-starcoder2
83
[ { "api_name": "flask.Flask", "line_number": 4, "usage_type": "call" }, { "api_name": "flask.request.method", "line_number": 10, "usage_type": "attribute" }, { "api_name": "flask.request", "line_number": 10, "usage_type": "name" }, { "api_name": "flask.request.form...
284570753
import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim as optim import torch.utils.data from Variables import * # Tracer input will always be (1 x 100040) class Encoder(nn.Module): def __init__(self, ngpu): super(Encoder, self).__ini...
null
Tracers/AutoEncoder.py
AutoEncoder.py
py
2,139
python
en
code
null
code-starcoder2
83
[ { "api_name": "torch.nn.Module", "line_number": 11, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 11, "usage_type": "name" }, { "api_name": "torch.nn.Sequential", "line_number": 15, "usage_type": "call" }, { "api_name": "torch.nn", "lin...
425074030
import sys import os import time boss_path = os.path.dirname(os.path.dirname(__file__)) framework_path = os.path.join(os.path.dirname((os.path.dirname(os.path.dirname(__file__)))),"Framework") sys.path.append(os.path.join(framework_path,"provisioning_wrappers","boss_wrappers")) sys.path.append(os.path.join(framework_p...
null
MiV400Automation/lib/BossApiComponent.py
BossApiComponent.py
py
76,398
python
en
code
null
code-starcoder2
83
[ { "api_name": "os.path.dirname", "line_number": 5, "usage_type": "call" }, { "api_name": "os.path", "line_number": 5, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_number": 6, "usage_type": "call" }, { "api_name": "os.path", "line_number": 6...
10375283
import os from flask import Flask, jsonify, request from math import sqrt app = Flask(__name__) @app.route('/') def nao_entre_em_panico(): primos = "2" num = 3 cont = 0 primo = True while(cont < 99): for i in range(2, num-1, 1 ): if num % i == 0: primo = False ...
null
primos.py
primos.py
py
650
python
en
code
null
code-starcoder2
83
[ { "api_name": "flask.Flask", "line_number": 5, "usage_type": "call" }, { "api_name": "os.environ.get", "line_number": 28, "usage_type": "call" }, { "api_name": "os.environ", "line_number": 28, "usage_type": "attribute" } ]
443931853
from django.db import models from django.utils.translation import ugettext_lazy as _ # заявки пользователей на БЕТА-тест class Test_registration(models.Model): email = models.EmailField( _('email address'), max_length=255, unique=True, db_index=True ) activation = models.B...
null
ESPOR/registration_for_beta/models.py
models.py
py
527
python
en
code
null
code-starcoder2
83
[ { "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.EmailField", "line_number": 7, "usage_type": "call" }, { "api_name": ...
129454616
import json from xml import etree import numpy as np import xml.etree.ElementTree as ET tree = ET.parse('copa-test.xml') root = tree.getroot() choice_test = [] for child in root.findall('item'): answer = int(child.get('most-plausible-alternative')) choice_test.append(answer) choice_test = [x-1 for x in choice_...
null
resources/ProcessData.py
ProcessData.py
py
2,224
python
en
code
null
code-starcoder2
83
[ { "api_name": "xml.etree.ElementTree.parse", "line_number": 5, "usage_type": "call" }, { "api_name": "xml.etree.ElementTree", "line_number": 5, "usage_type": "name" }, { "api_name": "json.loads", "line_number": 25, "usage_type": "call" }, { "api_name": "json.loads...
186298197
# -*- coding:utf-8 -*- # Author : 'SAM' # CreateTime : '2020/12/10 10:13' # file : 'RedisSession.py' # Summary : '' import json import random import string import time from hashlib import sha256 from Config.RedisConn import select_redis_db, RedisConn create_session_id = lambda: sha256((''.join(random.sample(str(stri...
null
Infrastructure/Utils/Session/RedisSession.py
RedisSession.py
py
2,101
python
en
code
null
code-starcoder2
83
[ { "api_name": "hashlib.sha256", "line_number": 15, "usage_type": "call" }, { "api_name": "random.sample", "line_number": 15, "usage_type": "call" }, { "api_name": "string.ascii_letters", "line_number": 15, "usage_type": "attribute" }, { "api_name": "string.digits"...
651689030
#### 請解壓縮data.rar,取得本程式之數據 ##### # 驗證碼識別(訓練) import os import tensorflow as tf import numpy as np import random import cv2 import math from sklearn.model_selection import train_test_split # 不同字符數量 CHAR_SET_LEN = 10 # 批次 BATCH_SIZE = 50 # 圖片高度 IMAGE_HEIGHT = 60 # 圖片寬度 IMAGE_WIDTH = 160 # 獲取數據路徑 imagePaths = [] for ...
null
Tensorflow_進階/06_Multitask_Learning/02_multitask_learning_class_version.py
02_multitask_learning_class_version.py
py
16,323
python
en
code
null
code-starcoder2
83
[ { "api_name": "os.listdir", "line_number": 24, "usage_type": "call" }, { "api_name": "random.seed", "line_number": 26, "usage_type": "call" }, { "api_name": "random.shuffle", "line_number": 27, "usage_type": "call" }, { "api_name": "cv2.imread", "line_number":...
105142045
import requests import json import datetime import ckanapi from pprint import pprint # The original Datapusher code was extracted at some point from # https://github.com/WPRDC/wprdc-etl # Datanudger is backward-compatible but uses ckanapi to do the # heavy lifting. This provides a minimal set of functions to ...
null
datanudger.py
datanudger.py
py
6,203
python
en
code
null
code-starcoder2
83
[ { "api_name": "json.load", "line_number": 26, "usage_type": "call" }, { "api_name": "ckanapi.RemoteCKAN", "line_number": 40, "usage_type": "call" }, { "api_name": "ckanapi.RemoteCKAN", "line_number": 60, "usage_type": "call" }, { "api_name": "datetime.datetime.utc...
187298245
""" Output a normalized vegetative index """ import gdal, gdalnumeric, ogr import Image, ImageDraw def imageToArray(i): """ Converts a Python Imaging Library array to a gdalnumeric image. """ a=gdalnumeric.numpy.fromstring(i.tobytes(),'b') a.shape=i.im.size[1], i.im.size[0] return a d...
null
08/01-ndvi.py
01-ndvi.py
py
4,067
python
en
code
null
code-starcoder2
83
[ { "api_name": "gdalnumeric.numpy.fromstring", "line_number": 12, "usage_type": "call" }, { "api_name": "gdalnumeric.numpy", "line_number": 12, "usage_type": "attribute" }, { "api_name": "gdalnumeric.LoadFile", "line_number": 42, "usage_type": "call" }, { "api_name...
375931030
from django.urls import path, include from rest_framework import routers from .views import BrandViewSet, CategoryViewSet, ProductViewSet router = routers.DefaultRouter() router.register(r"brands", BrandViewSet, basename="brands") router.register(r"categories", CategoryViewSet, basename="categories") router.register(r...
null
apps/catalog/api/v1/urls.py
urls.py
py
424
python
en
code
null
code-starcoder2
83
[ { "api_name": "rest_framework.routers.DefaultRouter", "line_number": 5, "usage_type": "call" }, { "api_name": "rest_framework.routers", "line_number": 5, "usage_type": "name" }, { "api_name": "views.BrandViewSet", "line_number": 6, "usage_type": "argument" }, { "a...
536204918
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os from datetime import date from django.conf import settings from django.core.cache import cache from rest_framework import status from rest_framework.test import APITestCase from blog.models import User from .factories import * class EntryTes...
null
blog_api_media/blog/tests/test_api.py
test_api.py
py
5,434
python
en
code
null
code-starcoder2
83
[ { "api_name": "rest_framework.test.APITestCase", "line_number": 16, "usage_type": "name" }, { "api_name": "blog.models.User.objects.create_user", "line_number": 21, "usage_type": "call" }, { "api_name": "blog.models.User.objects", "line_number": 21, "usage_type": "attribu...
130360414
from util.basic import * import os import datetime import setting from config import * os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID' gpu_list = '0' # gpus to runs The element of the list is 'g0,g1,...g,n-1',where n is number of gpu each task uses setting_name = 'SH_classifier' kfold = 5 train_repeat = 2 param_settin...
null
train_SH_classifier.py
train_SH_classifier.py
py
2,660
python
en
code
null
code-starcoder2
83
[ { "api_name": "os.environ", "line_number": 6, "usage_type": "attribute" }, { "api_name": "setting.get_param_setting", "line_number": 12, "usage_type": "call" }, { "api_name": "datetime.datetime.now", "line_number": 17, "usage_type": "call" }, { "api_name": "dateti...
491453532
from tkinter import * from tkinter import filedialog from os import chdir,listdir,system from time import sleep from pygame import mixer master = Tk() volume = 10 i = 0 chdir(f'D:\MUSIC') list1=(listdir()) # YOU CAN ALSO WRITE AS list1=(listdir('D:\MUSIC')) dict1={i:f"{list1[i]}" for i in range(len(list...
null
music_Player.py
music_Player.py
py
2,969
python
en
code
null
code-starcoder2
83
[ { "api_name": "os.chdir", "line_number": 12, "usage_type": "call" }, { "api_name": "os.listdir", "line_number": 13, "usage_type": "call" }, { "api_name": "pygame.mixer.init", "line_number": 19, "usage_type": "call" }, { "api_name": "pygame.mixer", "line_number...
239210469
from flask import Flask from flask import request from flask import jsonify from flask_sslify import SSLify import requests import os from dotenv import load_dotenv app = Flask(__name__) sslify = SSLify(app) load_dotenv('.env') token = os.getenv('OAUTH_TOKEN') URL = 'https://api.telegram.org/bot' + token + '/' wiki_a...
null
app.py
app.py
py
1,876
python
en
code
null
code-starcoder2
83
[ { "api_name": "flask.Flask", "line_number": 9, "usage_type": "call" }, { "api_name": "flask_sslify.SSLify", "line_number": 10, "usage_type": "call" }, { "api_name": "dotenv.load_dotenv", "line_number": 12, "usage_type": "call" }, { "api_name": "os.getenv", "li...
420888567
# 将 python_0001 题生成的 200 个激活码(或者优惠券)保存到 MySQL 关系型数据库中。 import pymysql import logging import uuid def save_data_to_db(): try: # 连接数据库 conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='123456', db='student', charset='utf8') # 设置自动提交 ...
null
python_daily/test_0003/python_0003.py
python_0003.py
py
1,970
python
en
code
null
code-starcoder2
83
[ { "api_name": "pymysql.connect", "line_number": 11, "usage_type": "call" }, { "api_name": "logging.error", "line_number": 38, "usage_type": "call" }, { "api_name": "uuid.uuid1", "line_number": 46, "usage_type": "call" }, { "api_name": "logging.error", "line_nu...
362075831
import numpy as np import sys from metrics import * import cv2 from debug_utils import * from tqdm import tqdm from inspect import signature from descriptors import * from local_descriptors_match import match_descriptors_qs_db from keypoint_finder import compute_keypoints from descriptors_local import compute_local_des...
null
week5/match_methods.py
match_methods.py
py
9,487
python
en
code
null
code-starcoder2
83
[ { "api_name": "tqdm.tqdm", "line_number": 44, "usage_type": "call" }, { "api_name": "numpy.concatenate", "line_number": 52, "usage_type": "call" }, { "api_name": "numpy.argpartition", "line_number": 54, "usage_type": "call" }, { "api_name": "inspect.signature", ...
107849281
import pandas as pd from typing import List, Union import random import plotly.express as px import plotly.graph_objects as go # dash specific imports import dash_core_components as dcc import dash_html_components as html import dash.dependencies from dash.dependencies import Input, Output import dash_bootstrap_compon...
null
app.py
app.py
py
7,304
python
en
code
null
code-starcoder2
83
[ { "api_name": "pandas.read_csv", "line_number": 17, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 18, "usage_type": "call" }, { "api_name": "dash_bootstrap_components.themes", "line_number": 24, "usage_type": "attribute" }, { "api_name": ...
201559234
# -*- coding:utf-8 -*- """ Common parsing methods """ from __future__ import print_function import sys import argparse import itertools import iotlabcli from iotlabcli import helpers from iotlabcli import rest DOMAIN_DNS = 'iot-lab.info' def base_parser(user_required=False): """ Base parser giving 'user' 'passw...
null
iotlabcli/parser/common.py
common.py
py
5,992
python
en
code
null
code-starcoder2
83
[ { "api_name": "argparse.ArgumentParser", "line_number": 18, "usage_type": "call" }, { "api_name": "iotlabcli.__version__", "line_number": 35, "usage_type": "attribute" }, { "api_name": "sys.argv", "line_number": 40, "usage_type": "attribute" }, { "api_name": "iotl...
631364101
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Copyright (c) 2016, Qilei All rights reserved. 摘 要: redirect.py 创 建 者: Qilei 创建日期: 2016-07-02 ''' import tornado.ioloop import tornado.web class MainHandler(tornado.web.RequestHandler): def get(self): self.redirect("/sec") # self.write("main ha...
null
python/tornado/redirect.py
redirect.py
py
674
python
en
code
null
code-starcoder2
83
[ { "api_name": "tornado.ioloop.web", "line_number": 15, "usage_type": "attribute" }, { "api_name": "tornado.ioloop", "line_number": 15, "usage_type": "name" }, { "api_name": "tornado.ioloop.web", "line_number": 20, "usage_type": "attribute" }, { "api_name": "tornad...
470680382
from collections.abc import MutableMapping, Mapping, Iterable, Iterator class Tree(MutableMapping): def __init__(self, mapping=None): self._length = 0 self._root = None if mapping is not None: if not isinstance(mapping, Mapping): class_name = type(self).__name__...
null
data_structures/python/tree.py
tree.py
py
7,539
python
en
code
null
code-starcoder2
83
[ { "api_name": "collections.abc.MutableMapping", "line_number": 4, "usage_type": "name" }, { "api_name": "collections.abc.Mapping", "line_number": 9, "usage_type": "argument" }, { "api_name": "collections.abc.Mapping", "line_number": 56, "usage_type": "argument" }, { ...
156082397
from __future__ import unicode_literals from devpi_common.archive import zip_dict from devpi_web.doczip import get_unpack_path from devpi_web.indexing import ProjectIndexingInfo from devpi_web.indexing import preprocess_project import pytest def test_inheritance(xom): with xom.keyfs.transaction(write=True): ...
null
web/tests/test_indexing.py
test_indexing.py
py
1,861
python
en
code
null
code-starcoder2
83
[ { "api_name": "devpi_web.indexing.preprocess_project", "line_number": 20, "usage_type": "call" }, { "api_name": "devpi_web.indexing.ProjectIndexingInfo", "line_number": 20, "usage_type": "call" }, { "api_name": "devpi_common.archive.zip_dict", "line_number": 26, "usage_ty...
117893245
# -*- coding: utf-8 -*- from django.core.urlresolvers import reverse from django.shortcuts import render_to_response from django.template import RequestContext from django.contrib.auth.models import User from mypage.models import FacePhoto from mysite.polls.models import Poll from mysite.mypage.models import Request fr...
null
mypage/views.py
views.py
py
3,638
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.shortcuts.render_to_response", "line_number": 17, "usage_type": "call" }, { "api_name": "django.contrib.auth.models.User.objects.get", "line_number": 20, "usage_type": "call" }, { "api_name": "django.contrib.auth.models.User.objects", "line_number": 20, ...
114089498
import bpy, time, traceback, os, json from bpy.props import StringProperty from pathlib import Path from ..interface.dictionary_en import t def toggle_console(): #show the console so you can see some kind of progression try: bpy.ops.wm.console_toggle() except: return #only available on win...
null
importing/importbuttons.py
importbuttons.py
py
7,995
python
en
code
null
code-starcoder2
83
[ { "api_name": "bpy.ops.wm.console_toggle", "line_number": 10, "usage_type": "call" }, { "api_name": "bpy.ops", "line_number": 10, "usage_type": "attribute" }, { "api_name": "bpy.data.texts.get", "line_number": 15, "usage_type": "call" }, { "api_name": "bpy.data", ...
265076602
import math import random import numpy as np import networkx as nx import matplotlib.pyplot as plt def initalize(nodes, adj, num_nodes): random.seed() for i in range (0, num_nodes): status = random.randint(0, 1) # 0 = cooperate, 1 = defect nodes[i] = status f...
null
finalProjectSimulation/game.py
game.py
py
2,131
python
en
code
null
code-starcoder2
83
[ { "api_name": "random.seed", "line_number": 8, "usage_type": "call" }, { "api_name": "random.randint", "line_number": 10, "usage_type": "call" }, { "api_name": "random.randint", "line_number": 14, "usage_type": "call" }, { "api_name": "networkx.convert_matrix.from...
176543906
import sys, os from interpreter.scanner.scanner import Scanner class Dexter: had_error = False def __init__(self): pass def start(self): if len(sys.argv) == 2: self._run_file(sys.argv[1]) elif len(sys.argv) == 1: self._run_prompt() else: ...
null
python/src/main.py
main.py
py
1,373
python
en
code
null
code-starcoder2
83
[ { "api_name": "sys.argv", "line_number": 12, "usage_type": "attribute" }, { "api_name": "sys.argv", "line_number": 13, "usage_type": "attribute" }, { "api_name": "sys.argv", "line_number": 14, "usage_type": "attribute" }, { "api_name": "sys.exit", "line_number...
420905792
import numpy as np import mmcv import matplotlib.pyplot as plt from mmcv import Config from mmseg.apis import set_random_seed from mmseg.datasets.builder import DATASETS from mmseg.datasets.custom import CustomDataset import os.path as osp import numpy as np from PIL import Image from tqdm import tqdm import torch, tor...
null
Semantic-Segmantation/train.py
train.py
py
11,626
python
en
code
null
code-starcoder2
83
[ { "api_name": "argparse.ArgumentParser", "line_number": 31, "usage_type": "call" }, { "api_name": "numpy.nanmean", "line_number": 65, "usage_type": "call" }, { "api_name": "numpy.nanmean", "line_number": 66, "usage_type": "call" }, { "api_name": "numpy.nanmean", ...
624961401
from django.utils.text import slugify import random import string def random_string_generator(size=10, chars=string.ascii_lowercase + string.digits): return ''.join(random.choice(chars) for _ in range(size)) def unique_order_id_generator(instance): order_new_id=random_string_generator(size=5).upper() Klas...
null
src/ecommerce/utils.py
utils.py
py
1,277
python
en
code
null
code-starcoder2
83
[ { "api_name": "string.ascii_lowercase", "line_number": 5, "usage_type": "attribute" }, { "api_name": "string.digits", "line_number": 5, "usage_type": "attribute" }, { "api_name": "random.choice", "line_number": 6, "usage_type": "call" }, { "api_name": "random.rand...
445286732
import mne import matplotlib.pyplot as pp import numpy as np from sklearn.model_selection import KFold from mne.decoding import ReceptiveField as RField from mne.decoding import Scaler as MultiChannelScaler from sklearn.metrics import r2_score from sklearn.metrics import mean_squared_error from scipy.stats import pears...
null
old/decoding_RidgeReg_allChannel.py
decoding_RidgeReg_allChannel.py
py
30,093
python
en
code
null
code-starcoder2
83
[ { "api_name": "sklearn.decomposition.PCA", "line_number": 22, "usage_type": "call" }, { "api_name": "sklearn.decomposition.KernelPCA", "line_number": 34, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 46, "usage_type": "call" }, { "api_name": ...
127555233
from kivy.app import App from kivy.config import Config from kivy.uix.floatlayout import FloatLayout from kivy.uix.button import Button from kivy.uix.image import Image from kivy.uix.label import Label from kivy.metrics import dp log = print """ 本次作业需要实现一个功能相对完整,界面优美专业的播放器 本次的播放器不支持播放列表,只支持单曲播放 播放器界面设计参考下面的链接,选一...
null
project/项目9-完整播放器.py
项目9-完整播放器.py
py
2,838
python
en
code
null
code-starcoder2
83
[ { "api_name": "sys.platform", "line_number": 41, "usage_type": "name" }, { "api_name": "sys.platform", "line_number": 43, "usage_type": "name" }, { "api_name": "kivy.app.App", "line_number": 49, "usage_type": "name" }, { "api_name": "kivy.config.Config.set", "...
523192338
import logging from szurubooru import config, db logger = logging.getLogger(__name__) class DbSession(object): ''' Attaches database session to the context of every request. ''' def process_request(self, request, _response): request.context.session = db.session() db.reset_query_count() d...
null
server/szurubooru/middleware/db_session.py
db_session.py
py
511
python
en
code
null
code-starcoder2
83
[ { "api_name": "logging.getLogger", "line_number": 4, "usage_type": "call" }, { "api_name": "szurubooru.db.session", "line_number": 10, "usage_type": "call" }, { "api_name": "szurubooru.db", "line_number": 10, "usage_type": "name" }, { "api_name": "szurubooru.db.re...
243545786
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. import ConfigParser import Queue import StringIO import datetime import logging import multiprocessing import os import ...
null
worker.py
worker.py
py
12,443
python
en
code
null
code-starcoder2
83
[ { "api_name": "multiprocessing.Queue", "line_number": 35, "usage_type": "call" }, { "api_name": "multiprocessing.Lock", "line_number": 36, "usage_type": "call" }, { "api_name": "logging.info", "line_number": 71, "usage_type": "call" }, { "api_name": "mozdevice.Dev...
167096959
""" Adminlte通用控件 """ from django import template from django.template.loader import render_to_string from django.utils.html import mark_safe from django.conf import settings from django.urls import reverse from zencore.utils.magic import import_from_string from zencore.utils.magic import call_with_parameters_injection ...
null
src/zencore/adminlte/templatetags/adminlte.py
adminlte.py
py
2,631
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.template.Library", "line_number": 12, "usage_type": "call" }, { "api_name": "django.template", "line_number": 12, "usage_type": "name" }, { "api_name": "django.urls.reverse", "line_number": 17, "usage_type": "call" }, { "api_name": "zencore.u...
468904516
# -*- coding: utf-8 -*- from django.conf.urls import url import views urlpatterns = [ url(r'^contact$', views.contact), url(r'^contact/thanks$', views.contact_thx), url(r'^about_us$', views.about_us), ]
null
business_site/apps/page/urls.py
urls.py
py
217
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.conf.urls.url", "line_number": 6, "usage_type": "call" }, { "api_name": "views.contact", "line_number": 6, "usage_type": "attribute" }, { "api_name": "django.conf.urls.url", "line_number": 7, "usage_type": "call" }, { "api_name": "views.conta...
368869787
#!/usr/bin/python3 """ Test for Amenity Class """ import unittest import pep8 from models.base_model import BaseModel from models.amenity import Amenity from datetime import datetime class TestStringMethods(unittest.TestCase): """ Testing class """ @classmethod def setUpClass(cls): """se...
null
tests/test_models/test_amenity.py
test_amenity.py
py
1,341
python
en
code
null
code-starcoder2
83
[ { "api_name": "unittest.TestCase", "line_number": 14, "usage_type": "attribute" }, { "api_name": "models.amenity.Amenity", "line_number": 21, "usage_type": "call" }, { "api_name": "models.amenity.Amenity.__doc__", "line_number": 26, "usage_type": "attribute" }, { ...
430119823
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting model 'Usuario' db.delete_table(u'usuario_usuario') def backwards(self, orm): # Add...
null
NossaCarona/usuario/migrations/0002_auto__del_usuario.py
0002_auto__del_usuario.py
py
939
python
en
code
null
code-starcoder2
83
[ { "api_name": "south.v2.SchemaMigration", "line_number": 8, "usage_type": "name" }, { "api_name": "south.db.db.delete_table", "line_number": 12, "usage_type": "call" }, { "api_name": "south.db.db", "line_number": 12, "usage_type": "name" }, { "api_name": "south.db...
229137050
#!/usr/bin/env python3 import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from pytorch_translate import common_layers # noqa from pytorch_translate import rnn class HighwayLayer(nn.Module): def __init__( self, input_dim, transform_activation=F.relu, ...
null
pytorch_translate/char_encoder.py
char_encoder.py
py
5,062
python
en
code
null
code-starcoder2
83
[ { "api_name": "torch.nn.Module", "line_number": 11, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 11, "usage_type": "name" }, { "api_name": "torch.nn.functional.relu", "line_number": 15, "usage_type": "attribute" }, { "api_name": "torch.nn....
91501813
import os, time, datetime from pymongo import MongoClient # function dbConnect # Connect to database and return open connected database def dbConnect(m_user, m_password, m_dbName, ip_addr): conn = MongoClient('mongodb://'+ m_user +':'+ m_password + ip_addr + m_dbName) db = conn[m_dbName] # define database return db...
null
csv2db.py
csv2db.py
py
3,710
python
en
code
null
code-starcoder2
83
[ { "api_name": "pymongo.MongoClient", "line_number": 7, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 45, "usage_type": "call" }, { "api_name": "os.scandir", "line_number": 53, "usage_type": "call" }, { "api_name": "os.path.exists", ...
136223166
# coding: utf-8 # In[312]: import nltk,re import pandas as pd import numpy as np from nltk import sent_tokenize,word_tokenize from nltk.corpus import stopwords from nltk.stem import PorterStemmer from nltk.sentiment.vader import SentimentIntensityAnalyzer from pprint import pprint from collections import Counter f...
null
003 source_code/000 school report code/analyze_predict_py/v2/get_vs_by_apply_summarize_and_sentiment.py
get_vs_by_apply_summarize_and_sentiment.py
py
15,030
python
en
code
null
code-starcoder2
83
[ { "api_name": "numpy.datetime64", "line_number": 49, "usage_type": "call" }, { "api_name": "numpy.timedelta64", "line_number": 50, "usage_type": "call" }, { "api_name": "numpy.datetime64", "line_number": 52, "usage_type": "call" }, { "api_name": "numpy.timedelta64...
567368821
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import streamlit as st @st.cache() def load_data(): df = pd.read_csv('https://student-datasets-bucket.s3.ap-south-1.amazonaws.com/whitehat-ds-datasets/adult.csv', header=None) df.head() column_name =['age', 'w...
null
census_app.py
census_app.py
py
1,202
python
en
code
null
code-starcoder2
83
[ { "api_name": "pandas.read_csv", "line_number": 9, "usage_type": "call" }, { "api_name": "numpy.nan", "line_number": 15, "usage_type": "attribute" }, { "api_name": "numpy.nan", "line_number": 16, "usage_type": "attribute" }, { "api_name": "numpy.nan", "line_nu...
361174366
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 from typing import List, Tuple, Callable import numpy as np import scipy.optimize from .. import ParameterSpace from .context_manager import ContextManager class Optimizer(object): """ Class for ...
null
emukit/core/optimization/optimizer.py
optimizer.py
py
7,086
python
en
code
null
code-starcoder2
83
[ { "api_name": "typing.List", "line_number": 18, "usage_type": "name" }, { "api_name": "typing.Tuple", "line_number": 18, "usage_type": "name" }, { "api_name": "numpy.array", "line_number": 24, "usage_type": "attribute" }, { "api_name": "typing.Callable", "line...
198985336
import numpy as np import gym from gym import error, spaces, utils from gym.utils import seeding N_EDGES = 8 ACTION_MAP = np.array([ [0,1,1,1,0,0,1,0], [1,0,1,0,0,1,0,1], [1,1,0,1,0,1,1,1], [1,0,1,0,1,0,1,1], [0,0,0,1,0,1,1,1], [0,1,1,0,1,0,1,1], [1,0,1,1,1,1,0,0], [0,1,1,1,1,1,0,0], ]...
null
TD/my_env.py
my_env.py
py
5,285
python
en
code
null
code-starcoder2
83
[ { "api_name": "numpy.array", "line_number": 7, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 19, "usage_type": "call" }, { "api_name": "gym.Env", "line_number": 38, "usage_type": "attribute" }, { "api_name": "gym.spaces.Box", "line_number...
570543278
# Databricks notebook source # MAGIC # MAGIC %md # MAGIC # XGBoost # MAGIC # MAGIC If you are not using the DBR 7.x ML Runtime, you will need to install `ml.dmlc:xgboost4j-spark_2.12:1.0.0` from Maven, well as `xgboost` from PyPI. # MAGIC # MAGIC **NOTE:** There is currently only a distributed version of XGBoost fo...
null
Notebooks/Learning-Spark/Python/Chapter11/11-2 XGBoost.py
11-2 XGBoost.py
py
5,392
python
en
code
null
code-starcoder2
83
[ { "api_name": "pyspark.sql.functions.log", "line_number": 25, "usage_type": "call" }, { "api_name": "pyspark.sql.functions.col", "line_number": 25, "usage_type": "call" }, { "api_name": "pyspark.ml.feature.StringIndexer", "line_number": 30, "usage_type": "call" }, { ...
84143184
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('MsgDisplay', '0003_auto_20160324_2252'), ] operations = [ migrations.CreateModel( name='salesBill', ...
null
MsgDisplay/migrations/0004_auto_20160324_2309.py
0004_auto_20160324_2309.py
py
1,084
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.db.migrations.Migration", "line_number": 7, "usage_type": "attribute" }, { "api_name": "django.db.migrations", "line_number": 7, "usage_type": "name" }, { "api_name": "django.db.migrations.CreateModel", "line_number": 14, "usage_type": "call" }, ...