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
332442747
import os import random from collections import deque from collections import namedtuple import tensorflow as tf import numpy as np import model_builder class Buffer: def __init__(self, buffer_size, batch_size): self.batch_size = batch_size self.buffer_size = buffer_size self.buffer_data ...
null
DQN/deep_q_network.py
deep_q_network.py
py
9,106
python
en
code
null
code-starcoder2
76
[ { "api_name": "collections.namedtuple", "line_number": 15, "usage_type": "call" }, { "api_name": "collections.deque", "line_number": 22, "usage_type": "call" }, { "api_name": "random.sample", "line_number": 37, "usage_type": "call" }, { "api_name": "numpy.array", ...
46419682
import ctypes from collections import OrderedDict from pathlib import Path import numpy as np from devito.logger import yask as log from devito.ir.equations import LoweredEq from devito.ir.iet import (Expression, FindNodes, FindSymbols, Transformer, derive_parameters, find_affine_trees) fro...
null
devito/yask/operator.py
operator.py
py
9,866
python
en
code
null
code-starcoder2
76
[ { "api_name": "devito.operator.Operator", "line_number": 26, "usage_type": "name" }, { "api_name": "devito.operator.Operator._default_headers", "line_number": 32, "usage_type": "attribute" }, { "api_name": "devito.operator.Operator", "line_number": 32, "usage_type": "name...
427309383
from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import numpy as np import os import json from tensorflow.python.tools import optimize_for_inference_lib from tensorflow.python.framework import graph_util from subprocess import run im...
null
pix2pix_exportcellphone_4.py
pix2pix_exportcellphone_4.py
py
7,407
python
en
code
null
code-starcoder2
76
[ { "api_name": "tensorflow.gfile.GFile", "line_number": 31, "usage_type": "call" }, { "api_name": "tensorflow.gfile", "line_number": 31, "usage_type": "attribute" }, { "api_name": "tensorflow.GraphDef", "line_number": 32, "usage_type": "call" }, { "api_name": "tens...
563053701
from . import workshop import json @workshop.route("/workshop/getAllWg/") def getAllWg(): c = [ { "worgkshop_group_name": "Workshop Group A", "numbreps_workshop": "2", "host_ip": "123.123.122.2", "status_s": "brightness_3", "workshop_description": "desc", ...
null
TestbedManagementSystem/Files/JesusChavez/stargate/workshop/routes.py
routes.py
py
1,624
python
en
code
null
code-starcoder2
76
[ { "api_name": "json.dumps", "line_number": 23, "usage_type": "call" }, { "api_name": "json.dumps", "line_number": 38, "usage_type": "call" } ]
447861876
#!/usr/bin/env python #-*- coding:utf-8 -*- # Author: LiuHuan # Datetime: 2020/4/9 10:44 from itertools import combinations def dep_relation(terms, txt, nlp): doc = nlp(txt) deps = [] for co in list(combinations(terms, 2)): # 取短语最后一个词 if ' ' in co[0]: a = co[0].split(' ')[-1] ...
null
dep_relation.py
dep_relation.py
py
1,535
python
en
code
null
code-starcoder2
76
[ { "api_name": "itertools.combinations", "line_number": 11, "usage_type": "call" }, { "api_name": "spacy.load", "line_number": 42, "usage_type": "call" }, { "api_name": "spacy.load", "line_number": 43, "usage_type": "call" } ]
367225142
from rest_framework import serializers from regattas.models import Regatta, Event, Entry, Club, Race, Result class ResultSerializer(serializers.ModelSerializer): entry_name = serializers.StringRelatedField( source='entry', read_only=True ) entry_id = serializers.PrimaryKeyRelatedField( source='entry', rea...
null
regattas/serializers.py
serializers.py
py
2,548
python
en
code
null
code-starcoder2
76
[ { "api_name": "rest_framework.serializers.ModelSerializer", "line_number": 5, "usage_type": "attribute" }, { "api_name": "rest_framework.serializers", "line_number": 5, "usage_type": "name" }, { "api_name": "rest_framework.serializers.StringRelatedField", "line_number": 7, ...
446105698
import os import requests from bs4 import BeautifulSoup headers = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36' } path = '/Users/knight/workspace/python/day01/spiderstory/xxx.txt' if not os.path.exists(path): os.mkdir...
null
learn_python/other/spiderstory/story.py
story.py
py
1,108
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.exists", "line_number": 11, "usage_type": "call" }, { "api_name": "os.path", "line_number": 11, "usage_type": "attribute" }, { "api_name": "os.mkdir", "line_number": 12, "usage_type": "call" }, { "api_name": "requests.get", "line_number"...
130612518
"""Calculates verification metrics with confidence intervals""" import matplotlib.pyplot as plt import numpy as np import pandas as pd import xarray as xr import xskillscore as xs from data_ingestion import read_data def resample_dataset(filtered_df): return filtered_df.sample(frac=1, replace=True) def convert_...
null
Project2/src/03_verification_metrics.py
03_verification_metrics.py
py
5,520
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.array", "line_number": 23, "usage_type": "call" }, { "api_name": "pandas.DataFrame", "line_number": 24, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 29, "usage_type": "call" }, { "api_name": "pandas.DataFrame", "line...
554970997
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import scrapy from models import db_connect, create_tables, Article from utils import redis_connect, oss_connect from sqlalchemy...
null
practices/common_article_spider/common_article_spider/pipelines.py
pipelines.py
py
4,459
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.getLogger", "line_number": 19, "usage_type": "call" }, { "api_name": "contextlib.contextmanager", "line_number": 22, "usage_type": "name" }, { "api_name": "utils.redis_connect", "line_number": 62, "usage_type": "call" }, { "api_name": "re.fi...
337214103
# coding: utf-8 import tensorflow as tf import io # from PIL import Image # import matplotlib.pyplot as plt class TensorBoardLogger(object): def __init__(self, log_dir, session=None): self.log_dir = log_dir self.writer = tf.summary.FileWriter(self.log_dir) # print('TensorBoardLogger start...
null
tensor_board_logger.py
tensor_board_logger.py
py
2,339
python
en
code
null
code-starcoder2
76
[ { "api_name": "tensorflow.summary.FileWriter", "line_number": 12, "usage_type": "call" }, { "api_name": "tensorflow.summary", "line_number": 12, "usage_type": "attribute" }, { "api_name": "tensorflow.get_default_session", "line_number": 17, "usage_type": "call" }, { ...
254729396
import logging import urllib.parse from typing import Any, Dict, Iterable, List, Optional, Tuple import pydantic import sqlalchemy.dialects.mssql # This import verifies that the dependencies are available. import sqlalchemy_pytds # noqa: F401 from pydantic.fields import Field from sqlalchemy import create_engine, in...
null
metadata-ingestion/src/datahub/ingestion/source/sql/mssql.py
mssql.py
py
11,432
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.Logger", "line_number": 35, "usage_type": "attribute" }, { "api_name": "logging.getLogger", "line_number": 35, "usage_type": "call" }, { "api_name": "datahub.ingestion.source.sql.sql_common.register_custom_type", "line_number": 37, "usage_type": "ca...
397453646
import pandas as pd from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score from sklearn.model_selection import GridSearchCV , KFold iris_data = pd.read_csv('./data/iris2.csv', encoding='utf-8') # 붓꽃 데이터를 레이블과 입력 데...
null
ml/0807/m11_gridSearch_RF.py
m11_gridSearch_RF.py
py
1,396
python
en
code
null
code-starcoder2
76
[ { "api_name": "pandas.read_csv", "line_number": 9, "usage_type": "call" }, { "api_name": "sklearn.model_selection.train_test_split", "line_number": 15, "usage_type": "call" }, { "api_name": "sklearn.model_selection.KFold", "line_number": 26, "usage_type": "call" }, { ...
238808768
import tensorflow as tf import tempfile, os, zipfile # tempfile.gettempdir() def get_miniade20k(dataset_path=os.getcwd()): num_classes = 152 dataset_size = 2000 zip_url = 'https://segmind-data.s3.ap-south-1.amazonaws.com/edge/data/segmentation/mini_ADE20K.zip' path_to_zip_file = tf.keras.utils.get_file(...
null
utils.py
utils.py
py
829
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.getcwd", "line_number": 4, "usage_type": "call" }, { "api_name": "tensorflow.keras.utils.get_file", "line_number": 8, "usage_type": "call" }, { "api_name": "tensorflow.keras", "line_number": 8, "usage_type": "attribute" }, { "api_name": "os.path....
294495146
# -*- coding: utf-8 -*- # @Time : 2020/2/11 21:03 # @Author : 南国旧梦i # @FileName: test1.py # @Software: PyCharm import time import requests from flask import Flask, make_response, request, json,render_template from cx_homework2 import mobile_func from cx_homework2.func import login server = Flask('server'...
null
cx_homework2/server.py
server.py
py
4,670
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask.Flask", "line_number": 14, "usage_type": "call" }, { "api_name": "requests.session", "line_number": 25, "usage_type": "call" }, { "api_name": "flask.request.cookies.get", "line_number": 26, "usage_type": "call" }, { "api_name": "flask.request....
231381194
import numpy as np import torch def dice_coefficient(pred, target, *, epsilon=1e-10): """ This definition generalize to real valued pred and target vector. This should be differentiable. pred: tensor with first dimension as batch target: tensor with first dimension as batch """ pred_flat = pred.contiguou...
null
vision/segmentation/loss_functions/dice_loss.py
dice_loss.py
py
1,118
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.random.seed", "line_number": 29, "usage_type": "call" }, { "api_name": "numpy.random", "line_number": 29, "usage_type": "attribute" }, { "api_name": "numpy.random.random_sample", "line_number": 30, "usage_type": "call" }, { "api_name": "numpy....
387306614
from i8自动化测试框架.comment.pageDriver import Action from i8自动化测试框架.comment import getValueFromExcel from selenium.webdriver.common.by import By import time class ini_operation(Action): def __init__(self, driver=None): Action.__init__(self, driver) self.fileName = "mi8-仓库初始化.xlsx" self.projectN...
null
i8自动化测试框架/case/MI8/test_仓库初始操作.py
test_仓库初始操作.py
py
5,629
python
en
code
null
code-starcoder2
76
[ { "api_name": "i8自动化测试框架.comment.pageDriver.Action", "line_number": 7, "usage_type": "name" }, { "api_name": "i8自动化测试框架.comment.pageDriver.Action.__init__", "line_number": 9, "usage_type": "call" }, { "api_name": "i8自动化测试框架.comment.pageDriver.Action", "line_number": 9, "u...
544500304
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render from django.template import loader from django.http import HttpResponse, JsonResponse import json import requests import operator import sqlite3 # Create your views here. def index(request): return render(request, '...
null
journal/views.py
views.py
py
5,431
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.shortcuts.render", "line_number": 14, "usage_type": "call" }, { "api_name": "requests.post", "line_number": 19, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 20, "usage_type": "call" }, { "api_name": "sqlite3.connect", ...
482617338
import json parameter_operators = ['/', '-', '\\'] def sort_models_count_dicc(dicc): dicc = sorted(dicc.items(), key=lambda x: order_function(x[0]), reverse=True) return dicc # Download all the attachment files for all emails in the inbox. def order_function(order): res = 0 for char in order[0]: ...
null
inventory_count.py
inventory_count.py
py
1,198
python
en
code
null
code-starcoder2
76
[ { "api_name": "json.dumps", "line_number": 36, "usage_type": "call" } ]
334709714
import argparse from dataclasses import dataclass from logzero import logger from .proc import run_command @dataclass(repr=False, eq=False) class Scheduler: """Utility class for job submission using a scheduler.""" scheduler_name: str submit_command: str queue_name: str = None def __post_init__(s...
null
BITS/util/scheduler.py
scheduler.py
py
5,899
python
en
code
null
code-starcoder2
76
[ { "api_name": "logzero.logger.info", "line_number": 28, "usage_type": "call" }, { "api_name": "logzero.logger", "line_number": 28, "usage_type": "name" }, { "api_name": "proc.run_command", "line_number": 39, "usage_type": "call" }, { "api_name": "dataclasses.datac...
321602375
#!/usr/bin/env python # Programmer : zhuxp # Date: # Last-modified: 06-17-2013, 15:49:45 EDT VERSION="0.1" import os,sys,argparse from xplib.Annotation import Bed from xplib import TableIO from xplib import DBI import signal signal.signal(signal.SIGPIPE,signal.SIG_DFL) import gzip import time def ParseArg(): ''' ...
null
bin/xCmpGene.py
xCmpGene.py
py
3,963
python
en
code
null
code-starcoder2
76
[ { "api_name": "signal.signal", "line_number": 11, "usage_type": "call" }, { "api_name": "signal.SIGPIPE", "line_number": 11, "usage_type": "attribute" }, { "api_name": "signal.SIG_DFL", "line_number": 11, "usage_type": "attribute" }, { "api_name": "argparse.Argume...
582462158
import os import smtplib from email.mime.text import MIMEText from email.mime.image import MIMEImage from email.mime.multipart import MIMEMultipart import yaml import logging def send_mail(body, project_name): path = os.getcwd() config_path = path+"/test_data/mail/mail_config.yml" logging.info("Reading from "+ con...
null
Oggy/lib/send_mail.py
send_mail.py
py
885
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.getcwd", "line_number": 10, "usage_type": "call" }, { "api_name": "logging.info", "line_number": 12, "usage_type": "call" }, { "api_name": "yaml.load", "line_number": 14, "usage_type": "call" }, { "api_name": "email.mime.multipart.MIMEMultipart",...
314651148
#!/usr/bin/env python from chdrft.cmds import CmdsList from chdrft.main import app from chdrft.utils.cmdify import ActionHandler from chdrft.utils.misc import Attributize from chdrft.utils.path import FileFormatHelper import glog global flags, cache flags = None cache = None def args(parser): clist = CmdsList().a...
null
acm/wf/18/check.py
check.py
py
842
python
en
code
null
code-starcoder2
76
[ { "api_name": "chdrft.cmds.CmdsList", "line_number": 16, "usage_type": "call" }, { "api_name": "chdrft.utils.cmdify.ActionHandler.Prepare", "line_number": 17, "usage_type": "call" }, { "api_name": "chdrft.utils.cmdify.ActionHandler", "line_number": 17, "usage_type": "name...
132514439
# Copyright 2012-2015 NEC Corporation. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
null
networking_nec/plugins/openflow/rpc.py
rpc.py
py
5,584
python
en
code
null
code-starcoder2
76
[ { "api_name": "oslo_log.log.getLogger", "line_number": 28, "usage_type": "call" }, { "api_name": "oslo_log.log", "line_number": 28, "usage_type": "name" }, { "api_name": "neutron.db.securitygroups_rpc_base.SecurityGroupServerRpcMixin", "line_number": 31, "usage_type": "at...
81634349
import os, sys import requests import xmltodict from datetime import datetime from dateutil import parser from pprint import pprint import copy from collections import OrderedDict, defaultdict import re from util.util import to_dict, write_to_csv, value_or_blank, is_a_lot, is_a_virtual_lot, is_a_virtual_zone, correcte...
null
fetch_terminals.py
fetch_terminals.py
py
21,791
python
en
code
null
code-starcoder2
76
[ { "api_name": "parameters.local_parameters.path", "line_number": 54, "usage_type": "name" }, { "api_name": "os.path.dirname", "line_number": 54, "usage_type": "call" }, { "api_name": "os.path", "line_number": 54, "usage_type": "attribute" }, { "api_name": "os.path...
429592053
import requests def getHTMLTest(url): try: r = requests.get(url,timeout=30) r.raise_for_status() r.encoding = r.apparent_encoding return r.text except: return "产生异常" if __name__ == "__main__": url = "http://112.29.169.2:8081/omc/" print(getHTMLTest(url))
null
爬虫/tongyongdaimakuangjia.py
tongyongdaimakuangjia.py
py
278
python
en
code
null
code-starcoder2
76
[ { "api_name": "requests.get", "line_number": 5, "usage_type": "call" } ]
594647797
# Server.py import socket,json,os,time LISTEN_ADDR = '127.0.0.1' #监听地址 DEFAULT_PORT = 8008 #监听端口 listenSock = None def start(): listenSock = socket.socket() listenSock.bind((LISTEN_ADDR, DEFAULT_PORT)) listenSock.listen(5) while True: (ctlSock, clientAddr) = listenSock.accept() pr...
null
thinking1/Server.py
Server.py
py
1,609
python
en
code
null
code-starcoder2
76
[ { "api_name": "socket.socket", "line_number": 10, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 24, "usage_type": "call" }, { "api_name": "json.dumps", "line_number": 32, "usage_type": "call" }, { "api_name": "os.path.exists", "line_number...
380604552
from django.core.management.base import BaseCommand from share.models import NormalizedData from share.tasks import disambiguate class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument('normalized', nargs='*', type=int, help='The id(*) of the normalized data to make changes for'...
null
share/management/commands/disambiguate.py
disambiguate.py
py
932
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.core.management.base.BaseCommand", "line_number": 7, "usage_type": "name" }, { "api_name": "share.models.NormalizedData.objects.filter", "line_number": 17, "usage_type": "call" }, { "api_name": "share.models.NormalizedData.objects", "line_number": 17, ...
518400273
import sys # sys.path.insert(1, './pyKinectAzure/') sys.path.insert(1, './src/pyKinectAzure/') import datetime import numpy as np import queue import threading # from . import pyKinectAzure from .pyKinectAzure import _k4a from .pyKinectAzure.pyKinectAzure import pyKinectAzure from .pyKinectAzure.kinectBodyTracker i...
null
EfficientGCNv1/src/k4aBodyTracker.py
k4aBodyTracker.py
py
10,821
python
en
code
null
code-starcoder2
76
[ { "api_name": "sys.path.insert", "line_number": 4, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 4, "usage_type": "attribute" }, { "api_name": "pyKinectAzure.pyKinectAzure.pyKinectAzure", "line_number": 49, "usage_type": "call" }, { "api_name": ...
500179208
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('banks', '0002_bank_csv_mapping'), ] operations = [ migrations.RemoveField( model_name='bank', name='...
null
banks/migrations/0003_auto_20160124_1144.py
0003_auto_20160124_1144.py
py
987
python
en
code
null
code-starcoder2
76
[ { "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.RemoveField", "line_number": 14, "usage_type": "call" }, ...
550911454
import util import chromadude.jellyjump.image as images from pygame.locals import * import pygame class Main(): def __init__(self, view): images.load_game_images() self.view = view self.highlighted_buttons = [0, 0, 0] self.pause_start_time = None self.background = None ...
null
src/chromadude/jellyjump/scenes/menu.py
menu.py
py
5,165
python
en
code
null
code-starcoder2
76
[ { "api_name": "chromadude.jellyjump.image.load_game_images", "line_number": 9, "usage_type": "call" }, { "api_name": "chromadude.jellyjump.image", "line_number": 9, "usage_type": "name" }, { "api_name": "pygame.Rect", "line_number": 16, "usage_type": "call" }, { "...
98623129
import requests import urllib.parse as rep import urllib.request as req from bs4 import BeautifulSoup import os # 로그인 유저 정보 LOGIN_INFO = { 'log': 'outsider7224', 'pwd': 'dmsrl8482', 'user-submit': rep.quote_plus('로그인'), 'user-cookie': 1 } with requests.Session() as s: login_req = s.post('https://w...
null
WebCrawler/Requests/download3-4-2.py
download3-4-2.py
py
1,063
python
en
code
null
code-starcoder2
76
[ { "api_name": "urllib.parse.quote_plus", "line_number": 11, "usage_type": "call" }, { "api_name": "urllib.parse", "line_number": 11, "usage_type": "name" }, { "api_name": "requests.Session", "line_number": 15, "usage_type": "call" }, { "api_name": "bs4.BeautifulSo...
408829908
# encoding: utf-8 import json import datetime import string from flask import request, g, jsonify from flask.ext.security import login_required from myapp.models import User, WeiboList from myapp import app, db from myapp.api_app import api_app from weibo import APIClient client = APIClient(app_key=app.config['APP...
null
myapp/api_app/api_status_view.py
api_status_view.py
py
4,693
python
en
code
null
code-starcoder2
76
[ { "api_name": "weibo.APIClient", "line_number": 16, "usage_type": "call" }, { "api_name": "myapp.app.config", "line_number": 16, "usage_type": "attribute" }, { "api_name": "myapp.app", "line_number": 16, "usage_type": "name" }, { "api_name": "myapp.app.config", ...
174726364
#!/usr/bin/python # -*- coding: utf-8 -*- """ Only used for testing different word and sentence splitting options. """ import spacy import re import nltk.data import nltk.tokenize # some sentences that should test quite a few things to work correctly when splitting doc1 = "As the most quoted English writer Shakespea...
null
split_text_test.py
split_text_test.py
py
2,827
python
en
code
null
code-starcoder2
76
[ { "api_name": "re.split", "line_number": 42, "usage_type": "call" }, { "api_name": "re.split", "line_number": 49, "usage_type": "call" }, { "api_name": "re.findall", "line_number": 52, "usage_type": "call" }, { "api_name": "spacy.load", "line_number": 62, ...
362557165
from CheckSystem.Health import HealthProcessor from CheckSystem.Judgement import Check from collections import namedtuple import copy from global_var import Settings Info = namedtuple("Info", "time combo combostatus showscore score accuracy clicks hitresult timestamp id hp more") Circle = namedtuple("Circle", "state ...
null
src/CheckSystem/HitObjectChecker.py
HitObjectChecker.py
py
8,027
python
en
code
null
code-starcoder2
76
[ { "api_name": "collections.namedtuple", "line_number": 8, "usage_type": "call" }, { "api_name": "collections.namedtuple", "line_number": 9, "usage_type": "call" }, { "api_name": "collections.namedtuple", "line_number": 10, "usage_type": "call" }, { "api_name": "co...
51114352
import compose_utility import numpy as np import sounddevice as sd import soundfile as sf cu = compose_utility.ComposeUtility() params = np.zeros(8) + 1.0 audio = cu.make_note_osc(params, 5.0) audio2 = cu.predictive_feedback(cu.make_note_osc(params, 30.0)) sd.play(audio, 44100) sd.wait() sd.play(audio2, 44100) audio3 ...
null
probably_useful_for_author_only/test_predictive_feedback.py
test_predictive_feedback.py
py
1,226
python
en
code
null
code-starcoder2
76
[ { "api_name": "compose_utility.ComposeUtility", "line_number": 6, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 7, "usage_type": "call" }, { "api_name": "sounddevice.play", "line_number": 10, "usage_type": "call" }, { "api_name": "sounddevice...
136462267
import functools import os import time import win32gui, win32com.client from pywinauto.application import Application from pywinauto.controls.common_controls import TabControlWrapper PATH_TO_EXE = os.path.join("lazy-z.com", "winnings", "winnings.exe") BUTTON = 'TBitBtn' RADIOBUTTON = 'TRadioButton' CHECKBOX = 'TChec...
null
calculator.py
calculator.py
py
7,767
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.join", "line_number": 10, "usage_type": "call" }, { "api_name": "os.path", "line_number": 10, "usage_type": "attribute" }, { "api_name": "functools.wraps", "line_number": 29, "usage_type": "call" }, { "api_name": "functools.wraps", "line...
570132386
# -*- coding: utf-8 -*- import json from kinto_signer.serializer import canonical_json # # Kinto specific # def test_supports_records_as_iterators(): records = iter([ {'bar': 'baz', 'last_modified': '45678', 'id': '1'}, ]) canonical_json(records, '45678') def test_provides_records_in_data_alon...
null
tests/test_serializer.py
test_serializer.py
py
4,921
python
en
code
null
code-starcoder2
76
[ { "api_name": "kinto_signer.serializer.canonical_json", "line_number": 15, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 22, "usage_type": "call" }, { "api_name": "kinto_signer.serializer.canonical_json", "line_number": 22, "usage_type": "call" }, ...
142082963
"""A simple example of how to access the Google Analytics API.""" # GOOGLE API import argparse from apiclient.discovery import build import httplib2 from oauth2client import client from oauth2client import file from oauth2client import tools from googleapiclient.errors import HttpError # END GOOGLE API imp...
null
OnlineMarketingDashboard/imports/google_analytics/google_analytics_devices.py
google_analytics_devices.py
py
6,374
python
en
code
null
code-starcoder2
76
[ { "api_name": "argparse.ArgumentParser", "line_number": 31, "usage_type": "call" }, { "api_name": "argparse.RawDescriptionHelpFormatter", "line_number": 32, "usage_type": "attribute" }, { "api_name": "oauth2client.tools.argparser", "line_number": 33, "usage_type": "attrib...
205107623
"""DQN model class for RL experiments with neural net function approx. Written by: Zahi Kakish (zmk5) """ from typing import List import numpy as np from tensorflow import keras from tensorflow.keras.optimizers import Adam from mrt_msgs.srv import Gradients from mrt_msgs.srv import Weights class ServerPolicyDQN()...
null
mrt_server/mrt_server/policy/dqn.py
dqn.py
py
3,937
python
en
code
null
code-starcoder2
76
[ { "api_name": "typing.List", "line_number": 34, "usage_type": "name" }, { "api_name": "tensorflow.keras.Sequential", "line_number": 46, "usage_type": "call" }, { "api_name": "tensorflow.keras", "line_number": 46, "usage_type": "name" }, { "api_name": "tensorflow.k...
257158298
from zipfile import ZipFile import os def get_all_file_paths(directory): # initializing empty file paths list file_paths = [] # crawling through directory and subdirectories for root, directories, files in os.walk(directory): for filename in files: # join the two strings in order to form the full filepath. ...
null
CreateZip/createzip.py
createzip.py
py
989
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.walk", "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": "zipfile.ZipFile", "line_number"...
319927950
#!/usr/bin/env python3 """ Name: Daniel Krepski Email: dkrepski@madisoncollege.edu Assignment: Week 13 - Website Interaction """ import requests import bs4 res = requests.get('https://notpurple.com') res.raise_for_status() notpurplesoup = bs4.BeautifulSoup(res.text, 'html.parser') title=notpurplesoup.select('title') l...
null
week13-inspect-web.py
week13-inspect-web.py
py
396
python
en
code
null
code-starcoder2
76
[ { "api_name": "requests.get", "line_number": 10, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 12, "usage_type": "call" } ]
277006815
""" Django settings for orienting project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ # Static settings common to all environments import os from django.utils...
null
src/config/settings/base.py
base.py
py
3,829
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.dirname", "line_number": 20, "usage_type": "call" }, { "api_name": "os.path", "line_number": 20, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_number": 21, "usage_type": "call" }, { "api_name": "os.path", "line_number"...
213515723
# !/usr/bin/python # -*- coding:utf-8 -*- from django.conf.urls import url from . import views app_name = 'books' urlpatterns = [ # ex:/books/ url(r'^$', views.index, name='index'), # ex:/books/5/ url(r'^search_form/$', views.search_form, name='search_form'), # ex:/books/5/results/ url(r'^...
null
books/urls.py
urls.py
py
756
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.conf.urls.url", "line_number": 12, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 15, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 18, "usage_type": "call" }, { "api_name": "django...
417460796
import matplotlib.pyplot as plt import numpy as np from keras import backend as K from keras.datasets import mnist from keras.utils import to_categorical from sklearn.metrics import confusion_matrix from preprocess import preprocess from buildModel import buildModel from getHyperparameters import getHyperparameters fro...
null
mnistNumbers/mainTraining.py
mainTraining.py
py
1,496
python
en
code
null
code-starcoder2
76
[ { "api_name": "keras.datasets.mnist.load_data", "line_number": 12, "usage_type": "call" }, { "api_name": "keras.datasets.mnist", "line_number": 12, "usage_type": "name" }, { "api_name": "preprocess.preprocess", "line_number": 14, "usage_type": "call" }, { "api_nam...
480185474
import pyttsx3 import PyPDF2 from tkinter.filedialog import * print("Input a PDF text only file:") book=askopenfilename() pdfreader=PyPDF2.PdfFileReader(book) pages=pdfreader.numPages for num in range(0,pages): page=pdfreader.getPage(num) text=page.extractText() player=pyttsx3.init() player.say(text) ...
null
main.py
main.py
py
342
python
en
code
null
code-starcoder2
76
[ { "api_name": "PyPDF2.PdfFileReader", "line_number": 6, "usage_type": "call" }, { "api_name": "pyttsx3.init", "line_number": 12, "usage_type": "call" } ]
584411688
import base64 import json class BaseTestCloudAuth: """ Required setup: initialize test case teardown: del items for test decode: check decoded token and assigned info """ ACCESS_TOKEN = "" SCOPE_ACCESS_TOKEN = "" ID_TOKEN = "" TESTCLIENT = None def assert_get_res...
null
tests/helpers.py
helpers.py
py
1,007
python
en
code
null
code-starcoder2
76
[ { "api_name": "json.loads", "line_number": 36, "usage_type": "call" }, { "api_name": "base64.b64decode", "line_number": 36, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 37, "usage_type": "call" }, { "api_name": "base64.b64decode", "line_n...
82919787
import http import logging from abc import ABCMeta, abstractmethod from collections import namedtuple import json from django.conf import settings from typing import List import base64 import requests from django.http import JsonResponse log = logging.getLogger('smesco') TokenResponse = namedtuple('TokenResponse', ['t...
null
src/smesco/apps/payment/gateway.py
gateway.py
py
4,646
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.getLogger", "line_number": 12, "usage_type": "call" }, { "api_name": "collections.namedtuple", "line_number": 13, "usage_type": "call" }, { "api_name": "typing.List", "line_number": 17, "usage_type": "name" }, { "api_name": "abc.ABCMeta", ...
523202694
# Copyright 2020 Alex Woroschilow (alex.woroschilow@gmail.com) # # 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/modules/apprepo_appimage/apprepo/icon.py
icon.py
py
1,916
python
en
code
null
code-starcoder2
76
[ { "api_name": "glob.glob", "line_number": 27, "usage_type": "call" }, { "api_name": "glob.glob", "line_number": 31, "usage_type": "call" }, { "api_name": "glob.glob", "line_number": 35, "usage_type": "call" }, { "api_name": "glob.glob", "line_number": 39, ...
59536371
from setuptools import setup, find_packages with open('README.md', encoding='utf8') as fr: readme = fr.read() setup( name='auto_contract', version='0.1', keywords='static, contract, auto', description='make your scalable contracts easily for your python projects.', long_description=readme, ...
null
setup.py
setup.py
py
919
python
en
code
null
code-starcoder2
76
[ { "api_name": "setuptools.setup", "line_number": 5, "usage_type": "call" }, { "api_name": "setuptools.find_packages", "line_number": 17, "usage_type": "call" } ]
161176658
### This file: line-by-line translation from Algorithm 2 ### in the paper "Representing higher-order dependencies in networks" ### Code written by Jian Xu, Jan 2017 ### Technical questions? Please contact i[at]jianxu[dot]net ### Demo of HON: please visit http://www.HigherOrderNetwork.com ### Latest code: please visit ...
null
Data_analysis/HON_Creation/jianxu_BuildNetwork.py
jianxu_BuildNetwork.py
py
2,138
python
en
code
null
code-starcoder2
76
[ { "api_name": "collections.defaultdict", "line_number": 17, "usage_type": "call" }, { "api_name": "collections.defaultdict", "line_number": 21, "usage_type": "call" } ]
318561832
''' Classes for user information for the social network project ''' # pylint: disable=R0903 import logging from peewee import IntegrityError, DoesNotExist import socialnetwork_model as sql class UserCollection(): ''' Interfaces with the User table ''' def __init__(self): self.table = sql.User ...
null
Python/320/assignment 06/sqlite/users.py
users.py
py
2,664
python
en
code
null
code-starcoder2
76
[ { "api_name": "socialnetwork_model.User", "line_number": 16, "usage_type": "attribute" }, { "api_name": "socialnetwork_model.db", "line_number": 17, "usage_type": "attribute" }, { "api_name": "logging.getLogger", "line_number": 19, "usage_type": "call" }, { "api_n...
379078015
import base64 import hashlib # 说道摘要算法,首先要明确哈希函数的作用。 # Hash,一般翻译做“散列”,也有直接音译为”哈希”的,就是把任意长度的输入,通过散列算法,变换成固定长度的输出,该输出就是散列值。 # 与加密解密不同,摘要算法是一个不可逆的算法,但不同的输入有可能会产生相同的哈希值,这就是碰撞。 # 摘要算法的典型应用是对一段信息产生信息摘要,以防止被篡改。 def MD5(data, charset='utf-8'): ''' MD5是一个信息摘要算法,通常用于密码的加密存储,数字签名,文件完整性验证等。 :param data: :param...
null
new_p6_network_security/摘要算法.py
摘要算法.py
py
2,557
python
en
code
null
code-starcoder2
76
[ { "api_name": "hashlib.md5", "line_number": 21, "usage_type": "call" }, { "api_name": "hashlib.md5", "line_number": 23, "usage_type": "call" }, { "api_name": "hashlib.sha1", "line_number": 35, "usage_type": "call" }, { "api_name": "hashlib.sha1", "line_number"...
601311852
# -*- coding: utf-8 -*- import scrapy import csv import urllib import urlparse from retrieve_faces.items import FaceItem class ToshinSpider(scrapy.Spider): name = "toshin" allowed_domains = ['www.toshin.com'] base_urls = [ "http://www.toshin.com/taikenki/2013/box_list.php", "http:...
null
scrapy/retrieve_faces/retrieve_faces/spiders/toshin_spider.py
toshin_spider.py
py
3,190
python
en
code
null
code-starcoder2
76
[ { "api_name": "scrapy.Spider", "line_number": 10, "usage_type": "attribute" }, { "api_name": "csv.reader", "line_number": 20, "usage_type": "call" }, { "api_name": "urllib.urlencode", "line_number": 28, "usage_type": "call" }, { "api_name": "scrapy.Request", "...
285930179
from dataclasses import fields, MISSING, is_dataclass, Field, dataclass, field as dc_field from typing import Dict, Any, TypeVar, Type, Union, Callable, List, Collection, Optional, Set, Mapping, Tuple, get_type_hints import copy class DaciteError(Exception): pass class WrongTypeError(DaciteError): def __ini...
null
dacite.py
dacite.py
py
13,907
python
en
code
null
code-starcoder2
76
[ { "api_name": "dataclasses.Field", "line_number": 11, "usage_type": "name" }, { "api_name": "typing.Any", "line_number": 11, "usage_type": "name" }, { "api_name": "dataclasses.Field", "line_number": 19, "usage_type": "name" }, { "api_name": "dataclasses.Field", ...
438489629
import re, yaml, json from pymongo import MongoClient from os import path, pardir from json_ref_dict import RefDict, materialize ################################################################################ def read_bycon_configs_by_name(name, byc): """podmd Reading the config from the same wrapper dir: ...
null
beaconServer/lib/read_specs.py
read_specs.py
py
3,362
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.join", "line_number": 19, "usage_type": "call" }, { "api_name": "os.path", "line_number": 19, "usage_type": "name" }, { "api_name": "yaml.load", "line_number": 21, "usage_type": "call" }, { "api_name": "yaml.FullLoader", "line_number": 2...
328773504
import numpy as np from collections import defaultdict import json from nltk.tokenize import word_tokenize def str_lower_cleaner(s): return s.replace("''",'" ').replace('``','" ').lower() def my_tokenize(s): tokens = word_tokenize(s) tokens = ['"' if t == "''" or t=='``' else t for t in tokens] ...
null
NLP/BIDAF/load_dataset.py
load_dataset.py
py
10,072
python
en
code
null
code-starcoder2
76
[ { "api_name": "nltk.tokenize.word_tokenize", "line_number": 10, "usage_type": "call" }, { "api_name": "json.load", "line_number": 16, "usage_type": "call" }, { "api_name": "collections.defaultdict", "line_number": 31, "usage_type": "call" }, { "api_name": "collect...
146041996
from itertools import combinations main_input = input() listValue = input().split() comboValue = input() a = list(combinations(listValue,int(comboValue))) final = len(a) count = 0 for i in a: if "a" in i: count +=1 print("{:3f}".format(count/final))
null
Python(Done)/050 Iterables and Iterators/Solution.py
Solution.py
py
265
python
en
code
null
code-starcoder2
76
[ { "api_name": "itertools.combinations", "line_number": 7, "usage_type": "call" } ]
172634263
import unittest from atlasclient.exceptions import BadRequest from mock import patch, MagicMock from metadata_service.entity.popular_table import PopularTable from metadata_service.entity.table_detail import (Table) from metadata_service.exception import NotFoundException from metadata_service.proxy.atlas_proxy impor...
null
tests/unit/proxy/test_atlas_proxy.py
test_atlas_proxy.py
py
6,952
python
en
code
null
code-starcoder2
76
[ { "api_name": "unittest.TestCase", "line_number": 12, "usage_type": "attribute" }, { "api_name": "mock.patch", "line_number": 15, "usage_type": "call" }, { "api_name": "metadata_service.proxy.atlas_proxy.AtlasProxy", "line_number": 16, "usage_type": "call" }, { "a...
85353641
""" Copyright 2020 InfAI (CC SES) 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...
null
zway/zway.py
zway.py
py
6,521
python
en
code
null
code-starcoder2
76
[ { "api_name": "logger.root_logger.getChild", "line_number": 28, "usage_type": "call" }, { "api_name": "logger.root_logger", "line_number": 28, "usage_type": "name" }, { "api_name": "configuration.config.Zway", "line_number": 32, "usage_type": "attribute" }, { "api...
156735106
from sklearn.ensemble import BaggingClassifier import pandas as pd from sklearn.model_selection import train_test_split from sklearn import preprocessing train_features = pd.read_csv('../data/dengue_features_train.csv') train_labels = pd.read_csv('../data/dengue_labels_train.csv') test_data = pd.read_csv('../data/deng...
null
algorithms/Bagging.py
Bagging.py
py
1,440
python
en
code
null
code-starcoder2
76
[ { "api_name": "pandas.read_csv", "line_number": 6, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 7, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 8, "usage_type": "call" }, { "api_name": "sklearn.preprocessing.La...
363684710
import functools import traceback import requests # 参数化装饰器 def retry(attempt): def decorator(func): @functools.wraps(func) def wrapper(*arg, **kw): att = 0 while att < attempt: try: return func(*arg, **kw) except Exceptio...
null
utils/retry.py
retry.py
py
1,749
python
en
code
null
code-starcoder2
76
[ { "api_name": "functools.wraps", "line_number": 10, "usage_type": "call" }, { "api_name": "requests.get", "line_number": 25, "usage_type": "call" }, { "api_name": "traceback.print_exc", "line_number": 54, "usage_type": "call" }, { "api_name": "functools.wraps", ...
20822903
#!/usr/bin/env python from __future__ import print_function from optparse import OptionParser from os.path import exists from swift.cli.ringbuilder import main as rb_main import json import sys import threading USAGE = "usage: %prog -f <swift_cluster_json>" def run_and_wait(func, *args): t = threading.Thread(ta...
null
config/swift/rings/build_rings.py
build_rings.py
py
2,267
python
en
code
null
code-starcoder2
76
[ { "api_name": "threading.Thread", "line_number": 15, "usage_type": "call" }, { "api_name": "swift.cli.ringbuilder.main", "line_number": 21, "usage_type": "argument" }, { "api_name": "swift.cli.ringbuilder.main", "line_number": 33, "usage_type": "argument" }, { "ap...
414022053
import torch from model import LeNet from PIL import Image import numpy as np import argparse def img2MNIST(filename): img = Image.open(filename).convert('L') img = img.resize((28,28),Image.ANTIALIAS) arr = [] for i in range(28): for j in range(28): pixel = float(img.get...
null
sample_predict.py
sample_predict.py
py
1,177
python
en
code
null
code-starcoder2
76
[ { "api_name": "PIL.Image.open", "line_number": 8, "usage_type": "call" }, { "api_name": "PIL.Image", "line_number": 8, "usage_type": "name" }, { "api_name": "PIL.Image.ANTIALIAS", "line_number": 9, "usage_type": "attribute" }, { "api_name": "PIL.Image", "line_...
234200499
''' Created on 2017. 7. 16. @author: Park ''' import socket import cv2 import numpy as np import os import sys import platform def recvall(sock,count): buf = b'' while count: newbuf = sock.recv(count) if not newbuf: return None buf += newbuf count -= len(newbu...
null
PaintsChainer/images/Client2.py
Client2.py
py
1,262
python
en
code
null
code-starcoder2
76
[ { "api_name": "socket.gethostname", "line_number": 25, "usage_type": "call" }, { "api_name": "cv2.imread", "line_number": 26, "usage_type": "call" }, { "api_name": "cv2.imread", "line_number": 27, "usage_type": "call" }, { "api_name": "cv2.IMREAD_UNCHANGED", "...
532593355
# -*- coding: utf-8 -*- """ @author: Wei, Shuowen https://leetcode.com/problems/array-of-doubled-pairs/ LC954, LC2007 """ import collections class Solution(object): def canReorderDoubled(self, arr): """ :type arr: List[int] :rtype: bool """ # solution 1: O(NlogK) # ...
null
Medium/LC954.py
LC954.py
py
1,348
python
en
code
null
code-starcoder2
76
[ { "api_name": "collections.defaultdict", "line_number": 18, "usage_type": "call" }, { "api_name": "collections.defaultdict", "line_number": 31, "usage_type": "call" } ]
296387363
import beluga import logging ocp = beluga.Problem() # Define independent variables ocp.independent('t', 's') # Define equations of motion ocp.state('r', 'v_r', 'L') \ .state('theta', 'v_theta/r', 'rad') \ .state('v_r', 'v_theta**2/r - mu/r**2 + Tf*cos(alpha)', 'L/s') \ .state('v_theta', '-v_r*v_theta/r +...
null
examples/Astrodynamics/OrbitRaising/HighThrust.py
HighThrust.py
py
2,429
python
en
code
null
code-starcoder2
76
[ { "api_name": "beluga.Problem", "line_number": 4, "usage_type": "call" }, { "api_name": "beluga.bvp_algorithm", "line_number": 51, "usage_type": "call" }, { "api_name": "beluga.bvp_algorithm", "line_number": 52, "usage_type": "call" }, { "api_name": "beluga.guess_...
530133562
#coding:utf8 import datetime from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import object_session import sqlalchemy as SA from ..espoirjson import EspoirJson from ..globalobject import GlobalObject class Config(object): def __init__(self): self.mysql_url = None self....
null
echecs_hall/app/extensions/mysql/mysql_base.py
mysql_base.py
py
1,081
python
en
code
null
code-starcoder2
76
[ { "api_name": "globalobject.GlobalObject", "line_number": 18, "usage_type": "call" }, { "api_name": "sqlalchemy.orm.object_session", "line_number": 22, "usage_type": "call" }, { "api_name": "sqlalchemy.Column", "line_number": 23, "usage_type": "call" }, { "api_nam...
457021997
#!/usr/bin/env python3 """ Author : wwong3 Date : 2019-MAR-19 Purpose: War Game >.< """ import argparse import sys import random from itertools import product # -------------------------------------------------- def get_args(): """get command-line arguments""" parser = argparse.ArgumentParser( descr...
null
assignments/10-war/war.py
war.py
py
2,189
python
en
code
null
code-starcoder2
76
[ { "api_name": "argparse.ArgumentParser", "line_number": 16, "usage_type": "call" }, { "api_name": "argparse.ArgumentDefaultsHelpFormatter", "line_number": 18, "usage_type": "attribute" }, { "api_name": "sys.stderr", "line_number": 34, "usage_type": "attribute" }, { ...
386083688
from parser.pcfgs.pcfgs import PCFG_base from parser.pcfgs.fn import stripe, diagonal_copy_, checkpoint import torch class TDPCFG(PCFG_base): def __init__(self): super(TDPCFG, self).__init__() def loss(self, rules, lens): return self._inside(rules, lens) @torch.enable_grad() def _in...
null
parser/pcfgs/tdpcfg.py
tdpcfg.py
py
3,738
python
en
code
null
code-starcoder2
76
[ { "api_name": "parser.pcfgs.pcfgs.PCFG_base", "line_number": 6, "usage_type": "name" }, { "api_name": "parser.pcfgs.fn.checkpoint", "line_number": 34, "usage_type": "name" }, { "api_name": "parser.pcfgs.fn.checkpoint", "line_number": 42, "usage_type": "name" }, { ...
338041574
import os from urllib.parse import quote_plus import requests from django.conf import settings from django.contrib.sites.shortcuts import get_current_site from django.http import Http404 from django.template.defaultfilters import date from django.templatetags.l10n import localize from django.templatetags.tz import utc...
null
simple_ui/views.py
views.py
py
8,313
python
en
code
null
code-starcoder2
76
[ { "api_name": "djng.views.mixins.JSONResponseMixin", "line_number": 33, "usage_type": "name" }, { "api_name": "django.views.generic.base.View", "line_number": 33, "usage_type": "name" }, { "api_name": "django.utils.translation.activate", "line_number": 41, "usage_type": "...
176558609
#! python2 #coding: utf-8 import sys import os # #========================================================= # #无论哪个文件执行,只要执行,就把当前路径切换到脚本的根目录 # #目前执行,只有两地,enter和脚本,如果后续还有其他的执行地可以在这个地方扩展 if __name__ == '__main__': if "interfaces" in os.getcwd(): os.chdir("../../../..") sys.path.append(".") else: ...
null
interface_test_tool/utils/father_for_call.py
father_for_call.py
py
11,402
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.getcwd", "line_number": 9, "usage_type": "call" }, { "api_name": "os.chdir", "line_number": 10, "usage_type": "call" }, { "api_name": "sys.path.append", "line_number": 11, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 11, ...
220811172
#coding:utf-8 # vscode读取不到了包路径解决方案 import sys import os curPath = os.path.abspath(os.path.dirname(__file__)) rootPath = os.path.split(curPath)[0] sys.path.append(rootPath) import smtplib from email.mime.text import MIMEText from email.mime.application import MIMEApplication from email.mime.multipart import MIMEMultipa...
null
auto_python5_V3/common/handleemail.py
handleemail.py
py
1,678
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.abspath", "line_number": 5, "usage_type": "call" }, { "api_name": "os.path", "line_number": 5, "usage_type": "attribute" }, { "api_name": "os.path.dirname", "line_number": 5, "usage_type": "call" }, { "api_name": "os.path.split", "line_n...
151798818
#!/usr/bin/env python """ This module runs basic Quil text files against the Forest QVM API. """ from __future__ import print_function from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter from pyquil import Program, get_qc help_string = "Script takes two arguments. Quil program filename is required as ...
null
examples/run_quil.py
run_quil.py
py
1,199
python
en
code
null
code-starcoder2
76
[ { "api_name": "argparse.ArgumentParser", "line_number": 17, "usage_type": "call" }, { "api_name": "argparse.ArgumentDefaultsHelpFormatter", "line_number": 17, "usage_type": "name" }, { "api_name": "pyquil.Program", "line_number": 28, "usage_type": "call" }, { "api...
520150271
"""Train a model on SQuAD. Author: Chris Chute (chute@stanford.edu) """ import numpy as np import random import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.optim.lr_scheduler as sched import torch.utils.data as data import util from args import get_train_a...
null
train.py
train.py
py
17,725
python
en
code
null
code-starcoder2
76
[ { "api_name": "args.save_dir", "line_number": 31, "usage_type": "attribute" }, { "api_name": "util.get_save_dir", "line_number": 31, "usage_type": "call" }, { "api_name": "args.name", "line_number": 31, "usage_type": "attribute" }, { "api_name": "util.get_logger",...
535816829
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. #from openerp import api, fields, models, _ from datetime import datetime from odoo import api, fields, models, _ from cStringIO import StringIO import xlwt import base64 class ExportCsvReportStock(models.TransientModel...
null
sale_purchase_xls_report/wizard/export_csv_report_stock.py
export_csv_report_stock.py
py
15,309
python
en
code
null
code-starcoder2
76
[ { "api_name": "odoo.models.TransientModel", "line_number": 11, "usage_type": "attribute" }, { "api_name": "odoo.models", "line_number": 11, "usage_type": "name" }, { "api_name": "odoo.fields.Binary", "line_number": 14, "usage_type": "call" }, { "api_name": "odoo.f...
543789768
from collections import Counter class Solution: def hasGroupsSizeX(self, deck) -> bool: d = Counter(deck) if len(deck) <= 1: return False res = list(d.values()) minnum = min(res) if minnum == 1: return False for j in ra...
null
卡牌分组.py
卡牌分组.py
py
583
python
en
code
null
code-starcoder2
76
[ { "api_name": "collections.Counter", "line_number": 7, "usage_type": "call" } ]
275143748
#!/usr/bin/env python3 """ ------------------------------------------------------------------------------- Classes to implement a Hidden Markov Model (HMM). ------------------------------------------------------------------------------- """ import numpy as np import csv import time import glob import sys # fo...
null
hmm.py
hmm.py
py
45,720
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.log", "line_number": 25, "usage_type": "call" }, { "api_name": "numpy.sum", "line_number": 25, "usage_type": "call" }, { "api_name": "numpy.exp", "line_number": 25, "usage_type": "call" }, { "api_name": "numpy.ones", "line_number": 53, ...
109898398
from setuptools import setup, find_packages from os import path HERE = path.abspath(path.dirname(__file__)) LONG_DESCRIPTION = '' with open(path.join(HERE, 'README.md')) as readme_file: LONG_DESCRIPTION = readme_file.read() setup( name='whotracksme', version='2017.11', description='Learn about track...
null
setup.py
setup.py
py
1,861
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.abspath", "line_number": 4, "usage_type": "call" }, { "api_name": "os.path", "line_number": 4, "usage_type": "name" }, { "api_name": "os.path.dirname", "line_number": 4, "usage_type": "call" }, { "api_name": "os.path.join", "line_number"...
527263908
from django import forms from tracker.models import EmergencyRequest from tracker.constants import ADDITIONAL_PERSONS_TF class EmergencyRequestForm(forms.ModelForm): additional_persons = forms.CharField(widget=forms.Textarea, label="Is there anyone else with you?", help_text=ADDITIONAL_PERSONS_TF, required=False)...
null
tracker/forms/emergency_request_form.py
emergency_request_form.py
py
810
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.forms.ModelForm", "line_number": 6, "usage_type": "attribute" }, { "api_name": "django.forms", "line_number": 6, "usage_type": "name" }, { "api_name": "django.forms.CharField", "line_number": 7, "usage_type": "call" }, { "api_name": "django.f...
199364614
import asyncio import os from aiogram import Bot from aiogram.contrib.fsm_storage.memory import MemoryStorage from aiogram.dispatcher import Dispatcher from aiogram.dispatcher import FSMContext from aiogram.types import ReplyKeyboardMarkup, KeyboardButton from aiogram import Bot, Dispatcher, types from aiogram.contri...
null
main.py
main.py
py
8,459
python
en
code
null
code-starcoder2
76
[ { "api_name": "aiogram.Bot", "line_number": 22, "usage_type": "call" }, { "api_name": "aiogram.contrib.fsm_storage.memory.MemoryStorage", "line_number": 23, "usage_type": "call" }, { "api_name": "aiogram.Dispatcher", "line_number": 24, "usage_type": "call" }, { "a...
594478420
import pathlib from setuptools import setup # The directory containing this file HERE = pathlib.Path(__file__).parent # The text of the README file README = (HERE / "README.md").read_text() setup( name="tourist-maker", version="1.0.0", description="Tourist greeter", long_description=README, long_...
null
setup.py
setup.py
py
799
python
en
code
null
code-starcoder2
76
[ { "api_name": "pathlib.Path", "line_number": 5, "usage_type": "call" }, { "api_name": "setuptools.setup", "line_number": 9, "usage_type": "call" } ]
30679763
import os import argparse from glob import glob from bilm.training import tag, load_options_latest_checkpoint, load_vocab from bilm.data import LMDataset, BidirectionalLMDataset os.environ['TF_CPP_MIN_LOG_LEVEL'] = '4' def main(args): print(args) print('-' * 100) print('Loading models and options...') ...
null
bin/run_tag.py
run_tag.py
py
1,658
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.environ", "line_number": 8, "usage_type": "attribute" }, { "api_name": "bilm.training.load_options_latest_checkpoint", "line_number": 14, "usage_type": "call" }, { "api_name": "bilm.training.load_vocab", "line_number": 21, "usage_type": "call" }, { ...
466887704
import numpy as np from math import pi, sin, cos, tan import matplotlib.pyplot as plt dist_meas_percent_tolerance = 0.2 wall_length = 1.25 xlims = np.array([-wall_length/2, wall_length/2]) ylims = np.array([-wall_length/2, wall_length/2]) position = np.array([0.5*(max(xlims) + min(xlims)), 0.5*(max(ylims) + min(ylims...
null
test_scripts/geo_test2.py
geo_test2.py
py
12,471
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.array", "line_number": 8, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 9, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 10, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 11...
434575839
import heapq from collections import deque def main(path): with open(path) as infile: line = infile.read().split('\n') rawmap = list(map(list, line)) portals = dict() # Checks the 4 outer edges, -1 to flag as outer portal # Top Edge for x in range(len(rawmap[0])): mapchar = rawmap[0][x] if (mapchar.isa...
null
2019_original/Day 20/d_20.py
d_20.py
py
5,569
python
en
code
null
code-starcoder2
76
[ { "api_name": "collections.deque", "line_number": 110, "usage_type": "call" }, { "api_name": "heapq.heappush", "line_number": 150, "usage_type": "call" }, { "api_name": "heapq.heappop", "line_number": 152, "usage_type": "call" }, { "api_name": "heapq.heappush", ...
418489848
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
null
aria/orchestrator/workflow_runner.py
workflow_runner.py
py
6,947
python
en
code
null
code-starcoder2
76
[ { "api_name": "context.workflow.WorkflowContext", "line_number": 73, "usage_type": "call" }, { "api_name": "workflows.executor.process.ProcessExecutor", "line_number": 87, "usage_type": "call" }, { "api_name": "workflows.core.engine.Engine", "line_number": 88, "usage_type...
389348142
from django.conf.urls import patterns, include, url from django.conf import settings from django.conf.urls.static import static from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: url(r'^$', 'apps.main.views.index', name='index'), url(r'^topic/(?P<topic_id>\d+)$', ...
null
source/urls.py
urls.py
py
1,034
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.contrib.admin.autodiscover", "line_number": 6, "usage_type": "call" }, { "api_name": "django.contrib.admin", "line_number": 6, "usage_type": "name" }, { "api_name": "django.conf.urls.patterns", "line_number": 8, "usage_type": "call" }, { "api...
529793250
''' Created on Feb 29, 2020 @author: Siddhartha ''' import getopt import socket import sys from labs.common.ActuatorData import ActuatorData from labs.common.SensorData import SensorData from labs.common.ConfigUtil import ConfigUtil import logging from coapthon.client.helperclient import HelperClient from coapthon.me...
null
apps/labs/module07/CoapClientConnector.py
CoapClientConnector.py
py
2,273
python
en
code
null
code-starcoder2
76
[ { "api_name": "labs.common.ConfigUtil.ConfigUtil", "line_number": 18, "usage_type": "call" }, { "api_name": "coapthon.client.helperclient.HelperClient", "line_number": 23, "usage_type": "call" }, { "api_name": "coapthon.messages.response", "line_number": 42, "usage_type":...
346540008
#-*-coding=utf-8-*- from PIL import Image import requests from lxml import etree from io import BytesIO import pytesseract def download(url,retry=3): try: r=requests.get(url=url) except Exception as e: print(e) if retry <0: return None else: download(url,retry-1) return r.text def getCaptcha(): url...
null
datamining/chapter7.py
chapter7.py
py
917
python
en
code
null
code-starcoder2
76
[ { "api_name": "requests.get", "line_number": 11, "usage_type": "call" }, { "api_name": "lxml.etree.HTML", "line_number": 24, "usage_type": "call" }, { "api_name": "lxml.etree", "line_number": 24, "usage_type": "name" }, { "api_name": "io.BytesIO", "line_number...
217511575
#Definition for singly-linked list. from typing import List class Solution: def minMeetingRooms(self, S: List[List[int]]) -> int: if S is None or len(S) == 0: return 0 S.sort(key=lambda se: se[0]) max_room = 1 cur_room = 1 dup_room = 1 dup_s = dup_e = None pr...
null
lc/mdm/20190813_mdm_253_meeting_room_ii.py
20190813_mdm_253_meeting_room_ii.py
py
1,463
python
en
code
null
code-starcoder2
76
[ { "api_name": "typing.List", "line_number": 5, "usage_type": "name" } ]
275260741
import requests from PIL import Image, ImageOps from flask import request, Response from foundation import create_app from tests.artwork_classification import recognize from tests.primary_color_detection import crop_image, get_primary_color app = create_app('/home/danielng/Projects/the-eye/config.py') @app.route('/...
null
Back-end/art-in-eyes-master/app.py
app.py
py
1,706
python
en
code
null
code-starcoder2
76
[ { "api_name": "foundation.create_app", "line_number": 9, "usage_type": "call" }, { "api_name": "flask.request.files.get", "line_number": 14, "usage_type": "call" }, { "api_name": "flask.request.files", "line_number": 14, "usage_type": "attribute" }, { "api_name": ...
406967227
# -*- coding: utf-8 -*- from enum import Enum from .config_role import RoleName class ScreenName(Enum): """ Screen name define """ CreateCourse = 2 Course = 3 User = 4 Statistical = 5 Master = 6 ManagerStastical = 7 """ Screen name and role name mapping """ config_menus_roles...
null
Source/remi/default/config/config_menu.py
config_menu.py
py
1,417
python
en
code
null
code-starcoder2
76
[ { "api_name": "enum.Enum", "line_number": 7, "usage_type": "name" }, { "api_name": "config_role.RoleName.Admin", "line_number": 22, "usage_type": "attribute" }, { "api_name": "config_role.RoleName", "line_number": 22, "usage_type": "name" }, { "api_name": "config_...
880095
import cv2 import pytesseract pytesseract.pytesseract.tesseract_cmd = "C:\\Program Files\\Tesseract-OCR\\tesseract.exe" img = cv2.imread('1.png') img = cv2.cvtColor(img,cv2.COLOR_BGR2RGB) # print(pytesseract.image_to_string(img)) # Detecting Characters # print(pytesseract.image_to_boxes(img)) # hImg,wImg,_ = img.shap...
null
TessaractOCR/textDetection.py
textDetection.py
py
2,011
python
en
code
null
code-starcoder2
76
[ { "api_name": "pytesseract.pytesseract", "line_number": 4, "usage_type": "attribute" }, { "api_name": "cv2.imread", "line_number": 5, "usage_type": "call" }, { "api_name": "cv2.cvtColor", "line_number": 6, "usage_type": "call" }, { "api_name": "cv2.COLOR_BGR2RGB",...
5853654
from django.shortcuts import render, redirect from django.contrib import messages from django.db.models import Q from .models import User, Trip import bcrypt # Create your views here. def main(request): return render(request, 'main.html') def register(request): print(request.POST) resultFromValidator = User.objec...
null
python_stack/django/django_full_stack/travel_buddy1/travelApp/views.py
views.py
py
3,053
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.shortcuts.render", "line_number": 10, "usage_type": "call" }, { "api_name": "models.User.objects.validateUser", "line_number": 14, "usage_type": "call" }, { "api_name": "models.User.objects", "line_number": 14, "usage_type": "attribute" }, { ...
295629147
from argparse import ArgumentParser import os import glob from datetime import datetime import shutil import yaml from tqdm import tqdm import torch import numpy as np from collections import defaultdict import h5py import getpass from sklearn.manifold import TSNE import data import model import probe import regimen ...
null
structural-probes/extract.py
extract.py
py
6,306
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.save", "line_number": 30, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 30, "usage_type": "call" }, { "api_name": "os.path", "line_number": 30, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_number"...
524476011
# -*- coding: utf-8 -*- # # libchannels - update channels management library # Copyright (C) 2015 Eugenio "g7" Paolantonio # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # versi...
null
libchannels/updates.py
updates.py
py
10,737
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.getLogger", "line_number": 30, "usage_type": "call" }, { "api_name": "apt_pkg.config.set", "line_number": 35, "usage_type": "call" }, { "api_name": "apt_pkg.config", "line_number": 35, "usage_type": "attribute" }, { "api_name": "apt_pkg.conf...
325560406
"""empty message Revision ID: 61c292cb641e Revises: 837ceb94bac6 Create Date: 2017-06-10 14:55:15.069845 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision = '61c292cb641e' down_revision = '837ceb94bac6' branch_labels = None depe...
null
migrations/versions/61c292cb641e_.py
61c292cb641e_.py
py
796
python
en
code
null
code-starcoder2
76
[ { "api_name": "alembic.op.drop_index", "line_number": 21, "usage_type": "call" }, { "api_name": "alembic.op", "line_number": 21, "usage_type": "name" }, { "api_name": "alembic.op.drop_column", "line_number": 22, "usage_type": "call" }, { "api_name": "alembic.op", ...
562192137
#file = open("input-crisscross.txt", "r").read() import requests file = requests.get('https://s3-eu-west-1.amazonaws.com/knowit-julekalender-2018/input-bounding-crisscross.txt').text #file = "2H2F2H1B3V" h, f, b, v = 0, 0, 0, 0 for i in range(1, len(file), 2): c = file[i] num = int(file[i-1]) if c == 'H':...
null
Informatikk/Bachelor/julekalender_knowit/11/11.py
11.py
py
456
python
en
code
null
code-starcoder2
76
[ { "api_name": "requests.get", "line_number": 4, "usage_type": "call" } ]
147831995
import numpy as np import cv2 from matplotlib import pyplot as plt import time from sklearn.svm import SVC from sklearn.externals import joblib class ImageProcessor: width = 8 height = 9 # Hough Circles parameters ir = 2 mindist = 85 param1 = 50 param2 = 40 minr = 40 maxr = 48 ...
null
ImageProcessing.py
ImageProcessing.py
py
8,830
python
en
code
null
code-starcoder2
76
[ { "api_name": "cv2.VideoCapture", "line_number": 32, "usage_type": "call" }, { "api_name": "cv2.CAP_PROP_FRAME_WIDTH", "line_number": 35, "usage_type": "attribute" }, { "api_name": "cv2.CAP_PROP_FRAME_HEIGHT", "line_number": 36, "usage_type": "attribute" }, { "api...
186016086
import json from utils import log from utils import current_time def save(data, path): s = json.dumps(data, indent=2, ensure_ascii=False) with open(path, 'w+', encoding='utf-8') as f: return f.write(s) def load(path): with open(path, 'r', encoding='utf-8') as f: s = f.read() ret...
null
model.py
model.py
py
4,457
python
en
code
null
code-starcoder2
76
[ { "api_name": "json.dumps", "line_number": 8, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 16, "usage_type": "call" }, { "api_name": "utils.log", "line_number": 115, "usage_type": "call" } ]
201138192
# -*- coding=utf8 -*- import requests from bs4 import BeautifulSoup def qiushibaike(): content = requests.get('http://www.qiushibaike.com').content soup = BeautifulSoup(content, 'html.parser') for div in soup.find_all('div', {'class' : 'content'}): print(div.text.strip()) def ustcjob(): he...
null
python爬虫/糗事百科爬取(requests+bs4).py
糗事百科爬取(requests+bs4).py
py
1,033
python
en
code
null
code-starcoder2
76
[ { "api_name": "requests.get", "line_number": 8, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 9, "usage_type": "call" }, { "api_name": "requests.get", "line_number": 19, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "li...