code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#tani
from utility.feature_extract import ModelExtractFaceFeature
from utility.data_loader import data_load
from utility.similarity_calculate import *
from PIL import Image
import numpy as np
import os
... | [
"numpy.tile",
"PIL.Image.open",
"utility.data_loader.data_load",
"os.path.dirname",
"utility.feature_extract.ModelExtractFaceFeature"
] | [((361, 372), 'utility.data_loader.data_load', 'data_load', ([], {}), '()\n', (370, 372), False, 'from utility.data_loader import data_load\n'), ((510, 530), 'PIL.Image.open', 'Image.open', (['img_path'], {}), '(img_path)\n', (520, 530), False, 'from PIL import Image\n'), ((545, 570), 'os.path.dirname', 'os.path.dirnam... |
#!/usr/bin/env python
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("path",help="Path to source")
args = parser.parse_args()
file = open(args.path,"r")
dict = {}
count = 0
max = 0
duplicates = 0
sec = 0
most_requested = ""
for line in file:
count+=1
line_a... | [
"argparse.ArgumentParser"
] | [((62, 87), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (85, 87), False, 'import argparse\n')] |
# Copyright 2019 The Forseti Security Authors. 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-1.0
#
# Unless required by ap... | [
"unittest.main",
"google.cloud.forseti.common.util.http_helpers.set_user_agent_suffix",
"google.cloud.forseti.common.util.http_helpers.build_http"
] | [((2104, 2119), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2117, 2119), False, 'import unittest\n'), ((1410, 1448), 'google.cloud.forseti.common.util.http_helpers.set_user_agent_suffix', 'http_helpers.set_user_agent_suffix', (['""""""'], {}), "('')\n", (1444, 1448), False, 'from google.cloud.forseti.common.ut... |
import numpy as np
import cv2
import keras
import utils
import glob
import os
from keras.models import load_model
import time
import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
config = tf.compat.v1.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.7
set_session(tf.comp... | [
"tensorflow.compat.v1.ConfigProto",
"cv2.rectangle",
"keras.models.load_model",
"utils.decode_netout",
"numpy.squeeze",
"cv2.imshow",
"cv2.waitKey",
"cv2.VideoCapture",
"utils.do_nms",
"time.time",
"tensorflow.compat.v1.Session",
"utils.preprocess_input",
"utils.correct_yolo_boxes"
] | [((217, 243), 'tensorflow.compat.v1.ConfigProto', 'tf.compat.v1.ConfigProto', ([], {}), '()\n', (241, 243), True, 'import tensorflow as tf\n'), ((313, 348), 'tensorflow.compat.v1.Session', 'tf.compat.v1.Session', ([], {'config': 'config'}), '(config=config)\n', (333, 348), True, 'import tensorflow as tf\n'), ((4439, 44... |
"""crowdcoin_merchant URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home... | [
"django.conf.urls.include",
"django.contrib.staticfiles.urls.staticfiles_urlpatterns",
"django.conf.urls.url"
] | [((3528, 3553), 'django.contrib.staticfiles.urls.staticfiles_urlpatterns', 'staticfiles_urlpatterns', ([], {}), '()\n', (3551, 3553), False, 'from django.contrib.staticfiles.urls import staticfiles_urlpatterns\n'), ((1062, 1093), 'django.conf.urls.url', 'url', (['"""^admin/"""', 'admin.site.urls'], {}), "('^admin/', ad... |
"""@package module
Output is a wrapper over print to provide coloring and verbose mode
"""
from __future__ import print_function
import os
import sys
from colorama import (
init,
Style,
)
class Scope:
"""holds the verbose flag and output status flag"""
verbose_flag = False
output_status_flag =... | [
"colorama.init"
] | [((361, 367), 'colorama.init', 'init', ([], {}), '()\n', (365, 367), False, 'from colorama import init, Style\n')] |
# -*- coding: utf-8 -*-
"""
Created on Tue May 06 09:47:05 2014
Ballistic trajectories Case 2 Drag
@author: etodorov
"""
import math
import matplotlib.pyplot as plt
v0 = 50. #m/s
x0 = 0.
y0 = 0.
deg = math.pi/180.
g = -9.81
dt = .01 #time step
cD = .47 #drag c
A = 0.8 # m^2
m =... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"math.cos",
"math.atan2",
"matplotlib.pyplot.title",
"math.sin",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((934, 944), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (942, 944), True, 'import matplotlib.pyplot as plt\n'), ((813, 825), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (823, 825), True, 'import matplotlib.pyplot as plt\n'), ((830, 866), 'matplotlib.pyplot.title', 'plt.title', (['"""Ballis... |
# Generated by Django 3.1.3 on 2020-12-07 21:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dualtext_api', '0007_auto_20201207_2106'),
]
operations = [
migrations.AddField(
model_name='label',
name='color',
... | [
"django.db.models.JSONField",
"django.db.models.CharField"
] | [((337, 364), 'django.db.models.JSONField', 'models.JSONField', ([], {'null': '(True)'}), '(null=True)\n', (353, 364), False, 'from django.db import migrations, models\n'), ((485, 526), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1)', 'null': '(True)'}), '(max_length=1, null=True)\n', (501, ... |
from django.shortcuts import render
from django.template.loader import get_template
from django.template import Context
from django.http import Http404, HttpResponse, HttpResponseRedirect
import datetime
def hello(request):
return HttpResponse("Hello world")
def current_datetime(request):
now = datetime.dat... | [
"django.shortcuts.render",
"django.http.HttpResponseRedirect",
"django.http.HttpResponse",
"datetime.datetime.now",
"django.template.Context",
"datetime.timedelta",
"django.template.loader.get_template",
"django.http.Http404"
] | [((237, 264), 'django.http.HttpResponse', 'HttpResponse', (['"""Hello world"""'], {}), "('Hello world')\n", (249, 264), False, 'from django.http import Http404, HttpResponse, HttpResponseRedirect\n'), ((308, 331), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (329, 331), False, 'import datetime\n'... |
import os
import sys
import base64
import json
import requests
import pandas as pd
import xlsxwriter
# dirName = ["cross_all_v18", "cross_all_v19", "cross_da_v20"]
dirName = ["U_R_U_All_Data_V1"]
# dirName = ["U_R_U_All_V10", "U_R_U_All_V14", "U_R_U_DA_V19"]
# dirPath = "D:/FingerPrint_Dataset/Logs/U_R_U/U_R_U_All... | [
"os.listdir",
"base64.b64encode",
"json.dumps",
"pandas.DataFrame",
"xlsxwriter.Workbook"
] | [((591, 610), 'os.listdir', 'os.listdir', (['dirPath'], {}), '(dirPath)\n', (601, 610), False, 'import os\n'), ((2037, 2057), 'pandas.DataFrame', 'pd.DataFrame', (['scores'], {}), '(scores)\n', (2049, 2057), True, 'import pandas as pd\n'), ((2137, 2166), 'xlsxwriter.Workbook', 'xlsxwriter.Workbook', (['fileName'], {}),... |
# 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 u... | [
"cloudpickle.dumps"
] | [((1276, 1309), 'cloudpickle.dumps', 'cloudpickle.dumps', (['student.schema'], {}), '(student.schema)\n', (1293, 1309), False, 'import cloudpickle\n'), ((1362, 1388), 'cloudpickle.dumps', 'cloudpickle.dumps', (['student'], {}), '(student)\n', (1379, 1388), False, 'import cloudpickle\n')] |
import os
from flask import Flask, session, render_template, request
from flask_session import Session
from sqlalchemy import create_engine, exc
from sqlalchemy.orm import scoped_session, sessionmaker
import traceback
import csv
# Set up database
engine = create_engine("dbURL")
db = scoped_session(sessionmaker(bind=... | [
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.create_engine",
"csv.reader"
] | [((259, 281), 'sqlalchemy.create_engine', 'create_engine', (['"""dbURL"""'], {}), "('dbURL')\n", (272, 281), False, 'from sqlalchemy import create_engine, exc\n'), ((362, 375), 'csv.reader', 'csv.reader', (['f'], {}), '(f)\n', (372, 375), False, 'import csv\n'), ((302, 327), 'sqlalchemy.orm.sessionmaker', 'sessionmaker... |
"""Helper function to setup the run from the command line.
Adapted from https://github.com/atomistic-machine-learning/schnetpack/blob/dev/src/schnetpack/utils/script_utils/setup.py
"""
import os
import logging
from shutil import rmtree
from nff.utils.tools import to_json, set_random_seed, read_from_json
__all__ = ["... | [
"os.path.exists",
"nff.utils.tools.set_random_seed",
"os.makedirs",
"os.path.join",
"nff.utils.tools.read_from_json",
"nff.utils.tools.to_json",
"shutil.rmtree",
"os.path.abspath",
"logging.info"
] | [((401, 443), 'os.path.join', 'os.path.join', (['args.model_path', '"""args.json"""'], {}), "(args.model_path, 'args.json')\n", (413, 443), False, 'import os\n'), ((499, 542), 'os.path.abspath', 'os.path.abspath', (["argparse_dict['data_path']"], {}), "(argparse_dict['data_path'])\n", (514, 542), False, 'import os\n'),... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Scikit-Learn Model-by-Cluster wrapper.
Original code by jnorthman: https://gist.github.com/jnothman/566ebde618ec18f2bea6
"""
import numpy as np
from sklearn.base import BaseEstimator, clone
from sklearn.utils import safe_mask
class ModelByCluster(BaseEstimator):
... | [
"numpy.unique",
"sklearn.base.clone",
"numpy.flatnonzero",
"numpy.concatenate",
"numpy.full",
"sklearn.utils.safe_mask"
] | [((694, 715), 'sklearn.base.clone', 'clone', (['self.clusterer'], {}), '(self.clusterer)\n', (699, 715), False, 'from sklearn.base import BaseEstimator, clone\n'), ((788, 807), 'numpy.unique', 'np.unique', (['clusters'], {}), '(clusters)\n', (797, 807), True, 'import numpy as np\n'), ((1817, 1838), 'numpy.concatenate',... |
from django.contrib import admin
from django.conf import settings
# Register your models here.
from .models import User
admin.site.register(User)
| [
"django.contrib.admin.site.register"
] | [((122, 147), 'django.contrib.admin.site.register', 'admin.site.register', (['User'], {}), '(User)\n', (141, 147), False, 'from django.contrib import admin\n')] |
#!/usr/bin/env python3
"""
benchmarks writing boolean array vs uint8 array of same values.
For high-speed in the loop writing where performance is critical.
"""
import tempfile
from numpy.random import random
from numpy import packbits
import h5py
from time import time
SIZE = (3, 200000) # arbitrary size to test
# ... | [
"numpy.packbits",
"numpy.random.random",
"h5py.File",
"tempfile.NamedTemporaryFile",
"time.time"
] | [((356, 368), 'numpy.random.random', 'random', (['SIZE'], {}), '(SIZE)\n', (362, 368), False, 'from numpy.random import random\n'), ((413, 442), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {}), '()\n', (440, 442), False, 'import tempfile\n'), ((459, 477), 'h5py.File', 'h5py.File', (['fn', '"""w""... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.utilities2 import utilities2
def test_utilities2():
"""Test module utilities2.py by downloading
utilities2.csv and testing shape of
extrac... | [
"shutil.rmtree",
"tempfile.mkdtemp",
"observations.r.utilities2.utilities2"
] | [((377, 395), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (393, 395), False, 'import tempfile\n'), ((418, 439), 'observations.r.utilities2.utilities2', 'utilities2', (['test_path'], {}), '(test_path)\n', (428, 439), False, 'from observations.r.utilities2 import utilities2\n'), ((499, 523), 'shutil.rmtree'... |
##############################################################################
#
# Copyright (c) 2007 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | [
"zope.schema.fieldproperty.FieldProperty",
"zope.component.hooks.getSite"
] | [((1188, 1226), 'zope.schema.fieldproperty.FieldProperty', 'FieldProperty', (["IHTMLImageWidget['src']"], {}), "(IHTMLImageWidget['src'])\n", (1201, 1226), False, 'from zope.schema.fieldproperty import FieldProperty\n'), ((1928, 1943), 'zope.component.hooks.getSite', 'hooks.getSite', ([], {}), '()\n', (1941, 1943), Fal... |
from sqlalchemy.orm import scoped_session, sessionmaker
Session = scoped_session(sessionmaker())
| [
"sqlalchemy.orm.sessionmaker"
] | [((82, 96), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', ([], {}), '()\n', (94, 96), False, 'from sqlalchemy.orm import scoped_session, sessionmaker\n')] |
#!/usr/bin/env python
from setuptools import setup, find_packages
import os
data_files = [(d, [os.path.join(d, f) for f in files])
for d, folders, files in os.walk(os.path.join('src', 'config'))]
setup(name='splunk-connector',
version='1.0',
description='execute splunk queries and format d... | [
"setuptools.find_packages",
"os.path.join"
] | [((498, 518), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (511, 518), False, 'from setuptools import setup, find_packages\n'), ((97, 115), 'os.path.join', 'os.path.join', (['d', 'f'], {}), '(d, f)\n', (109, 115), False, 'import os\n'), ((180, 209), 'os.path.join', 'os.path.join', (['"... |
import os
import argparse
import csv
import pickle
import logging
import multiprocessing
import subprocess
import autosklearn.classification
import pandas as pd
from ml_utils import load_polya_seq_df, map_clvs, compare, KARBOR_FEATURE_COLS
from kleat.misc.cluster import cluster_clv_sites
from kleat.misc.utils import... | [
"logging.basicConfig",
"pandas.read_pickle",
"kleat.misc.utils.backup_file",
"pickle.dump",
"argparse.ArgumentParser",
"csv.writer",
"logging.info",
"multiprocessing.cpu_count",
"os.path.dirname",
"ml_utils.map_clvs",
"ml_utils.load_polya_seq_df",
"multiprocessing.Pool",
"os.path.basename",
... | [((335, 428), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(asctime)s|%(levelname)s|%(message)s"""'}), "(level=logging.DEBUG, format=\n '%(asctime)s|%(levelname)s|%(message)s')\n", (354, 428), False, 'import logging\n'), ((754, 791), 'logging.info', 'logging.info', (['... |
import json
import os
import random
import numpy as np
from math import ceil
import bottle
from bottle import HTTPResponse
# import time
from timeit import default_timer as timer
from grid_data_maker import *
from util_fns import *
# my_moves
delta = [[-1, 0], # go up
[0, -1], # go left
[1, 0], #... | [
"numpy.copy",
"numpy.zeros",
"numpy.argwhere",
"numpy.abs"
] | [((1279, 1320), 'numpy.zeros', 'np.zeros', (['snakes_grid.shape'], {'dtype': 'np.int'}), '(snakes_grid.shape, dtype=np.int)\n', (1287, 1320), True, 'import numpy as np\n'), ((2234, 2254), 'numpy.copy', 'np.copy', (['snakes_grid'], {}), '(snakes_grid)\n', (2241, 2254), True, 'import numpy as np\n'), ((3246, 3285), 'nump... |
"""Test for Chiral linear layers."""
import unittest
import torch
import torch.nn.functional as F
from tests.test_chiral_base import TestChiralBase
from chiral_layers.chiral_linear import ChiralLinear
class TestChiralConv1d(TestChiralBase):
"""Implements unittests for chiral linear layers."""
def test_single_l... | [
"unittest.main",
"chiral_layers.chiral_linear.ChiralLinear"
] | [((2979, 2994), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2992, 2994), False, 'import unittest\n'), ((995, 1147), 'chiral_layers.chiral_linear.ChiralLinear', 'ChiralLinear', (['(in_dim * num_joints)', '(out_dim * num_joints)'], {'bias': '(True)', 'sym_groupings': 'sym_groupings', 'neg_dim_in': 'neg_dim_in', ... |
from unittest import TestCase
from src.superconductor_losses import parallel_loss, perp_loss, norris_equation, cryostat_losses, cryo_surface, \
thermal_incomes, cooler_cost, sc_load_loss, magnusson_ac_loss
from math import pi
class TestLosses(TestCase):
def test_losses(self):
# BSCCO cable from Magn... | [
"src.superconductor_losses.cryo_surface",
"src.superconductor_losses.norris_equation",
"src.superconductor_losses.cryostat_losses",
"src.superconductor_losses.magnusson_ac_loss",
"src.superconductor_losses.thermal_incomes",
"src.superconductor_losses.perp_loss",
"src.superconductor_losses.sc_load_loss",... | [((1728, 1767), 'src.superconductor_losses.magnusson_ac_loss', 'magnusson_ac_loss', (['bax', 'brad', '(50)', '(18.75)'], {}), '(bax, brad, 50, 18.75)\n', (1745, 1767), False, 'from src.superconductor_losses import parallel_loss, perp_loss, norris_equation, cryostat_losses, cryo_surface, thermal_incomes, cooler_cost, sc... |
#!/usr/bin/env python3
import sys
from datetime import datetime
import message_filters
import rosbag
import rospy
import yaml
from geometry_msgs.msg import Twist, TwistStamped
from mini_tools.msg import BoolStamped
from nav_msgs.msg import Odometry
from sensor_msgs.msg import CompressedImage, Imu, NavSatFix
from std_... | [
"rospy.init_node",
"rosbag.Bag",
"rospy.Time.now",
"datetime.datetime.now",
"rospy.spin",
"message_filters.Subscriber",
"message_filters.ApproximateTimeSynchronizer",
"rospy.Subscriber",
"rospy.loginfo",
"mini_tools.msg.BoolStamped"
] | [((7714, 7748), 'rospy.init_node', 'rospy.init_node', (['"""rosbag_recorder"""'], {}), "('rosbag_recorder')\n", (7729, 7748), False, 'import rospy\n'), ((7753, 7793), 'rospy.loginfo', 'rospy.loginfo', (['"""Rosbag Recorder Started"""'], {}), "('Rosbag Recorder Started')\n", (7766, 7793), False, 'import rospy\n'), ((783... |
import cv2
import numpy as np
import logging
class TileUtils:
@staticmethod
def add_texts_with_bg(img, texts):
'''
Adds each text line by line at the bottom left area of the image
:param img:
:param texts:
:return:
'''
font_scale = 2
thickness... | [
"cv2.rectangle",
"numpy.ones",
"logging.warning",
"numpy.argmax",
"numpy.floor",
"cv2.putText",
"numpy.array",
"cv2.getTextSize"
] | [((6774, 6862), 'cv2.putText', 'cv2.putText', (['a', 'text', 'bottom_left_corner_of_text', 'font', 'font_scale', 'color', 'thickness'], {}), '(a, text, bottom_left_corner_of_text, font, font_scale, color,\n thickness)\n', (6785, 6862), False, 'import cv2\n'), ((1103, 1178), 'cv2.rectangle', 'cv2.rectangle', (['img',... |
# ============================================================================
# 第七章 給湯設備
# 第一節 給湯設備
# Ver.18(エネルギー消費性能計算プログラム(住宅版)Ver.02.05~)
# ============================================================================
import numpy as np
from functools import lru_cache
import pyhees.section7_1_b as default
import... | [
"numpy.clip",
"pyhees.section7_1_d.calc_E_E_hs_d_t",
"numpy.convolve",
"pyhees.section7_1_g_3.calc_E_E_hs_d_t",
"pyhees.section7_1_i.get_E_K_hs_d_t",
"pyhees.section7_1_d.get_E_G_hs_d_t",
"pyhees.section9_3.calc_E_E_W_aux_ass_d_t",
"pyhees.section7_1_j.get_f_sb",
"pyhees.section7_1_c.get_E_K_hs_d_t"... | [((1290, 1301), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (1299, 1301), False, 'from functools import lru_cache\n'), ((3745, 3760), 'pyhees.section11_3.load_schedule', 'load_schedule', ([], {}), '()\n', (3758, 3760), False, 'from pyhees.section11_3 import load_schedule, get_schedule_hw\n'), ((3779, 3804), '... |
from libs.config import alias, gget, color
@alias(func_alias="ext", _type="COMMON",)
def run():
"""
extension
Lists installed extensions.
"""
loaded_ext = gget("webshell.loaded_ext",namespace="webshell")
print()
if isinstance(loaded_ext,list):
print(color.magenta("Extension ---> \n... | [
"libs.config.color.red",
"libs.config.gget",
"libs.config.alias",
"libs.config.color.magenta",
"libs.config.color.cyan"
] | [((45, 84), 'libs.config.alias', 'alias', ([], {'func_alias': '"""ext"""', '_type': '"""COMMON"""'}), "(func_alias='ext', _type='COMMON')\n", (50, 84), False, 'from libs.config import alias, gget, color\n'), ((177, 226), 'libs.config.gget', 'gget', (['"""webshell.loaded_ext"""'], {'namespace': '"""webshell"""'}), "('we... |
#!/usr/bin/env python3.6
from os import listdir, makedirs
from os.path import join, isdir, isfile, exists
from shutil import copy
'''multi-doc version: This script aims to make folders with "system" and "reference"
subfolders and then copy files from source_path to destin_path for locating summaries
in rouge format ... | [
"os.path.exists",
"os.listdir",
"os.path.join",
"os.makedirs"
] | [((937, 955), 'os.listdir', 'listdir', (['main_path'], {}), '(main_path)\n', (944, 955), False, 'from os import listdir, makedirs\n'), ((974, 997), 'os.path.join', 'join', (['main_path', 'folder'], {}), '(main_path, folder)\n', (978, 997), False, 'from os.path import join, isdir, isfile, exists\n'), ((1019, 1044), 'os.... |
from typing import Callable, Dict, Optional, Sequence, Tuple, Union
import pytest # type: ignore
from looker_sdk import methods, models
from henry.modules import exceptions, fetcher
@pytest.fixture(name="fc")
def initialize() -> fetcher.Fetcher:
"""Returns an instance of fetcher"""
options = fetcher.Input(... | [
"henry.modules.fetcher.Fetcher",
"henry.modules.fetcher.Input",
"pytest.mark.parametrize",
"pytest.raises",
"pytest.fixture"
] | [((188, 213), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""fc"""'}), "(name='fc')\n", (202, 213), False, 'import pytest\n'), ((2109, 2172), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""project, model"""', "[(None, 'BadModel')]"], {}), "('project, model', [(None, 'BadModel')])\n", (2132, 2172), F... |
# coding: utf-8
from collections import defaultdict
from typing import List, Dict
import networkx as nx
import matplotlib.pyplot as plt
from interface import AttentionTensor, PathScores
class Subgraph:
def __init__(self, center_nodes: List[int], all_path_scores: Dict[int, PathScores]):
self.center_nodes ... | [
"matplotlib.pyplot.show",
"networkx.spring_layout",
"networkx.Graph",
"collections.defaultdict",
"matplotlib.pyplot.get_cmap"
] | [((583, 593), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (591, 593), True, 'import networkx as nx\n'), ((2185, 2195), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2193, 2195), True, 'import matplotlib.pyplot as plt\n'), ((2546, 2556), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (2554, 2556), True, ... |
import time
import peewee
from peewee import BlobField, BigIntegerField, TextField
from playhouse.postgres_ext import BinaryJSONField
from slim.utils import StateObject, to_hex
import config
from model import BaseModel, MyTimestampField
from model._post import LongIdPostModel, POST_TYPES
class UPLOAD_SOURCE(StateOb... | [
"playhouse.postgres_ext.BinaryJSONField",
"slim.utils.to_hex",
"peewee.BigIntegerField",
"peewee.TextField"
] | [((466, 504), 'peewee.TextField', 'TextField', ([], {'index': '(True)', 'help_text': '"""哈希值"""'}), "(index=True, help_text='哈希值')\n", (475, 504), False, 'from peewee import BlobField, BigIntegerField, TextField\n'), ((549, 584), 'peewee.BigIntegerField', 'BigIntegerField', ([], {'help_text': '"""图片文件大小"""'}), "(help_t... |
#!/usr/bin/env python
# Copyright <NAME> 2013. BSD 3-Clause license, see LICENSE file.
from os.path import dirname, join
from distutils.core import setup
from colorama import VERSION
NAME = 'colorama'
def get_long_description(filename):
readme = join(dirname(__file__), filename)
return open(readme).read()
... | [
"os.path.dirname"
] | [((260, 277), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (267, 277), False, 'from os.path import dirname, join\n')] |
from unittest.mock import MagicMock
import pytest
from cura.PrinterOutput.Models.PrintJobOutputModel import PrintJobOutputModel
from cura.PrinterOutput.Models.PrinterConfigurationModel import PrinterConfigurationModel
from cura.PrinterOutput.Models.PrinterOutputModel import PrinterOutputModel
from cura.PrinterOutpu... | [
"pytest.mark.parametrize",
"unittest.mock.MagicMock"
] | [((1045, 1104), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""data"""', 'test_validate_data_get_set'], {}), "('data', test_validate_data_get_set)\n", (1068, 1104), False, 'import pytest\n'), ((1918, 1980), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""data"""', 'test_validate_data_get_update... |
#!/usr/bin/python
import ipgetter
import os
import platform
import subprocess
import time
import wx
# TODO Clean up the code.
# Licenced under the MIT Licence. See LICENCE for more details.
class Auditor(wx.Frame):
def __init__(self, parent, title):
self.audit = ""
self.version = "0.1 (b2)"
... | [
"platform.node",
"ipgetter.myip",
"platform.release",
"wx.ProgressDialog",
"wx.StaticBox",
"wx.App",
"platform.version",
"subprocess.Popen",
"wx.StaticBoxSizer",
"wx.CheckBox",
"platform.system",
"platform.processor",
"wx.MessageDialog",
"wx.AboutDialogInfo",
"wx.Panel",
"os.path.expan... | [((17622, 17630), 'wx.App', 'wx.App', ([], {}), '()\n', (17628, 17630), False, 'import wx\n'), ((628, 642), 'wx.Panel', 'wx.Panel', (['self'], {}), '(self)\n', (636, 642), False, 'import wx\n'), ((667, 691), 'wx.BoxSizer', 'wx.BoxSizer', (['wx.VERTICAL'], {}), '(wx.VERTICAL)\n', (678, 691), False, 'import wx\n'), ((719... |
'''
Module containing the DataFiller class,
which is responsible for filling data
to plots and monitors
'''
from copy import copy
from ast import literal_eval # to convert a string to list
import numpy as np
from PyQt5 import QtGui, QtCore
import pyqtgraph as pg
class DataFiller():
#pylint: disable=too-many-inst... | [
"PyQt5.QtGui.QGraphicsTextItem",
"numpy.max",
"ast.literal_eval",
"numpy.linspace",
"pyqtgraph.mkPen",
"numpy.min",
"copy.copy",
"PyQt5.QtCore.QPointF"
] | [((2602, 2653), 'numpy.linspace', 'np.linspace', (['(-self._time_window)', '(0)', 'self._n_samples'], {}), '(-self._time_window, 0, self._n_samples)\n', (2613, 2653), True, 'import numpy as np\n'), ((3497, 3531), 'numpy.linspace', 'np.linspace', (['(0)', '(0)', 'self._n_samples'], {}), '(0, 0, self._n_samples)\n', (350... |
from flask import Blueprint
report = Blueprint('report', __name__, template_folder='templates',
static_folder='static')
from . import views
| [
"flask.Blueprint"
] | [((39, 126), 'flask.Blueprint', 'Blueprint', (['"""report"""', '__name__'], {'template_folder': '"""templates"""', 'static_folder': '"""static"""'}), "('report', __name__, template_folder='templates', static_folder=\n 'static')\n", (48, 126), False, 'from flask import Blueprint\n')] |
# Generated by Django 2.0.5 on 2018-06-21 16:10
import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operation... | [
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((5885, 6032), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""quickstart.Source"""', 'verbose_name': '"""Indicator Source"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.CASCADE, to='qu... |
from collections import Counter
def day6(n_days: int) -> int:
with open("input.txt") as f:
fishes = map(int, f.readline().split(","))
n_fish_per_day = Counter()
for f in fishes:
n_fish_per_day[f] += 1
# simulate days
for _ in range(n_days):
new_n_fish_per_day = {}
... | [
"collections.Counter"
] | [((170, 179), 'collections.Counter', 'Counter', ([], {}), '()\n', (177, 179), False, 'from collections import Counter\n')] |
import factory
import app.factories.common as common
from app.factories.discount_code import DiscountCodeFactory
from app.factories.event import EventFactoryBasic
from app.factories.user import UserFactory
from app.models.event_invoice import db, EventInvoice
class EventInvoiceFactory(factory.alchemy.SQLAlchemyModel... | [
"factory.RelatedFactory"
] | [((428, 469), 'factory.RelatedFactory', 'factory.RelatedFactory', (['EventFactoryBasic'], {}), '(EventFactoryBasic)\n', (450, 469), False, 'import factory\n'), ((481, 516), 'factory.RelatedFactory', 'factory.RelatedFactory', (['UserFactory'], {}), '(UserFactory)\n', (503, 516), False, 'import factory\n'), ((537, 580), ... |
import re
import os
import shutil
SCRIPT_DIR = "/home/teddy/projects/dixit/cards"
FRONTEND_DIR = "/home/teddy/projects/dixit/client"
BACKEND_DIR = "/home/teddy/projects/dixit/server"
FRONTEND_CARD_PATH = "cards"
SQL_FILENAME = "insert_cards.sql"
SQL_OUTPUT = os.path.join(SCRIPT_DIR, SQL_FILENAME)
TEMPLATE_FILENAME =... | [
"os.path.join",
"re.match"
] | [((261, 299), 'os.path.join', 'os.path.join', (['SCRIPT_DIR', 'SQL_FILENAME'], {}), '(SCRIPT_DIR, SQL_FILENAME)\n', (273, 299), False, 'import os\n'), ((3326, 3364), 'os.path.join', 'os.path.join', (['SCRIPT_DIR', 'SQL_FILENAME'], {}), '(SCRIPT_DIR, SQL_FILENAME)\n', (3338, 3364), False, 'import os\n'), ((3386, 3425), ... |
from .models import Comment, Post, Reply
from django import forms
from django.utils import timezone
class PostForm(forms.Form):
heading = forms.CharField(max_length=100)
text = forms.CharField(max_length=2000)
# def clean(self, request):
# heading = self.cleaned_data['heading']
# confessi... | [
"django.forms.CharField"
] | [((144, 175), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (159, 175), False, 'from django import forms\n'), ((187, 219), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(2000)'}), '(max_length=2000)\n', (202, 219), False, 'from django import forms\... |
import requests
from bs4 import BeautifulSoup
import re
import pandas
import csv
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
page_no = 1
restaurant_reviews =[]
for page in range(0, 813):
print(page_no)
re... | [
"pandas.DataFrame",
"bs4.BeautifulSoup",
"requests.get",
"re.compile"
] | [((2432, 2468), 'pandas.DataFrame', 'pandas.DataFrame', (['restaurant_reviews'], {}), '(restaurant_reviews)\n', (2448, 2468), False, 'import pandas\n'), ((474, 511), 'bs4.BeautifulSoup', 'BeautifulSoup', (['content', '"""html.parser"""'], {}), "(content, 'html.parser')\n", (487, 511), False, 'from bs4 import BeautifulS... |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
T... | [
"json.loads",
"urllib.quote_plus",
"salts_lib.log_utils.log",
"xbmcaddon.Addon",
"urlparse.urlsplit",
"salts_lib.constants.Q_ORDER.items",
"urlparse.urlparse"
] | [((996, 1011), 'salts_lib.constants.Q_ORDER.items', 'Q_ORDER.items', ([], {}), '()\n', (1009, 1011), False, 'from salts_lib.constants import Q_ORDER\n'), ((1649, 1666), 'xbmcaddon.Addon', 'xbmcaddon.Addon', ([], {}), '()\n', (1664, 1666), False, 'import xbmcaddon\n'), ((2298, 2366), 'urllib.quote_plus', 'urllib.quote_p... |
from django.db import models
from django.contrib.postgres.fields import ArrayField
from apps.beatitud_corpus.models import Language
from utils.scraping.beautiful_soup import get_text_from_bs, BeautifulSoup
from django.db.models.signals import post_save
from django.dispatch import receiver
class Pope(models.Model):
... | [
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"utils.scraping.beautiful_soup.BeautifulSoup",
"django.db.models.AutoField",
"django.dispatch.receiver",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((2407, 2446), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'VaticanText'}), '(post_save, sender=VaticanText)\n', (2415, 2446), False, 'from django.dispatch import receiver\n'), ((327, 374), 'django.db.models.AutoField', 'models.AutoField', ([], {'unique': '(True)', 'primary_key': '(True)'}), '(u... |
# coding=utf-8
# Copyright 2021 TF-Transformers Authors.
# 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 r... | [
"tensorflow.shape",
"tf_transformers.layers.PatchEmbeddings",
"tf_transformers.activations.get_activation",
"tensorflow.keras.layers.Dense",
"tf_transformers.layers.transformer.TransformerVIT",
"tensorflow.keras.layers.Input",
"tensorflow.keras.initializers.serialize",
"tensorflow.concat",
"tensorfl... | [((1282, 1311), 'absl.logging.set_verbosity', 'logging.set_verbosity', (['"""INFO"""'], {}), "('INFO')\n", (1303, 1311), False, 'from absl import logging\n'), ((7909, 7984), 'tf_transformers.utils.docstring_file_utils.add_start_docstrings', 'add_start_docstrings', (['"""Forward pass of Vit :"""', 'CALL_ENCODER_DOCSTRIN... |
from flask import request, jsonify
from flask.views import MethodView
from models import Status
from db import db
class StatusAPI(MethodView):
def get(self, id):
if id is None:
return jsonify([s.serialize for s in Status.query.all()])
else:
status = Status.query.filter_by(id... | [
"db.db.session.delete",
"flask.request.get_json",
"models.Status.query.filter_by",
"db.db.session.commit",
"db.db.session.add",
"models.Status.query.all",
"flask.jsonify"
] | [((670, 696), 'db.db.session.add', 'db.session.add', (['new_status'], {}), '(new_status)\n', (684, 696), False, 'from db import db\n'), ((705, 724), 'db.db.session.commit', 'db.session.commit', ([], {}), '()\n', (722, 724), False, 'from db import db\n'), ((1082, 1107), 'db.db.session.delete', 'db.session.delete', (['st... |
# Generated by Django 3.2.6 on 2021-10-24 10:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('material', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='GICategoryModel',
fields=[
... | [
"django.db.models.DateTimeField",
"django.db.models.CharField",
"django.db.models.BigAutoField"
] | [((1074, 1184), 'django.db.models.CharField', 'models.CharField', ([], {'default': 'None', 'help_text': '"""plant_name"""', 'max_length': '(100)', 'null': '(True)', 'verbose_name': '"""comment"""'}), "(default=None, help_text='plant_name', max_length=100, null\n =True, verbose_name='comment')\n", (1090, 1184), False... |
import multiprocessing
import time
from multiprocessing import Queue
import numpy as np
import os
from keras import Input, Model
from keras.layers import Dense, Conv2D, MaxPooling2D, concatenate, Flatten
from keras_vggface.vggface import VGGFace
from skimage.feature import hog
from skimage.metrics import structural_si... | [
"numpy.ptp",
"keras.layers.Conv2D",
"multiprocessing.Process",
"training.misc.adjust_dynamic_range",
"numpy.array",
"sklearn.metrics.roc_curve",
"keras.layers.Dense",
"training.misc.convert_to_pil_image",
"os.listdir",
"skimage.metrics.structural_similarity",
"keras.Model",
"pretrained_network... | [((781, 897), 'training.dataset.load_dataset', 'dataset.load_dataset', ([], {'data_dir': 'data_dir', 'tfrecord_dir': 'dataset_name', 'max_label_size': '(1)', 'repeat': '(False)', 'shuffle_mb': '(0)'}), '(data_dir=data_dir, tfrecord_dir=dataset_name,\n max_label_size=1, repeat=False, shuffle_mb=0)\n', (801, 897), Fal... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import requests
browser = webdriver.Chrome()
browser.get("https://book.douban.com/tag/%E6%95%A3%E6%96%87")
# imgs=browser.find_elements_by_xpath('//div[#content]')
# elem = driver.find_element_by_css_selector("#q")
# print(elem)
# elem.clea... | [
"selenium.webdriver.Chrome"
] | [((106, 124), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (122, 124), False, 'from selenium import webdriver\n'), ((533, 551), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (549, 551), False, 'from selenium import webdriver\n')] |
"""Define __version__ and enforce minimum library versions"""
from __future__ import division
from __future__ import print_function
import os
import sys
from distutils.version import LooseVersion
__version__ = '2.1' # incremented mostly to track significant changes to sort file format
# enforce minimum versions of ... | [
"distutils.version.LooseVersion",
"os.sys.version.split",
"pkg_resources.get_distribution",
"PyQt4.pyqtconfig.Configuration"
] | [((2280, 2295), 'PyQt4.pyqtconfig.Configuration', 'Configuration', ([], {}), '()\n', (2293, 2295), False, 'from PyQt4.pyqtconfig import Configuration\n'), ((2060, 2085), 'os.sys.version.split', 'os.sys.version.split', (['""" """'], {}), "(' ')\n", (2080, 2085), False, 'import os\n'), ((2732, 2771), 'pkg_resources.get_d... |
import logging
from functools import partial
import wandb
import torch
from torch.utils.data import DataLoader
from climart.data_wrangling.constants import TEST_YEARS, LAYERS, OOD_PRESENT_YEARS, TRAIN_YEARS, get_flux_mean, \
get_data_dims, OOD_FUTURE_YEARS, OOD_HISTORIC_YEARS
from climart.data_wrangling.h5_datase... | [
"wandb.log",
"climart.models.interface.get_trainer",
"torch.set_printoptions",
"climart.data_wrangling.constants.get_data_dims",
"wandb.config.update",
"climart.utils.utils.set_seed",
"climart.models.column_handler.ColumnPreprocesser",
"climart.utils.hyperparams_and_args.get_argparser",
"climart.mod... | [((741, 779), 'torch.set_printoptions', 'torch.set_printoptions', ([], {'sci_mode': '(False)'}), '(sci_mode=False)\n', (763, 779), False, 'import torch\n'), ((786, 806), 'climart.utils.utils.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (796, 806), False, 'from climart.utils.utils import set_seed, year... |
import os
import scipy.misc as im
import numpy as np
files = os.listdir("dataset")
r = 0
g = 0
b = 0
for f in files:
image = im.imread("dataset/"+f,mode='RGB')
r += image[:,:,0]
g += image[:,:,1]
b += image[:,:,2]
print (image.shape)
r = np.sum(r)
g = np.sum(g)
b = np.sum(b)
pr... | [
"numpy.sum",
"scipy.misc.imread",
"os.listdir"
] | [((66, 87), 'os.listdir', 'os.listdir', (['"""dataset"""'], {}), "('dataset')\n", (76, 87), False, 'import os\n'), ((275, 284), 'numpy.sum', 'np.sum', (['r'], {}), '(r)\n', (281, 284), True, 'import numpy as np\n'), ((290, 299), 'numpy.sum', 'np.sum', (['g'], {}), '(g)\n', (296, 299), True, 'import numpy as np\n'), ((3... |
############
# Standard #
############
import logging
###############
# Third Party #
###############
import pytest
import numpy as np
from bluesky.preprocessors import run_wrapper
from ophyd.status import Status
##########
# Module #
##########
from pswalker.iterwalk import iterwalk
TOL = 5
logger = logging.getLogger... | [
"logging.getLogger",
"pswalker.iterwalk.iterwalk",
"pytest.mark.parametrize",
"ophyd.status.Status",
"pytest.raises",
"pytest.mark.timeout"
] | [((303, 330), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (320, 330), False, 'import logging\n'), ((344, 368), 'pytest.mark.timeout', 'pytest.mark.timeout', (['tmo'], {}), '(tmo)\n', (363, 368), False, 'import pytest\n'), ((370, 418), 'pytest.mark.parametrize', 'pytest.mark.parametrize... |
from app_data.threads import threads_invitations
from app_utils.helpers.pagination import Paginate
class ThreadInvitationsHandler(object):
def get(self, thread_id, start, limit):
paginated_thread_invitation_models = Paginate(
start=start,
limit=limit,
resource=threads_i... | [
"app_utils.helpers.pagination.Paginate"
] | [((230, 305), 'app_utils.helpers.pagination.Paginate', 'Paginate', ([], {'start': 'start', 'limit': 'limit', 'resource': 'threads_invitations[thread_id]'}), '(start=start, limit=limit, resource=threads_invitations[thread_id])\n', (238, 305), False, 'from app_utils.helpers.pagination import Paginate\n')] |
# -*- coding: utf-8 -*-
"""
tests.unit.test_database
------------------------
Database Tests
:copyright: (c) 2020 by <NAME>
:license: BSD, see LICENSE for more details
"""
import pytest
import datetime
from sqlalchemy import func
from log_it.extensions import db
from log_it.user.model import TR... | [
"datetime.datetime",
"log_it.extensions.db.session.rollback",
"sqlalchemy.func.count",
"pytest.mark.parametrize",
"pytest.mark.usefixtures",
"pytest.fixture",
"log_it.user.model.TRole.create",
"log_it.user.model.TRole.query.get"
] | [((588, 617), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""'}), "(scope='class')\n", (602, 617), False, 'import pytest\n'), ((696, 729), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""testdb"""'], {}), "('testdb')\n", (719, 729), False, 'import pytest\n'), ((1154, 1276), 'pytest.mark.para... |
"""empty message
Revision ID: <PASSWORD>
Revises: <PASSWORD>
Create Date: 2018-07-18 12:08:54.854137
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
from alembic.ddl import postgresql
revision = '<PASSWORD>'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = ... | [
"sqlalchemy.Boolean",
"sqlalchemy.String",
"alembic.op.drop_column"
] | [((412, 450), 'alembic.op.drop_column', 'op.drop_column', (['"""resource"""', '"""approved"""'], {}), "('resource', 'approved')\n", (426, 450), False, 'from alembic import op\n'), ((679, 717), 'alembic.op.drop_column', 'op.drop_column', (['"""resource"""', '"""approved"""'], {}), "('resource', 'approved')\n", (693, 717... |
from random import randint
from time import sleep
escolha_do_computador = randint(0, 2)
print('Pedra = 0, Papel = 1 e Tessoura = 2')
escolha_do_player = int(input('Escolha a sua jogada: '))
Jogada = ['Pedra', 'Papel', 'Tessoura']
if escolha_do_player <= 2 and escolha_do_player >= 0:
print('=' * 30)
sleep(3)
... | [
"random.randint",
"time.sleep"
] | [((74, 87), 'random.randint', 'randint', (['(0)', '(2)'], {}), '(0, 2)\n', (81, 87), False, 'from random import randint\n'), ((308, 316), 'time.sleep', 'sleep', (['(3)'], {}), '(3)\n', (313, 316), False, 'from time import sleep\n')] |
# ===============================================================================
# Copyright 2020 ross
#
# 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/LICE... | [
"traitsui.api.InstanceEditor",
"traits.api.Instance",
"traitsui.api.UCustom",
"pychron.hardware.ostech.OsTechLaserController",
"pychron.hardware.fiber_light.FiberLight"
] | [((1283, 1314), 'traits.api.Instance', 'Instance', (['OsTechLaserController'], {}), '(OsTechLaserController)\n', (1291, 1314), False, 'from traits.api import Instance\n'), ((1771, 1791), 'traits.api.Instance', 'Instance', (['FiberLight'], {}), '(FiberLight)\n', (1779, 1791), False, 'from traits.api import Instance\n'),... |
# Generated by Django 3.2.6 on 2021-08-02 07:39
import Picturedom.core.validators
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
depen... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.ImageField",
"django.db.models.BigAutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((340, 397), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (371, 397), False, 'from django.db import migrations, models\n'), ((3011, 3096), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'djang... |
import time
import progressbar
def cls():
print(chr(27) + "[2J")
def uInput(aIn):
chc = input(">> ")
while chc not in aIn:
print("err > {} err.input".format(chc))
print("accepted inputs >>> {}".format(aIn))
chc = input(">> ")
return chc
def bar(lngth, delay):
bar = prog... | [
"time.sleep",
"progressbar.ProgressBar"
] | [((316, 341), 'progressbar.ProgressBar', 'progressbar.ProgressBar', ([], {}), '()\n', (339, 341), False, 'import progressbar\n'), ((387, 404), 'time.sleep', 'time.sleep', (['delay'], {}), '(delay)\n', (397, 404), False, 'import time\n')] |
from math import sqrt, floor
def is_prime(x):
for i in range(2, floor(sqrt(x))):
if x % i == 0:
return False
return True
composites = 0
numbers = range(107_900, 124_900 + 1, 17)
for n in numbers:
if not is_prime(n):
composites += 1
print('Number of composites:', composites) # ... | [
"math.sqrt"
] | [((75, 82), 'math.sqrt', 'sqrt', (['x'], {}), '(x)\n', (79, 82), False, 'from math import sqrt, floor\n')] |
#!/usr/bin/env python
import kopf
import kubernetes
import os
import json
import subprocess
import yaml
operator_domain = os.environ.get('OPERATOR_DOMAIN', 'app.example.com')
config_map_label = operator_domain + '/config'
app_name_label = operator_domain + '/name'
if os.path.exists('/var/run/secrets/kubernetes.io/se... | [
"os.path.exists",
"json.loads",
"kubernetes.config.load_incluster_config",
"kubernetes.client.CoreV1Api",
"kubernetes.client.CustomObjectsApi",
"subprocess.run",
"os.environ.get",
"kubernetes.config.load_kube_config",
"kopf.PermanentError",
"json.dumps",
"yaml.safe_load",
"kubernetes.config.li... | [((124, 176), 'os.environ.get', 'os.environ.get', (['"""OPERATOR_DOMAIN"""', '"""app.example.com"""'], {}), "('OPERATOR_DOMAIN', 'app.example.com')\n", (138, 176), False, 'import os\n'), ((271, 344), 'os.path.exists', 'os.path.exists', (['"""/var/run/secrets/kubernetes.io/serviceaccount/namespace"""'], {}), "('/var/run... |
#!/usr/bin/env python3
import argparse
import sys
import os
# This key table has to match the one in bootloader
keyTbl = [0xDEADBEEF, 0xAAAAAAAA, 0x11111111, 0x00000000, 0xFFFFFFFF, 0x55555555, 0xA5A5A5A5, 0x66666666]
#******************************************************************************
#
# Main function
#... | [
"os.urandom",
"argparse.ArgumentParser"
] | [((4231, 4328), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Secure Image generation utility for Apollo or Apollo2"""'}), "(description=\n 'Secure Image generation utility for Apollo or Apollo2')\n", (4254, 4328), False, 'import argparse\n'), ((761, 774), 'os.urandom', 'os.urandom',... |
################################################################################
# Copyright (c) 2020 ContinualAI #
# Copyrights licensed under the MIT License. #
# See the accompanying LICENSE file for terms. ... | [
"matplotlib.pyplot.imshow",
"avalanche.benchmarks.datasets.Stream51",
"math.ceil",
"torch.utils.data.dataloader.DataLoader",
"os.path.join",
"torchvision.transforms.Normalize",
"torchvision.transforms.Resize",
"torchvision.transforms.ToTensor",
"matplotlib.pyplot.show"
] | [((3432, 3477), 'avalanche.benchmarks.datasets.Stream51', 'Stream51', (['root'], {'train': '(True)', 'download': 'download'}), '(root, train=True, download=download)\n', (3440, 3477), False, 'from avalanche.benchmarks.datasets import Stream51\n'), ((3493, 3539), 'avalanche.benchmarks.datasets.Stream51', 'Stream51', (['... |
from weakvtg.utils import get_batch_size, percent, pivot, identity, map_dict, expand
def test_get_batch_size():
assert get_batch_size({"id": range(10), "foo": range(100), "bar": "hello"}) == 10
def test_percent():
assert percent(0) == 0
assert percent(54) == 5400
def test_pivot():
out = pivot([{"a... | [
"weakvtg.utils.percent",
"weakvtg.utils.map_dict",
"weakvtg.utils.identity",
"weakvtg.utils.expand",
"torch.tensor",
"weakvtg.utils.pivot"
] | [((310, 357), 'weakvtg.utils.pivot', 'pivot', (["[{'a': 1, 'b': 100}, {'a': 2, 'b': 200}]"], {}), "([{'a': 1, 'b': 100}, {'a': 2, 'b': 200}])\n", (315, 357), False, 'from weakvtg.utils import get_batch_size, percent, pivot, identity, map_dict, expand\n'), ((560, 574), 'weakvtg.utils.identity', 'identity', (['(True)'], ... |
"""
Django settings for drf_template project.
Generated by 'django-admin startproject' using Django 2.2.7.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import ... | [
"os.path.exists",
"os.getenv",
"os.path.join",
"os.mkdir",
"os.path.abspath"
] | [((341, 368), 'os.getenv', 'os.getenv', (['"""ENV"""', '"""DEVELOP"""'], {}), "('ENV', 'DEVELOP')\n", (350, 368), False, 'import os\n'), ((4483, 4515), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""media/"""'], {}), "(BASE_DIR, 'media/')\n", (4495, 4515), False, 'import os\n'), ((4559, 4589), 'os.path.join', 'os.pa... |
"""
Добавьте в предыдущий класс следующие методы:
__add__, принимающий вторую матрицу того же размера
и возвращающий сумму матриц.
__mul__, принимающий число типа int или float и возвращающий
матрицу, умноженную на скаляр.
__rmul__, делающий то же самое, что и __mul__. Этот метод будет
вызван в ... | [
"sys.stdin.read",
"copy.deepcopy"
] | [((1640, 1652), 'sys.stdin.read', 'stdin.read', ([], {}), '()\n', (1650, 1652), False, 'from sys import stdin\n'), ((924, 938), 'copy.deepcopy', 'deepcopy', (['list'], {}), '(list)\n', (932, 938), False, 'from copy import deepcopy\n'), ((1136, 1155), 'copy.deepcopy', 'deepcopy', (['self.list'], {}), '(self.list)\n', (1... |
import unittest
from snapstack import Plan, Step
class SnapstackTest(unittest.TestCase):
def test_snapstack(self):
'''
_test_snapstack_
Run a basic smoke test, utilizing our snapstack testing harness.
snapstack will install a "base" set of snaps, including
keystone, nova... | [
"snapstack.Plan",
"snapstack.Step"
] | [((551, 683), 'snapstack.Step', 'Step', ([], {'snap': '"""{{ cookiecutter.repo_name }}"""', 'script_loc': '"""./tests/"""', 'scripts': "['{{ cookiecutter.repo_name }}.sh']", 'snap_store': '(False)'}), "(snap='{{ cookiecutter.repo_name }}', script_loc='./tests/', scripts=[\n '{{ cookiecutter.repo_name }}.sh'], snap_s... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from ..domains.models import Domain
class Crawl(models.Model):
TYPE_CHOICES = (
('article', 'Article'),
('feed:urls', 'Feed URLs'),
('feed:entries', 'Feed Entries'),
)
otype = models.Char... | [
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.DurationField",
"django.db.models.ManyToManyField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((309, 385), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)', 'choices': 'TYPE_CHOICES', 'blank': '(True)', 'null': '(True)'}), '(max_length=30, choices=TYPE_CHOICES, blank=True, null=True)\n', (325, 385), False, 'from django.db import models\n'), ((408, 445), 'django.db.models.ForeignKey'... |
from fastapi import status, HTTPException, Depends, APIRouter
from fastapi.security.oauth2 import OAuth2PasswordRequestForm
from .. import schemas, models, utils, oauth2
from sqlalchemy.orm.session import Session
from ..database import get_db
router = APIRouter(tags=["Authentication"])
@ router.post("/login", respo... | [
"fastapi.HTTPException",
"fastapi.APIRouter",
"fastapi.Depends"
] | [((254, 288), 'fastapi.APIRouter', 'APIRouter', ([], {'tags': "['Authentication']"}), "(tags=['Authentication'])\n", (263, 288), False, 'from fastapi import status, HTTPException, Depends, APIRouter\n'), ((389, 398), 'fastapi.Depends', 'Depends', ([], {}), '()\n', (396, 398), False, 'from fastapi import status, HTTPExc... |
import setuptools
import pkg_resources
import os
# setup.cfg
pkg_resources.require('setuptools>=39.2')
setuptools.setup() | [
"pkg_resources.require",
"setuptools.setup"
] | [((62, 103), 'pkg_resources.require', 'pkg_resources.require', (['"""setuptools>=39.2"""'], {}), "('setuptools>=39.2')\n", (83, 103), False, 'import pkg_resources\n'), ((105, 123), 'setuptools.setup', 'setuptools.setup', ([], {}), '()\n', (121, 123), False, 'import setuptools\n')] |
import gsw
import xarray as xr
import subprocess
import numpy as np
import os
import pylab as plt
# Import utils and decorators
from tcoasts.utils.utils import *
from tcoasts.utils.decorators import _file_exists
class TransportAlongCoast(object):
'''
'''
def __init__(self,path,initpos,contour_file,di... | [
"subprocess.check_output",
"numpy.sqrt",
"numpy.flipud",
"pylab.plot",
"os.path.join",
"numpy.diff",
"os.path.isfile",
"numpy.array",
"numpy.linspace",
"numpy.cos",
"xarray.DataArray",
"numpy.sin",
"pylab.subplots",
"numpy.loadtxt",
"pylab.gca",
"xarray.open_mfdataset",
"numpy.arange... | [((327, 352), 'numpy.arange', 'np.arange', (['(-400)', '(400)', '(100)'], {}), '(-400, 400, 100)\n', (336, 352), True, 'import numpy as np\n'), ((1168, 1201), 'os.path.isfile', 'os.path.isfile', (['self.contour_file'], {}), '(self.contour_file)\n', (1182, 1201), False, 'import os\n'), ((1702, 1745), 'gsw.distance', 'gs... |
import sys
import time
import torch
import random
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from util_torch import graphs_re,choice_by_prob,gumbel_softmax,graphs_threshold
class GNN_Block(nn.Module):
def __init__(self,input_size,output_size,gn... | [
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.init.xavier_normal_",
"torch.nn.functional.pad",
"torch.nn.functional.softmax",
"torch.nn.ModuleList",
"torch.nn.LSTM",
"torch.eye",
"torch.zeros_like",
"torch.randn",
"torch.nn.Embedding",
"util_torch.gumbel_softmax",
"torch.nn.PReLU",
"torch... | [((12225, 12251), 'torch.randn', 'torch.randn', (['(5)', '(3)', '(100)', '(12)'], {}), '(5, 3, 100, 12)\n', (12236, 12251), False, 'import torch\n'), ((593, 608), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (606, 608), True, 'import torch.nn as nn\n'), ((1869, 1892), 'torch.stack', 'torch.stack', (['out']... |
import tensorflow as tf
x = tf.placeholder(tf.float32, shape=(None,2))
w1 = tf.Variable(tf.random_normal([2,3], stddev=1, seed=1))
w2 = tf.Variable(tf.random_normal([3,1], stddev=1, seed=1))
a = tf.matmul(x, w1)
y = tf.matmul(a, w2)
with tf.Session() as sess:
init_op = tf.global_variables_initializer()
sess.run(in... | [
"tensorflow.random_normal",
"tensorflow.Session",
"tensorflow.placeholder",
"tensorflow.global_variables_initializer",
"tensorflow.matmul"
] | [((29, 72), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '(None, 2)'}), '(tf.float32, shape=(None, 2))\n', (43, 72), True, 'import tensorflow as tf\n'), ((197, 213), 'tensorflow.matmul', 'tf.matmul', (['x', 'w1'], {}), '(x, w1)\n', (206, 213), True, 'import tensorflow as tf\n'), ((218, 234), '... |
from init import __init as p
def cut(sql):
db=p.conntion()
cur=db.cursor()
cur.execute(sql)
b=cur.fetchall()
db.commit()
return b
cur.close()
def findall(sql):
db = p.conntion()
cur = db.cursor()
cur.execute(sql)
listfile = cur.fetchall()
cur.close()
return listfile
def fin... | [
"init.__init.conntion"
] | [((50, 62), 'init.__init.conntion', 'p.conntion', ([], {}), '()\n', (60, 62), True, 'from init import __init as p\n'), ((191, 203), 'init.__init.conntion', 'p.conntion', ([], {}), '()\n', (201, 203), True, 'from init import __init as p\n'), ((342, 354), 'init.__init.conntion', 'p.conntion', ([], {}), '()\n', (352, 354)... |
#!/usr/bin/env python
import sys
from pvconnect import pvserver_process
if len(sys.argv) < 5:
print ('Incorrect usage')
print ('pververlauncher.py server_port user@host' +
' remote_paraview_location mpi_num_tasks' +
' mpiexec (optional)' +
' shell prefix command (optional)')
... | [
"pvconnect.pvserver_process",
"sys.exit"
] | [((821, 959), 'pvconnect.pvserver_process', 'pvserver_process', ([], {'data_host': 'data_host', 'data_dir': 'data_dir', 'paraview_port': 'server_port', 'paraview_cmd': 'paraview_cmd', 'job_ntasks': 'job_ntasks'}), '(data_host=data_host, data_dir=data_dir, paraview_port=\n server_port, paraview_cmd=paraview_cmd, job_... |
from datetime import time
import pandas as pd
from pluto.trading_calendars import calendar_utils as cu
from pluto.control.clock.utils import get_generator
from dev import events
events.add_event('clock.update')
class StopExecution(Exception):
pass
class FakeClock(object):
def update(self, dt):
r... | [
"dev.events.add_event",
"pandas.Timedelta",
"pluto.trading_calendars.calendar_utils.get_calendar_in_range",
"pluto.control.clock.utils.get_generator"
] | [((182, 214), 'dev.events.add_event', 'events.add_event', (['"""clock.update"""'], {}), "('clock.update')\n", (198, 214), False, 'from dev import events\n'), ((2639, 2696), 'pluto.trading_calendars.calendar_utils.get_calendar_in_range', 'cu.get_calendar_in_range', (['self.exchange', 'start_dt', 'end_dt'], {}), '(self.e... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Provides a non-parametric two-stage least squares instrumental variable estimator."""
import numpy as np
from copy import deepcopy
from sklearn import clone
from sklearn.linear_model import LinearRegression
from ...utilit... | [
"numpy.identity",
"numpy.prod",
"sklearn.preprocessing.PolynomialFeatures",
"numpy.hstack",
"numpy.float_power",
"numpy.exp",
"numpy.zeros",
"sklearn.clone",
"numpy.polynomial.hermite_e.hermeval",
"sklearn.linear_model.LinearRegression"
] | [((4866, 4965), 'sklearn.preprocessing.PolynomialFeatures', 'PolynomialFeatures', ([], {'degree': 'degree', 'interaction_only': 'interaction_only', 'include_bias': 'include_bias'}), '(degree=degree, interaction_only=interaction_only,\n include_bias=include_bias)\n', (4884, 4965), False, 'from sklearn.preprocessing i... |
from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
import os
app = Flask(__name__)
app.debug = True
#Database
POSTGRES = {
'user': 'postgres',
'pw': 'test',
'db': 'benchmarkpc',
'host': 'localhost',
'port': '5432',
}
# app.config['SQLAL... | [
"flask_login.LoginManager",
"flask.Flask",
"flask_wtf.csrf.CsrfProtect",
"os.path.join",
"flask_migrate.Migrate",
"flask_sqlalchemy.SQLAlchemy"
] | [((131, 146), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (136, 146), False, 'from flask import Flask, render_template\n'), ((542, 583), 'os.path.join', 'os.path.join', (['"""bench"""', '"""static"""', '"""Images"""'], {}), "('bench', 'static', 'Images')\n", (554, 583), False, 'import os\n'), ((590, 605... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=C0321,C0103,C0301,E1101,C0303,E1004,C0330,R0915,R0914,W0703,C0326
"""
SchemaMap
Used to map solr fields to more common user names and vice versa
2020.0106.1 - First version
Notes:
2020-03-13 - Added Body to USER2SOLR_MAP as a standalone item, in case... | [
"re.sub",
"doctest.testmod",
"re.compile"
] | [((5290, 5325), 're.sub', 're.sub', (['"""\\\\sOR\\\\s"""', '""" || """', 'ret_val'], {}), "('\\\\sOR\\\\s', ' || ', ret_val)\n", (5296, 5325), False, 'import re\n'), ((5338, 5374), 're.sub', 're.sub', (['"""\\\\sAND\\\\s"""', '""" && """', 'ret_val'], {}), "('\\\\sAND\\\\s', ' && ', ret_val)\n", (5344, 5374), False, '... |
# /usr/bin/env python3.5
# -*- mode: python -*-
# =============================================================================
# @@-COPYRIGHT-START-@@
#
# Copyright (c) 2017-2018, Qualcomm Innovation Center, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# mod... | [
"torch.nn.CrossEntropyLoss",
"aimet_torch.examples.supervised_classification_pipeline.create_stand_alone_supervised_classification_evaluator",
"aimet_torch.visualize_model.visualize_relative_weight_ranges_to_identify_problematic_layers",
"aimet_torch.compress.ModelCompressor.compress_model",
"aimet_torch.ut... | [((3068, 3134), 'aimet_torch.examples.imagenet_dataloader.ImageNetDataLoader', 'ImageNetDataLoader', (['image_dir', 'image_size', 'batch_size', 'num_workers'], {}), '(image_dir, image_size, batch_size, num_workers)\n', (3086, 3134), False, 'from aimet_torch.examples.imagenet_dataloader import ImageNetDataLoader\n'), ((... |
# Line Plot
import numpy as np
from matplotlib import pyplot as plt
x = np.arange(1, 11)
print(x)
print()
y = 2 * x
print(y)
print()
plt.plot(x, y)
plt.show()
print()
# Line Plot - 2 (adding titles and labels)
plt.plot(x, y)
plt.title("Line Plot")
plt.xlabel("x-label")
plt.ylabel("y-label")
plt.show()
print()
# Line P... | [
"matplotlib.pyplot.boxplot",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.hist",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"seaborn.load_dataset",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.barh",
"matplotlib.pyplot.pie",
"matplotlib.pyplot.violinplot",
"seab... | [((73, 89), 'numpy.arange', 'np.arange', (['(1)', '(11)'], {}), '(1, 11)\n', (82, 89), True, 'import numpy as np\n'), ((134, 148), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {}), '(x, y)\n', (142, 148), True, 'from matplotlib import pyplot as plt\n'), ((149, 159), 'matplotlib.pyplot.show', 'plt.show', ([], {}),... |
import os
import numpy as np
from pyfftw.builders import rfft
from scipy.interpolate import interp1d
from scipy.special import gamma
from scipy.integrate import quad
import matplotlib.pyplot as plt
class FFTLog(object):
def __init__(self, **kwargs):
self.Nmax = kwargs['Nmax']
self.xmin = kwargs['xm... | [
"pyfftw.builders.rfft",
"numpy.log",
"scipy.interpolate.interp1d",
"numpy.exp",
"numpy.sum",
"numpy.empty_like",
"numpy.empty",
"numpy.arange"
] | [((808, 838), 'scipy.interpolate.interp1d', 'interp1d', (['xin', 'f'], {'kind': '"""cubic"""'}), "(xin, f, kind='cubic')\n", (816, 838), False, 'from scipy.interpolate import interp1d\n'), ((1233, 1252), 'numpy.empty', 'np.empty', (['self.Nmax'], {}), '(self.Nmax)\n', (1241, 1252), True, 'import numpy as np\n'), ((1328... |
from PIL import Image
import os
from stop_words import get_stop_words
import stylecloud
from youtube_transcript_api import YouTubeTranscriptApi
import openai
from keys import *
openai.api_key = OPENAI_API_KEY
def youtube_transcript(youtube_video="https://www.youtube.com/watch?v=zAtcRbYdvuw"):
'''youtube transcri... | [
"youtube_transcript_api.YouTubeTranscriptApi.get_transcript",
"stylecloud.gen_stylecloud",
"os.listdir",
"stop_words.get_stop_words",
"os.path.join",
"openai.Completion.create"
] | [((462, 507), 'youtube_transcript_api.YouTubeTranscriptApi.get_transcript', 'YouTubeTranscriptApi.get_transcript', (['video_id'], {}), '(video_id)\n', (497, 507), False, 'from youtube_transcript_api import YouTubeTranscriptApi\n'), ((780, 956), 'openai.Completion.create', 'openai.Completion.create', ([], {'engine': '""... |
import io
from enum import Enum
from contextlib import closing
import csv
import requests
import zipfile
from linalgo.annotate.models import Annotation, Annotator, Corpus, Document, \
Entity, Task
class AssignmentType(Enum):
REVIEW = 'R'
LABEL = 'A'
class AssignmentStatus(Enum):
ASSIGNED = 'A'
... | [
"linalgo.annotate.models.Task.from_dict",
"requests.post",
"linalgo.annotate.models.Annotator.from_dict",
"io.BytesIO",
"requests.get",
"requests.delete",
"linalgo.annotate.models.Corpus.from_dict",
"linalgo.annotate.models.Entity.from_dict",
"linalgo.annotate.models.Annotation.from_dict",
"linalg... | [((936, 991), 'requests.get', 'requests.get', (['url'], {'headers': 'headers', 'params': 'query_params'}), '(url, headers=headers, params=query_params)\n', (948, 991), False, 'import requests\n'), ((2623, 2644), 'linalgo.annotate.models.Corpus.from_dict', 'Corpus.from_dict', (['res'], {}), '(res)\n', (2639, 2644), Fals... |
# -*- coding: utf-8 -*-
"""
.. currentmodule:: jccli.jc_api_v2.py
.. moduleauthor:: zaro0508 <<EMAIL>>
This is a utility library for the jumpcloud version 2 api
.. note::
To learn more about the jumpcloud api 2
`project website <https://github.com/TheJumpCloud/jcapi-python/tree/master/jcapiv2>`_.
"""
from t... | [
"jccli.errors.JcApiException",
"jcapiv2.Configuration",
"jcapiv2.ApiClient",
"jcapiv2.UserGroupMembersReq",
"jcapiv2.UserGroupPost",
"jcapiv2.GraphManagementReq",
"jcapiv2.SystemGroupData"
] | [((667, 690), 'jcapiv2.Configuration', 'jcapiv2.Configuration', ([], {}), '()\n', (688, 690), False, 'import jcapiv2\n'), ((4425, 4487), 'jcapiv2.UserGroupMembersReq', 'jcapiv2.UserGroupMembersReq', ([], {'id': 'user_id', 'op': '"""add"""', 'type': '"""user"""'}), "(id=user_id, op='add', type='user')\n", (4452, 4487), ... |
# Generated by Django 3.2.7 on 2021-10-04 09:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('eduhub', '0011_alter_classification_parent'),
]
operations = [
migrations.AlterField(
model_name='classification',
n... | [
"django.db.models.CharField"
] | [((353, 451), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(64)', 'null': '(True)', 'verbose_name': '"""Classification comment"""'}), "(blank=True, max_length=64, null=True, verbose_name=\n 'Classification comment')\n", (369, 451), False, 'from django.db import migrations... |
from django.shortcuts import render
from django.views.generic.base import View
from base.models import SiteInfo
class IndexView(View):
def get(self, request):
site_infos = SiteInfo.objects.all().filter(is_live=True)[0]
context = {
'site_infos': site_infos
}
request.se... | [
"django.shortcuts.render",
"base.models.SiteInfo.objects.all"
] | [((397, 435), 'django.shortcuts.render', 'render', (['request', '"""index.html"""', 'context'], {}), "(request, 'index.html', context)\n", (403, 435), False, 'from django.shortcuts import render\n'), ((188, 210), 'base.models.SiteInfo.objects.all', 'SiteInfo.objects.all', ([], {}), '()\n', (208, 210), False, 'from base... |
import os
from PIL import Image
from pubnub.pnconfiguration import PNConfiguration
from pubnub.pubnub import PubNub
pnconfig = PNConfiguration()
pnconfig.publish_key = os.environ["PUBNUB_PUBKEY"]
pnconfig.subscribe_key = os.environ["PUBNUB_SUBKEY"]
pnconfig.uuid = "serverUUID-PUB"
pubnub = PubNub(pnconfig)
with ope... | [
"pubnub.pnconfiguration.PNConfiguration",
"PIL.Image.open",
"pubnub.pubnub.PubNub"
] | [((129, 146), 'pubnub.pnconfiguration.PNConfiguration', 'PNConfiguration', ([], {}), '()\n', (144, 146), False, 'from pubnub.pnconfiguration import PNConfiguration\n'), ((294, 310), 'pubnub.pubnub.PubNub', 'PubNub', (['pnconfig'], {}), '(pnconfig)\n', (300, 310), False, 'from pubnub.pubnub import PubNub\n'), ((367, 381... |
from flask_app import config
import requests
import base64
import json
def mojioko_main(img_url):
img_base64 = img_to_base64("flask_app/static/img/kb-1915.png")
# img_base64 = img_url_to_base64(img_url)
result = request_cloud_vison_api(img_base64)
text_r = result["responses"][0]["fullTextAnnotation"]... | [
"base64.b64encode",
"requests.post",
"requests.get"
] | [((772, 809), 'requests.post', 'requests.post', (['api_url'], {'data': 'req_body'}), '(api_url, data=req_body)\n', (785, 809), False, 'import requests\n'), ((950, 976), 'base64.b64encode', 'base64.b64encode', (['img_byte'], {}), '(img_byte)\n', (966, 976), False, 'import base64\n'), ((1065, 1090), 'base64.b64encode', '... |
# -*- coding: utf-8 -*-
import os
from json import dump
from unittest import TestCase
from datasets.samples import init_datasets
class TestSamples(TestCase):
def setUp(self):
with open("config.json", "w+") as f:
data = [
{
"name": "sample",
... | [
"datasets.samples.init_datasets",
"json.dump",
"os.remove"
] | [((566, 589), 'os.remove', 'os.remove', (['"""sample.csv"""'], {}), "('sample.csv')\n", (575, 589), False, 'import os\n'), ((598, 622), 'os.remove', 'os.remove', (['"""config.json"""'], {}), "('config.json')\n", (607, 622), False, 'import os\n'), ((666, 694), 'datasets.samples.init_datasets', 'init_datasets', (['"""con... |
from copy import copy
from marshmallow import Schema as MarshmallowSchema
from marshmallow import ValidationError as MarshmallowValidationError
from marshmallow import post_load, pre_load
from . import exceptions, fields, settings, utils
# Responses
class Pagination(utils.Immutable):
"""Immutable pagination que... | [
"copy.copy"
] | [((1006, 1016), 'copy.copy', 'copy', (['spec'], {}), '(spec)\n', (1010, 1016), False, 'from copy import copy\n')] |
from yalul.lex.token import Token
from yalul.lex.token_type import TokenType
from yalul.parser import Parser
from yalul.parsers.ast.nodes.statements.expressions.grouping import Grouping
from yalul.parsers.ast.nodes.statements.expressions.binary import Binary
from yalul.parsers.ast.nodes.statements.expressions.var_assig... | [
"yalul.lex.token.Token",
"yalul.parser.Parser"
] | [((698, 729), 'yalul.lex.token.Token', 'Token', (['TokenType.WHILE', '"""while"""'], {}), "(TokenType.WHILE, 'while')\n", (703, 729), False, 'from yalul.lex.token import Token\n'), ((743, 775), 'yalul.lex.token.Token', 'Token', (['TokenType.LEFT_PAREN', '"""("""'], {}), "(TokenType.LEFT_PAREN, '(')\n", (748, 775), Fals... |
import json
import pickle
from datetime import datetime
from argparse import ArgumentParser
from nltk.corpus import stopwords
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.svm import LinearSVC
from sklearn.multiclass import OneVsRestClassifier
from sklearn.preprocessing import MultiLabelBinar... | [
"json.loads",
"pickle.dump",
"nltk.corpus.stopwords.words",
"argparse.ArgumentParser",
"sklearn.svm.LinearSVC",
"sklearn.feature_extraction.text.TfidfVectorizer",
"datetime.datetime.today",
"sklearn.preprocessing.MultiLabelBinarizer"
] | [((358, 374), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (372, 374), False, 'from argparse import ArgumentParser\n'), ((689, 715), 'nltk.corpus.stopwords.words', 'stopwords.words', (['"""english"""'], {}), "('english')\n", (704, 715), False, 'from nltk.corpus import stopwords\n'), ((1039, 1116), 'sk... |
import cmd
from asm_dicts import reg_dict
commands = [
'START',
'RESET',
'MODE',
'STEP',
'LOAD',
'REQ'
]
mode_commands = [
'GET',
'SET_CONT',
'SET_STEP'
]
load_commands = [
'INSTR',
'FILE'
]
req_commands = [
'MEM_DATA',
'MEM_INSTR',
'REG',
'REG_PC',
'LA... | [
"asm_dicts.reg_dict.keys"
] | [((3788, 3803), 'asm_dicts.reg_dict.keys', 'reg_dict.keys', ([], {}), '()\n', (3801, 3803), False, 'from asm_dicts import reg_dict\n'), ((3493, 3508), 'asm_dicts.reg_dict.keys', 'reg_dict.keys', ([], {}), '()\n', (3506, 3508), False, 'from asm_dicts import reg_dict\n')] |
""" Products available to ingest by this package
"""
from collections import OrderedDict
import logging
from .espa import ESPALandsat
from ..errors import ProductNotFoundException
logger = logging.getLogger('tilezilla')
PRODUCTS = [
(ESPALandsat.description, ESPALandsat)
]
class ProductRegistry(object):
""... | [
"logging.getLogger",
"collections.OrderedDict"
] | [((191, 221), 'logging.getLogger', 'logging.getLogger', (['"""tilezilla"""'], {}), "('tilezilla')\n", (208, 221), False, 'import logging\n'), ((416, 437), 'collections.OrderedDict', 'OrderedDict', (['products'], {}), '(products)\n', (427, 437), False, 'from collections import OrderedDict\n')] |
# if someone says no u, respond
import configuration
import manager
import time
from manager import *
modname = "nou"
YES_U = f"^no [uùúüû]$"
TIMEOUT = 2.2
timeouts = {}
@manager.hook(modname, "noufilter", hook=HookType.PATTERN, pattern=YES_U)
@manager.config("respond-to-nou", ConfigScope.CHAN, desc="True or False... | [
"manager.config",
"manager.hook",
"manager.register",
"time.time",
"configuration.get"
] | [((176, 248), 'manager.hook', 'manager.hook', (['modname', '"""noufilter"""'], {'hook': 'HookType.PATTERN', 'pattern': 'YES_U'}), "(modname, 'noufilter', hook=HookType.PATTERN, pattern=YES_U)\n", (188, 248), False, 'import manager\n'), ((250, 337), 'manager.config', 'manager.config', (['"""respond-to-nou"""', 'ConfigSc... |
"""Morse code handling"""
from configparser import ConfigParser
import os
from pathlib import Path
import sys
import warnings
import numpy as np
import sklearn.cluster
import sklearn.exceptions
from .io import read_wave
from .processing import smoothed_power, squared_signal
class MorseCode:
"""Morse code
... | [
"numpy.insert",
"configparser.ConfigParser",
"pathlib.Path",
"warnings.catch_warnings",
"numpy.diff",
"numpy.array",
"sys.stderr.write",
"numpy.nonzero",
"warnings.simplefilter",
"numpy.vectorize"
] | [((2473, 2487), 'configparser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (2485, 2487), False, 'from configparser import ConfigParser\n'), ((3287, 3305), 'numpy.diff', 'np.diff', (['self.data'], {}), '(self.data)\n', (3294, 3305), True, 'import numpy as np\n'), ((3328, 3356), 'numpy.nonzero', 'np.nonzero', (['(squ... |
# http://www.apache.org/licenses/LICENSE-2.0
import unittest
import time
import numpy as np
import auspex.config as config
config.auspex_dummy_mode = True
from auspex.experiment import Experiment
from auspex.stream import DataStream, DataAxis, DataStreamDescriptor, OutputConnector
from auspex.filters.debug impor... | [
"time.sleep",
"numpy.sum",
"numpy.linspace",
"auspex.filters.io.DataBuffer",
"numpy.random.randint",
"numpy.random.seed",
"auspex.stream.OutputConnector",
"unittest.main",
"auspex.filters.correlator.Correlator",
"auspex.log.logger.debug"
] | [((533, 550), 'auspex.stream.OutputConnector', 'OutputConnector', ([], {}), '()\n', (548, 550), False, 'from auspex.stream import DataStream, DataAxis, DataStreamDescriptor, OutputConnector\n'), ((563, 580), 'auspex.stream.OutputConnector', 'OutputConnector', ([], {}), '()\n', (578, 580), False, 'from auspex.stream imp... |