code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import glob
import os
# os.environ["IMAGEIO_FFMPEG_EXE"] = "C:/ffmpeg-4.4.1-essentials_build/ffmpeg-4.4.1-essentials_build/bin"
import re
import sys
import urllib
from tkinter import (BOTH, RIGHT, YES, Button, Entry, Label, Listbox, Menu,
Scrollbar, StringVar, Tk, Y)
from tkinter import messagebox ... | [
"tkinter.messagebox.askyesnocancel",
"tkinter.Button",
"tkinter.Label",
"os.remove",
"tkinter.Entry",
"tkinter.StringVar",
"os.path.isdir",
"tkinter.messagebox.showinfo",
"glob.glob",
"tkinter.Menu",
"tkinter.messagebox.showerror",
"os.path.dirname",
"validators.url",
"re.sub",
"pytube.Y... | [((453, 457), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (455, 457), False, 'from tkinter import BOTH, RIGHT, YES, Button, Entry, Label, Listbox, Menu, Scrollbar, StringVar, Tk, Y\n'), ((5406, 5550), 'tkinter.Label', 'Label', (['ws'], {'anchor': '"""w"""', 'fg': '"""#f5453c"""', 'text': '"""Bentornato su "YT Downloader - Sc... |
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
import glob, random
import sklearn
from sklearn.decomposition import PCA
from xgboost.sklearn import XGBRegressor
from sklearn.tr... | [
"sklearn.preprocessing.LabelEncoder",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.isin",
"catboost.CatBoostRegressor",
"os.path.abspath",
"numpy.load"
] | [((691, 705), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (703, 705), False, 'from sklearn.preprocessing import LabelEncoder\n'), ((828, 862), 'pandas.read_csv', 'pd.read_csv', (["(folder + '/Train.csv')"], {}), "(folder + '/Train.csv')\n", (839, 862), True, 'import pandas as pd\n'), ((2214,... |
import math
def ipno2ipadd(ipno):
if math.isnan(ipno):
ipno = 0
w = int ( ipno / 16777216 ) % 256
x = int ( ipno / 65536 ) % 256
y = int ( ipno / 256 ) % 256
z = int ( ipno ) % 256
return "{}.{}.{}.{}".format(w,x,y,z)
def ipadd2ipno(ipadd):
w,x,y,z = ipadd.split('.... | [
"math.isnan"
] | [((41, 57), 'math.isnan', 'math.isnan', (['ipno'], {}), '(ipno)\n', (51, 57), False, 'import math\n')] |
# Copyright 2020 MongoDB Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribu... | [
"collections.defaultdict",
"SCons.Action.FunctionAction",
"SCons.Util.is_String"
] | [((1217, 1234), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1228, 1234), False, 'from collections import defaultdict\n'), ((1507, 1533), 'SCons.Util.is_String', 'SCons.Util.is_String', (['file'], {}), '(file)\n', (1527, 1533), False, 'import SCons\n'), ((1847, 1878), 'SCons.Util.is_String', '... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.cloud.asset_v1.proto import (
asset_service_pb2 as google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2,
)
from google.longrunning import (
operations_pb2 as google_dot_longrunning_dot_operations__pb2,
)
f... | [
"grpc.method_handlers_generic_handler",
"grpc.unary_unary_rpc_method_handler"
] | [((8440, 8539), 'grpc.method_handlers_generic_handler', 'grpc.method_handlers_generic_handler', (['"""google.cloud.asset.v1.AssetService"""', 'rpc_method_handlers'], {}), "('google.cloud.asset.v1.AssetService',\n rpc_method_handlers)\n", (8476, 8539), False, 'import grpc\n'), ((5953, 6240), 'grpc.unary_unary_rpc_met... |
from datetime import datetime, timedelta
import logging
from flask import Blueprint, abort, render_template, request, redirect
from flask_oauthlib.provider import OAuth2Provider
from oauthlib.common import generate_token as generate_random_token
from flask_login import current_user, login_required
from auth.login.bas... | [
"flask.request.args.get",
"datetime.datetime.utcnow",
"json.dumps",
"flask_oauthlib.provider.OAuth2Provider",
"datetime.timedelta",
"flask.Blueprint",
"logging.error",
"oauthlib.common.generate_token"
] | [((456, 487), 'flask.Blueprint', 'Blueprint', (['"""oauth_bp"""', '__name__'], {}), "('oauth_bp', __name__)\n", (465, 487), False, 'from flask import Blueprint, abort, render_template, request, redirect\n'), ((496, 512), 'flask_oauthlib.provider.OAuth2Provider', 'OAuth2Provider', ([], {}), '()\n', (510, 512), False, 'f... |
from re import compile as re_compile
from urllib.parse import parse_qs, quote_plus, urlencode, urlparse, urlunparse
from marshmallow import ValidationError
from .base_validators import BaseError, BaseValidator
class ValidError(BaseError):
@classmethod
def field_is_missing(cls, field: str, field_name: str) -... | [
"urllib.parse.urlparse",
"marshmallow.ValidationError",
"re.compile",
"urllib.parse.urlunparse",
"urllib.parse.parse_qs"
] | [((3135, 3259), 'marshmallow.ValidationError', 'ValidationError', (['f"""{obj_name} с {field}="{value}" уже существует. Запрещено добавлять дубликаты."""', 'obj_name', 'field'], {}), '(\n f\'{obj_name} с {field}="{value}" уже существует. Запрещено добавлять дубликаты.\'\n , obj_name, field)\n', (3150, 3259), Fals... |
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2014 Mag. <NAME> All rights reserved
# Glasauergasse 32, A--1130 Wien, Austria. <EMAIL>
# #*** <License> ************************************************************#
# This module is part of the package CNDB.OMP.
#
# This module is licensed under the terms of the BSD 3-Cla... | [
"_CNDB.CNDB.OMP._Export",
"_TFL.Regexp.Regexp"
] | [((3420, 3441), '_CNDB.CNDB.OMP._Export', 'CNDB.OMP._Export', (['"""*"""'], {}), "('*')\n", (3436, 3441), False, 'from _CNDB import CNDB\n'), ((3224, 3257), '_TFL.Regexp.Regexp', 'Regexp', (["'^[\\x00-ÿ]*$'", 're.VERBOSE'], {}), "('^[\\x00-ÿ]*$', re.VERBOSE)\n", (3230, 3257), False, 'from _TFL.Regexp import Regexp, re\... |
#!/usr/bin/env python3
import sys
from PyQt5.QtWidgets import QApplication
from capybara_tw.app import MainWindow
__version__ = '0.1'
__application_name__ = 'Capybara Translation Workbench'
__organization_name__ = 'Capybara Translation'
def run():
app_ = QApplication(sys.argv)
app_.setApplicationName(__appli... | [
"capybara_tw.app.MainWindow",
"PyQt5.QtWidgets.QApplication"
] | [((262, 284), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (274, 284), False, 'from PyQt5.QtWidgets import QApplication\n'), ((444, 456), 'capybara_tw.app.MainWindow', 'MainWindow', ([], {}), '()\n', (454, 456), False, 'from capybara_tw.app import MainWindow\n')] |
import requests
from django.urls import reverse
from django.test import TestCase
from django.db.models import Count
from django.shortcuts import get_object_or_404
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Car, Rate
from car.serializers import CarSerializer, P... | [
"core.models.Rate.objects.filter",
"car.serializers.CarSerializer",
"core.models.Car.objects.filter",
"django.db.models.Count",
"core.models.Rate.objects.create",
"django.shortcuts.get_object_or_404",
"core.models.Car.objects.create",
"car.serializers.PopularCarSerializer",
"requests.get",
"rest_f... | [((351, 375), 'django.urls.reverse', 'reverse', (['"""car:cars-list"""'], {}), "('car:cars-list')\n", (358, 375), False, 'from django.urls import reverse\n'), ((394, 421), 'django.urls.reverse', 'reverse', (['"""car:popular-list"""'], {}), "('car:popular-list')\n", (401, 421), False, 'from django.urls import reverse\n'... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import copy
import json
import os
from typing import Any, Dict, List, Optional, Sequence
from iopath.common.f... | [
"os.getenv",
"os.path.join",
"os.path.isfile",
"copy.deepcopy",
"json.load"
] | [((1516, 1550), 'os.getenv', 'os.getenv', (['"""CO3D_DATASET_ROOT"""', '""""""'], {}), "('CO3D_DATASET_ROOT', '')\n", (1525, 1550), False, 'import os\n'), ((4409, 4474), 'os.path.join', 'os.path.join', (['dataset_root', 'category', 'f"""eval_batches_{task}.json"""'], {}), "(dataset_root, category, f'eval_batches_{task}... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
class RNN(nn.Module):
def __init__(self, num_layers, hidden_size, input_size):
super(RNN, self).__init__()
self.num_layers = num_layers
self.hidden_size = hidden_size
self.encoder = nn.Emb... | [
"torch.nn.Dropout",
"torch.nn.LSTM",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.Embedding"
] | [((314, 371), 'torch.nn.Embedding', 'nn.Embedding', (['input_size', 'self.hidden_size'], {'padding_idx': '(0)'}), '(input_size, self.hidden_size, padding_idx=0)\n', (326, 371), True, 'import torch.nn as nn\n'), ((393, 510), 'torch.nn.LSTM', 'nn.LSTM', ([], {'input_size': 'self.hidden_size', 'hidden_size': 'self.hidden_... |
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from brambling.utils.payment import dwolla_update_tokens
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option(
'--days',
action='store',
des... | [
"brambling.utils.payment.dwolla_update_tokens",
"optparse.make_option",
"django.core.management.base.CommandError"
] | [((737, 763), 'brambling.utils.payment.dwolla_update_tokens', 'dwolla_update_tokens', (['days'], {}), '(days)\n', (757, 763), False, 'from brambling.utils.payment import dwolla_update_tokens\n'), ((242, 372), 'optparse.make_option', 'make_option', (['"""--days"""'], {'action': '"""store"""', 'dest': '"""days"""', 'defa... |
# Everyone did everything here
## JSON, Main UI, Keybinds, 'Backend' mostly by Ethan
## Refractoring, 'Backend' by Jerick
## Everything else + Starting Point by Granwyn
import tkinter as tk
from tkinter import ttk
import os
from tkinter import font
import json
from PIL import ImageTk, Image
from tkinter import Menu
im... | [
"tkinter.ttk.Button",
"components.wrappedLabel.WrappingLabel",
"tkinter.ttk.Scrollbar",
"tkinter.Canvas",
"tkinter.ttk.Treeview",
"tkinter.ttk.Frame",
"tkinter.Menu",
"tkinter.ttk.Checkbutton",
"tkinter.Image",
"tools.periodicTable.search",
"tkinter.ttk.PanedWindow",
"PIL.Image.open",
"os.pa... | [((567, 584), 'os.chdir', 'os.chdir', (['ROOTDIR'], {}), '(ROOTDIR)\n', (575, 584), False, 'import os\n'), ((597, 632), 'os.path.join', 'os.path.join', (['ROOTDIR', '""".data.json"""'], {}), "(ROOTDIR, '.data.json')\n", (609, 632), False, 'import os\n'), ((647, 700), 'os.path.join', 'os.path.join', (['ROOTDIR', '"""src... |
import traceback
from pathlib import Path
import discord
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from discord.ext import commands, fancyhelp
from pytz import utc
from testbot import __version__
MAIN_GUILD_ID = 845688627265536010
STDOUT_CHANNEL_ID = 845691044527210515
class Bot(commands.Bot):
... | [
"discord.ext.fancyhelp.EmbeddedHelpCommand",
"pathlib.Path",
"discord.Intents.all",
"apscheduler.schedulers.asyncio.AsyncIOScheduler",
"discord.Activity",
"traceback.print_exc"
] | [((565, 583), 'apscheduler.schedulers.asyncio.AsyncIOScheduler', 'AsyncIOScheduler', ([], {}), '()\n', (581, 583), False, 'from apscheduler.schedulers.asyncio import AsyncIOScheduler\n'), ((2039, 2060), 'traceback.print_exc', 'traceback.print_exc', ([], {}), '()\n', (2058, 2060), False, 'import traceback\n'), ((779, 80... |
"""Added a flag to commands if it should be run through the banphrases
Revision ID: 8feba263d722
Revises: a6f9b5c3ba83
Create Date: 2016-05-24 22:04:49.803097
"""
# revision identifiers, used by Alembic.
revision = '8feba263d722'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
from alembic import op
... | [
"sqlalchemy.Boolean",
"alembic.op.drop_column"
] | [((664, 718), 'alembic.op.drop_column', 'op.drop_column', (['"""tb_command"""', '"""run_through_banphrases"""'], {}), "('tb_command', 'run_through_banphrases')\n", (678, 718), False, 'from alembic import op\n'), ((493, 505), 'sqlalchemy.Boolean', 'sa.Boolean', ([], {}), '()\n', (503, 505), True, 'import sqlalchemy as s... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Common functions used by the metadata encoding scripts"""
import json
def load_metadata_dicts(metadata_files):
metadata_dicts = []
for metadata_file in metadata_files:
with open(metadata_file, "r") as fp:
m... | [
"json.load",
"json.dump"
] | [((606, 648), 'json.dump', 'json.dump', (['metadata_dicts[i]', 'fp'], {'indent': '(4)'}), '(metadata_dicts[i], fp, indent=4)\n', (615, 648), False, 'import json\n'), ((341, 354), 'json.load', 'json.load', (['fp'], {}), '(fp)\n', (350, 354), False, 'import json\n')] |
from MELC.utils.myDatasets import generate_workingRaw_from_raw, MELCStructureDataset
import numpy as np
import tifffile as tiff
from MELC.utils.registration_daria import register
import matplotlib.pyplot as plt
import cv2
from MELC.utils.Files import create_folder
from skimage import img_as_float, img_as_uint
from MELC... | [
"MELC.utils.registration_daria.register",
"MELC.utils.myDatasets.MELCStructureDataset",
"tifffile.imread",
"argparse.ArgumentParser",
"skimage.img_as_uint",
"numpy.where",
"numpy.int16",
"os.path.join",
"MELC.utils.Files.create_folder",
"tifffile.imsave",
"numpy.percentile",
"MELC.utils.myData... | [((550, 615), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run Training of Mask R-CNN"""'}), "(description='Run Training of Mask R-CNN')\n", (573, 615), False, 'import argparse\n'), ((1600, 1627), 'MELC.utils.myDatasets.MELCStructureDataset', 'MELCStructureDataset', (['w_raw'], {}), '(... |
from itertools import chain
from random import choice
from lib.durak.exceptions import IllegalAction
class AI:
class CannotPerform(IllegalAction):
pass
def __init__(self, *, game):
self._game = game
def perform_action(self, *, player):
"""
Have the user perform a random ... | [
"itertools.chain",
"random.choice"
] | [((894, 1112), 'itertools.chain', 'chain', (["([('attacked', self._attack)] * 3 * not_defending)", "([('defended', self._defend)] * 9 * defending)", "([('gave_up', self._give_up)] * 1 * defending)", "([('yielded_attack', self._yield_attack)] * 7 * not_defending)"], {}), "([('attacked', self._attack)] * 3 * not_defendin... |
import numpy as np
from utils import C_bohr
__all__ = ['Grid']
class Grid:
def __init__(self, npoints, rgrid, solver='sinc', alpha=0.0, rbar=0.0):
self.ngrid = npoints
self.rmin = rgrid[0] / C_bohr
self.rmax = rgrid[1] / C_bohr
rbar = rbar / C_bohr
self.solver = solver.l... | [
"numpy.ones",
"numpy.power",
"numpy.sinc",
"numpy.zeros",
"numpy.linspace",
"numpy.empty"
] | [((346, 365), 'numpy.ones', 'np.ones', (['self.ngrid'], {}), '(self.ngrid)\n', (353, 365), True, 'import numpy as np\n'), ((384, 404), 'numpy.zeros', 'np.zeros', (['self.ngrid'], {}), '(self.ngrid)\n', (392, 404), True, 'import numpy as np\n'), ((1523, 1602), 'numpy.linspace', 'np.linspace', (['self.rmin', 'self.rmax']... |
import random
class Codec:
base62 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
baseurl = 'http://tinyurl.com/'
tinyTolong = {'1':'1'}
longTotiny = {}
def encode(self, longUrl):
"""Encodes a URL to a shortened URL.
:type longUrl: str
:rtype: str
... | [
"random.choice"
] | [((516, 543), 'random.choice', 'random.choice', (['Codec.base62'], {}), '(Codec.base62)\n', (529, 543), False, 'import random\n')] |
import requests
from bs4 import BeautifulSoup
import os
import shutil
import threading
import uuid
import time
import sys
import helper
import threadpool
import mzitu_frame
def __task(url):
#print(url)
while not mzitu_frame.DownloadImage(url):pass
def DownloadImagePage(url):
bs = helper.GetBs(url)
#... | [
"helper.GetBs",
"sys.exit",
"mzitu_frame.DownloadImage",
"threadpool.ThreadPool",
"threadpool.WorkRequest"
] | [((297, 314), 'helper.GetBs', 'helper.GetBs', (['url'], {}), '(url)\n', (309, 314), False, 'import helper\n'), ((223, 253), 'mzitu_frame.DownloadImage', 'mzitu_frame.DownloadImage', (['url'], {}), '(url)\n', (248, 253), False, 'import mzitu_frame\n'), ((428, 452), 'threadpool.ThreadPool', 'threadpool.ThreadPool', (['(8... |
from inspect import isawaitable
from sanic import Sanic
from sanic.response import redirect, json, text
from sanic.exceptions import SanicException
from sanic_plugin_toolkit import SanicPluginRealm
from sanic_oauthlib.client import oauthclient
def create_oauth(app):
realm = SanicPluginRealm(app)
try:
... | [
"sanic.response.json",
"inspect.isawaitable",
"sanic.Sanic",
"sanic.exceptions.SanicException",
"sanic_plugin_toolkit.SanicPluginRealm",
"sanic.response.text"
] | [((281, 302), 'sanic_plugin_toolkit.SanicPluginRealm', 'SanicPluginRealm', (['app'], {}), '(app)\n', (297, 302), False, 'from sanic_plugin_toolkit import SanicPluginRealm\n'), ((3251, 3269), 'sanic.Sanic', 'Sanic', (['"""test_main"""'], {}), "('test_main')\n", (3256, 3269), False, 'from sanic import Sanic\n'), ((2746, ... |
import os
import glob
from tqdm import tqdm
import argparse
from PIL import Image
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.utils.data as data
from torchvision import transforms, datasets
from networks.dan import DAN
def parse_args():
parser = argparse.ArgumentParse... | [
"torch.nn.CrossEntropyLoss",
"pandas.read_csv",
"torch.max",
"torch.pow",
"torch.eq",
"torch.cuda.is_available",
"torch.arange",
"os.path.exists",
"argparse.ArgumentParser",
"tqdm.tqdm.write",
"torchvision.datasets.ImageFolder",
"torch.nn.AdaptiveAvgPool2d",
"pandas.DataFrame",
"torchvisio... | [((298, 323), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (321, 323), False, 'import argparse\n'), ((5792, 5817), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (5815, 5817), False, 'import torch\n'), ((5972, 6025), 'networks.dan.DAN', 'DAN', ([], {'num_class': 'args... |
import os
import keyboard
banner = '''\u001b[34m____ ____ _ _ ___ ____ _ _ _ ____ ___ ____ ____ _ _ ____ ____ _ _
| | | |\/| |__] | | | | | |__| | |___ |__/ |\/| |__| |__/ |_/
|___ |__| | | |__] |__| |_|_| | | | |___ | \ | | | | | \ | \_ \u001b[37m'''
class Watermark():
def ... | [
"os.system",
"os._exit",
"keyboard.write",
"keyboard.is_pressed"
] | [((3586, 3641), 'os.system', 'os.system', (['"""cls & title [Combo Watermarker] By Dropout"""'], {}), "('cls & title [Combo Watermarker] By Dropout')\n", (3595, 3641), False, 'import os\n'), ((3917, 3941), 'keyboard.is_pressed', 'keyboard.is_pressed', (['"""1"""'], {}), "('1')\n", (3936, 3941), False, 'import keyboard\... |
#! /bin/python
import re
from sympy import exp, ln, sin, cos
from sympy.abc import x
from chebyshev.approximation import get_best_approximation
table_of_contents = []
function_entries = []
def generate_for_readme(approximation):
function_filename = re.sub(r'( |/)', '_', str(approximation.function))
approxim... | [
"sympy.exp",
"sympy.sin",
"sympy.ln",
"sympy.cos"
] | [((1590, 1596), 'sympy.exp', 'exp', (['x'], {}), '(x)\n', (1593, 1596), False, 'from sympy import exp, ln, sin, cos\n'), ((1667, 1676), 'sympy.ln', 'ln', (['(1 + x)'], {}), '(1 + x)\n', (1669, 1676), False, 'from sympy import exp, ln, sin, cos\n'), ((1809, 1815), 'sympy.cos', 'cos', (['x'], {}), '(x)\n', (1812, 1815), ... |
# Licensed under an MIT open source license - see LICENSE
'''
Test functions for VCA
'''
from unittest import TestCase
import numpy as np
import numpy.testing as npt
from ..statistics import VCA, VCA_Distance
from ._testing_data import \
dataset1, dataset2, computed_data, computed_distances
class testVCA(Test... | [
"numpy.testing.assert_almost_equal",
"numpy.allclose"
] | [((627, 682), 'numpy.allclose', 'np.allclose', (['self.tester.ps1D', "computed_data['vca_val']"], {}), "(self.tester.ps1D, computed_data['vca_val'])\n", (638, 682), True, 'import numpy as np\n'), ((858, 949), 'numpy.testing.assert_almost_equal', 'npt.assert_almost_equal', (['self.tester_dist.distance', "computed_distan... |
import FWCore.ParameterSet.Config as cms
from ElectroWeakAnalysis.ZMuMu.ZMuMuCategoriesSequences_cff import *
import copy
zPlots = cms.PSet(
histograms = cms.VPSet(
cms.PSet(
min = cms.untracked.double(0.0),
max = cms.untracked.double(200.0),
nbins = cms.untracked.int32(200),
name = cms.untra... | [
"FWCore.ParameterSet.Config.untracked.double",
"FWCore.ParameterSet.Config.untracked.string",
"FWCore.ParameterSet.Config.InputTag",
"copy.deepcopy",
"FWCore.ParameterSet.Config.untracked.int32"
] | [((4281, 4312), 'copy.deepcopy', 'copy.deepcopy', (['goodZToMuMuPlots'], {}), '(goodZToMuMuPlots)\n', (4294, 4312), False, 'import copy\n'), ((4340, 4371), 'FWCore.ParameterSet.Config.InputTag', 'cms.InputTag', (['"""goodZToMuMu2HLT"""'], {}), "('goodZToMuMu2HLT')\n", (4352, 4371), True, 'import FWCore.ParameterSet.Con... |
# Copyright 2019 Graphcore Ltd.
# coding=utf-8
import tensorflow as tf
from utils.optimisers import VcdRMSPropOptimizer
def vcd_lr_schedule(base_lr, current_step, total_steps, n_epoch, iter_timescale=15000, decay_factor=0.9):
"""
Exponential LR decay: lr <- lr * 0.9 applied every 15000 iterations
"""
... | [
"tensorflow.cast"
] | [((336, 387), 'tensorflow.cast', 'tf.cast', (['(current_step // iter_timescale)', 'tf.float32'], {}), '(current_step // iter_timescale, tf.float32)\n', (343, 387), True, 'import tensorflow as tf\n')] |
import sys
import os
if sys.platform == 'linux':
sys.path.append('/n/groups/patel/samuel/Aging')
elif sys.platform == 'darwin':
sys.path.append('/Users/samuel/Desktop/Aging')
from aging.model.environment_predictor import EnvironmentPredictor
name = sys.argv[1]
n_iter = int(sys.argv[2])
target_dataset = sy... | [
"sys.path.append",
"aging.model.environment_predictor.EnvironmentPredictor"
] | [((648, 735), 'aging.model.environment_predictor.EnvironmentPredictor', 'EnvironmentPredictor', (['name', '(-1)', 'n_splits', 'n_iter', 'target_dataset', 'input_dataset', '(-1)'], {}), '(name, -1, n_splits, n_iter, target_dataset,\n input_dataset, -1)\n', (668, 735), False, 'from aging.model.environment_predictor im... |
# coding=utf-8
from __future__ import absolute_import, division, print_function
import logging
import argparse
import os
import random
import numpy as np
from datetime import timedelta
import torch
import torch.distributed as dist
from tqdm import tqdm
from torch.utils.tensorboard import SummaryWriter
from apex imp... | [
"logging.getLogger",
"torch.nn.CrossEntropyLoss",
"argparse.ArgumentParser",
"torch.load",
"tqdm.tqdm",
"models.modeling.VisionTransformer",
"torch.argmax",
"torch.no_grad",
"utils.data_utils.get_loader",
"torch.device"
] | [((605, 632), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (622, 632), False, 'import logging\n'), ((1144, 1160), 'utils.data_utils.get_loader', 'get_loader', (['args'], {}), '(args)\n', (1154, 1160), False, 'from utils.data_utils import get_loader\n'), ((1312, 1452), 'tqdm.tqdm', 'tqdm... |
# Copyright (c) 2018 The Pooch Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
#
# This code is part of the Fatiando a Terra project (https://www.fatiando.org)
#
# pylint: disable=redefined-outer-name
"""
Test the hash calculation and checking functions.
""... | [
"pathlib.Path",
"os.path.join",
"pytest.importorskip",
"pytest.raises",
"tempfile.NamedTemporaryFile",
"os.remove"
] | [((1861, 1893), 'tempfile.NamedTemporaryFile', 'NamedTemporaryFile', ([], {'delete': '(False)'}), '(delete=False)\n', (1879, 1893), False, 'from tempfile import NamedTemporaryFile\n'), ((2656, 2688), 'tempfile.NamedTemporaryFile', 'NamedTemporaryFile', ([], {'delete': '(False)'}), '(delete=False)\n', (2674, 2688), Fals... |
# -*- coding:utf-8 -*-
import numpy as np
def sin_sin(x,y):
return 1000*abs(np.sin(x/2000*np.pi) + np.sin(y/2000.0*np.pi))+100
| [
"numpy.sin"
] | [((80, 104), 'numpy.sin', 'np.sin', (['(x / 2000 * np.pi)'], {}), '(x / 2000 * np.pi)\n', (86, 104), True, 'import numpy as np\n'), ((103, 129), 'numpy.sin', 'np.sin', (['(y / 2000.0 * np.pi)'], {}), '(y / 2000.0 * np.pi)\n', (109, 129), True, 'import numpy as np\n')] |
import codecs
from solthiruthi.dictionary import *
from tamil import wordutils
TVU, TVU_size = DictionaryBuilder.create(TamilVU)
ag, ag2 = wordutils.anagrams_in_dictionary(TVU)
with codecs.open("demo.txt", "w", "utf-8") as fp:
itr = 1
for k, c in ag:
v = ag2[k]
fp.write("%03d) %s\n" % (itr, " ... | [
"codecs.open",
"tamil.wordutils.anagrams_in_dictionary"
] | [((141, 178), 'tamil.wordutils.anagrams_in_dictionary', 'wordutils.anagrams_in_dictionary', (['TVU'], {}), '(TVU)\n', (173, 178), False, 'from tamil import wordutils\n'), ((184, 221), 'codecs.open', 'codecs.open', (['"""demo.txt"""', '"""w"""', '"""utf-8"""'], {}), "('demo.txt', 'w', 'utf-8')\n", (195, 221), False, 'im... |
import numpy as np
import datetime
import smtplib
import logging
import time
import csv
import cv2
print ("======================START======================")
all_count = 0 #Checking finding count
true_count = 0 #Checking detection count
#open result CSV file
file = open('./result/res_Insert_name.csv', 'w')
#... | [
"cv2.rectangle",
"time.clock",
"cv2.imshow",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.CascadeClassifier",
"time.time"
] | [((434, 494), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""haarcascade_frontalface_default.xml"""'], {}), "('haarcascade_frontalface_default.xml')\n", (455, 494), False, 'import cv2\n'), ((501, 520), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (517, 520), False, 'import cv2\n'), ((542, 55... |
"""
Scraping Tools
Provides all tools for getting data onto/off the pi and submitting back to google drive.
"""
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
import requests
import time
# for twint
import twint
import nest_asyncio
def download_file_from_google_drive(id, destination):
... | [
"twint.Config",
"requests.Session",
"pydrive.drive.GoogleDrive",
"time.sleep",
"pydrive.auth.GoogleAuth",
"twint.run.Search",
"nest_asyncio.apply"
] | [((388, 406), 'requests.Session', 'requests.Session', ([], {}), '()\n', (404, 406), False, 'import requests\n'), ((1590, 1602), 'pydrive.auth.GoogleAuth', 'GoogleAuth', ([], {}), '()\n', (1600, 1602), False, 'from pydrive.auth import GoogleAuth\n'), ((1625, 1643), 'pydrive.drive.GoogleDrive', 'GoogleDrive', (['gauth'],... |
from __future__ import division
import numpy as np
from path import Path
from imageio import imread
from skimage.transform import resize as imresize
from kitti_util import pose_from_oxts_packet, generate_depth_map, read_calib_file, transform_from_rot_trans
from datetime import datetime
class KittiRawLoader(object):
... | [
"numpy.eye",
"kitti_util.read_calib_file",
"numpy.reshape",
"numpy.genfromtxt",
"datetime.datetime.strptime",
"path.Path",
"numpy.array",
"numpy.dot",
"kitti_util.generate_depth_map",
"kitti_util.transform_from_rot_trans",
"numpy.zeros",
"numpy.cos",
"numpy.linalg.norm",
"imageio.imread",
... | [((6194, 6221), 'kitti_util.read_calib_file', 'read_calib_file', (['calib_file'], {}), '(calib_file)\n', (6209, 6221), False, 'from kitti_util import pose_from_oxts_packet, generate_depth_map, read_calib_file, transform_from_rot_trans\n'), ((6239, 6298), 'numpy.reshape', 'np.reshape', (["filedata['P_rect_' + scene_data... |
import pickle
import numpy as np
import feature_extraction as fe
""" source : https://www.census.gov/quickfacts/fact/table/alleghenycountypennsylvania/PST045216 """
CURR_YEAR = 2015
# gender
FEMALE_PERCENT = 0.517 # 4327
# MALE = 0.483 # 3134
# age
# BELOW_18 = 0.189 # 0
OVER_65_PERCENT = 0.18 # 4353
# OTHER = 0.631 #... | [
"numpy.random.randint"
] | [((3692, 3712), 'numpy.random.randint', 'np.random.randint', (['(2)'], {}), '(2)\n', (3709, 3712), True, 'import numpy as np\n')] |
# !/usr/bin/env python
# -- coding: utf-8 --
# @Author zengxiaohui
# Datatime:8/20/2021 8:39 AM
# @File:knn
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn import datasets
X, y = datasets.load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = t... | [
"sklearn.datasets.load_iris",
"sklearn.model_selection.train_test_split",
"sklearn.neighbors.KNeighborsClassifier"
] | [((248, 283), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (266, 283), False, 'from sklearn import datasets\n'), ((319, 372), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.4)', 'random_state': '(0)'}), '(X, y,... |
#!/usr/bin/python3
from lab01_authserver_app.oauthclient import *
import json
import requests
import time
import requests
import logging
import http.client
http.client.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages... | [
"logging.basicConfig",
"logging.getLogger"
] | [((203, 224), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (222, 224), False, 'import logging\n'), ((284, 330), 'logging.getLogger', 'logging.getLogger', (['"""requests.packages.urllib3"""'], {}), "('requests.packages.urllib3')\n", (301, 330), False, 'import logging\n'), ((225, 244), 'logging.getLogg... |
# Copyright 2015 OpenStack Foundation
# 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... | [
"tempest.lib.common.utils.data_utils.rand_name",
"tempest.lib.decorators.idempotent_id",
"oslo_log.log.getLogger"
] | [((791, 818), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (808, 818), True, 'from oslo_log import log as logging\n'), ((1877, 1941), 'tempest.lib.decorators.idempotent_id', 'decorators.idempotent_id', (['"""dc2f2f46-0577-4e2a-b35d-3c8c8bbce5bf"""'], {}), "('dc2f2f46-0577-4e2a-b35d... |
#!/usr/bin/env python3
"""
Check that PEP8 format is followed
Author: <NAME>
Email: <EMAIL>
:copyright: 2020 by Optionset authors, see AUTHORS for more details.
:license: GPLv3, see LICENSE for more details.
"""
import subprocess
def check_format(py_file_path):
"""Check format of Python file. """
print("="*... | [
"subprocess.run"
] | [((385, 454), 'subprocess.run', 'subprocess.run', (['run_str'], {'shell': '(True)', 'capture_output': '(True)', 'check': '(False)'}), '(run_str, shell=True, capture_output=True, check=False)\n', (399, 454), False, 'import subprocess\n')] |
import sys
sys.path.append('../vmdgadgets')
import vmdutil
import functools
def alt_dot_v(v1, v2):
return functools.reduce(
lambda i, j: i + j, [x * y for x, y in zip(v1, v2)])
vmdutil.vmdutil.dot_v = alt_dot_v
vmdutil.dot_v = alt_dot_v
class strexp():
def __init__(self, val):
self.val = val
... | [
"vmdutil.multiply_quaternion",
"sys.path.append",
"vmdutil.dot_m"
] | [((11, 43), 'sys.path.append', 'sys.path.append', (['"""../vmdgadgets"""'], {}), "('../vmdgadgets')\n", (26, 43), False, 'import sys\n'), ((1449, 1482), 'vmdutil.multiply_quaternion', 'vmdutil.multiply_quaternion', (['r', 'p'], {}), '(r, p)\n', (1476, 1482), False, 'import vmdutil\n'), ((1927, 2052), 'vmdutil.dot_m', '... |
from pathlib import Path
from typing import List, Optional, Tuple
from app.api.meta.service import task_type_from_id
from fedot.core.data.data import DataTypesEnum, InputData
from fedot.core.repository.tasks import Task, TaskParams, TsForecastingParams
from flask import current_app
from utils import project_root
defa... | [
"fedot.core.data.data.InputData.from_csv",
"app.api.meta.service.task_type_from_id",
"utils.project_root",
"fedot.core.repository.tasks.TsForecastingParams",
"fedot.core.data.data.InputData.from_csv_time_series"
] | [((1912, 1951), 'fedot.core.repository.tasks.TsForecastingParams', 'TsForecastingParams', ([], {'forecast_length': '(30)'}), '(forecast_length=30)\n', (1931, 1951), False, 'from fedot.core.repository.tasks import Task, TaskParams, TsForecastingParams\n'), ((2077, 2091), 'utils.project_root', 'project_root', ([], {}), '... |
import re
from data.scrape.link_extractors.create_extractor import create_extractor
from data.scrape.utils import clean_url
from .constants import ID
class Strategy:
def __init__(self, url_pattern, template=None, **extractor_args):
self.url_pattern = url_pattern.format(ID=ID)
self.url_regex = re.... | [
"data.scrape.link_extractors.create_extractor.create_extractor",
"data.scrape.utils.clean_url"
] | [((546, 560), 'data.scrape.utils.clean_url', 'clean_url', (['url'], {}), '(url)\n', (555, 560), False, 'from data.scrape.utils import clean_url\n'), ((735, 797), 'data.scrape.link_extractors.create_extractor.create_extractor', 'create_extractor', (['url'], {'allow_domains': '[]'}), '(url, allow_domains=[], **self.extra... |
from django.db import models
class Publisher(models.Model):
name = models.CharField(max_length=100)
class Author(models.Model):
name = models.CharField(max_length=100)
class Book(models.Model):
name = models.CharField(max_length=100)
authors = models.ManyToManyField(Author, related_name='books')
... | [
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((72, 104), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (88, 104), False, 'from django.db import models\n'), ((145, 177), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (161, 177), False, 'from django.db ... |
import math
# 10進数 -> base進数に変換
def base10to(x: int, base: int) -> str:
s = ''
while x > 0:
s = str(x % base) + s
x = x // base
return s
# 最小公倍数
def lcm(a: int, b: int) -> int:
return int(a * b / math.gcd(a, b))
# n以下の素数の一覧
def make_primes(n: int) -> list:
is_prime = [False, Fal... | [
"math.gcd"
] | [((232, 246), 'math.gcd', 'math.gcd', (['a', 'b'], {}), '(a, b)\n', (240, 246), False, 'import math\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-06 20:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('entertainment_tonight', '0002_auto_20170321_1517'),
]
operations = [
migrat... | [
"django.db.models.CharField"
] | [((418, 461), 'django.db.models.CharField', 'models.CharField', ([], {'default': '(1)', 'max_length': '(200)'}), '(default=1, max_length=200)\n', (434, 461), False, 'from django.db import migrations, models\n')] |
from datetime import datetime, date, timezone, timedelta
from swpt_accounts.models import Account
D_ID = -1
C_ID = 1
def test_sibnalbus_burst_count(app):
from swpt_accounts import models as m
assert isinstance(m.RejectedTransferSignal.signalbus_burst_count, int)
assert isinstance(m.PreparedTransferSignal... | [
"datetime.datetime.now",
"datetime.timedelta",
"datetime.date"
] | [((841, 863), 'datetime.timedelta', 'timedelta', ([], {'days': '(365.25)'}), '(days=365.25)\n', (850, 863), False, 'from datetime import datetime, date, timezone, timedelta\n'), ((881, 910), 'datetime.datetime.now', 'datetime.now', ([], {'tz': 'timezone.utc'}), '(tz=timezone.utc)\n', (893, 910), False, 'from datetime i... |
# -*- coding: UTF-8 -*-
import socket
import pyaudio
import numpy as np
import time
import logging
address = ('127.0.0.1', 8301)
RATE = 8000
RECORD_SECONDS = 10 #录制时长,单位秒
FORMAT = pyaudio.paInt16
CHANNELS = 1
CHUNK=256
DEBUG=1
def start_client ():
#socket init
tcpClient = socket.socket(socket.AF_INET, sock... | [
"logging.basicConfig",
"logging.debug",
"socket.socket",
"numpy.zeros",
"time.time",
"pyaudio.PyAudio",
"logging.info"
] | [((286, 335), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (299, 335), False, 'import socket\n'), ((373, 436), 'logging.info', 'logging.info', (["(' connect to %s:%s OK' % (address[0], address[1]))"], {}), "(' connect to %s:%s OK' % (address... |
import os
import click
from developers_chamber.scripts import cli
from developers_chamber.version_utils import bump_to_next_version as bump_to_next_version_func
from developers_chamber.version_utils import get_next_version, get_version
from developers_chamber.types import EnumType, ReleaseType
default_version_files... | [
"developers_chamber.scripts.cli.command",
"click.option",
"os.environ.get",
"developers_chamber.version_utils.get_version",
"developers_chamber.version_utils.get_next_version",
"developers_chamber.types.EnumType",
"developers_chamber.version_utils.bump_to_next_version"
] | [((385, 398), 'developers_chamber.scripts.cli.command', 'cli.command', ([], {}), '()\n', (396, 398), False, 'from developers_chamber.scripts import cli\n'), ((496, 560), 'click.option', 'click.option', (['"""--build_hash"""'], {'help': '"""hash of the build"""', 'type': 'str'}), "('--build_hash', help='hash of the buil... |
import requests
class TMDBClient:
BASE_URL = "https://api.themoviedb.org/3/discover/movie"
API_KEY = ""
def request_best_movies_from_year(self, year):
params = {
'language': 'pt-BR',
'primary_release_year': year,
'sort_by': 'vote_average.desc',
'api... | [
"requests.get"
] | [((398, 433), 'requests.get', 'requests.get', (['self.BASE_URL', 'params'], {}), '(self.BASE_URL, params)\n', (410, 433), False, 'import requests\n')] |
import codecs
import os
import os.path
import string
import random
from random import shuffle
import csv
import time
import hashlib
import struct
import binascii
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
DefaultSize = "mode con: cols=100 lines=20"
os.system(DefaultSize)
pre = "C:\Pr... | [
"os.path.exists",
"hashlib.sha256",
"random.choice",
"os.makedirs",
"os.path.join",
"time.sleep",
"cryptography.hazmat.primitives.ciphers.algorithms.AES",
"cryptography.hazmat.primitives.ciphers.modes.CTR",
"os.system",
"csv.reader",
"codecs.decode"
] | [((284, 306), 'os.system', 'os.system', (['DefaultSize'], {}), '(DefaultSize)\n', (293, 306), False, 'import os\n'), ((345, 364), 'os.path.exists', 'os.path.exists', (['pre'], {}), '(pre)\n', (359, 364), False, 'import os\n'), ((370, 386), 'os.makedirs', 'os.makedirs', (['pre'], {}), '(pre)\n', (381, 386), False, 'impo... |
"""Asynchronous MongoDB and Redis connections."""
from functools import partial
import motor
import tornadoredis
from cloudtunes import settings
RedisClient = partial(tornadoredis.Client, **settings.REDIS)
mongo = motor.MotorClient(**settings.MONGODB).cloudtunes
redis = RedisClient()
| [
"functools.partial",
"motor.MotorClient"
] | [((163, 209), 'functools.partial', 'partial', (['tornadoredis.Client'], {}), '(tornadoredis.Client, **settings.REDIS)\n', (170, 209), False, 'from functools import partial\n'), ((220, 257), 'motor.MotorClient', 'motor.MotorClient', ([], {}), '(**settings.MONGODB)\n', (237, 257), False, 'import motor\n')] |
#!/usr/bin/env python3
import os
from generate_cnn_model import *
from generate_transformer_model import *
parser = argparse.ArgumentParser()
parser.add_argument("model_path", type=str)
parser.add_argument("--batch_size", type=int, default=128)
args = parser.parse_args()
input_channel_num = 42
board_size = 9
policy_c... | [
"os.path.basename"
] | [((509, 542), 'os.path.basename', 'os.path.basename', (['args.model_path'], {}), '(args.model_path)\n', (525, 542), False, 'import os\n')] |
import os
import time
class Var(object):
# Get a bot token from botfather
BOT_TOKEN = os.environ.get("BOT_TOKEN", "")
# Get from my.telegram.org
API_ID = int(os.environ.get("API_ID", 12345))
# Get from my.telegram.org
API_HASH = os.environ.get("API_HASH", "")
# To record start time of... | [
"os.environ.get",
"time.time"
] | [((97, 128), 'os.environ.get', 'os.environ.get', (['"""BOT_TOKEN"""', '""""""'], {}), "('BOT_TOKEN', '')\n", (111, 128), False, 'import os\n'), ((258, 288), 'os.environ.get', 'os.environ.get', (['"""API_HASH"""', '""""""'], {}), "('API_HASH', '')\n", (272, 288), False, 'import os\n'), ((346, 357), 'time.time', 'time.ti... |
# add LDDMM shooting code into path
import sys
sys.path.append('../vectormomentum/Code/Python');
sys.path.append('../library')
from subprocess import call
import argparse
import os.path
#Add deep learning related libraries
from collections import Counter
import torch
import prediction_network
import util
import numpy... | [
"PyCA.Common.ImFromNPArr",
"PyCA.Common.SaveITKField",
"sys.exit",
"PyCA.Common.FieldFromNPArr",
"sys.path.append",
"numpy.divide",
"argparse.ArgumentParser",
"PyCA.Common.LoadITKImage",
"util.predict_momentum",
"subprocess.call",
"registration_methods.geodesic_shooting",
"skimage.exposure.equ... | [((47, 95), 'sys.path.append', 'sys.path.append', (['"""../vectormomentum/Code/Python"""'], {}), "('../vectormomentum/Code/Python')\n", (62, 95), False, 'import sys\n'), ((97, 126), 'sys.path.append', 'sys.path.append', (['"""../library"""'], {}), "('../library')\n", (112, 126), False, 'import sys\n'), ((638, 743), 'ar... |
#!/usr/bin/env python3
import math
from typing import Iterable, Optional, Tuple, Union
import numpy as np
from analysis import linearity
from utils import utils
from unit_test import unit_test
from processor import ProcessorBase
from generation import signal_generation
def generate_impulse(n_samp, am... | [
"utils.utils.approx_equal",
"numpy.zeros",
"numpy.ones",
"numpy.arange"
] | [((354, 388), 'numpy.zeros', 'np.zeros', (['n_samp'], {'dtype': 'np.float64'}), '(n_samp, dtype=np.float64)\n', (362, 388), True, 'import numpy as np\n'), ((640, 671), 'utils.utils.approx_equal', 'utils.approx_equal', (['y[0]', 'slope'], {}), '(y[0], slope)\n', (658, 671), False, 'from utils import utils\n'), ((681, 71... |
"""
Copyright 2021 Objectiv B.V.
"""
import datetime
import warnings
from abc import ABC
from enum import Enum
from typing import Union, cast, List, Tuple, Optional, Any
import numpy
import pandas
from sqlalchemy.engine import Dialect
from bach import DataFrame
from bach.series import Series, SeriesString, SeriesBool... | [
"datetime.datetime.utcfromtimestamp",
"bach.series.utils.datetime_formats.parse_c_code_to_bigquery_code",
"datetime.timedelta",
"bach.series.series.ToPandasInfo",
"bach.DataFrame.from_pandas",
"bach.expression.Expression.construct",
"numpy.datetime64",
"warnings.warn",
"bach.series.utils.datetime_fo... | [((2410, 2555), 'warnings.warn', 'warnings.warn', (['"""Call to deprecated method, we recommend to use SeriesAbstractDateTime.dt.strftime instead"""'], {'category': 'DeprecationWarning'}), "(\n 'Call to deprecated method, we recommend to use SeriesAbstractDateTime.dt.strftime instead'\n , category=DeprecationWarn... |
# Hash Time Lock Contract Example in pyTeal
# Add parent directory to path so that algobpy can be imported
import sys
sys.path.insert(0,'..')
from algobpy.parse import parse_params
from pyteal import *
def htlc(tmpl_bob, tmpl_alice, tmpl_secret, tmpl_timeout):
common_fields = And(
Txn.type_enum() == Tx... | [
"algobpy.parse.parse_params",
"sys.path.insert"
] | [((119, 143), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (134, 143), False, 'import sys\n'), ((1076, 1109), 'algobpy.parse.parse_params', 'parse_params', (['sys.argv[1]', 'params'], {}), '(sys.argv[1], params)\n', (1088, 1109), False, 'from algobpy.parse import parse_params\n')] |
import sys
from PyQt5 import QtGui, QtCore
from PyQt5.QtWidgets import QApplication, QDialog, QGroupBox, QVBoxLayout, QHBoxLayout, QRadioButton, QLabel
class MainWindow(QDialog):
def __init__(self):
super().__init__()
self.title = "PyQt5 Radio Button"
self.top = 400
self.left = 2... | [
"PyQt5.QtGui.QIcon",
"PyQt5.QtGui.QFont",
"PyQt5.QtWidgets.QRadioButton",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QGroupBox",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtCore.QSize"
] | [((2555, 2577), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (2567, 2577), False, 'from PyQt5.QtWidgets import QApplication, QDialog, QGroupBox, QVBoxLayout, QHBoxLayout, QRadioButton, QLabel\n'), ((704, 717), 'PyQt5.QtWidgets.QVBoxLayout', 'QVBoxLayout', ([], {}), '()\n', (715, 7... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-01-23 18:09
from __future__ import unicode_literals
from django.db import migrations, models
import sorl.thumbnail.fields
class Migration(migrations.Migration):
dependencies = [
('guides', '0001_initial'),
]
operations = [
mig... | [
"django.db.models.TextField",
"django.db.models.CharField"
] | [((419, 447), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)'}), '(blank=True)\n', (435, 447), False, 'from django.db import migrations, models\n'), ((571, 615), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(128)'}), '(blank=True, max_length=128)\n'... |
# Generated by Django 3.2 on 2021-04-25 02:49
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('hipyelp', '0013_alter_drinktag_tagname'),
]
operations = [
migrations.RenameField(
model_name='drinktag',
old_name='tagName',
... | [
"django.db.migrations.RenameField"
] | [((229, 324), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""drinktag"""', 'old_name': '"""tagName"""', 'new_name': '"""drinktagName"""'}), "(model_name='drinktag', old_name='tagName', new_name=\n 'drinktagName')\n", (251, 324), False, 'from django.db import migrations\n')] |
from recip.util import DataType
from recip.util import Validator
def toAddressBytes(address):
if address.startswith('0x'):
address = address[2:]
return DataType.fromHex(address)
def toAddressStr(addressBytes):
return DataType.toHex(addressBytes)
def to0xAddress(addressBytes):
address = toAddr... | [
"recip.util.DataType.fromHex",
"recip.util.DataType.toHex"
] | [((169, 194), 'recip.util.DataType.fromHex', 'DataType.fromHex', (['address'], {}), '(address)\n', (185, 194), False, 'from recip.util import DataType\n'), ((239, 267), 'recip.util.DataType.toHex', 'DataType.toHex', (['addressBytes'], {}), '(addressBytes)\n', (253, 267), False, 'from recip.util import DataType\n')] |
from datetime import datetime
from webapp.services import db
class ReqErrorLog(db.Model):
__tablename__ = 'req_error_log'
id = db.Column(db.Integer, primary_key=True)
action = db.Column(db.String(50))
key = db.Column(db.String(255))
msg = db.Column(db.String(2000))
created_time = db.Column(d... | [
"webapp.services.db.String",
"webapp.services.db.Column"
] | [((139, 178), 'webapp.services.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (148, 178), False, 'from webapp.services import db\n'), ((309, 353), 'webapp.services.db.Column', 'db.Column', (['db.DateTime'], {'default': 'datetime.now'}), '(db.DateTime, default=d... |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class SupplierScorecardStanding(Document):
pass
@frappe.whitelist()
def get... | [
"frappe.whitelist",
"frappe.get_doc",
"frappe.db.sql"
] | [((294, 312), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (310, 312), False, 'import frappe\n'), ((448, 466), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (464, 466), False, 'import frappe\n'), ((366, 426), 'frappe.get_doc', 'frappe.get_doc', (['"""Supplier Scorecard Standing"""', 'standing_n... |
#!/usr/bin/python3.6
# -*- coding: utf-8 -*-
import re
import ftplib
import calendar
import time
import sys
import os
import json
from pprint import pprint
from datetime import datetime
from datetime import date, timedelta
from bson import ObjectId
from helper.ftp import Ftp
from helper.mongod import Mo... | [
"helper.ftp.Ftp",
"helper.mongod.Mongodb",
"helper.common.Common",
"helper.excel.Excel",
"helper.jaccs.Config",
"datetime.datetime.now",
"calendar.monthrange",
"helper.mongodbaggregate.Mongodbaggregate",
"sys.exit",
"datetime.date.today",
"time.time",
"pprint.pprint"
] | [((492, 515), 'helper.mongod.Mongodb', 'Mongodb', (['"""worldfone4xs"""'], {}), "('worldfone4xs')\n", (499, 515), False, 'from helper.mongod import Mongodb\n'), ((528, 552), 'helper.mongod.Mongodb', 'Mongodb', (['"""_worldfone4xs"""'], {}), "('_worldfone4xs')\n", (535, 552), False, 'from helper.mongod import Mongodb\n'... |
import re
from pathlib import Path
from typing import Union
from kgextractiontoolbox.document.document import TaggedDocument
class Classifier:
def __init__(self, classification, rule_path: Union[str, Path]):
self.rules = []
self.explanations = []
self.classification = classification
... | [
"re.compile"
] | [((2744, 2775), 're.compile', 're.compile', (['term', 're.IGNORECASE'], {}), '(term, re.IGNORECASE)\n', (2754, 2775), False, 'import re\n')] |
#!/usr/bin/env python
from ism_pkg.kernels.gaussian import gaussian
from ism_pkg.optimizer.full_ism import full_ism
from ism_pkg.optimizer.stochastic_ism import stochastic_ism
from ism_pkg.tools.HSIC_IDS_optimizer import HSIC_IDS_optimizer
from ism_pkg.tools.terminal_print import *
from ism_pkg.tools.rff_layer import ... | [
"sklearn.linear_model.SGDClassifier",
"sklearn.preprocessing.LabelEncoder",
"sklearn.kernel_approximation.RBFSampler",
"ism_pkg.optimizer.full_ism.full_ism",
"ism_pkg.optimizer.stochastic_ism.stochastic_ism",
"ism_pkg.kernels.gaussian.gaussian",
"ism_pkg.tools.HSIC_IDS_optimizer.HSIC_IDS_optimizer",
"... | [((1180, 1197), 'ism_pkg.kernels.gaussian.gaussian', 'gaussian', (['self.db'], {}), '(self.db)\n', (1188, 1197), False, 'from ism_pkg.kernels.gaussian import gaussian\n'), ((3130, 3150), 'sklearn.metrics.accuracy_score', 'accuracy_score', (['Y', 'Ŷ'], {}), '(Y, Ŷ)\n', (3144, 3150), False, 'from sklearn.metrics import a... |
import jinja2
class TimeDelay(object):
def __init__(self, name, dw, aw):
self.aw = aw
self.dw = dw
context = {'name': name, 'dw': dw, 'aw': aw}
loader = jinja2.PackageLoader('controlinverilog', 'templates')
env = jinja2.Environment(loader=loader)
template = env.... | [
"jinja2.Environment",
"jinja2.PackageLoader"
] | [((195, 248), 'jinja2.PackageLoader', 'jinja2.PackageLoader', (['"""controlinverilog"""', '"""templates"""'], {}), "('controlinverilog', 'templates')\n", (215, 248), False, 'import jinja2\n'), ((263, 296), 'jinja2.Environment', 'jinja2.Environment', ([], {'loader': 'loader'}), '(loader=loader)\n', (281, 296), False, 'i... |
# -*- coding: utf-8 -*-
## Design notes & thoughts ##############################
##
## Goals:
## * Support nested dict and array objects.
## * Access elements & sub-trees via "obj['key.key.index']"
## * Access via JSON-Path
## - https://jsonpath-rw.readthedocs.io/en/latest/
## * Serializable to JSON
## * De-... | [
"re.compile"
] | [((1617, 1636), 're.compile', 're.compile', (['k_regex'], {}), '(k_regex)\n', (1627, 1636), False, 'import re\n'), ((1707, 1726), 're.compile', 're.compile', (['i_regex'], {}), '(i_regex)\n', (1717, 1726), False, 'import re\n')] |
import os
import logging
from timeit import default_timer as timer
import numpy as np
from automon import AutomonNode
from automon.zmq_socket_utils import init_client_socket
from function_def import func_inner_product
logging.getLogger('automon').setLevel(logging.INFO)
def time_to_wait_for_next_sample_milliseconds(st... | [
"logging.getLogger",
"numpy.random.normal",
"os.getenv",
"timeit.default_timer",
"automon.AutomonNode"
] | [((516, 583), 'automon.AutomonNode', 'AutomonNode', ([], {'idx': 'NODE_IDX', 'func_to_monitor': 'func_inner_product', 'd': '(40)'}), '(idx=NODE_IDX, func_to_monitor=func_inner_product, d=40)\n', (527, 583), False, 'from automon import AutomonNode\n'), ((1027, 1034), 'timeit.default_timer', 'timer', ([], {}), '()\n', (1... |
import os
import re
import shutil
from datetime import date
customHeader = """
---
layout: post
title: {}
categories: {}
excerpt: {}
---
"""
def ModifiedMarkDownFile():
#Loop each file
blog = [filename for filename in os.listdir('notion-backup') if filename.startswith("Blog") and filename.endswith(".md")][0]... | [
"os.listdir",
"shutil.move",
"os.rename",
"os.path.isdir",
"shutil.rmtree"
] | [((401, 413), 'os.listdir', 'os.listdir', ([], {}), '()\n', (411, 413), False, 'import os\n'), ((2095, 2131), 'shutil.rmtree', 'shutil.rmtree', (['"""../../notion-backup"""'], {}), "('../../notion-backup')\n", (2108, 2131), False, 'import shutil\n'), ((1677, 1727), 'os.rename', 'os.rename', (['notionMarkDownFile', 'new... |
from dataclasses import dataclass
from raytracer.tuple import tuple, point, vector, magnitude, normalize, dot, cross
from raytracer.util import equal
@dataclass
class Projectile:
position: tuple # point
velocity: tuple # vector
@dataclass
class Environment:
gravity: tuple # vector
wind: tuple ... | [
"raytracer.tuple.vector",
"raytracer.tuple.point"
] | [((554, 568), 'raytracer.tuple.point', 'point', (['(0)', '(1)', '(0)'], {}), '(0, 1, 0)\n', (559, 568), False, 'from raytracer.tuple import tuple, point, vector, magnitude, normalize, dot, cross\n'), ((669, 687), 'raytracer.tuple.vector', 'vector', (['(0)', '(-0.1)', '(0)'], {}), '(0, -0.1, 0)\n', (675, 687), False, 'f... |
# Generated by Django 3.1.7 on 2021-04-29 15:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('rbac', '0002_auto_20210426_2345'),
('patient', '0006_auto_20210429_1431'),
]
operations = [
migrations.RenameModel(
... | [
"django.db.migrations.RenameModel"
] | [((285, 379), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""PatientURLPermissions"""', 'new_name': '"""PatientURLPermission"""'}), "(old_name='PatientURLPermissions', new_name=\n 'PatientURLPermission')\n", (307, 379), False, 'from django.db import migrations\n')] |
import os
from celery import Celery
from celery.schedules import crontab
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'flatgov.dev')
app = Celery('flatgov')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()
app.conf.redbeat_redis_url = os.getenv('REDIS_URL', 'redis://local... | [
"os.environ.setdefault",
"celery.Celery",
"celery.schedules.crontab",
"os.getenv"
] | [((74, 136), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""flatgov.dev"""'], {}), "('DJANGO_SETTINGS_MODULE', 'flatgov.dev')\n", (95, 136), False, 'import os\n'), ((144, 161), 'celery.Celery', 'Celery', (['"""flatgov"""'], {}), "('flatgov')\n", (150, 161), False, 'from celery i... |
from sqlalchemy import Column, Integer, Numeric
from sqlalchemy.ext.declarative import declared_attr
from .pengaturan_base import MxPengaturanBase
class MxPengaturan(MxPengaturanBase):
# TODO: Set precision & scale for Numerics
@declared_attr
def bpjs_ketenagakerjaan_perusahaan(cls):
return Column... | [
"sqlalchemy.Column"
] | [((314, 345), 'sqlalchemy.Column', 'Column', (['Numeric'], {'nullable': '(False)'}), '(Numeric, nullable=False)\n', (320, 345), False, 'from sqlalchemy import Column, Integer, Numeric\n'), ((425, 456), 'sqlalchemy.Column', 'Column', (['Numeric'], {'nullable': '(False)'}), '(Numeric, nullable=False)\n', (431, 456), Fals... |
"""
socat - UNIX-CONNECT:repl.sock
import sys, threading, pdb, functools
def _attach(repl):
frame = sys._current_frames()[threading.enumerate()[0].ident]
debugger = pdb.Pdb(
stdin=repl.conn.makefile('r'),
stdout=repl.conn.makefile('w'),
)
debugger.reset()
while frame:
frame... | [
"logging.getLogger",
"weakref.WeakKeyDictionary",
"traceback.format_exception_only",
"os.path.exists",
"threading.current_thread",
"socket.socket",
"traceback.format_exception",
"threading.Event",
"sys.exc_info",
"functools.partial",
"codeop.CommandCompiler",
"os.unlink",
"contextlib.closing... | [((735, 762), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (752, 762), False, 'import logging\n'), ((1453, 1477), 'codeop.CommandCompiler', 'codeop.CommandCompiler', ([], {}), '()\n', (1475, 1477), False, 'import codeop\n'), ((6400, 6414), 'sys.exc_info', 'sys.exc_info', ([], {}), '()\n... |
#!/usr/bin/python
#-*- coding: utf-8 -*-
# >.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.
# Licensed under the Apache License, Version 2.0 (the "License")
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# --- File Name: shapes3d.py
# --- Creation Date: 16-01-2021
# --- Last Modified: Tue 13 A... | [
"PIL.Image.fromarray",
"os.path.join",
"h5py.File",
"numpy.array",
"random.choices",
"numpy.dot",
"numpy.random.randint",
"datasets.transforms.PairTransform",
"torch.zeros",
"torch.rand"
] | [((1353, 1385), 'numpy.array', 'np.array', (['[10, 10, 10, 8, 4, 15]'], {}), '([10, 10, 10, 8, 4, 15])\n', (1361, 1385), True, 'import numpy as np\n'), ((2578, 2589), 'numpy.array', 'np.array', (['f'], {}), '(f)\n', (2586, 2589), True, 'import numpy as np\n'), ((2631, 2669), 'os.path.join', 'os.path.join', (['self.file... |
from collections import OrderedDict
from rest_framework import serializers
from data_import.models import DataFile
from open_humans.models import User
from private_sharing.models import project_membership_visible
class PublicDataFileSerializer(serializers.ModelSerializer):
"""
Serialize a public data file.
... | [
"private_sharing.models.project_membership_visible",
"collections.OrderedDict",
"rest_framework.serializers.JSONField"
] | [((344, 367), 'rest_framework.serializers.JSONField', 'serializers.JSONField', ([], {}), '()\n', (365, 367), False, 'from rest_framework import serializers\n'), ((422, 435), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (433, 435), False, 'from collections import OrderedDict\n'), ((750, 799), 'private_sha... |
import json
import os
import time
from django.template import Context
from django.template.loader import get_template
from django.utils.safestring import mark_safe
from monocle.settings import settings
class Resource(object):
"""
A JSON compatible response from an OEmbed provider
"""
def __init__(s... | [
"os.path.join",
"time.time",
"django.template.loader.get_template",
"django.template.Context"
] | [((388, 399), 'time.time', 'time.time', ([], {}), '()\n', (397, 399), False, 'import time\n'), ((1662, 1689), 'django.template.loader.get_template', 'get_template', (['template_name'], {}), '(template_name)\n', (1674, 1689), False, 'from django.template.loader import get_template\n'), ((3073, 3084), 'time.time', 'time.... |
from warnings import warn
from charms.layer.nginx import * # noqa
warn('nginxlib is being deprecated, use charms.layer.nginx instead')
| [
"warnings.warn"
] | [((68, 136), 'warnings.warn', 'warn', (['"""nginxlib is being deprecated, use charms.layer.nginx instead"""'], {}), "('nginxlib is being deprecated, use charms.layer.nginx instead')\n", (72, 136), False, 'from warnings import warn\n')] |
# -*- coding: utf-8 -*-
# Name: <NAME>
# NUSP: 9778985
# Course Code: SCC0251
# Semester: 2019/1
# Assignment: 2 - Image enhancement and filtering
# -
import numpy as np
import imageio
# ## Defining functions
# +
# method 1 - limiarization
def limiarization(img, t0):
t = 0.5 * (np.nanmean(np.where(img > t0, img... | [
"numpy.median",
"numpy.where",
"numpy.zeros",
"imageio.imread",
"numpy.pad"
] | [((632, 655), 'numpy.where', 'np.where', (['(img > t)', '(1)', '(0)'], {}), '(img > t, 1, 0)\n', (640, 655), True, 'import numpy as np\n'), ((765, 805), 'numpy.zeros', 'np.zeros', (['imgFlat.shape'], {'dtype': 'np.double'}), '(imgFlat.shape, dtype=np.double)\n', (773, 805), True, 'import numpy as np\n'), ((1087, 1128),... |
# Generated by Django 2.0.3 on 2018-03-25 15:29
from django.conf import settings
import django.contrib.auth.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('organization', '0001_initial'),
]
operations = [... | [
"django.db.models.ForeignKey"
] | [((611, 791), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'help_text': '"""chief information security officer"""', 'null': '(True)', 'on_delete': 'django.db.models.deletion.PROTECT', 'related_name': '"""ciso"""', 'to': 'settings.AUTH_USER_MODEL'}), "(help_text='chief information security officer', null=Tr... |
import torch
import pickle
import argparse
import os
from tqdm import trange, tqdm
import torch
import torchtext
from torchtext import data
from torchtext import datasets
from torch import nn
import torch.nn.functional as F
import math
from models import SimpleLSTMModel, AttentionRNN
from train_args import get_arg_par... | [
"models.SimpleLSTMModel.add_args",
"os.path.exists",
"os.makedirs",
"vocab.load_vocab",
"os.path.join",
"torch.nn.DataParallel",
"dataset.ShardedCSVDataset",
"models.SimpleLSTMModel.build_model",
"torch.cuda.is_available",
"dataset.BatchedIterator",
"models.AttentionRNN.add_args",
"models.Atte... | [((6460, 6476), 'train_args.get_arg_parser', 'get_arg_parser', ([], {}), '()\n', (6474, 6476), False, 'from train_args import get_arg_parser\n'), ((7411, 7511), 'dataset.BatchedIterator', 'd.BatchedIterator', (['args.batch_size', 'train_dataset', 'en_vocab', 'fr_vocab', 'args.max_sequence_length'], {}), '(args.batch_si... |
from django.db import connection
class RawQuery:
# return a list of dicts
# e.g. SELECT * FROM my_table
# [
# {'a': 1, 'b': 2, 'c': 3},
# {'a': 1, 'b': 2, 'c': 3},
# ]
def multiple_rows(self, sql, params=[]):
cursor = self._do_query(sql, params)
columns = [col[0] for c... | [
"django.db.connection.cursor"
] | [((1326, 1345), 'django.db.connection.cursor', 'connection.cursor', ([], {}), '()\n', (1343, 1345), False, 'from django.db import connection\n')] |
from functools import reduce
import numpy as np
import json
import tensorflow as tf
from scipy.optimize import linear_sum_assignment
import os
import time
def deleteDuplicate_v1(input_dict_lst):
f = lambda x,y:x if y in x else x + [y]
return reduce(f, [[], ] + input_dict_lst)
def get_context_pair(resp, l):
label_w... | [
"tensorflow.gfile.Open",
"numpy.reshape",
"scipy.optimize.linear_sum_assignment",
"tensorflow.contrib.predictor.from_saved_model",
"functools.reduce",
"json.dumps",
"os.path.join",
"tensorflow.logging.set_verbosity",
"numpy.mod",
"time.time"
] | [((2296, 2337), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.INFO'], {}), '(tf.logging.INFO)\n', (2320, 2337), True, 'import tensorflow as tf\n'), ((2830, 2875), 'os.path.join', 'os.path.join', (['FLAGS.buckets', 'FLAGS.input_file'], {}), '(FLAGS.buckets, FLAGS.input_file)\n', (2842, 28... |
from typing import List
from .exceptions import InvalidConfigError
from .utils import check_schema
try:
import ujson as json
except Exception:
import json
class _config:
def __init__(self, c: dict) -> None:
# 与iotbot 对应的配置, 不存在只能为None
# ip
host = c.get('host')
if host:
... | [
"json.load"
] | [((1272, 1284), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1281, 1284), False, 'import json\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
remove wrong sentence breaking marks after period error eojeol
__author__ = 'Jamie (<EMAIL>)'
__copyright__ = 'Copyright (C) 2017-, Kakao Corp. All rights reserved.'
"""
###########
# imports #
###########
from argparse import ArgumentParser
import logging
import o... | [
"logging.basicConfig",
"argparse.ArgumentParser",
"khaiii.munjong.sejong_corpus.WORD_ID_PTN.match",
"re.match",
"os.path.basename",
"khaiii.munjong.sejong_corpus.Morph.parse",
"logging.info"
] | [((1470, 1514), 're.match', 're.match', (['""".+/SF \\\\+ [\\\\\'"’”]/SS$"""', 'cols[2]'], {}), '(\'.+/SF \\\\+ [\\\\\\\'"’”]/SS$\', cols[2])\n', (1478, 1514), False, 'import re\n'), ((2069, 2101), 'os.path.basename', 'os.path.basename', (['sys.stdin.name'], {}), '(sys.stdin.name)\n', (2085, 2101), False, 'import os\n'... |
from google.cloud import storage
import json
client = storage.Client()
bucket = client.get_bucket('ibvdata')
blob = bucket.get_blob("experiments/2018-04-14-03-06-01/outputs/json/a0.05_r3.00_p0.05_t1.00")
check = json.loads(blob.download_as_string())
print(check)
| [
"google.cloud.storage.Client"
] | [((56, 72), 'google.cloud.storage.Client', 'storage.Client', ([], {}), '()\n', (70, 72), False, 'from google.cloud import storage\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
def residuals(fit, obs):
"""Calculate residuals for fit compared to observed data
:fit: list of discrete fit data points
:obs: list of observed data points
:returns: fit minus observed data points
"""
return fit-obs
def fit_... | [
"numpy.sum",
"numpy.mean",
"numpy.sqrt"
] | [((486, 504), 'numpy.sum', 'np.sum', (['(resid ** 2)'], {}), '(resid ** 2)\n', (492, 504), True, 'import numpy as np\n'), ((1022, 1041), 'numpy.sum', 'np.sum', (['(resids ** 2)'], {}), '(resids ** 2)\n', (1028, 1041), True, 'import numpy as np\n'), ((1266, 1286), 'numpy.mean', 'np.mean', (['(resids ** 2)'], {}), '(resi... |
"""
Test Production model
"""
import pytest
from mixer.backend.flask import mixer
from cubbie.model import Production, Capability
from cubbie.fixture import create_production_fixtures
def test_fixtures_created(productions):
"""The production fixture should have > 3 productions."""
assert Production.query.cou... | [
"cubbie.model.Production.query.count",
"cubbie.model.Capability.query.get",
"mixer.backend.flask.mixer.blend"
] | [((419, 486), 'mixer.backend.flask.mixer.blend', 'mixer.blend', (['Capability'], {'user': 'mixer.SELECT', 'production': 'mixer.SELECT'}), '(Capability, user=mixer.SELECT, production=mixer.SELECT)\n', (430, 486), False, 'from mixer.backend.flask import mixer\n'), ((300, 324), 'cubbie.model.Production.query.count', 'Prod... |
#!/usr/bin/env python3
import os
import subprocess
import pytest
@pytest.mark.parametrize(
'testfile',
[
('foo.txt', 'ZnjDGxQAAAAAAAAABAAAAAAAAAA=\n'),
('loremipsum.txt', 'ZNqmJyqS9l79QjW7eNx0qjaDpMY=\n'),
('binary.bin', 'GgQWCSPUD9bQ/3xxO0VcOoxc4ZM=\n'),
]
)
def test_qxh(testfil... | [
"os.path.realpath",
"pytest.mark.parametrize",
"os.path.join"
] | [((70, 273), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""testfile"""', '[(\'foo.txt\', \'ZnjDGxQAAAAAAAAABAAAAAAAAAA=\\n\'), (\'loremipsum.txt\',\n \'ZNqmJyqS9l79QjW7eNx0qjaDpMY=\\n\'), (\'binary.bin\',\n """GgQWCSPUD9bQ/3xxO0VcOoxc4ZM=\n""")]'], {}), '(\'testfile\', [(\'foo.txt\',\n \'ZnjDGxQA... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : load_cub_hypernym.py
# Author : <NAME>, <NAME>
# Email : <EMAIL>, <EMAIL>
# Date : 07.08.2019
# Last Modified Date: 20.11.2019
# Last Modified By : Chi Han
#
# This file is part of the VCML codebase
# Distributed u... | [
"utility.common.contains"
] | [((3573, 3611), 'utility.common.contains', 'contains', (["q['keywords']", 'test_concepts'], {}), "(q['keywords'], test_concepts)\n", (3581, 3611), False, 'from utility.common import contains\n'), ((3447, 3485), 'utility.common.contains', 'contains', (["q['keywords']", 'test_concepts'], {}), "(q['keywords'], test_concep... |
"""Helper functions and classes for users.
They should not be used in skorch directly.
"""
from collections import Sequence
from collections import namedtuple
from functools import partial
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.base import TransformerMixin
import torch
from skorch.cl... | [
"torch.unique",
"numpy.flatnonzero",
"numpy.stack",
"numpy.issubdtype",
"skorch.utils.to_tensor",
"functools.partial",
"skorch.utils.is_torch_data_type"
] | [((8580, 8618), 'functools.partial', 'partial', (['_make_split'], {'valid_ds': 'dataset'}), '(_make_split, valid_ds=dataset)\n', (8587, 8618), False, 'from functools import partial\n'), ((15120, 15140), 'numpy.stack', 'np.stack', (['Xf'], {'axis': '(1)'}), '(Xf, axis=1)\n', (15128, 15140), True, 'import numpy as np\n')... |
from collections import OrderedDict
import pandas as pd
from tests import project_test, assert_output
@project_test
def test_csv_to_close(fn):
tickers = ['A', 'B', 'C']
dates = ['2017-09-22', '2017-09-25', '2017-09-26', '2017-09-27', '2017-09-28']
fn_inputs = {
'csv_filepath': 'prices_2017_09_22_... | [
"pandas.DataFrame",
"tests.assert_output"
] | [((919, 967), 'tests.assert_output', 'assert_output', (['fn', 'fn_inputs', 'fn_correct_outputs'], {}), '(fn, fn_inputs, fn_correct_outputs)\n', (932, 967), False, 'from tests import project_test, assert_output\n'), ((531, 695), 'pandas.DataFrame', 'pd.DataFrame', (['[[152.48, 149.19, 59.35], [151.11, 145.06, 60.29], [1... |
"""
Starting with 1 and spiralling anticlockwise in the following way,
a square spiral with side length 7 is formed.
37 36 35 34 33 32 31
38 17 16 15 14 13 30
39 18 5 4 3 12 29
40 19 6 1 2 11 28
41 20 7 8 9 10 27
42 21 22 23 24 25 26
43 44 45 46 47 48 49
It is interesting to note that the odd squares lie al... | [
"time.process_time"
] | [((1030, 1049), 'time.process_time', 'time.process_time', ([], {}), '()\n', (1047, 1049), False, 'import time\n'), ((1278, 1297), 'time.process_time', 'time.process_time', ([], {}), '()\n', (1295, 1297), False, 'import time\n')] |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module that contains base save widget for data items
"""
from __future__ import print_function, division, absolute_import
import os
import logging
import traceback
from Qt.QtCore import Signal, QSize
from Qt.QtWidgets import QSizePolicy, QFrame, QDialogButtonBox, Q... | [
"logging.getLogger",
"tpDcc.libs.qt.widgets.snapshot.SnapshotWindow",
"tpDcc.dcc.client",
"tpDcc.libs.qt.widgets.layouts.HorizontalLayout",
"tpDcc.libs.qt.widgets.label.BaseLabel",
"tpDcc.libs.qt.widgets.formwidget.FormWidget",
"tpDcc.tools.datalibrary.core.utils.copy_path",
"Qt.QtWidgets.QFileDialog"... | [((724, 767), 'logging.getLogger', 'logging.getLogger', (['"""tpDcc-libs-datalibrary"""'], {}), "('tpDcc-libs-datalibrary')\n", (741, 767), False, 'import logging\n'), ((19417, 19458), 'tpDcc.libs.python.decorators.add_metaclass', 'decorators.add_metaclass', (['_MetaSaveWidget'], {}), '(_MetaSaveWidget)\n', (19441, 194... |
from flask import Flask
app = Flask(__name__)
if __name__ == "__main__":
from api import *
app.run(host ='0.0.0.0', port = 5000, debug = False) | [
"flask.Flask"
] | [((30, 45), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (35, 45), False, 'from flask import Flask\n')] |
#############################################################################
#
# VFRAME
# MIT License
# Copyright (c) 2019 <NAME> and VFRAME
# https://vframe.io
#
#############################################################################
import click
from vframe.settings import app_cfg
ext_choices = ['jpg', 'png... | [
"click.option",
"click.command",
"pandas.read_csv"
] | [((325, 340), 'click.command', 'click.command', ([], {}), '()\n', (338, 340), False, 'import click\n'), ((342, 427), 'click.option', 'click.option', (['"""-i"""', '"""--input"""', '"""opt_input"""'], {'required': '(True)', 'help': '"""Input file CSV"""'}), "('-i', '--input', 'opt_input', required=True, help='Input file... |