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
460900007
import chess import chess.pgn import os import numpy as np from connect4 import Connect4 cwd = os.getcwd() def buildInput(board): oldBoard = board.copy(stack=1) try: oldBoard.pop() except IndexError: oldBoard.clear() if board.turn: currentBoard = board flipped = False else: flipped = True currentBo...
null
Connect4/inputBuilder.py
inputBuilder.py
py
5,449
python
en
code
null
code-starcoder2
83
[ { "api_name": "os.getcwd", "line_number": 7, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 26, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 27, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 28,...
342759041
import csv from django.http import HttpResponse from .base_export_model import BaseExportModel class ExportAsCsv(BaseExportModel): @property def file_obj(self): """Returns a file object for the writer.""" if not self._file_obj: self._file_obj = HttpResponse(mimetype='text/csv') ...
null
edc/export/classes/export_as_csv.py
export_as_csv.py
py
898
python
en
code
null
code-starcoder2
83
[ { "api_name": "base_export_model.BaseExportModel", "line_number": 8, "usage_type": "name" }, { "api_name": "django.http.HttpResponse", "line_number": 14, "usage_type": "call" }, { "api_name": "csv.writer", "line_number": 20, "usage_type": "call" } ]
270628241
import pygame import random from sprites import * from settings import * import os vec = pygame.math.Vector2 import time class Game(): def __init__(self): pygame.init() pygame.mixer.init() self.clock = pygame.time.Clock() self.screen = pygame.display.set_mode((WIDTH,HEIGHT)) ...
null
src/main.py
main.py
py
7,797
python
en
code
null
code-starcoder2
83
[ { "api_name": "pygame.math", "line_number": 6, "usage_type": "attribute" }, { "api_name": "pygame.init", "line_number": 13, "usage_type": "call" }, { "api_name": "pygame.mixer.init", "line_number": 14, "usage_type": "call" }, { "api_name": "pygame.mixer", "lin...
342378229
import pygame def blur(img, radius): new = img.copy() size = new.get_size() for x in range(size[0]): for y in range(size[1]): total = [0,0,0] cnt = 0 for kx in range(-radius,radius+1): for ky in range(-radius,radius+1): try: ncol = img.get_at((x + kx, y + ky)) total[0] += ncol[0] ...
null
Python Photo Editing/blur.py
blur.py
py
718
python
en
code
null
code-starcoder2
83
[ { "api_name": "pygame.image.load", "line_number": 27, "usage_type": "call" }, { "api_name": "pygame.image", "line_number": 27, "usage_type": "attribute" }, { "api_name": "pygame.display.set_mode", "line_number": 28, "usage_type": "call" }, { "api_name": "pygame.di...
196624083
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render import redis r = redis.StrictRedis(host='localhost', port=6379, db=0) class Movie(object): def __init__(self, title=None, actors=None): self.title = title self.actors = actors # Create your views...
null
wt4examen/movies/views.py
views.py
py
1,136
python
en
code
null
code-starcoder2
83
[ { "api_name": "redis.StrictRedis", "line_number": 8, "usage_type": "call" }, { "api_name": "django.shortcuts.render", "line_number": 23, "usage_type": "call" }, { "api_name": "django.shortcuts.render", "line_number": 29, "usage_type": "call" }, { "api_name": "djan...
287235485
import csv import io from django.core import serializers from django.core.files.storage import FileSystemStorage from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect from django.contrib import messages from django.views.decorators.csrf import csrf_exempt from .Filters import Sa...
null
classroom_reservation_system/classroom_reservation_app/Admin_views.py
Admin_views.py
py
10,919
python
en
code
null
code-starcoder2
83
[ { "api_name": "models.Batiment.objects.all", "line_number": 14, "usage_type": "call" }, { "api_name": "models.Batiment.objects", "line_number": 14, "usage_type": "attribute" }, { "api_name": "models.Batiment", "line_number": 14, "usage_type": "name" }, { "api_name...
419526551
import logging import os import pickle import socket from functools import partial from multiprocessing import Process from pathlib import Path from time import sleep from pika.exceptions import AMQPConnectionError from tp2_utils.blocking_socket_transferer import BlockingSocketTransferer from tp2_utils.in...
null
business_joiner_service/__main__.py
__main__.py
py
6,052
python
en
code
null
code-starcoder2
83
[ { "api_name": "logging.getLogger", "line_number": 31, "usage_type": "call" }, { "api_name": "tp2_utils.message_pipeline.message_pipeline.message_is_end", "line_number": 35, "usage_type": "call" }, { "api_name": "pathlib.Path", "line_number": 36, "usage_type": "call" }, ...
202174056
from django.conf.urls import patterns, url from beercellar import views urlpatterns = patterns('', #Some important learning notes here... #<var> is passed to view, must have same name as class/method #Must include regex to grab pattern ([a-z]+) url(r'^$', views.index, name='index'), url(r'^login', ...
null
waters/beercellar/urls.py
urls.py
py
407
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.conf.urls.patterns", "line_number": 4, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 8, "usage_type": "call" }, { "api_name": "beercellar.views.index", "line_number": 8, "usage_type": "attribute" }, { "api_name"...
277049099
from flask import Flask, render_template from flask_table import Table, Col from match import matchesMain app = Flask(__name__) class Match(object): def __init__(self, graduateName, teamName): self.graduateName = graduateName self.teamName = teamName # Or, equivalently, some dicts items = [dic...
null
TeamMatcher/flaskTest.py
flaskTest.py
py
1,267
python
en
code
null
code-starcoder2
83
[ { "api_name": "flask.Flask", "line_number": 4, "usage_type": "call" }, { "api_name": "flask_table.Table", "line_number": 15, "usage_type": "name" }, { "api_name": "flask_table.Col", "line_number": 16, "usage_type": "call" }, { "api_name": "flask_table.Col", "l...
322356063
import os import sys sys.path.insert(0, "../lib/") import numpy as np import pandas as pd import scanpy as sc import matplotlib as mpl import matplotlib.pyplot as plt import bbknn import sankey import sc_utils SAMPLES = pd.read_csv("samples.csv") def rename_genes(names): names = names.str.replace("^GRCh38_+",...
null
single_cell_analysis/02preprint/integrate.py
integrate.py
py
4,201
python
en
code
null
code-starcoder2
83
[ { "api_name": "sys.path.insert", "line_number": 3, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 3, "usage_type": "attribute" }, { "api_name": "pandas.read_csv", "line_number": 16, "usage_type": "call" }, { "api_name": "os.path.basename", "l...
113606875
''' paper.data.scripts.delete_files copies files to cold storage and then deletes from main host author | Immanuel Washington Functions --------- delete_check | checks for which files should and can be deleted set_delete_table | updates database with deleted file status delete_files | parses list of files then copie...
null
paper/data/scripts/delete_files.py
delete_files.py
py
3,696
python
en
code
null
code-starcoder2
83
[ { "api_name": "paper.data.dbi.File", "line_number": 38, "usage_type": "attribute" }, { "api_name": "paper.data.dbi", "line_number": 38, "usage_type": "name" }, { "api_name": "os.path.join", "line_number": 40, "usage_type": "call" }, { "api_name": "os.path", "l...
634863736
from inspect import getmembers, signature, _empty, Parameter from typing import Type, Any, Tuple, List, Set, Dict, Mapping, Iterable from parsyfiles.var_checker import check_var def robust_isinstance(inst, typ): """ Similar to isinstance, but if 'typ' is a parametrized generic Type, it is first transformed i...
null
parsyfiles/type_inspection_tools.py
type_inspection_tools.py
py
12,914
python
en
code
null
code-starcoder2
83
[ { "api_name": "typing.Dict", "line_number": 121, "usage_type": "name" }, { "api_name": "typing.List", "line_number": 122, "usage_type": "name" }, { "api_name": "typing.Set", "line_number": 123, "usage_type": "name" }, { "api_name": "typing.Tuple", "line_number...
2267559
import cv2 filename = 'traffic1.avi' cap = cv2.VideoCapture(filename) reference_frame =None #first frame image_area = None while True: ret,frame = cap.read() #print ret = frame = True, last frame =false if ret is False: break else: #getting grayscale/threshold frame if reference_frame is None: reference_fr...
null
vehicleDetection.py
vehicleDetection.py
py
1,197
python
en
code
null
code-starcoder2
83
[ { "api_name": "cv2.VideoCapture", "line_number": 3, "usage_type": "call" }, { "api_name": "cv2.cvtColor", "line_number": 16, "usage_type": "call" }, { "api_name": "cv2.COLOR_BGR2GRAY", "line_number": 16, "usage_type": "attribute" }, { "api_name": "cv2.cvtColor", ...
97510156
import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt # --- Räuber-Beute-Modell mit beschränkter Beutepopulation --- #Paramter a = 2 b = 0.002 c = 2 d = 0.002 k = 20000 def dx1(x1,x2): ret = (a * x1) - ((a/k) * x1**2) - (b * x1 * x2) return ret def dx2(x1,x2): ret = -(c *...
null
src/RB_beschraekt.py
RB_beschraekt.py
py
1,079
python
en
code
null
code-starcoder2
83
[ { "api_name": "numpy.linspace", "line_number": 34, "usage_type": "call" }, { "api_name": "scipy.integrate.odeint", "line_number": 36, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.plot", "line_number": 42, "usage_type": "call" }, { "api_name": "matplotl...
317067464
# collin gros # 05/11/2019 # arg description # "s":scale_factor, "n":min_neighbors, "p":resolution_height, "z":cascade_xml, # "w":warm, "c":cold, "l":low, "m":medium, "b":high, # "v":vanilla_set, "f":hat_set, "e":glasses_set, # "x":profile_pictures, "a":angled_pictures, "o":central_pictures, # "g":shadows, "i":central...
null
main/progs/test.py
test.py
py
6,876
python
en
code
null
code-starcoder2
83
[ { "api_name": "argparse.ArgumentParser", "line_number": 34, "usage_type": "call" }, { "api_name": "cv2.CascadeClassifier", "line_number": 73, "usage_type": "call" }, { "api_name": "cv2.face.LBPHFaceRecognizer_create", "line_number": 76, "usage_type": "call" }, { "...
211598080
from PIL import Image from math import floor import numpy as np import filter.util as util # 快速引导滤波算法,通过上下采样将复杂度降为O(N/s^2) # 使用彩色图像作为Guide进行引导滤波 # 适用于RGB任何通道都无显著边界的情况 class FastCIPGuidedFilter(object): def __init__(self): # -- constant value -- self.__GREY_LEVEL = 256.0 # -- init value ...
null
filter/FastCIPGuidedFilter.py
FastCIPGuidedFilter.py
py
12,268
python
en
code
null
code-starcoder2
83
[ { "api_name": "PIL.Image.open", "line_number": 40, "usage_type": "call" }, { "api_name": "PIL.Image", "line_number": 40, "usage_type": "name" }, { "api_name": "filter.util.list_to_matrix", "line_number": 61, "usage_type": "call" }, { "api_name": "filter.util", ...
80203048
#!/usr/bin/env python """The setup script.""" from setuptools import setup, find_packages from os import getenv with open("README.rst") as readme_file: readme = readme_file.read() with open("stuff/HISTORY.rst") as history_file: history = history_file.read() requirements = [ "esm_master @ git+https://gi...
null
setup.py
setup.py
py
2,182
python
en
code
null
code-starcoder2
83
[ { "api_name": "os.getenv", "line_number": 25, "usage_type": "call" }, { "api_name": "setuptools.setup", "line_number": 27, "usage_type": "call" }, { "api_name": "setuptools.find_packages", "line_number": 49, "usage_type": "call" }, { "api_name": "esm_rcfile.set_rc...
546195495
''' Created on Jun 28, 2017 @author: make ma ''' from AudioSrc import AudioSrc from threading import Thread from MsgHandler import MsgHandler, Message, MsgConst from VoiceCmd import VoiceCmd from OlamiNlp import OlamiNlp #import uartapi import time import json import bluetooth class SpeechProcess(Thread): ''' ...
null
olami/SpeechProcess.py
SpeechProcess.py
py
4,565
python
en
code
null
code-starcoder2
83
[ { "api_name": "threading.Thread", "line_number": 16, "usage_type": "name" }, { "api_name": "threading.Thread.__init__", "line_number": 22, "usage_type": "call" }, { "api_name": "threading.Thread", "line_number": 22, "usage_type": "name" }, { "api_name": "AudioSrc....
179941774
from math import sqrt, ceil import numpy from shapely import geometry from shapely import ops from rtree import index import O4_UI_Utils as UI max_pols_for_merge=20 ############################################################################## class Vector_Map(): nodata=-32768 dico_attributes = {'DUMMY':...
null
src/O4_Vector_Utils.py
O4_Vector_Utils.py
py
31,121
python
en
code
null
code-starcoder2
83
[ { "api_name": "rtree.index.Index", "line_number": 20, "usage_type": "call" }, { "api_name": "rtree.index", "line_number": 20, "usage_type": "name" }, { "api_name": "numpy.array", "line_number": 91, "usage_type": "call" }, { "api_name": "numpy.array", "line_num...
489055366
from ipaddress import ip_address, ip_network import unittest import logging import sys import random from ipv6gen import IPv6Gen lazy = False class IPv6Tests(unittest.TestCase): def setUp(self): self.log = logging.getLogger() self.log.setLevel(logging.DEBUG) self.stream_handler = logging...
null
misc/ipv6/ipv6gen_test.py
ipv6gen_test.py
py
3,824
python
en
code
null
code-starcoder2
83
[ { "api_name": "unittest.TestCase", "line_number": 11, "usage_type": "attribute" }, { "api_name": "logging.getLogger", "line_number": 14, "usage_type": "call" }, { "api_name": "logging.DEBUG", "line_number": 15, "usage_type": "attribute" }, { "api_name": "logging.S...
80314077
#!/usr/bin/env python # -*- coding: utf-8 -*- # # sprint2.py # # Copyright 2020 Yan <yan@yan-Inspiron-5558> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the Lic...
null
sprint2.py
sprint2.py
py
2,099
python
en
code
null
code-starcoder2
83
[ { "api_name": "csv.writer", "line_number": 39, "usage_type": "call" }, { "api_name": "requests.post", "line_number": 49, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 54, "usage_type": "call" } ]
609103439
""" ################################data_helper.py################################ 程序名称: data_helper.py 功能描述: 数据处理 创建人名: wuxinhui 创建日期: 2019-07-31 版本说明: v1.0 ################################data_helper.py################################ """ import os import tqdm import json import pickle import ran...
null
utils/data_helper.py
data_helper.py
py
2,550
python
en
code
null
code-starcoder2
83
[ { "api_name": "json.load", "line_number": 30, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 45, "usage_type": "call" }, { "api_name": "pickle.dump", "line_number": 68, "usage_type": "call" }, { "api_name": "sklearn.model_selection.train_test_...
305422269
import json import json import optparse import os import cv2 import numpy as np from skimage.io import imread from skimage.transform import resize from helpers.helpers import mkdir_p from metric_learning.main import face_align from metric_learning.resnet34 import Resnet34 from validators.matio import save_mat def m...
null
validators/megaface.py
megaface.py
py
3,264
python
en
code
null
code-starcoder2
83
[ { "api_name": "metric_learning.resnet34.Resnet34", "line_number": 18, "usage_type": "call" }, { "api_name": "json.load", "line_number": 22, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 26, "usage_type": "call" }, { "api_name": "os.path", ...
222731472
import itertools import shutil import os import numpy as np import pytest from big_pivot import big_pivot INPUT_PATTERN = 'test_data/input/ts_{}' OUTPUT_PATTERN = 'test_data/output/grid_{}_{}' TEST_BUFFER_LENGTH = 10 grid_x, grid_y, time_steps = 5, 5, 50 @pytest.fixture def test_data(): # clean out the dire...
null
big_pivot/test_big_pivot.py
test_big_pivot.py
py
1,430
python
en
code
null
code-starcoder2
83
[ { "api_name": "os.path.exists", "line_number": 22, "usage_type": "call" }, { "api_name": "os.path", "line_number": 22, "usage_type": "attribute" }, { "api_name": "shutil.rmtree", "line_number": 23, "usage_type": "call" }, { "api_name": "os.mkdir", "line_number...
615263664
from flask import Flask, Session, render_template, request, redirect, jsonify, url_for, flash, send_from_directory #from flask.ext.session import Session #from sqlalchemy import create_engine, asc #from sqlalchemy.orm import sessionmaker from flask_sqlalchemy import SQLAlchemy from database_setup import Category, Categ...
null
udacity-catalog-app-master/server.py
server.py
py
14,764
python
en
code
null
code-starcoder2
83
[ { "api_name": "flask.Flask", "line_number": 19, "usage_type": "call" }, { "api_name": "flask.Session", "line_number": 21, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 23, "usage_type": "call" }, { "api_name": "flask_sqlalchemy.SQLAlchemy", ...
293529083
''' Implementation based off of stack overflow post https://stackoverflow.com/questions/27416296/how-to-push-a-csv-data-to-mongodb-using-python/53431264 ''' import csv import json import sys, getopt, pprint from datetime import datetime from pymongo import MongoClient csvfile = open('freeway_stations.csv', 'rU') csv...
null
insertStations.py
insertStations.py
py
4,846
python
en
code
null
code-starcoder2
83
[ { "api_name": "csv.DictReader", "line_number": 15, "usage_type": "call" }, { "api_name": "csv.DictReader", "line_number": 16, "usage_type": "call" }, { "api_name": "pymongo.MongoClient", "line_number": 17, "usage_type": "call" }, { "api_name": "datetime.datetime.s...
341005535
import tensorflow as tf import tensorflow_addons as tfa @tf.function def Yolo_head(feats, anchors, num_classes, input_shape, calc_loss=False): """Create the spatial grid and adjust the prediction to their respective cell""" num_anchors = len(anchors) # Reshape to batch, height, width, num_anchors, box_par...
null
Archive/yolo.py
yolo.py
py
6,503
python
en
code
null
code-starcoder2
83
[ { "api_name": "tensorflow.reshape", "line_number": 10, "usage_type": "call" }, { "api_name": "tensorflow.constant", "line_number": 10, "usage_type": "call" }, { "api_name": "tensorflow.shape", "line_number": 12, "usage_type": "call" }, { "api_name": "tensorflow.ra...
619123335
# Run 1st # Converts the dates of the file to their numerical equivalent and puts the data table back into a csv. # Assumes no NaN entries import pandas as pd import datetime from datetime import datetime def convert_date_to_number(date): d2 = datetime.strptime(date, "%Y-%m-%d") d1 = datetime.st...
null
ConvertDates.py
ConvertDates.py
py
958
python
en
code
null
code-starcoder2
83
[ { "api_name": "datetime.datetime.strptime", "line_number": 12, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 12, "usage_type": "name" }, { "api_name": "datetime.datetime.strptime", "line_number": 13, "usage_type": "call" }, { "api_name"...
487455495
"""Unit test for Configuration logic.""" import asyncio import unittest from xknx import XKNX from xknx.devices import (Action, BinarySensor, Climate, Cover, Light, Notification, Sensor, Switch, Time) # pylint: disable=too-many-public-methods,invalid-name class TestConfig(unittest.TestCase)...
null
test/config_test.py
config_test.py
py
11,339
python
en
code
null
code-starcoder2
83
[ { "api_name": "unittest.TestCase", "line_number": 11, "usage_type": "attribute" }, { "api_name": "asyncio.new_event_loop", "line_number": 16, "usage_type": "call" }, { "api_name": "asyncio.set_event_loop", "line_number": 17, "usage_type": "call" }, { "api_name": "...
6970915
#!/usr/bin/env python3 # Copyright (c) 2023 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
null
csit.infra.etl/stats.py
stats.py
py
4,203
python
en
code
null
code-starcoder2
83
[ { "api_name": "pytz.utc.localize", "line_number": 36, "usage_type": "call" }, { "api_name": "pytz.utc", "line_number": 36, "usage_type": "name" }, { "api_name": "datetime.datetime.strptime", "line_number": 37, "usage_type": "call" }, { "api_name": "datetime.dateti...
360210788
from datetime import datetime import json import os import http.client from passlib.context import CryptContext from myapp import models from django.core import serializers from django.core.exceptions import ValidationError, ObjectDoesNotExist from django.db import connection from django.db.utils import IntegrityErro...
null
myapp/view/equipo.py
equipo.py
py
11,670
python
en
code
null
code-starcoder2
83
[ { "api_name": "myapp.view.utilidades.usuarioAutenticado", "line_number": 54, "usage_type": "call" }, { "api_name": "django.db.connection.cursor", "line_number": 66, "usage_type": "call" }, { "api_name": "django.db.connection", "line_number": 66, "usage_type": "name" }, ...
283486238
import os import tvm import nnvm import numpy as np from nnvm import testing from tvm import autotvm from tvm.contrib.util import tempdir from tvm.autotvm.tuner import XGBTuner, GATuner, RandomTuner, GridSearchTuner import tvm.contrib.graph_runtime as runtime from build import get_network from utils import save_tvm_g...
null
tuner_deprecated.py
tuner_deprecated.py
py
5,813
python
en
code
null
code-starcoder2
83
[ { "api_name": "build.get_network", "line_number": 20, "usage_type": "call" }, { "api_name": "tvm.autotvm.task.extract_from_program", "line_number": 61, "usage_type": "call" }, { "api_name": "tvm.autotvm.task", "line_number": 61, "usage_type": "attribute" }, { "api...
250720827
import xmltodict def processXML(fileName): with open(fileName) as myXMLFile: fileContentString = myXMLFile.read() xmlDictionary = xmltodict.parse(fileContentString) return xmlDictionary productDict = processXML('bestand.xml') products = productDict['artikelen']['artikel'] print('Naam | ...
null
Les 08/PE 8_1.py
PE 8_1.py
py
440
python
en
code
null
code-starcoder2
83
[ { "api_name": "xmltodict.parse", "line_number": 7, "usage_type": "call" } ]
167665149
from flask import jsonify from microsetta_private_api.api._account import \ _validate_account_access from microsetta_private_api.repo.transaction import Transaction from microsetta_private_api.repo.survey_template_repo import SurveyTemplateRepo from microsetta_private_api.repo.vioscreen_repo import ( VioscreenS...
null
microsetta_private_api/api/_vioscreen.py
_vioscreen.py
py
7,570
python
en
code
null
code-starcoder2
83
[ { "api_name": "microsetta_private_api.repo.transaction.Transaction", "line_number": 15, "usage_type": "call" }, { "api_name": "microsetta_private_api.repo.survey_template_repo.SurveyTemplateRepo", "line_number": 16, "usage_type": "call" }, { "api_name": "microsetta_private_api.re...
158736365
import json import subprocess import sys def shell(cmd): sp = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = sp.communicate() return out, err def node_list_to_dict(nodes): nodes_dict = {} for node in nodes: if node["Provisioning State"] not in ...
null
ironic/init_script/port_group_check.py
port_group_check.py
py
4,325
python
en
code
null
code-starcoder2
83
[ { "api_name": "subprocess.Popen", "line_number": 6, "usage_type": "call" }, { "api_name": "subprocess.PIPE", "line_number": 6, "usage_type": "attribute" }, { "api_name": "json.loads", "line_number": 24, "usage_type": "call" }, { "api_name": "json.loads", "line...
380383752
# coding=utf-8 import json import threading from autobahn.twisted.websocket import WebSocketClientFactory, \ WebSocketClientProtocol, \ connectWS from twisted.internet import reactor, ssl from twisted.internet.protocol import ReconnectingClientFactory from twisted.internet.error import ReactorAlreadyRunning ...
null
binance/futures_websockets.py
futures_websockets.py
py
7,648
python
en
code
null
code-starcoder2
83
[ { "api_name": "autobahn.twisted.websocket.WebSocketClientProtocol", "line_number": 16, "usage_type": "name" }, { "api_name": "autobahn.twisted.websocket.WebSocketClientProtocol", "line_number": 19, "usage_type": "argument" }, { "api_name": "json.loads", "line_number": 28, ...
473766351
#!/usr/bin/env python # -*- coding: utf-8 -*- from six import with_metaclass from scrapy.item import Field, Item, ItemMeta from sqlalchemy.ext.declarative.api import DeclarativeMeta from sqlalchemy.sql.schema import Table class SqlalchemyItemMeta(ItemMeta): def __new__(mcs, class_name, bases, attrs): ...
null
Labs-solutions/Lab7/Lab7.3/imdb/venv/lib/python3.7/site-packages/scrapy_sqlalchemyitem/__init__.py
__init__.py
py
1,169
python
en
code
null
code-starcoder2
83
[ { "api_name": "scrapy.item.ItemMeta", "line_number": 9, "usage_type": "name" }, { "api_name": "sqlalchemy.ext.declarative.api.DeclarativeMeta", "line_number": 15, "usage_type": "argument" }, { "api_name": "sqlalchemy.sql.schema.Table", "line_number": 17, "usage_type": "ar...
561146878
#!/usr/bin/python import argparse import re parser = argparse.ArgumentParser(description='Count initiators in "symaccess list login" output.') parser.add_argument('-f','--file', help='Filename containing symaccess list login output.', required=True) args = vars(parser.parse_args()) logins = open(args['file'...
null
count_symaccess_inits.py
count_symaccess_inits.py
py
1,496
python
en
code
null
code-starcoder2
83
[ { "api_name": "argparse.ArgumentParser", "line_number": 6, "usage_type": "call" }, { "api_name": "re.match", "line_number": 16, "usage_type": "call" } ]
20362670
from pyspark.sql import SparkSession from pyspark.sql import functions as F import pandas as pd from pyspark.sql.functions import desc spark = SparkSession \ .builder \ .appName("Python NBA Salaries") \ .getOrCreate() df = spark.read.csv("NBACleanData/StatsClean.csv", header=True) df.createOrReplaceTempV...
null
NBAdata/PositionPoints.py
PositionPoints.py
py
625
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": "...
115602385
# -*- coding: utf-8 -*- """ Created on Fri Mar 15 13:21:14 2019 @author: William """ from sigmoid import sigmoid import matplotlib.pyplot as plt import numpy as np x = np.linspace(-6,6,1000) y = np.array([sigmoid(i) for i in x]) plt.figure() plt.plot(x, y) plt.vlines(0, 0, 1.05) plt.hlines(0, min(x), max(x)) plt.xli...
null
sigmoid graph.py
sigmoid graph.py
py
590
python
en
code
null
code-starcoder2
83
[ { "api_name": "numpy.linspace", "line_number": 11, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 12, "usage_type": "call" }, { "api_name": "sigmoid.sigmoid", "line_number": 12, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.figure",...
312912804
# -*- coding: utf-8 -*- """ Created on Sat Feb 1 10:45:09 2020 @author: tjtur """ from datetime import datetime num = 26.7 now = datetime.utcnow() day_of_year = datetime(now.year,now.month,now.day).timetuple().tm_yday days_left = 366 - day_of_year miles_left = 1000 - num miles_per_day = miles_left...
null
bike_miles.py
bike_miles.py
py
354
python
en
code
null
code-starcoder2
83
[ { "api_name": "datetime.datetime.utcnow", "line_number": 12, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 12, "usage_type": "name" }, { "api_name": "datetime.datetime", "line_number": 13, "usage_type": "call" } ]
603622986
from tensorflow import keras from keras import models from keras import layers from keras import optimizers, losses, metrics from keras import preprocessing import numpy as np import pandas as pd import matplotlib.pyplot as plt import pickle import os import re from konlpy.tag import Okt # ( Seq2Seq의 동작을 제어하는 태그들 PA...
null
Ztest/ttt.py
ttt.py
py
7,853
python
en
code
null
code-starcoder2
83
[ { "api_name": "re.compile", "line_number": 46, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 49, "usage_type": "call" }, { "api_name": "konlpy.tag.Okt", "line_number": 56, "usage_type": "call" }, { "api_name": "re.sub", "line_number":...
202701602
import re import django from django.utils.text import wrap from django.utils.translation import ugettext, ugettext_lazy as _ from django.template.loader import render_to_string from django.conf import settings from django.core.mail import send_mail def format_quote(sender, body): lines = wrap(body, 55).split('\n...
null
django_messages/utils.py
utils.py
py
2,499
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.utils.text.wrap", "line_number": 12, "usage_type": "call" }, { "api_name": "django.utils.translation.ugettext", "line_number": 16, "usage_type": "call" }, { "api_name": "re.match", "line_number": 24, "usage_type": "call" }, { "api_name": "re....
487245183
from django.urls import path from teachapp import views app_name = 'teachapp' urlpatterns = [ path('admin_teach/', views.getdata_teach, name='admin_teach'), path('add_teach/', views.add_teach, name='add_teach'), path('addlogic_teach/', views.addlogic_teach, name='addlogic_teach'), path('alter_teach/',...
null
teachingmanagement/teachapp/urls.py
urls.py
py
655
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.urls.path", "line_number": 7, "usage_type": "call" }, { "api_name": "teachapp.views.getdata_teach", "line_number": 7, "usage_type": "attribute" }, { "api_name": "teachapp.views", "line_number": 7, "usage_type": "name" }, { "api_name": "django...
184942297
import create_graphs import utils import networkx as nx import tensorflow as tf import numpy as np from copy import deepcopy class Dataset(object): def __init__(self, file_path, is_real=True, batch_size=None): assert batch_size is not None self.graph_list = utils.load_graph_list(file_path, is_real...
null
research/graph_gen/get_data.py
get_data.py
py
2,662
python
en
code
null
code-starcoder2
83
[ { "api_name": "utils.load_graph_list", "line_number": 12, "usage_type": "call" }, { "api_name": "copy.deepcopy", "line_number": 15, "usage_type": "call" }, { "api_name": "numpy.random.permutation", "line_number": 21, "usage_type": "call" }, { "api_name": "numpy.ra...
525559945
# coding: utf-8 import contextlib import functools from subprocess import Popen, PIPE, check_output from time import time def error_message_factory(subcommand): return functools.partial(error_with_message, subcommand) def error_with_message(subcommand, reason, slack=None): """Raises a :py:exc:`RuntimeErro...
null
hammers/util.py
util.py
py
1,290
python
en
code
null
code-starcoder2
83
[ { "api_name": "functools.partial", "line_number": 11, "usage_type": "call" }, { "api_name": "contextlib.contextmanager", "line_number": 33, "usage_type": "attribute" } ]
415851537
# uncompyle6 version 3.7.4 # Python bytecode 3.7 (3394) # Decompiled from: Python 3.6.9 (default, Apr 18 2020, 01:56:04) # [GCC 8.4.0] # Embedded file name: build\bdist.win-amd64\egg\aiohttp_init\command.py # Compiled at: 2019-10-11 05:22:07 # Size of source mod 2**32: 621 bytes """ @File : command.py @Time : ...
null
pycfiles/aiohttp_init-0.0.1-py3.7/command.cpython-37.py
command.cpython-37.py
py
785
python
en
code
null
code-starcoder2
83
[ { "api_name": "argparse.ArgumentParser", "line_number": 17, "usage_type": "call" }, { "api_name": "core.initialize.Initialize", "line_number": 25, "usage_type": "call" } ]
641810487
from dataclasses import dataclass import random from four_in_a_row_online.data import cards from four_in_a_row_online.tools.tools import flatten class DataContainer: """Super class for all objects that can be initialized randomly or have a default. Basically just a tool to make testing a bit easier, since obj...
null
four_in_a_row_online/game_logic/data.py
data.py
py
14,252
python
en
code
null
code-starcoder2
83
[ { "api_name": "four_in_a_row_online.data.cards.ShuffleTurnOrder", "line_number": 51, "usage_type": "attribute" }, { "api_name": "four_in_a_row_online.data.cards", "line_number": 51, "usage_type": "name" }, { "api_name": "four_in_a_row_online.data.cards.ReverseTurnOrder", "lin...
404107776
from flask import Flask, render_template, url_for, flash, redirect, request, session, json, current_app from flaskWeb.forms import RegistrationForm, LoginForm from flaskWeb.models import User, Post from flaskWeb import app, db, bcrypt from flask_login import login_user, current_user, logout_user, login_required impor...
null
flaskWeb/routes.py
routes.py
py
10,478
python
en
code
null
code-starcoder2
83
[ { "api_name": "flask.render_template", "line_number": 54, "usage_type": "call" }, { "api_name": "flaskWeb.app.route", "line_number": 51, "usage_type": "call" }, { "api_name": "flaskWeb.app", "line_number": 51, "usage_type": "name" }, { "api_name": "flaskWeb.app.ro...
469267652
import hashlib import time import random import string from urllib.parse import quote import requests def curlmd5(src): m = hashlib.md5(src.encode('UTF-8')) # 将得到的MD5值所有字符转换成大写 return m.hexdigest().upper() def get_params(plus_item): global params # 请求时间戳(秒级),用于防止请求重放(保证签名5分钟有效)   t = time.t...
null
dahewang/ploar/ploar.py
ploar.py
py
1,858
python
en
code
null
code-starcoder2
83
[ { "api_name": "hashlib.md5", "line_number": 11, "usage_type": "call" }, { "api_name": "time.time", "line_number": 19, "usage_type": "call" }, { "api_name": "random.sample", "line_number": 23, "usage_type": "call" }, { "api_name": "string.ascii_letters", "line_...
322299857
__author__ = 'Maosen' import torch import torch.nn as nn import torch.nn.functional as F import utils from utils import pos2id, ner2id import sys from tqdm import tqdm class PCNN(nn.Module): def __init__(self, args, rel2id, word_emb=None): super(PCNN, self).__init__() # arguments hidden, vocab_size, emb_dim, po...
null
dual_sent/Neural/models/pcnn.py
pcnn.py
py
5,154
python
en
code
null
code-starcoder2
83
[ { "api_name": "torch.nn.Module", "line_number": 10, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 10, "usage_type": "name" }, { "api_name": "torch.nn.Embedding", "line_number": 23, "usage_type": "call" }, { "api_name": "torch.nn", "line...
306184107
# -*- coding: utf-8 -*- """ Created on Thu Feb 16 14:42:16 2017 @author: insane """ import pickle import csv import numpy as np from sklearn.metrics import accuracy_score from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier exampleFile = open(r'./train.csv') exampleReader = csv.reader(exampleFile)...
null
Original/classifier.py
classifier.py
py
1,288
python
en
code
null
code-starcoder2
83
[ { "api_name": "csv.reader", "line_number": 13, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 15, "usage_type": "call" }, { "api_name": "numpy.float32", "line_number": 16, "usage_type": "call" }, { "api_name": "csv.reader", "line_number": ...
92563288
# ********************************************************************** # Copyright 2020 Advanced Micro Devices, Inc # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.o...
null
tools/build.py
build.py
py
5,361
python
en
code
null
code-starcoder2
83
[ { "api_name": "platform.system", "line_number": 24, "usage_type": "call" }, { "api_name": "pathlib.Path", "line_number": 25, "usage_type": "call" }, { "api_name": "pathlib.Path", "line_number": 28, "usage_type": "name" }, { "api_name": "shutil.rmtree", "line_n...
120047766
#!/usr/bin/env python # coding=utf-8 # Author: bloke from multiprocessing import Process, Queue import os import time def the_get(q): print('Size:', q.qsize()) print(q.get()) def run(q): q.put('Current pid: %s' % os.getpid()) if __name__ == '__main__': q = Queue() plist = [] pplist = [] ...
null
my_test/多进程/进程队列.py
进程队列.py
py
675
python
en
code
null
code-starcoder2
83
[ { "api_name": "os.getpid", "line_number": 14, "usage_type": "call" }, { "api_name": "multiprocessing.Queue", "line_number": 17, "usage_type": "call" }, { "api_name": "multiprocessing.Process", "line_number": 21, "usage_type": "call" }, { "api_name": "time.sleep", ...
479470041
import numpy as np import pdb def breakpoint(X): print('\n------------------------trace---------------------------\n') print(X) print('\n------------------------trace---------------------------\n') pdb.set_trace() def randInitializeWeights(L_in,L_out): # add bias weight epsilon = 0.12 W = np.zeros((L_out,L_in+...
null
nn_API.py
nn_API.py
py
4,783
python
en
code
null
code-starcoder2
83
[ { "api_name": "pdb.set_trace", "line_number": 8, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 13, "usage_type": "call" }, { "api_name": "numpy.random.rand", "line_number": 14, "usage_type": "call" }, { "api_name": "numpy.random", "line_n...
304147115
from django.urls import path, re_path from Api import views urlpatterns_User = [ # 登录注册 path('login/', views.Login.as_view(), name='login'), path('register/', views.Register.as_view(), name='register'), # 用户 path('user/', views.UserOwn.as_view(), name='userown'), re_path(r'^user/(?...
null
backend/apps/Api/urls/UserUrls.py
UserUrls.py
py
678
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.urls.path", "line_number": 6, "usage_type": "call" }, { "api_name": "Api.views.Login.as_view", "line_number": 6, "usage_type": "call" }, { "api_name": "Api.views.Login", "line_number": 6, "usage_type": "attribute" }, { "api_name": "Api.views"...
223961107
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('budget', '0001_initial'), ] operations = [ migrations.AlterField( model_name='otherbudgetitemcost', ...
null
application/budget/migrations/0002_auto_20150925_0211.py
0002_auto_20150925_0211.py
py
603
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.AlterField", "line_number": 14, "usage_type": "call" }, {...
110646715
from selenium.webdriver import Firefox from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.firefox.options import Options from selenium.webdriver.support import expected_conditions as expected from selenium.webdriver.support.wait import WebDriverWait ...
null
scrap.py
scrap.py
py
3,580
python
en
code
null
code-starcoder2
83
[ { "api_name": "selenium.webdriver.support.wait.WebDriverWait", "line_number": 39, "usage_type": "call" }, { "api_name": "time.sleep", "line_number": 40, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 45, "usage_type": "call" }, { "api_na...
207804318
from flask import request from flask_accepts import responds from flask_restx import Namespace, Resource from app.schemes.product_schema import GetProductSchema from repositories import product_repository ns = Namespace('product', description='Product') @ns.route('/list') class ProductGetItemListResource(Resource):...
null
app/api/product_api.py
product_api.py
py
984
python
en
code
null
code-starcoder2
83
[ { "api_name": "flask_restx.Namespace", "line_number": 8, "usage_type": "call" }, { "api_name": "flask_restx.Resource", "line_number": 12, "usage_type": "name" }, { "api_name": "flask.request.args.get", "line_number": 15, "usage_type": "call" }, { "api_name": "flas...
109572988
from implicit.approximate_als import NMSLibAlternatingLeastSquares, augment_inner_product_matrix from implicit.als import AlternatingLeastSquares from implicit.bpr import BayesianPersonalizedRanking from implicit.evaluation import precision_at_k, AUC_at_k import numpy as np from scipy import sparse from ray import tun...
null
python/implicit_library_evaluation.py
implicit_library_evaluation.py
py
4,903
python
en
code
null
code-starcoder2
83
[ { "api_name": "scipy.sparse.load_npz", "line_number": 14, "usage_type": "call" }, { "api_name": "scipy.sparse", "line_number": 14, "usage_type": "name" }, { "api_name": "scipy.sparse.load_npz", "line_number": 15, "usage_type": "call" }, { "api_name": "scipy.sparse...
87114825
import os import cv2 import sys import glob import random import numpy as np file_dir=sys.argv[1] grid_len=int(sys.argv[2]) grid_num_row=8 grid_num_col=6 margin = 5 tabel_len_width=grid_num_col*grid_len*2 tabel_len_height=grid_num_row*grid_len file_paths=glob.glob(file_dir+"/*_reality.jpg") random.shuffle(file_paths...
null
GANs_Advanced/CartoonGAN/tools/getImageTable_compare.py
getImageTable_compare.py
py
1,420
python
en
code
null
code-starcoder2
83
[ { "api_name": "sys.argv", "line_number": 8, "usage_type": "attribute" }, { "api_name": "sys.argv", "line_number": 9, "usage_type": "attribute" }, { "api_name": "glob.glob", "line_number": 17, "usage_type": "call" }, { "api_name": "random.shuffle", "line_number...
139191351
import numpy as np import pandas as pd from keras.utils import to_categorical from keras.models import Sequential from keras.layers import Dense, Conv2D, Flatten def cnn(X_train, X_test, y_train, y_test,nbClust): #Transform the training and testing set for the CNN X_train = X_train.reshape(len(X_train), 28...
null
characterRecognition/CNN/CNN.py
CNN.py
py
2,322
python
en
code
null
code-starcoder2
83
[ { "api_name": "keras.utils.to_categorical", "line_number": 16, "usage_type": "call" }, { "api_name": "keras.utils.to_categorical", "line_number": 17, "usage_type": "call" }, { "api_name": "keras.models.Sequential", "line_number": 20, "usage_type": "call" }, { "api...
486758353
# Copyright 2015 Metaswitch Networks # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
null
calico_containers/tests/st/test_arg_parsing.py
test_arg_parsing.py
py
2,954
python
en
code
null
code-starcoder2
83
[ { "api_name": "test_base.TestBase", "line_number": 21, "usage_type": "name" }, { "api_name": "tests.st.utils.docker_host.DockerHost", "line_number": 27, "usage_type": "call" }, { "api_name": "subprocess.CalledProcessError", "line_number": 40, "usage_type": "argument" },...
338354364
import uproot import plotly.graph_objects as go import matplotlib.cm import matplotlib._color_data as mcd import numpy as np import pandas as pd import math import random random.seed(0) colors_ = list(mcd.XKCD_COLORS.values()) random.shuffle(colors_) class HitsAndTracksPlotter(object): def __init__(self): ...
null
HitsAndTracksPlotter.py
HitsAndTracksPlotter.py
py
22,214
python
en
code
null
code-starcoder2
83
[ { "api_name": "random.seed", "line_number": 9, "usage_type": "call" }, { "api_name": "matplotlib._color_data.XKCD_COLORS.values", "line_number": 10, "usage_type": "call" }, { "api_name": "matplotlib._color_data.XKCD_COLORS", "line_number": 10, "usage_type": "attribute" ...
352893902
import matplotlib.pyplot as plt def dd(start,end,y,x): if start != end: return (dd(start,end-1,y,x)-dd(start+1,end,y,x))/(x[0][start]-x[0][end]) else: return y[0][start] x=list() y=list() out=list() inp=list() t=0 with open("C:/Users/User/Downloads/kagglecat...
null
newton's_interpolation.py
newton's_interpolation.py
py
1,159
python
en
code
null
code-starcoder2
83
[ { "api_name": "matplotlib.pyplot.plot", "line_number": 54, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 54, "usage_type": "name" } ]
209427464
import base64 import json import time def encode_dict(obj: dict) -> str: """Encode a dictionary to a base64 encoded json string.""" dumps = json.dumps(obj, separators=(',', ':')) return base64.b64encode(dumps.encode()).decode() def decode_dict(obj: str) -> dict: """Decode a base64 encoded json strin...
null
ev3dev/testfs/_util.py
_util.py
py
1,250
python
en
code
null
code-starcoder2
83
[ { "api_name": "json.dumps", "line_number": 8, "usage_type": "call" }, { "api_name": "base64.b64encode", "line_number": 9, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 14, "usage_type": "call" }, { "api_name": "base64.b64decode", "line_num...
424235854
from django.conf import settings import json import requests SPECIAL_CASES = {'75000': 'Paris'} def get_geo(zipcode): searched_code = zipcode if zipcode in SPECIAL_CASES: searched_code = SPECIAL_CASES[zipcode] url = "http://maps.google.com/maps/geo?q=%s,+France&output=json&sensor=false&key=%s" % ...
null
geo.py
geo.py
py
1,060
python
en
code
null
code-starcoder2
83
[ { "api_name": "django.conf.settings.GOOGLE_MAPS_KEY", "line_number": 12, "usage_type": "attribute" }, { "api_name": "django.conf.settings", "line_number": 12, "usage_type": "name" }, { "api_name": "requests.get", "line_number": 28, "usage_type": "call" }, { "api_n...
428333813
from random import random from compas.geometry import Pointcloud from compas_plotters import Plotter from compas.utilities import i_to_green from compas.utilities import i_to_red # construct a point cloud within a given box and by the number of the points in it cloud = Pointcloud.from_bounds(10, 5, 0, 20) # create a ...
null
code/02_geometry/examples/ex4_pointcloud_plotting.py
ex4_pointcloud_plotting.py
py
955
python
en
code
null
code-starcoder2
83
[ { "api_name": "compas.geometry.Pointcloud.from_bounds", "line_number": 8, "usage_type": "call" }, { "api_name": "compas.geometry.Pointcloud", "line_number": 8, "usage_type": "name" }, { "api_name": "random.random", "line_number": 14, "usage_type": "call" }, { "api...
109604256
import json import os import sys import requests from lib.utils import log def sync_user(): url='https://lostandfound.yiwangchunyu.wang/service/user/getById' for i in range(10,700): r = requests.post(url,data={'id':i,'user_id':10152150127}).json() data=r['data'] payload = { ...
null
sync/snyc_from_v1.py
snyc_from_v1.py
py
3,176
python
en
code
null
code-starcoder2
83
[ { "api_name": "requests.post", "line_number": 14, "usage_type": "call" }, { "api_name": "requests.post", "line_number": 28, "usage_type": "call" }, { "api_name": "requests.post", "line_number": 32, "usage_type": "call" }, { "api_name": "requests.post", "line_n...
610880734
import time from selenium import webdriver # 1.定义工具类 class DriverUtils: # 私有变量,用来存储浏览器驱动对象 __driver = None __openkey = False # 2.1定义获取浏览器驱动对象的方法 # a、实现基本获取浏览器驱动的方法 # b、为了方便其它地方调用,不想每次都实例化,则将方法定义为类级别的方法 # c、为了保障整个测试用例执行过程中所操作的浏览器对象的唯一性,添加判断条件 # 容易出错的地方 # 1.在if中的代码不要写成cls.driver ...
null
webAutoTestTPshop/utils.py
utils.py
py
1,432
python
en
code
null
code-starcoder2
83
[ { "api_name": "selenium.webdriver.Chrome", "line_number": 25, "usage_type": "call" }, { "api_name": "selenium.webdriver", "line_number": 25, "usage_type": "name" }, { "api_name": "time.sleep", "line_number": 34, "usage_type": "call" } ]
479198825
from PyQt5 import QtWidgets from MusicalIllusion.Interfaces.ExperimentSetup import ExperimentSetup from MusicalIllusion.Interfaces.SIExperimentPanel import SIExperimentPanel from MusicalIllusion.Interfaces.TOJExperimentPanel import TOJExperimentPanel class ExperimentBase(QtWidgets.QWidget): def __init__(self): ...
null
src/python3/MusicalIllusion/Experiments/ExperimentBase.py
ExperimentBase.py
py
734
python
en
code
null
code-starcoder2
83
[ { "api_name": "PyQt5.QtWidgets.QWidget", "line_number": 7, "usage_type": "attribute" }, { "api_name": "PyQt5.QtWidgets", "line_number": 7, "usage_type": "name" }, { "api_name": "PyQt5.QtWidgets.QWidget", "line_number": 9, "usage_type": "attribute" }, { "api_name":...
487085030
from torch.nn import Module from torch.functional import F import numpy as np import torch import gym from gym.spaces import Box, Discrete, MultiDiscrete, MultiBinary, Tuple, Dict def onehotdim(space: gym.Space) -> int: if isinstance(space, Box): return int(np.prod(space.shape)) elif isinstance(space,...
null
pyrl/pyrl/transforms/one_hot_transform.py
one_hot_transform.py
py
3,940
python
en
code
null
code-starcoder2
83
[ { "api_name": "gym.Space", "line_number": 9, "usage_type": "attribute" }, { "api_name": "gym.spaces.Box", "line_number": 10, "usage_type": "argument" }, { "api_name": "numpy.prod", "line_number": 11, "usage_type": "call" }, { "api_name": "gym.spaces.Discrete", ...
334448199
from model import Context_Encoder, Adversarial_Discriminator import torch import torch.nn as nn import torch.nn.functional as F from timeit import default_timer import numpy as np from utils import train_loader import os def train(input_path, save_path, hole_size=64, batch_size=32, lr_g=0.001, lr_d=0.0001...
null
Context_encoder/train.py
train.py
py
5,417
python
en
code
null
code-starcoder2
83
[ { "api_name": "model.Context_Encoder", "line_number": 16, "usage_type": "call" }, { "api_name": "model.Adversarial_Discriminator", "line_number": 17, "usage_type": "call" }, { "api_name": "utils.train_loader", "line_number": 18, "usage_type": "call" }, { "api_name...
364449193
import json import copy # Opening JSON file # with open('db.json') as json_file: # data = json.load(json_file) # # Print the type of data variable # print("Type:", type(data)) data = {} a = { "id": 0, "description": "1th Waltz by Mike Paer.", "image": "https://i.ibb.co/7YGYgpb/waltz.jpg...
null
test.py
test.py
py
1,972
python
en
code
null
code-starcoder2
83
[ { "api_name": "copy.deepcopy", "line_number": 22, "usage_type": "call" }, { "api_name": "json.dump", "line_number": 37, "usage_type": "call" } ]
120691904
#交叉驗證 #套件 import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.svm import SVC from sklearn.metrics import confusion_matrix from sklearn.model_selection import cross_val_score from sklearn.model_selection import GridSear...
null
模型選擇/交叉驗證.py
交叉驗證.py
py
1,614
python
en
code
null
code-starcoder2
83
[ { "api_name": "pandas.read_csv", "line_number": 13, "usage_type": "call" }, { "api_name": "sklearn.model_selection.train_test_split", "line_number": 18, "usage_type": "call" }, { "api_name": "sklearn.preprocessing.StandardScaler", "line_number": 22, "usage_type": "call" ...
275867716
#!/usr/bin/python ''' (C) Copyright 2018 Intel Corporation. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable ...
null
src/tests/ftest/object/PunchTest.py
PunchTest.py
py
16,042
python
en
code
null
code-starcoder2
83
[ { "api_name": "sys.path.append", "line_number": 32, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 32, "usage_type": "attribute" }, { "api_name": "sys.path.append", "line_number": 33, "usage_type": "call" }, { "api_name": "sys.path", "line_nu...
507517296
import random import numpy as np import matplotlib.pyplot as plt class Cell: """A cell in the maze. A maze "Cell" is a point in the grid which may be surrounded by walls to the north, east, south or west. """ # A wall separates a pair of cells in the N-S or W-E directions. wal...
null
noWalls/environment/thinWalsMazeMA.py
thinWalsMazeMA.py
py
4,941
python
en
code
null
code-starcoder2
83
[ { "api_name": "numpy.array", "line_number": 49, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.subplots", "line_number": 74, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 74, "usage_type": "name" }, { "api_name": "numpy.arange...
449175240
#!/usr/bin/env python3 from operator import mul from itertools import product from functools import reduce import sys print('% generator: img/fft.py') def prod(xs): return reduce(mul, xs, 1) def dot(a, b): return sum(x * y for x, y in zip(a, b)) flip = sys.argv[1] == 'cooley' N = list(map(int, sys.argv[2:...
null
img/fft.py
fft.py
py
3,643
python
en
code
null
code-starcoder2
83
[ { "api_name": "functools.reduce", "line_number": 11, "usage_type": "call" }, { "api_name": "operator.mul", "line_number": 11, "usage_type": "argument" }, { "api_name": "sys.argv", "line_number": 17, "usage_type": "attribute" }, { "api_name": "sys.argv", "line_...
258061825
#!/usr/bin/env python from __future__ import print_function import sys import argparse try: from catkin_pkg.package import parse_package except ImportError as impe: sys.exit("ERROR Cannot find a module of catkin_pkg, make sure it is up to date and on the PYTHONPATH, see catkin install instructions: %s" % impe...
null
root/ros_core_ws/install/share/catkin/cmake/parse_package_xml.py
parse_package_xml.py
py
1,593
python
en
code
null
code-starcoder2
83
[ { "api_name": "sys.exit", "line_number": 10, "usage_type": "call" }, { "api_name": "sys.argv", "line_number": 34, "usage_type": "attribute" }, { "api_name": "argparse.ArgumentParser", "line_number": 38, "usage_type": "call" }, { "api_name": "catkin_pkg.package.par...
308423456
# To install python setup.py install --prefix=$PREFIX from setuptools import setup, find_packages from codecs import open from os import path, remove import sys prefix = '/usr/local' for arg in sys.argv: if '--prefix' in arg: prefix = arg[arg.find('=')+1:] if prefix == '/usr': prefix = '' here = path....
null
setup.py
setup.py
py
1,253
python
en
code
null
code-starcoder2
83
[ { "api_name": "sys.argv", "line_number": 8, "usage_type": "attribute" }, { "api_name": "os.path.abspath", "line_number": 14, "usage_type": "call" }, { "api_name": "os.path", "line_number": 14, "usage_type": "name" }, { "api_name": "os.path.dirname", "line_numb...
360747070
# 1 2 3 4 5 6 7 #1234567890123456789012345678901234567890123456789012345678901234567890123456789 # coding: utf-8 import hashlib import hmac import requests import json import time # [START MySlackBot] # # General purpose class for Slack Bot. # # Supported with...
null
myslackbot.py
myslackbot.py
py
5,928
python
en
code
null
code-starcoder2
83
[ { "api_name": "time.time", "line_number": 59, "usage_type": "call" }, { "api_name": "hmac.new", "line_number": 65, "usage_type": "call" }, { "api_name": "hashlib.sha256", "line_number": 66, "usage_type": "attribute" }, { "api_name": "time.time", "line_number":...
306357913
import numpy as np import re import gensim from datetime import datetime from nlp_preprocess import * from apiclient.discovery import build from dotenv import load_dotenv load_dotenv() np.random.seed(400) def create_empty_hours(): """ Used to Create n Length 0 Array """ data = {} for i in range(...
null
back-end/helper_funcs.py
helper_funcs.py
py
7,111
python
en
code
null
code-starcoder2
83
[ { "api_name": "dotenv.load_dotenv", "line_number": 9, "usage_type": "call" }, { "api_name": "numpy.random.seed", "line_number": 11, "usage_type": "call" }, { "api_name": "numpy.random", "line_number": 11, "usage_type": "attribute" }, { "api_name": "apiclient.disco...
96066159
#!/usr/bin/python # -*- coding: UTF-8 -*- import datetime import requests import json import pandas as pd import platform import os import time from urllib.parse import urlencode # from pyquery import PyQuery as pq host = 'm.weibo.cn' base_url = 'http://39.105.189.154:12998/sys/login/restful' user_agent = 'User-Agent...
null
aj/code/get_data.py
get_data.py
py
11,922
python
en
code
null
code-starcoder2
83
[ { "api_name": "os.path.abspath", "line_number": 26, "usage_type": "call" }, { "api_name": "os.path", "line_number": 26, "usage_type": "attribute" }, { "api_name": "os.path.dirname", "line_number": 26, "usage_type": "call" }, { "api_name": "platform.system", "l...
607246592
import keras from keras.models import Sequential, load_model from keras.layers import Dense from keras.utils import to_categorical from keras.initializers import glorot_uniform from keras.regularizers import l1_l2 from .Classifier import * from statistics import mean class NeuralNetworkClassifier(Classifier):...
null
service/ml_toolkit/NeuralNetworkClassifier.py
NeuralNetworkClassifier.py
py
15,487
python
en
code
null
code-starcoder2
83
[ { "api_name": "keras.models.Sequential", "line_number": 24, "usage_type": "call" }, { "api_name": "keras.layers.Dense", "line_number": 26, "usage_type": "call" }, { "api_name": "keras.initializers.glorot_uniform", "line_number": 29, "usage_type": "call" }, { "api_...
644559415
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np class TextCNN(nn.Module): def __init__(self,vocab_size,emb_dim,filter_sizes,num_filter,num_classes,embedding_pretrained,dropout): super(TextCNN, self).__init__() if embedding_pretrained is not None: ...
null
text classify attention and textCNN/textCNN.py
textCNN.py
py
1,174
python
en
code
null
code-starcoder2
83
[ { "api_name": "torch.nn.Module", "line_number": 9, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 9, "usage_type": "name" }, { "api_name": "torch.nn.Embedding.from_pretrained", "line_number": 14, "usage_type": "call" }, { "api_name": "torch....
40336476
# from python import csv, zipfile, hashlib import os, string from decimal import Decimal from datetime import datetime # from django from django.utils.translation import ugettext as _ from django.db.models import get_model from django.db import connection, IntegrityError from infra.custom import CustomException from ...
null
infra/objects/archive_model.py
archive_model.py
py
23,411
python
en
code
null
code-starcoder2
83
[ { "api_name": "bin.constants.WORD_SEPARATOR.join", "line_number": 55, "usage_type": "call" }, { "api_name": "bin.constants.WORD_SEPARATOR", "line_number": 55, "usage_type": "name" }, { "api_name": "bin.constants.WORD_SEPARATOR.join", "line_number": 57, "usage_type": "call...
556357232
"""Tests for RFI thresholding algorithms.""" from abc import ABC, abstractmethod from typing import Type import numpy as np from .. import host from ...abc import AbstractContext, AbstractCommandQueue from ...test.test_accel import device_test, force_autotune from .. import device _deviations: np.ndarray _spikes: ...
null
katsdpsigproc/rfi/test/test_threshold.py
test_threshold.py
py
2,688
python
en
code
null
code-starcoder2
83
[ { "api_name": "numpy.ndarray", "line_number": 14, "usage_type": "attribute" }, { "api_name": "numpy.ndarray", "line_number": 15, "usage_type": "attribute" }, { "api_name": "numpy.random.RandomState", "line_number": 22, "usage_type": "call" }, { "api_name": "numpy....
148332340
import keras import tensorflow as tf from keras.layers import Layer import numpy as np class L2Normalize(Layer): """ This layer mainly change the visual sight of the image, used in VGG16-based SSD """ def __init__(self, scale, **kwargs): self.gamma = None self.scale = scale sel...
null
model/layer/normalized.py
normalized.py
py
955
python
en
code
null
code-starcoder2
83
[ { "api_name": "keras.layers.Layer", "line_number": 7, "usage_type": "name" }, { "api_name": "numpy.ones", "line_number": 21, "usage_type": "call" }, { "api_name": "tensorflow.Variable", "line_number": 22, "usage_type": "call" }, { "api_name": "tensorflow.nn.l2_nor...
15433115
import httplib2 import json def getGeocodeLocation(inputString, map_api_key): # I didnt use Google's api because it's not free anymore. locationString = inputString.replace(" ", "+") url = ("https://api.opencagedata.com/geocode/v1/json?q={}&key={}".format(locationString, map_api_key)) h = httplib2.Ht...
null
udacity_designing_restful_apis/Lesson 3/Restaurants/geocode.py
geocode.py
py
523
python
en
code
null
code-starcoder2
83
[ { "api_name": "httplib2.Http", "line_number": 10, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 11, "usage_type": "call" } ]
462688717
# 查看标注是否正确, 将标注结果在标注的原图显示出来 import os import cv2 label_dir = "./data/location/labels" def check_img(): for label in os.listdir(label_dir): if not label.endswith("json"): continue label_path = os.path.join(label_dir, label) print(label_path) with open(lab...
null
Ice_Thickness_Estimation/check_labels.py
check_labels.py
py
968
python
en
code
null
code-starcoder2
83
[ { "api_name": "os.listdir", "line_number": 10, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 13, "usage_type": "call" }, { "api_name": "os.path", "line_number": 13, "usage_type": "attribute" }, { "api_name": "cv2.imread", "line_number": ...
437528267
"""add more classes Revision ID: c54fa49fa656 Revises: 25089f664c07 Create Date: 2020-09-29 19:37:50.642132 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'c54fa49fa656' down_revision = '25089f664c07' branch_labels = None depends_on = None def upgrade(): ...
null
migrations/versions/c54fa49fa656_add_more_classes.py
c54fa49fa656_add_more_classes.py
py
2,169
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...
150676516
import logging import click from mlcommons_box import parse # Do not remove (it registers schemas on import) from mlcommons_box.common import mlbox_metadata, objects from mlcommons_box.common.objects import platform_config from mlcommons_box_k8s.k8s_run import KubernetesRun @click.group(name='mlcommons_box_k8s') de...
null
runners/mlcommons_box_k8s/mlcommons_box_k8s/main.py
main.py
py
1,869
python
en
code
null
code-starcoder2
83
[ { "api_name": "click.group", "line_number": 10, "usage_type": "call" }, { "api_name": "logging.basicConfig", "line_number": 41, "usage_type": "call" }, { "api_name": "logging.getLogger", "line_number": 44, "usage_type": "call" }, { "api_name": "mlcommons_box.commo...
38485284
from tensorflow.keras.models import Model from tensorflow.keras.layers import Input, Dropout, BatchNormalization, Activation from tensorflow.keras.layers import Conv3D, Conv3DTranspose from tensorflow.keras.layers import MaxPooling3D from tensorflow.keras.layers import concatenate from utils.nn import pad_to_fit, crop...
null
networks/archs/unet3d.py
unet3d.py
py
2,506
python
en
code
null
code-starcoder2
83
[ { "api_name": "tensorflow.keras.layers.Conv3D", "line_number": 12, "usage_type": "call" }, { "api_name": "tensorflow.keras.layers.BatchNormalization", "line_number": 19, "usage_type": "call" }, { "api_name": "tensorflow.keras.layers.Activation", "line_number": 20, "usage_...
386523964
from OpenSSL.crypto import PKCS12,X509,load_pkcs12,sign,verify import base64 f=open('d:/123.pfx','rb')#读取证书文件 bcert=f.read() f.close() pkcs=load_pkcs12(bcert, b'22222222')#加载pkcs x509=pkcs.get_certificate()#加载证书 prkey=pkcs.get_privatekey()#提取私钥 f=open('d:/new.txt','rb') #打开签章文件 content=f.read() #读取签章文件 f....
null
source/sign.py
sign.py
py
1,209
python
en
code
null
code-starcoder2
83
[ { "api_name": "OpenSSL.crypto.load_pkcs12", "line_number": 8, "usage_type": "call" }, { "api_name": "OpenSSL.crypto.sign", "line_number": 22, "usage_type": "call" }, { "api_name": "base64.b64encode", "line_number": 24, "usage_type": "call" }, { "api_name": "OpenSS...
388841398
from pynput import keyboard import time def on_release(key): print(key) listener = keyboard.Listener(on_release=on_release) listener.start() while True: # do whatever you need here) key = listener
null
keys.py
keys.py
py
211
python
en
code
null
code-starcoder2
83
[ { "api_name": "pynput.keyboard.Listener", "line_number": 7, "usage_type": "call" }, { "api_name": "pynput.keyboard", "line_number": 7, "usage_type": "name" } ]
77749833
# importation du module necessaires import sqlite3 import mariadb class database: # https://docs.python.org/3/library/sqlite3.html def __init__(self, base, module = "sqlite3"): """ méthode constructrice de la classe parametres: base, une chaine de caracteres...
null
modules/module_database.py
module_database.py
py
2,580
python
en
code
null
code-starcoder2
83
[ { "api_name": "sqlite3.connect", "line_number": 28, "usage_type": "call" }, { "api_name": "mariadb.connect", "line_number": 30, "usage_type": "call" }, { "api_name": "sqlite3.connect", "line_number": 44, "usage_type": "call" }, { "api_name": "mariadb.connect", ...
558901775
import collections import json import os import sys import tqdm os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' import django django.setup() from seqr.models import Individual def get_hpo_terms(phenotype_data): """Returns the set of HPO terms found in this phenotype collection. """ hpo_terms = [] try: ...
null
docker/base-scripts/simulate_and_call/add_seqr_columns.py
add_seqr_columns.py
py
2,788
python
en
code
null
code-starcoder2
83
[ { "api_name": "os.environ", "line_number": 7, "usage_type": "attribute" }, { "api_name": "django.setup", "line_number": 9, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 17, "usage_type": "call" }, { "api_name": "sys.argv", "line_number": 4...
230979383
""" used for cluster job submission and parameter search over main2.py, final model analysis """ import itertools import os import sys import logging BASE ='LD_LIBRARY_PATH="/share/apps/libc6_2.23/lib/x86_64-linux-gnu:/share/apps/libc6_2.23/lib64:/\ share/apps/gcc-6.2.0/lib64:/share/apps...
null
02_Autoencoder_rotation/hpc_job_script.py
hpc_job_script.py
py
4,196
python
en
code
null
code-starcoder2
83
[ { "api_name": "itertools.product", "line_number": 19, "usage_type": "call" }, { "api_name": "os.path.exists", "line_number": 79, "usage_type": "call" }, { "api_name": "os.path", "line_number": 79, "usage_type": "attribute" }, { "api_name": "os.path.exists", "l...
638588794
import logging import timeit NANOSECONDS = 10 ** 9 MILLISECONDS = 10 ** 3 def benchit(name, f, number, *args): logging.disable(logging.CRITICAL) n = int(number) seconds = timeit.timeit(lambda: f(*args), number=n) avg_milliseconds = (seconds * MILLISECONDS) / number avg_nanoseconds = (seconds * N...
null
tests/bench.py
bench.py
py
658
python
en
code
null
code-starcoder2
83
[ { "api_name": "logging.disable", "line_number": 9, "usage_type": "call" }, { "api_name": "logging.CRITICAL", "line_number": 9, "usage_type": "attribute" }, { "api_name": "timeit.timeit", "line_number": 12, "usage_type": "call" }, { "api_name": "logging.disable", ...
254118865
import os import json import re import __main__ import numpy as np from . import _sample from .settings import alpha, beta, K, dict_file, iter_max def n2s(counts): """Convert a counts vector to corresponding samples.""" samples = [] for (value, count) in enumerate(counts): samples...
null
code/mylda/lda.py
lda.py
py
7,556
python
en
code
null
code-starcoder2
83
[ { "api_name": "numpy.random.permutation", "line_number": 17, "usage_type": "call" }, { "api_name": "numpy.random", "line_number": 17, "usage_type": "attribute" }, { "api_name": "settings.K", "line_number": 23, "usage_type": "name" }, { "api_name": "settings.alpha"...