code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import logging
from dotenv import load_dotenv
import sqlalchemy
import urllib
import pyodbc
import os
ROOT = os.path.dirname(os.path.abspath(__name__))
load_dotenv(os.path.join(ROOT, '.env'))
LOG = logging.getLogger('luigi-interface')
RPT_SERVER = os.environ['SERVER_A']
SCG_SERVER = os.environ['SERVER_B']
RPT_DB =... | [
"logging.getLogger",
"os.path.abspath",
"urllib.parse.quote_plus",
"os.path.join"
] | [((203, 239), 'logging.getLogger', 'logging.getLogger', (['"""luigi-interface"""'], {}), "('luigi-interface')\n", (220, 239), False, 'import logging\n'), ((129, 154), 'os.path.abspath', 'os.path.abspath', (['__name__'], {}), '(__name__)\n', (144, 154), False, 'import os\n'), ((168, 194), 'os.path.join', 'os.path.join',... |
import os
import torch
import time
import numpy as np
from tqdm import tqdm
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
from generator import generator
from utils import get_model
sns.set_style("whitegrid")
font = {'family': 'serif',
'style': 'normal',
'size': 10}
matplotlib.... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"seaborn.set_style",
"numpy.array",
"matplotlib.ticker.ScalarFormatter",
"torch.cuda.is_available",
"matplotlib.rc",
"matplotlib.pyplot.semilogy",
"generator.generator",
"matplotlib.pyplot.xlabel",
"torch.set_default_tensor_type",
"matplotl... | [((208, 234), 'seaborn.set_style', 'sns.set_style', (['"""whitegrid"""'], {}), "('whitegrid')\n", (221, 234), True, 'import seaborn as sns\n'), ((309, 338), 'matplotlib.rc', 'matplotlib.rc', (['"""font"""'], {}), "('font', **font)\n", (322, 338), False, 'import matplotlib\n'), ((346, 397), 'matplotlib.ticker.ScalarForm... |
# coding=utf-8
# Copyright 2017 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | [
"sys.exit",
"tensorflow.profiler.ProfileOptionBuilder.time_and_memory",
"tensorflow.logging.info",
"tensorflow.logging.set_verbosity",
"tensor2tensor.utils.registry.help_string",
"tensor2tensor.tpu.tpu_trainer_lib.set_random_seed",
"tensor2tensor.utils.registry.problem",
"tensor2tensor.utils.usr_dir.i... | [((3213, 3277), 'tensor2tensor.tpu.tpu_trainer_lib.create_hparams', 'tpu_trainer_lib.create_hparams', (['FLAGS.hparams_set', 'FLAGS.hparams'], {}), '(FLAGS.hparams_set, FLAGS.hparams)\n', (3243, 3277), False, 'from tensor2tensor.tpu import tpu_trainer_lib\n'), ((5386, 5420), 'os.path.expanduser', 'os.path.expanduser', ... |
import numpy as np
from gym.envs.mujoco import mujoco_env
from gym import utils
import os
from scipy.spatial.distance import euclidean
from meta_mb.meta_envs.base import RandomEnv
#from mujoco-py.mujoco_py.pxd.mujoco import local
import mujoco_py
class PegFullBlueEnv(RandomEnv, utils.EzPickle):
def __init__(self, ... | [
"numpy.clip",
"numpy.square",
"numpy.array",
"numpy.zeros",
"scipy.spatial.distance.euclidean",
"os.path.dirname",
"numpy.random.uniform",
"meta_mb.meta_envs.base.RandomEnv.__init__"
] | [((571, 597), 'numpy.array', 'np.array', (['[x, y, z + 0.15]'], {}), '([x, y, z + 0.15])\n', (579, 597), True, 'import numpy as np\n'), ((623, 642), 'numpy.array', 'np.array', (['[x, y, z]'], {}), '([x, y, z])\n', (631, 642), True, 'import numpy as np\n'), ((669, 695), 'numpy.array', 'np.array', (['[x, y, z - 0.15]'], ... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^(?P<site_settings_pk>\d+)/special-page/add/$',
views.special_page_add, name='special-page-add'),
url(r'^(?P<site_settings_pk>\d+)/special-page/'
r'(?P<pk>\d+)/update/$',
views.special_page_edit, name='special-p... | [
"django.conf.urls.url"
] | [((75, 182), 'django.conf.urls.url', 'url', (['"""^(?P<site_settings_pk>\\\\d+)/special-page/add/$"""', 'views.special_page_add'], {'name': '"""special-page-add"""'}), "('^(?P<site_settings_pk>\\\\d+)/special-page/add/$', views.\n special_page_add, name='special-page-add')\n", (78, 182), False, 'from django.conf.url... |
import pickle
from functools import lru_cache
from pathlib import Path
import dask
from sample_pipeline.pipeline import get_full_pipeline
NON_REGRESSION_DATA_FILE = Path(__file__).parent / "non_regression_data.pickle"
NON_REGRESSION_TICKERS = {"AAPL", "MSFT", "AMZN", "GOOGL"}
NON_REGRESSION_START_DATE = "2021-01-04"... | [
"pickle.dump",
"dask.compute",
"pathlib.Path",
"pickle.load",
"sample_pipeline.pipeline.get_full_pipeline",
"functools.lru_cache"
] | [((564, 575), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (573, 575), False, 'from functools import lru_cache\n'), ((408, 534), 'sample_pipeline.pipeline.get_full_pipeline', 'get_full_pipeline', ([], {'tickers': 'NON_REGRESSION_TICKERS', 'start_date': 'NON_REGRESSION_START_DATE', 'end_date': 'NON_REGRESSION_E... |
#!/usr/bin/env python
import os
from ehive.runnable.IGFBaseProcess import IGFBaseProcess
from igf_data.utils.fileutils import get_temp_dir
from igf_data.process.data_qc.check_sequence_index_barcodes import CheckSequenceIndexBarcodes,IndexBarcodeValidationError
class CheckIndexStats(IGFBaseProcess):
'''
A ehive pro... | [
"igf_data.utils.fileutils.get_temp_dir",
"os.path.join",
"igf_data.process.data_qc.check_sequence_index_barcodes.CheckSequenceIndexBarcodes"
] | [((1149, 1202), 'igf_data.utils.fileutils.get_temp_dir', 'get_temp_dir', ([], {'use_ephemeral_space': 'use_ephemeral_space'}), '(use_ephemeral_space=use_ephemeral_space)\n', (1161, 1202), False, 'from igf_data.utils.fileutils import get_temp_dir\n'), ((1281, 1320), 'os.path.join', 'os.path.join', (['fastq_dir', 'stats_... |
import os
import numpy as np
import tensorflow as tf
import math
from PIL import Image
#import pdb
F = tf.app.flags.FLAGS
"""
Save tensorflow model
Parameters:
* checkpoint_dir - name of the directory where model is to be saved
* sess - current tensorflow session
* saver - tensorflow saver
"""
def save_model(checkpo... | [
"os.path.exists",
"PIL.Image.fromarray",
"os.makedirs",
"os.path.join",
"numpy.diag",
"tensorflow.train.get_checkpoint_state",
"numpy.sum",
"numpy.zeros",
"numpy.around",
"os.path.basename",
"numpy.min"
] | [((838, 883), 'tensorflow.train.get_checkpoint_state', 'tf.train.get_checkpoint_state', (['checkpoint_dir'], {}), '(checkpoint_dir)\n', (867, 883), True, 'import tensorflow as tf\n'), ((1990, 2034), 'numpy.zeros', 'np.zeros', (['(N_full_imgs, img_h, img_w, img_d)'], {}), '((N_full_imgs, img_h, img_w, img_d))\n', (1998,... |
from os.path import join, dirname
from pystacia import lena
dest = join(dirname(__file__), '../_static/generated')
image = lena(256)
image.sketch(3)
image.write(join(dest, 'lena_sketch3.jpg'))
image.close()
image = lena(256)
image.sketch(6, 0)
image.write(join(dest, 'lena_sketch6,0.jpg'))
image.close()
| [
"os.path.dirname",
"os.path.join",
"pystacia.lena"
] | [((126, 135), 'pystacia.lena', 'lena', (['(256)'], {}), '(256)\n', (130, 135), False, 'from pystacia import lena\n'), ((219, 228), 'pystacia.lena', 'lena', (['(256)'], {}), '(256)\n', (223, 228), False, 'from pystacia import lena\n'), ((74, 91), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (81, 91)... |
#Author: <NAME>
#Contact: <EMAIL>
#Date: Aug 02, 2020
import numpy as np
def cal_emp_cdf(insamples):
'''
This is function to calcualte emperical CDF of Dirichlet distributed facies proportion samples.
Variables:
insamples - input samples of facies proportions,
3D array, [n_seis_feature... | [
"numpy.count_nonzero",
"numpy.asarray"
] | [((598, 614), 'numpy.asarray', 'np.asarray', (['cdfs'], {}), '(cdfs)\n', (608, 614), True, 'import numpy as np\n'), ((469, 516), 'numpy.count_nonzero', 'np.count_nonzero', (['(samples[j, 0] > samples[:, 0])'], {}), '(samples[j, 0] > samples[:, 0])\n', (485, 516), True, 'import numpy as np\n')] |
import cv2
import numpy as np
import matplotlib.pyplot as plt
from skimage.filters import gabor
import mahotas as mt
import pandas as pd
from glob import glob
from skimage.feature import local_binary_pattern
def fun1(img_mask,Label):
count = 0
gaborenergy1 = []
gaborentropy1 = []
w1=[]
... | [
"numpy.uint8",
"numpy.sqrt",
"numpy.array",
"mahotas.features.haralick",
"numpy.mean",
"numpy.histogram",
"cv2.threshold",
"cv2.arcLength",
"cv2.contourArea",
"cv2.minAreaRect",
"pandas.DataFrame",
"glob.glob",
"cv2.drawContours",
"numpy.ones",
"cv2.boxPoints",
"cv2.boundingRect",
"n... | [((879, 893), 'glob.glob', 'glob', (['img_mask'], {}), '(img_mask)\n', (883, 893), False, 'from glob import glob\n'), ((8435, 8454), 'pandas.DataFrame', 'pd.DataFrame', (['dict1'], {}), '(dict1)\n', (8447, 8454), True, 'import pandas as pd\n'), ((1041, 1055), 'cv2.imread', 'cv2.imread', (['fn'], {}), '(fn)\n', (1051, 1... |
from __future__ import annotations
from typing import Any
import numpy as np
AR_i8: np.ndarray[Any, np.dtype[np.int_]] = np.arange(10)
ar_iter = np.lib.Arrayterator(AR_i8)
ar_iter.var
ar_iter.buf_size
ar_iter.start
ar_iter.stop
ar_iter.step
ar_iter.shape
ar_iter.flat
ar_iter.__array__()
for i in ar_iter:
pass... | [
"numpy.lib.Arrayterator",
"numpy.arange"
] | [((124, 137), 'numpy.arange', 'np.arange', (['(10)'], {}), '(10)\n', (133, 137), True, 'import numpy as np\n'), ((148, 174), 'numpy.lib.Arrayterator', 'np.lib.Arrayterator', (['AR_i8'], {}), '(AR_i8)\n', (167, 174), True, 'import numpy as np\n')] |
import discord
from discord.ext import commands
class kick(commands.Cog):
def __init__(self, client):
self.client = client
#kick command
@commands.command()
@commands.has_permissions(kick_members=True)
async def kick(self, ctx, member: discord.Member, *, reason=None):
await member... | [
"discord.ext.commands.has_permissions",
"discord.ext.commands.command"
] | [((161, 179), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (177, 179), False, 'from discord.ext import commands\n'), ((185, 228), 'discord.ext.commands.has_permissions', 'commands.has_permissions', ([], {'kick_members': '(True)'}), '(kick_members=True)\n', (209, 228), False, 'from discord.ext i... |
#!/usr/bin/python
# Copyright (c) 2016-2017, Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of cond... | [
"random.randint"
] | [((2605, 2627), 'random.randint', 'random.randint', (['(0)', '(127)'], {}), '(0, 127)\n', (2619, 2627), False, 'import random\n'), ((2641, 2663), 'random.randint', 'random.randint', (['(0)', '(255)'], {}), '(0, 255)\n', (2655, 2663), False, 'import random\n'), ((2677, 2699), 'random.randint', 'random.randint', (['(0)',... |
#coding: utf-8
#python 2 only!
from __future__ import unicode_literals, absolute_import
from django.utils.encoding import python_2_unicode_compatible
####################################################################################
from django.utils.translation import ugettext_lazy as _ #pootle do prowadzenia tluma... | [
"django.utils.translation.ugettext_lazy",
"django.db.models.DateField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.core.urlresolvers.reverse_lazy",
"django.db.models.CharField"
] | [((1141, 1172), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(70)'}), '(max_length=70)\n', (1157, 1172), False, 'from django.db import models\n'), ((1296, 1327), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (1312, 1327), False, 'from djan... |
import cv2
# ---------------------原始图像o1的边缘-------------------------
o1 = cv2.imread("cs1.bmp")
cv2.imshow("original1", o1)
gray1 = cv2.cvtColor(o1, cv2.COLOR_BGR2GRAY)
ret, binary1 = cv2.threshold(gray1, 127, 255, cv2.THRESH_BINARY)
contours1, hierarchy = cv2.findContours(binary1, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMP... | [
"cv2.createShapeContextDistanceExtractor",
"cv2.threshold",
"cv2.imshow",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.cvtColor",
"cv2.findContours",
"cv2.imread"
] | [((75, 96), 'cv2.imread', 'cv2.imread', (['"""cs1.bmp"""'], {}), "('cs1.bmp')\n", (85, 96), False, 'import cv2\n'), ((97, 124), 'cv2.imshow', 'cv2.imshow', (['"""original1"""', 'o1'], {}), "('original1', o1)\n", (107, 124), False, 'import cv2\n'), ((133, 169), 'cv2.cvtColor', 'cv2.cvtColor', (['o1', 'cv2.COLOR_BGR2GRAY... |
#-----------------------------------------------------------
# create-palette.py
#-----------------------------------------------------------
import StringIO
NL = '\015\012'
FILE_NAME = 'palette.dat'
#-----------------------------------------------------------
def Color8to16(color8):
r = (color8/0x04)/0x08
... | [
"StringIO.StringIO"
] | [((561, 580), 'StringIO.StringIO', 'StringIO.StringIO', ([], {}), '()\n', (578, 580), False, 'import StringIO\n')] |
"""Tests."""
import logging
import sys
import pytest
from _pytest.capture import CaptureFixture
from _pytest.monkeypatch import MonkeyPatch
from boilerplatepython.logging import LogFormatter
from .utils import __file__ as utils_filename, generate_log_statements
def _init_logger(name: str, formatter: logging.Formatt... | [
"logging.getLogger",
"logging.StreamHandler",
"pytest.mark.parametrize",
"pytest.mark.usefixtures",
"boilerplatepython.logging.LogFormatter"
] | [((624, 722), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""force_wide,terminal_width"""', '[(False, 160), (True, 80), (True, 160)]'], {}), "('force_wide,terminal_width', [(False, 160), (True, \n 80), (True, 160)])\n", (647, 722), False, 'import pytest\n'), ((761, 799), 'pytest.mark.usefixtures', 'pyte... |
#!/usr/bin/env python
"""
# Get distance matrices from Google Maps API for development
"""
import sys
import os
import asyncio
from typing import List
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from core.distancematrix.google_distance_matrix import (
get_distancematrix_fr... | [
"core.distancematrix.google_distance_matrix.parse_distancematrix_response",
"os.path.join",
"os.path.dirname",
"os.path.abspath",
"core.helpers.read_write.save_dict_to_json",
"core.distancematrix.google_distance_matrix.get_distancematrix_from_google"
] | [((610, 660), 'os.path.join', 'os.path.join', (['dir_for_data', '"""distance_matrix.json"""'], {}), "(dir_for_data, 'distance_matrix.json')\n", (622, 660), False, 'import os\n'), ((820, 877), 'os.path.join', 'os.path.join', (['dir_for_data', '"""parsed_distance_matrix.json"""'], {}), "(dir_for_data, 'parsed_distance_ma... |
"""
精简代码
爬虫退出登录
create by judy 2019/01/24
"""
import threading
import traceback
from datacontract import Task, ECommandStatus
from datacontract.apps.appbase import AppConfig
from idownclient.spider.spiderbase import SpiderBase
from idownclient.spidermanagent.spidermanagebase import SpiderManagebase
class SpiderLogou... | [
"traceback.format_exc",
"threading.Thread",
"idownclient.spidermanagent.spidermanagebase.SpiderManagebase.__init__"
] | [((374, 405), 'idownclient.spidermanagent.spidermanagebase.SpiderManagebase.__init__', 'SpiderManagebase.__init__', (['self'], {}), '(self)\n', (399, 405), False, 'from idownclient.spidermanagent.spidermanagebase import SpiderManagebase\n'), ((2032, 2106), 'threading.Thread', 'threading.Thread', ([], {'target': 'self._... |
import discord
from discord.ext import commands
from discord.utils import get
class c211(commands.Cog, name="c211"):
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.command(name='Scorn_Operative_Turncoat', aliases=['c211','Scorn_Operative_17'])
async def example_embed(self, ctx):
... | [
"discord.Embed",
"discord.ext.commands.command"
] | [((190, 283), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""Scorn_Operative_Turncoat"""', 'aliases': "['c211', 'Scorn_Operative_17']"}), "(name='Scorn_Operative_Turncoat', aliases=['c211',\n 'Scorn_Operative_17'])\n", (206, 283), False, 'from discord.ext import commands\n'), ((335, 395), 'dis... |
#!/usr/bin/env python
from os.path import join
from itertools import permutations
from random import shuffle
import pickle
import argparse
import uuid
def create_examples(multitext_ex, n_pairs):
# shuffle the languages in the example, yield n_pairs permutations
languages = [k for k in multitext_ex if k != "u... | [
"pickle.dump",
"random.shuffle",
"argparse.ArgumentParser",
"os.path.join",
"uuid.uuid4",
"itertools.permutations"
] | [((389, 407), 'random.shuffle', 'shuffle', (['languages'], {}), '(languages)\n', (396, 407), False, 'from random import shuffle\n'), ((424, 450), 'itertools.permutations', 'permutations', (['languages', '(2)'], {}), '(languages, 2)\n', (436, 450), False, 'from itertools import permutations\n'), ((747, 772), 'argparse.A... |
import os
import sys
import socket
import asyncio
import time
import types
import threading
from functools import partial
from collections import OrderedDict
import signal as signal
from typing import Any, Callable, Union
try:
import uvloop
uvloop.install()
except ImportError:
uvloop = None
import tornado.... | [
"uvloop.install",
"sys.exit",
"tweb.utils.environment.env.setenv",
"tweb.utils.daemon.fork",
"tweb.utils.settings.TronadoStdout.has_opt",
"tweb.utils.settings.default_settings",
"os.path.exists",
"tweb.utils.signal.SignalHandler.restart",
"tweb.utils.signal.SignalHandler.listen",
"asyncio.new_even... | [((249, 265), 'uvloop.install', 'uvloop.install', ([], {}), '()\n', (263, 265), False, 'import uvloop\n'), ((1622, 1655), 'tweb.utils.environment.env.setenv', 'env.setenv', (['"""CREATE_CONFIG"""', '(True)'], {}), "('CREATE_CONFIG', True)\n", (1632, 1655), False, 'from tweb.utils.environment import env\n'), ((2056, 206... |
from typing import Any, Callable
from unittest import TestCase
from puma.runnable import Runnable
from puma.runnable.runner import ThreadRunner
def call_runnable_method_on_running_instance(test_case: TestCase, runnable_factory: Callable[[], Runnable], test_callback: Callable[[Runnable], Any]) -> None:
runnable =... | [
"puma.runnable.runner.ThreadRunner"
] | [((349, 371), 'puma.runnable.runner.ThreadRunner', 'ThreadRunner', (['runnable'], {}), '(runnable)\n', (361, 371), False, 'from puma.runnable.runner import ThreadRunner\n')] |
import argparse
import os
parser=argparse.ArgumentParser()
parser.add_argument("--save",type=str,default="1",help='end ratio')
parser.add_argument("--get",type=str,default="ptcut",help='end ratio')
parser.add_argument("--gpu",type=str,default="0,1,2,3",help='end ratio')
parser.add_argument("--pt",type=str,default="100... | [
"argparse.ArgumentParser"
] | [((34, 59), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (57, 59), False, 'import argparse\n')] |
"""Fix types works
Revision ID: 340c59e2160c
Revises: 874db9c5a19d
Create Date: 2021-12-05 13:47:04.772395
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '340c59e2160c'
down_revision = '874db9c5a19d'
branch_labels = None
depends_on = None
def upgrade():
... | [
"sqlalchemy.String"
] | [((449, 460), 'sqlalchemy.String', 'sa.String', ([], {}), '()\n', (458, 460), True, 'import sqlalchemy as sa\n'), ((568, 579), 'sqlalchemy.String', 'sa.String', ([], {}), '()\n', (577, 579), True, 'import sqlalchemy as sa\n')] |
import sys
import lzma
import argparse
import json
parser = argparse.ArgumentParser()
parser.add_argument('-i', dest="indices", metavar="Packages.xz", nargs='+', help='Index file to look in (Packages.xz)', required=True)
parser.add_argument('-p', dest="packages", metavar="libpackage-dev", nargs='+', help='Package nam... | [
"lzma.open",
"json.dumps",
"argparse.ArgumentParser"
] | [((62, 87), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (85, 87), False, 'import argparse\n'), ((1799, 1843), 'json.dumps', 'json.dumps', (['result'], {'sort_keys': '(True)', 'indent': '(4)'}), '(result, sort_keys=True, indent=4)\n', (1809, 1843), False, 'import json\n'), ((447, 468), 'lzma.... |
from decimal import Decimal
import csv
from datetime import datetime
from imap_tools import MailBox, AND
from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404
from django.views.generic import CreateView, UpdateView, FormView, TemplateView
from dja... | [
"django.utils.translation.gettext",
"django.http.HttpResponse",
"csv.writer",
"django.shortcuts.get_object_or_404",
"django.contrib.auth.decorators.permission_required",
"django.urls.reverse",
"datetime.datetime.strftime",
"decimal.Decimal"
] | [((8191, 8237), 'django.contrib.auth.decorators.permission_required', 'permission_required', (['"""accounting.view_invoice"""'], {}), "('accounting.view_invoice')\n", (8210, 8237), False, 'from django.contrib.auth.decorators import permission_required\n'), ((8682, 8728), 'django.contrib.auth.decorators.permission_requi... |
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.db import models
"""
TAB_USER_INFO
字段Id 字段名称 类型/长度 必填 功能描述
userID 用户ID CHAR(8) Y PK
userName 用户名 VARCHAR(60) Y
passWord 密码 VARCHAR(120) Y 加密存储
phoneNum 联系电话 CHAR(20) Y
crtTime 创建时间 datetime Y 默认值当前时间戳
updTime 更新时间 datetime ... | [
"django.db.models.DateTimeField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((383, 438), 'django.db.models.AutoField', 'models.AutoField', ([], {'verbose_name': '"""用户ID"""', 'primary_key': '(True)'}), "(verbose_name='用户ID', primary_key=True)\n", (399, 438), False, 'from django.db import models\n'), ((455, 507), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)', 've... |
import numpy as np
import eqsig
from liquepy.element.models import ShearTest
from liquepy.element import assess
def test_with_one_cycle_no_dissipation():
strs = np.array([0, -1, -2, -3, -4, -3, -2, -1, 0, 1, 2, 3, 4, 3, 2, 1, 0])
tau = np.array([0, -2, -4, -6, -8, -6, -4, -2, 0, 2, 4, 6, 8, 6, 4, 2, 0])
... | [
"liquepy.element.assess.calc_diss_energy_fd",
"numpy.isclose",
"liquepy.element.assess.get_energy_peaks_for_cyclic_loading",
"liquepy.element.models.ShearTest",
"numpy.array",
"numpy.linspace",
"liquepy.element.assess.average_of_absolute_via_trapz",
"numpy.cos",
"numpy.sin",
"liquepy.element.asses... | [((169, 237), 'numpy.array', 'np.array', (['[0, -1, -2, -3, -4, -3, -2, -1, 0, 1, 2, 3, 4, 3, 2, 1, 0]'], {}), '([0, -1, -2, -3, -4, -3, -2, -1, 0, 1, 2, 3, 4, 3, 2, 1, 0])\n', (177, 237), True, 'import numpy as np\n'), ((248, 316), 'numpy.array', 'np.array', (['[0, -2, -4, -6, -8, -6, -4, -2, 0, 2, 4, 6, 8, 6, 4, 2, 0... |
#! /usr/bin/env python
import geometry_msgs.msg
import rospy
import tf2_ros
from arc_utilities import transformation_helper
from geometry_msgs.msg import Pose
class TF2Wrapper:
def __init__(self):
self.tf_buffer = tf2_ros.Buffer()
self.tf_listener = tf2_ros.TransformListener(self.tf_buffer)
... | [
"rospy.logerr",
"rospy.is_shutdown",
"tf2_ros.TransformListener",
"tf2_ros.TransformBroadcaster",
"arc_utilities.transformation_helper.BuildMatrixRos",
"tf2_ros.Buffer",
"rospy.Time.now",
"rospy.loginfo",
"rospy.Time",
"tf2_ros.StaticTransformBroadcaster",
"rospy.Duration",
"rospy.logdebug",
... | [((229, 245), 'tf2_ros.Buffer', 'tf2_ros.Buffer', ([], {}), '()\n', (243, 245), False, 'import tf2_ros\n'), ((273, 314), 'tf2_ros.TransformListener', 'tf2_ros.TransformListener', (['self.tf_buffer'], {}), '(self.tf_buffer)\n', (298, 314), False, 'import tf2_ros\n'), ((345, 375), 'tf2_ros.TransformBroadcaster', 'tf2_ros... |
# Used to retrieve the most current lottery data daily
import re
from time import strptime
from datetime import datetime
from .populate_database import (cash5, powerball,
mega_millions, GAMES)
from .models import (Pick3, Pick4, Cash5,
PowerBall, MegaMillions,
... | [
"feedparser.parse",
"re.sub",
"re.findall",
"datetime.datetime.strptime"
] | [((2842, 2863), 'feedparser.parse', 'feedparser.parse', (['url'], {}), '(url)\n', (2858, 2863), False, 'import feedparser\n'), ((740, 774), 're.sub', 're.sub', (['"""PB|PP|MB|MP"""', '""""""', 'numbers'], {}), "('PB|PP|MB|MP', '', numbers)\n", (746, 774), False, 'import re\n'), ((1077, 1111), 're.findall', 're.findall'... |
import git
import os
import time
class GitExtension:
""" Get git into on the site for display on the about page """
first = True
needs = {'request'}
provides = {'git'}
def __init__(self):
pass
def start(self, context):
format_string = "%Y-%m-%d %H:%M:%S %z"
context.re... | [
"os.path.dirname",
"time.gmtime"
] | [((569, 596), 'time.gmtime', 'time.gmtime', (['committed_date'], {}), '(committed_date)\n', (580, 596), False, 'import time\n'), ((347, 372), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (362, 372), False, 'import os\n'), ((1807, 1831), 'time.gmtime', 'time.gmtime', (['tagged_date'], {}), '... |
"""
Abstraction for NE root shell
"""
import os
import time
from pss1830ssh.pss1830 import PSS1830
from pss1830ssh.pss1830 import PSSException
def get_ec_ip(shelf, ec):
return '100.0.{shelf}.{ec}'.format(shelf=shelf, ec=ec)
class PSS1830Root(PSS1830):
"""Wrapper for PSS root mode."""
PRO... | [
"os.path.join",
"time.sleep",
"pss1830ssh.pss1830.PSSException"
] | [((2206, 2268), 'pss1830ssh.pss1830.PSSException', 'PSSException', (["('Failed to login to slot: %s/%s' % (shelf, slot))"], {}), "('Failed to login to slot: %s/%s' % (shelf, slot))\n", (2218, 2268), False, 'from pss1830ssh.pss1830 import PSSException\n'), ((1332, 1345), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n... |
#!/usr/bin/env python
"""
mbed
Copyright (c) 2017-2017 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicab... | [
"sys.path.insert",
"argparse.ArgumentParser",
"os.path.join",
"os.getcwd",
"os.path.normpath",
"os.path.dirname",
"fuzzywuzzy.process.extractOne",
"os.mkdir",
"tools.arm_pack_manager.Cache",
"os.walk"
] | [((936, 960), 'sys.path.insert', 'sys.path.insert', (['(0)', 'ROOT'], {}), '(0, ROOT)\n', (951, 960), False, 'import sys\n'), ((1059, 1076), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (1066, 1076), False, 'from os.path import join, abspath, dirname\n'), ((1457, 1491), 'fuzzywuzzy.process.extractO... |
from glob import glob
from reportlab.lib.pagesizes import letter
from reportlab.lib import colors
from reportlab.platypus import SimpleDocTemplate
from reportlab.platypus import Paragraph
from reportlab.platypus import Spacer
from reportlab.platypus import Image
from reportlab.platypus import PageBreak
from reportlab.... | [
"reportlab.platypus.TableStyle",
"reportlab.platypus.Paragraph",
"reportlab.platypus.Spacer",
"reportlab.platypus.SimpleDocTemplate",
"mdloader.LoadMDfile",
"reportlab.platypus.PageBreak",
"glob.glob",
"reportlab.platypus.Image"
] | [((6507, 6519), 'glob.glob', 'glob', (['"""day*"""'], {}), "('day*')\n", (6511, 6519), False, 'from glob import glob\n'), ((588, 708), 'reportlab.platypus.SimpleDocTemplate', 'SimpleDocTemplate', (["(self.name + '.pdf')"], {'pagesize': 'letter', 'rightMargin': '(72)', 'leftMargin': '(72)', 'topMargin': '(72)', 'bottomM... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Software License Agreement (BSD)
#
# file @data.py
# authors <NAME> <<EMAIL>>
# NovAtel <novatel.com/support>
# copyright Copyright (c) 2012, Clearpath Robotics, Inc., All rights reserved.
# Copyright (c) 2014, NovAtel Inc., All rights r... | [
"novatel_span_driver.mapping.msgs.keys",
"novatel_span_driver.handlers.MessageHandler",
"io.BytesIO",
"rospy.logwarn"
] | [((2291, 2302), 'novatel_span_driver.mapping.msgs.keys', 'msgs.keys', ([], {}), '()\n', (2300, 2302), False, 'from novatel_span_driver.mapping import msgs\n'), ((2335, 2364), 'novatel_span_driver.handlers.MessageHandler', 'MessageHandler', (['*msgs[msg_id]'], {}), '(*msgs[msg_id])\n', (2349, 2364), False, 'from novatel... |
import re
_VALID_IP_RE = '(?:(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])'
_VALID_HOSTNAME_RE = '(?:(?:[a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*(?:[A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])'
_VALID_NODEID_RE = re.compile('(?:%s|%s):(?P<port>[0-9]+)$... | [
"re.compile"
] | [((281, 359), 're.compile', 're.compile', (["('(?:%s|%s):(?P<port>[0-9]+)$' % (_VALID_HOSTNAME_RE, _VALID_IP_RE))"], {}), "('(?:%s|%s):(?P<port>[0-9]+)$' % (_VALID_HOSTNAME_RE, _VALID_IP_RE))\n", (291, 359), False, 'import re\n')] |
"""Library of Region objects I use in my research"""
from aospy.region import Region
china_west = Region(
name='china_west',
description='Western China',
lat_bounds=(35, 45),
lon_bounds=(75, 100),
do_land_mask=False
)
china_east = Region(
name='china_east',
description='Eastern China',
... | [
"aospy.region.Region"
] | [((100, 221), 'aospy.region.Region', 'Region', ([], {'name': '"""china_west"""', 'description': '"""Western China"""', 'lat_bounds': '(35, 45)', 'lon_bounds': '(75, 100)', 'do_land_mask': '(False)'}), "(name='china_west', description='Western China', lat_bounds=(35, 45),\n lon_bounds=(75, 100), do_land_mask=False)\n... |
#!/usr/bin/env python
import serial
import time
BAUD = 57600
with serial.Serial('/dev/cu.usbserial-DN05KLWU', BAUD) as port:
time.sleep(5.0)
n = 0
while True:
port.write(bytearray([n & 0xFF]))
n += 1
| [
"serial.Serial",
"time.sleep"
] | [((69, 118), 'serial.Serial', 'serial.Serial', (['"""/dev/cu.usbserial-DN05KLWU"""', 'BAUD'], {}), "('/dev/cu.usbserial-DN05KLWU', BAUD)\n", (82, 118), False, 'import serial\n'), ((130, 145), 'time.sleep', 'time.sleep', (['(5.0)'], {}), '(5.0)\n', (140, 145), False, 'import time\n')] |
# restful.py
# import objects from the flask model
from flask import Flask, jsonify, request
# define an app using flask
app = Flask(__name__)
languages = [{'name':'Python'}, {'name':'Ruby'}, {'name':'JavaScript'}]
@app.route('/', methods=['GET'])
def test():
return jsonify({'message':'It works!'})
@app.route... | [
"flask.jsonify",
"flask.Flask"
] | [((130, 145), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (135, 145), False, 'from flask import Flask, jsonify, request\n'), ((276, 309), 'flask.jsonify', 'jsonify', (["{'message': 'It works!'}"], {}), "({'message': 'It works!'})\n", (283, 309), False, 'from flask import Flask, jsonify, request\n'), ((3... |
import numpy as np
import cv2
def nms(bboxs, thresh):
# get all parameters
x1, y1, x2, y2, scores = [bboxs[:, i] for i in range(len(bboxs[0]))]
# calculate all areas of boxed
areas = (x2 - x1 + 1) * (y2 - y1 + 1)
# sort boxes according to their class score
sorted_index = scores.argsort()[::... | [
"cv2.rectangle",
"numpy.minimum",
"cv2.imshow",
"numpy.array",
"numpy.zeros",
"numpy.maximum",
"cv2.waitKey"
] | [((1286, 1316), 'numpy.zeros', 'np.zeros', (['(850, 850)', 'np.uint8'], {}), '((850, 850), np.uint8)\n', (1294, 1316), True, 'import numpy as np\n'), ((1458, 1483), 'cv2.imshow', 'cv2.imshow', (['pic_name', 'pic'], {}), '(pic_name, pic)\n', (1468, 1483), False, 'import cv2\n'), ((1487, 1501), 'cv2.waitKey', 'cv2.waitKe... |
import pipe.gui.select_from_list as sfl
from pymel.core import *
from pipe.gui import quick_dialogs as qd
from pipe.tools.mayatools.utils.utils import *
class Tagger:
def __init__(self):
self.selected_string = self.get_selected_string()
def tag(self):
if self.selected:
response =... | [
"pipe.gui.quick_dialogs.info",
"pipe.gui.quick_dialogs.warning"
] | [((455, 488), 'pipe.gui.quick_dialogs.warning', 'qd.warning', (['"""Nothing is selected"""'], {}), "('Nothing is selected')\n", (465, 488), True, 'from pipe.gui import quick_dialogs as qd\n'), ((650, 676), 'pipe.gui.quick_dialogs.info', 'qd.info', (['"""tag successful!"""'], {}), "('tag successful!')\n", (657, 676), Tr... |
# Copyright (c) Facebook, Inc. and its affiliates.
import os
'''
This forces the environment to use only 1 cpu when running.
This could be helpful when launching multiple environment simulatenously.
'''
os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS'] = '1'
# os.environ['CUDA_VISIBLE_DEVICES'] ... | [
"pybullet_data.getDataPath",
"fairmotion.ops.math.projectionOnVector",
"numpy.array",
"copy.deepcopy",
"numpy.linalg.norm",
"sim_agent.get_root_state",
"render_module.gl.glPushAttrib",
"render_module.bullet_render.render_contacts",
"render_module.initialize",
"render_module.gl.glBlendFunc",
"fai... | [((14150, 14165), 'render_module.initialize', 'rm.initialize', ([], {}), '()\n', (14163, 14165), True, 'import render_module as rm\n'), ((2242, 2317), 'bullet.bullet_client.BulletClient', 'bullet_client.BulletClient', ([], {'connection_mode': 'pb.DIRECT', 'options': '""" --opengl2"""'}), "(connection_mode=pb.DIRECT, op... |
import logging
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../")))
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../../FedML")))
try:
from fedml_core.distributed.client.client_manager import ClientManager
from fedml_core.distributed.communicat... | [
"numpy.zeros",
"os.getcwd",
"logging.info",
"time.time"
] | [((1855, 1887), 'numpy.zeros', 'np.zeros', (['(self.params_count, 1)'], {}), '((self.params_count, 1))\n', (1863, 1887), True, 'import numpy as np\n'), ((5430, 5503), 'logging.info', 'logging.info', (["('#######training########### round_id = %d' % self.round_idx)"], {}), "('#######training########### round_id = %d' % s... |
import os
from pathlib import Path
import aiofiles
import tempfile
import sys
from aionetworking.compatibility import py37
APP_NAME = 'AIONetworking'
FILE_OPENER = aiofiles.open
APP_CONFIG = {}
def __getattr__(name):
path = None
if name == 'TEMPDIR':
path = Path(tempfile.gettempdir()) / sys.modules[... | [
"tempfile.gettempdir",
"pathlib.Path.home",
"pep562.Pep562"
] | [((607, 623), 'pep562.Pep562', 'Pep562', (['__name__'], {}), '(__name__)\n', (613, 623), False, 'from pep562 import Pep562\n'), ((283, 304), 'tempfile.gettempdir', 'tempfile.gettempdir', ([], {}), '()\n', (302, 304), False, 'import tempfile\n'), ((431, 442), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (440, 442... |
from django.contrib import admin
from .models import Profile
# register the user
class ProfileAdmin(admin.ModelAdmin):
readonly_fields = ('id','user_status')
admin.site.register(Profile, ProfileAdmin) | [
"django.contrib.admin.site.register"
] | [((163, 205), 'django.contrib.admin.site.register', 'admin.site.register', (['Profile', 'ProfileAdmin'], {}), '(Profile, ProfileAdmin)\n', (182, 205), False, 'from django.contrib import admin\n')] |
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 12:25:22 2020
@author: MCARAYA
"""
__version__ = '0.5.20-06-05'
import os
from shutil import copyfile
from datafiletoolbox import extension
from gpx_reader.calculate import MD5
def rename(fullPath,newName) :
"""
renames the file on the fullPath to the newNam... | [
"os.path.exists",
"gpx_reader.calculate.MD5",
"os.path.isabs",
"os.rename",
"datafiletoolbox.extension",
"shutil.copyfile",
"os.mkdir",
"os.remove"
] | [((787, 805), 'datafiletoolbox.extension', 'extension', (['newName'], {}), '(newName)\n', (796, 805), False, 'from datafiletoolbox import extension\n'), ((820, 842), 'os.path.isabs', 'os.path.isabs', (['newName'], {}), '(newName)\n', (833, 842), False, 'import os\n'), ((1108, 1136), 'os.rename', 'os.rename', (['fullPat... |
# -*- coding: utf-8 -*-
import pandas as pd
import re
import pickle
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
import numpy as np
from dl_architecture import make_charvec, build_model
from keras.callbacks import ModelCheckpoint
from keras import backend as K
from sklearn.preprocessi... | [
"bm25.BM25Transformer",
"sklearn.feature_extraction.text.TfidfTransformer",
"sklearn.metrics.f1_score",
"pickle.dump",
"keras.callbacks.ModelCheckpoint",
"sklearn.feature_extraction.text.CountVectorizer",
"numpy.array",
"collections.defaultdict",
"keras.backend.clear_session",
"dl_architecture.bui... | [((663, 715), 're.sub', 're.sub', (['"""[\\\\w\\\\.-]+@[\\\\w\\\\.-]+"""', 'replace_token', 'text'], {}), "('[\\\\w\\\\.-]+@[\\\\w\\\\.-]+', replace_token, text)\n", (669, 715), False, 'import re\n'), ((856, 890), 're.sub', 're.sub', (['regex', 'replace_token', 'text'], {}), '(regex, replace_token, text)\n', (862, 890)... |
import unittest
from app.email import send_email_async
from app.models import User
from tests.test_selenium.base import TestBase
class TestSendMail(TestBase):
def test_send_mail(self):
with self.app.app_context():
new_user = User(first_name="John", last_name="Doe", email="<EMAIL>", role_id=... | [
"unittest.main",
"app.models.User.query.first",
"app.models.User"
] | [((777, 792), 'unittest.main', 'unittest.main', ([], {}), '()\n', (790, 792), False, 'import unittest\n'), ((254, 322), 'app.models.User', 'User', ([], {'first_name': '"""John"""', 'last_name': '"""Doe"""', 'email': '"""<EMAIL>"""', 'role_id': '(1)'}), "(first_name='John', last_name='Doe', email='<EMAIL>', role_id=1)\n... |
# -*- coding: utf-8 -*-
"""
Setup for qat-qscore
"""
import importlib
from setuptools import setup, find_packages
def detect_if_qlm():
"""
Detects if this setup is run in a complete QLM environement.
If not, we will need to add myQLM to the dependencies of the package.
"""
try:
importlib.i... | [
"setuptools.find_packages",
"importlib.import_module"
] | [((309, 346), 'importlib.import_module', 'importlib.import_module', (['"""qat.linalg"""'], {}), "('qat.linalg')\n", (332, 346), False, 'import importlib\n'), ((692, 724), 'setuptools.find_packages', 'find_packages', ([], {'include': "['qat.*']"}), "(include=['qat.*'])\n", (705, 724), False, 'from setuptools import setu... |
from RNNs import QIFExpAddNoiseSyns
import numpy as np
import pickle
import matplotlib.pyplot as plt
from scipy.ndimage import gaussian_filter1d
# STEP 0: Define simulation condition
#####################################
# parse worker indices from script arguments
idx_cond = 570
# STEP 1: Load pre-generated RNN par... | [
"numpy.mean",
"RNNs.QIFExpAddNoiseSyns",
"scipy.ndimage.gaussian_filter1d",
"numpy.sqrt",
"numpy.round",
"matplotlib.pyplot.colorbar",
"numpy.max",
"numpy.sum",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.legend",
"matplotlib.... | [((1264, 1354), 'RNNs.QIFExpAddNoiseSyns', 'QIFExpAddNoiseSyns', (['C', 'eta', 'J'], {'Delta': 'Delta', 'alpha': 'alpha', 'D': 'D', 'tau_s': 'tau_s', 'tau_a': 'tau_a'}), '(C, eta, J, Delta=Delta, alpha=alpha, D=D, tau_s=tau_s,\n tau_a=tau_a)\n', (1282, 1354), False, 'from RNNs import QIFExpAddNoiseSyns\n'), ((1484, ... |
#!/usr/bin/env python
# coding=utf-8
from functools import partial
from mock import Mock
from pytest import fixture
@fixture(autouse=True)
def a_function_setup(tmpdir, monkeypatch):
"""
:type tmpdir: py.path.local
:type monkeypatch: _pytest.monkeypatch.monkeypatch
"""
from redislite import Stric... | [
"pytest.fixture",
"mock.Mock",
"cache_requests.utils.default_connection"
] | [((120, 141), 'pytest.fixture', 'fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (127, 141), False, 'from pytest import fixture\n'), ((693, 714), 'pytest.fixture', 'fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (700, 714), False, 'from pytest import fixture\n'), ((1204, 1238), 'mock.Mock', 'Mock... |
import xml.etree.ElementTree as ET
import socket
#for get_access_token
import requests
#for starting mysql and java server
import subprocess
STRINGS_FILE_LOCATION = "C:\Data\Coding\\flash-cards-android\\app\\src\main\\res\\values\strings.xml"
IP_KEY = "flash_cards_api_url"
ACCESS_TOKEN_KEY = "flash_cards_acce... | [
"subprocess.Popen",
"requests.post",
"xml.etree.ElementTree.parse",
"socket.socket"
] | [((2829, 2940), 'subprocess.Popen', 'subprocess.Popen', (["['C:\\\\xampp\\\\mysql\\\\bin\\\\mysqld.exe']"], {'creationflags': 'subprocess.CREATE_NEW_PROCESS_GROUP'}), "(['C:\\\\xampp\\\\mysql\\\\bin\\\\mysqld.exe'], creationflags=\n subprocess.CREATE_NEW_PROCESS_GROUP)\n", (2845, 2940), False, 'import subprocess\n')... |
import pandas as pd
import numpy as np
from sklearn.feature_selection import RFE
from sklearn.linear_model import LogisticRegression
import os
import json
def load_data(data_path):
with open(data_path, "r") as fp:
data = json.load(fp)
#convert list -> np.array()
inputs = np.array(data["features"])... | [
"pandas.crosstab",
"sklearn.linear_model.LogisticRegression",
"json.load",
"numpy.array",
"sklearn.feature_selection.RFE",
"os.path.abspath"
] | [((294, 320), 'numpy.array', 'np.array', (["data['features']"], {}), "(data['features'])\n", (302, 320), True, 'import numpy as np\n'), ((335, 356), 'numpy.array', 'np.array', (["data['mms']"], {}), "(data['mms'])\n", (343, 356), True, 'import numpy as np\n'), ((470, 487), 'pandas.crosstab', 'pd.crosstab', (['x', 'y'],... |
from . import TorchModel, NUM_GESTURES
import torch
from torch import nn
import numpy as np
class ConvNet(TorchModel):
def define_model(self, dim_in):
self.conv = nn.Conv1d(dim_in[0], self.conv_filters, kernel_size=self.conv_kernel_size,
stride=self.conv_stride, padding=self... | [
"torch.nn.MaxPool1d",
"numpy.product",
"torch.nn.ReLU",
"torch.nn.Sigmoid",
"torch.nn.LeakyReLU",
"torch.nn.Softmax",
"numpy.floor",
"torch.nn.BatchNorm1d",
"torch.nn.Linear",
"torch.nn.functional.cross_entropy",
"torch.nn.Conv1d"
] | [((178, 308), 'torch.nn.Conv1d', 'nn.Conv1d', (['dim_in[0]', 'self.conv_filters'], {'kernel_size': 'self.conv_kernel_size', 'stride': 'self.conv_stride', 'padding': 'self.conv_padding'}), '(dim_in[0], self.conv_filters, kernel_size=self.conv_kernel_size,\n stride=self.conv_stride, padding=self.conv_padding)\n', (187... |
import code
def test_inc():
assert code.inc(3) == 4
| [
"code.inc"
] | [((40, 51), 'code.inc', 'code.inc', (['(3)'], {}), '(3)\n', (48, 51), False, 'import code\n')] |
"""-----------------------------------------------------------------------------
Name: positional_accuracy.py
Purpose: Statistically summarizes positional accuracy values that are stored
in a field within a feature class.
Description: This tool statistically summarizes the positional accuracy values
tha... | [
"pandas.__version__.split",
"traceback.format_exc",
"pandas.isnull",
"traceback.format_tb",
"sys.exc_info",
"arcgis.features.FeatureLayer"
] | [((1796, 1810), 'sys.exc_info', 'sys.exc_info', ([], {}), '()\n', (1808, 1810), False, 'import sys\n'), ((1827, 1850), 'traceback.format_tb', 'traceback.format_tb', (['tb'], {}), '(tb)\n', (1846, 1850), False, 'import traceback\n'), ((3756, 3798), 'arcgis.features.FeatureLayer', 'FeatureLayer', ([], {'gis': 'gis', 'url... |
import typing
from threading import Thread
from . import host, watcher
from .tray import Tray
def init_tray(trays: typing.List[Tray]):
host_thread = Thread(target=host.init, args=[0, trays])
host_thread.daemon = True
host_thread.start()
watcher_thread = Thread(target=watcher.init)
watcher_thread... | [
"threading.Thread"
] | [((156, 197), 'threading.Thread', 'Thread', ([], {'target': 'host.init', 'args': '[0, trays]'}), '(target=host.init, args=[0, trays])\n', (162, 197), False, 'from threading import Thread\n'), ((274, 301), 'threading.Thread', 'Thread', ([], {'target': 'watcher.init'}), '(target=watcher.init)\n', (280, 301), False, 'from... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created: March 2020
Python without class!
@author: <NAME> (RRCC)
"""
import numpy as np
import matplotlib.pyplot as plt
import argparse
def readFile(fName):
"""
Returns
-------
nDumps : TYPE
DESCRIPTION.
nPars : T... | [
"argparse.ArgumentParser",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.zeros",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.ylim",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((1063, 1088), 'numpy.zeros', 'np.zeros', (['(nDumps, nPars)'], {}), '((nDumps, nPars))\n', (1071, 1088), True, 'import numpy as np\n'), ((1098, 1127), 'numpy.zeros', 'np.zeros', (['(nDumps, nPars - 1)'], {}), '((nDumps, nPars - 1))\n', (1106, 1127), True, 'import numpy as np\n'), ((1135, 1164), 'numpy.zeros', 'np.zer... |
from pytube import YouTube
import tkinter as tk
import tkinter.messagebox
def download():
URL = url.get()
aud = var.get()
try:
if aud == 1:
ls = YouTube(URL).streams.filter(adaptive=True, only_audio=True)
ans = 'Audio'
path = ls[len(ls)-1].download()
elif ... | [
"tkinter.IntVar",
"tkinter.messagebox.showerror",
"tkinter.Entry",
"pytube.YouTube",
"tkinter.Button",
"tkinter.Radiobutton",
"tkinter.StringVar",
"tkinter.Tk",
"tkinter.Label",
"tkinter.messagebox.showinfo"
] | [((700, 707), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (705, 707), True, 'import tkinter as tk\n'), ((760, 774), 'tkinter.StringVar', 'tk.StringVar', ([], {}), '()\n', (772, 774), True, 'import tkinter as tk\n'), ((787, 853), 'tkinter.Label', 'tk.Label', (['root'], {'text': '"""URL: """', 'font': "('Comic Sans MS', 12,... |
from __future__ import print_function
import json
import logging
import sys
import time
from utils.chronograph import Chronograph
import grpc
import numpy as np
from grpc._channel import _Rendezvous
import taranis_pb2
import taranis_pb2_grpc
DB_NAME = 'db3'
INDEX_NAME = 'basic_index'
DIMENSION = 128 # dimension
N... | [
"logging.getLogger",
"logging.basicConfig",
"taranis_pb2_grpc.TaranisStub",
"logging.StreamHandler",
"utils.chronograph.Chronograph",
"grpc.insecure_channel",
"numpy.random.randint",
"taranis_pb2.SearchRequestModel",
"taranis_pb2.VectorsQueryModel"
] | [((541, 560), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (558, 560), False, 'import logging\n'), ((661, 701), 'logging.StreamHandler', 'logging.StreamHandler', ([], {'stream': 'sys.stdout'}), '(stream=sys.stdout)\n', (682, 701), False, 'import logging\n'), ((5803, 5836), 'logging.basicConfig', 'logging... |
import datetime
from pathlib import Path
from setuptools import setup, find_namespace_packages
with open(Path(__file__).parent / "requirements.txt") as f:
required = f.read().splitlines()
setup(
name="emmet-builders",
use_scm_version={"relative_to": Path(__file__).parent},
setup_requires=["setuptools_... | [
"setuptools.find_namespace_packages",
"pathlib.Path"
] | [((496, 540), 'setuptools.find_namespace_packages', 'find_namespace_packages', ([], {'include': "['emmet.*']"}), "(include=['emmet.*'])\n", (519, 540), False, 'from setuptools import setup, find_namespace_packages\n'), ((106, 120), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (110, 120), False, 'from pat... |
'''
a='1.1'
b='1'
l1=a.partition('.')
l2=b.partition('.')
print(l1)
print(l2)
c='new'
print(c+l1[1]+l1[2])
print(c+l2[1]+l2[2])
'''
'''
while '.DS_Store' in l:
l.remove('.DS_Store')
len(l)
'''
'''
import csv
f=open('sum.csv','rt')
f_csv=csv.reader(f)
print(type(f_csv))
h=next(f_csv)
print(h)
for r in f_csv:
p... | [
"pickle.load"
] | [((1582, 1596), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (1593, 1596), False, 'import pickle\n')] |
from django.contrib.auth import get_user_model, authenticate
from rest_framework import serializers
from rest_framework.serializers import ModelSerializer, Serializer
from django.utils.translation import ugettext_lazy as _
class UserSerializer(ModelSerializer):
"""Serialiser for user"""
class Meta:
m... | [
"django.contrib.auth.get_user_model",
"django.utils.translation.ugettext_lazy",
"rest_framework.serializers.CharField",
"rest_framework.serializers.ValidationError"
] | [((1064, 1087), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {}), '()\n', (1085, 1087), False, 'from rest_framework import serializers\n'), ((1103, 1180), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'style': "{'input_type': 'password'}", 'trim_whitespace': '(True)'}),... |
"""Creates a new table of characters in PostGreSQL from a characters in
a table in sqlite3"""
import sqlite3
import psycopg2
DBNAME = 'ytwptqxp'
USER = 'ytwptqxp'
PASSWORD = '***'
HOST = 'suleiman.db.elephantsql.com'
#Queries
create_character_table = """
CREATE TABLE charactercreator_character (
charact... | [
"psycopg2.connect",
"sqlite3.connect"
] | [((726, 798), 'psycopg2.connect', 'psycopg2.connect', ([], {'dbname': 'DBNAME', 'user': 'USER', 'password': 'PASSWORD', 'host': 'HOST'}), '(dbname=DBNAME, user=USER, password=PASSWORD, host=HOST)\n', (742, 798), False, 'import psycopg2\n'), ((984, 1007), 'sqlite3.connect', 'sqlite3.connect', (['dbname'], {}), '(dbname)... |
from .image import Image
from .base import StylizedElement
class HTML(StylizedElement):
def __init__(self, html, **kwargs):
super().__init__(**kwargs)
self.html = html
def build(self, style):
import imgkit
res = imgkit.from_string(self.html, False)
image = Image(res).d... | [
"imgkit.from_string"
] | [((255, 291), 'imgkit.from_string', 'imgkit.from_string', (['self.html', '(False)'], {}), '(self.html, False)\n', (273, 291), False, 'import imgkit\n')] |
import datetime
import json
from django.contrib.auth import logout as auth_logout
from django.contrib.auth.decorators import login_required
from django.http import JsonResponse, HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.views.decorators.cache import never_cache
from djan... | [
"django.shortcuts.render",
"tellme.models.Feedback.objects.all",
"json.loads",
"rules.contrib.views.objectgetter",
"django.http.JsonResponse",
"django.shortcuts.get_object_or_404",
"rules.contrib.views.permission_required",
"datetime.datetime.now",
"django.shortcuts.redirect",
"django.contrib.auth... | [((2267, 2301), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/login"""'}), "(login_url='/login')\n", (2281, 2301), False, 'from django.contrib.auth.decorators import login_required\n'), ((2603, 2637), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'... |
from nose.tools import raises
from rightscale.rightscale import Resource
def test_empty_linky_thing():
linky = Resource()
assert {} == linky.links
def test_resource_repr():
r = Resource()
assert r == eval(repr(r))
r = {
'a': '/path/to/a',
'mojo': '/somefingelse/blah/blah... | [
"rightscale.rightscale.Resource",
"nose.tools.raises"
] | [((1945, 1967), 'nose.tools.raises', 'raises', (['AttributeError'], {}), '(AttributeError)\n', (1951, 1967), False, 'from nose.tools import raises\n'), ((117, 127), 'rightscale.rightscale.Resource', 'Resource', ([], {}), '()\n', (125, 127), False, 'from rightscale.rightscale import Resource\n'), ((193, 203), 'rightscal... |
##
# Copyright (C) 2014 <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
"unittest.main",
"googler.recaptcha.mailhide._decrypt_email_address",
"googler.recaptcha.mailhide._encrypt_email_address"
] | [((1310, 1325), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1323, 1325), False, 'import unittest\n'), ((1106, 1162), 'googler.recaptcha.mailhide._encrypt_email_address', 'mailhide._encrypt_email_address', (['email', 'self.private_key'], {}), '(email, self.private_key)\n', (1137, 1162), False, 'from googler.rec... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2019 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Module tests."""
from __future__ import absolute_import, print_function
import ... | [
"invenio_sipstore.models.SIPMetadata.query.count",
"invenio_sipstore.models.SIPMetadata.query.one",
"invenio_accounts.testutils.create_test_user",
"invenio_sipstore.models.SIP.query.count",
"invenio_sipstore.models.SIPFile",
"invenio_sipstore.models.SIP.create",
"invenio_sipstore.models.RecordSIP",
"i... | [((769, 796), 'invenio_accounts.testutils.create_test_user', 'create_test_user', (['"""<EMAIL>"""'], {}), "('<EMAIL>')\n", (785, 796), False, 'from invenio_accounts.testutils import create_test_user\n'), ((1225, 1267), 'invenio_sipstore.models.SIP.create', 'SIP.create', ([], {'user_id': 'user1.id', 'agent': 'agent1'}),... |
from django.db import models
class Performer(models.Model):
name = models.CharField(max_length=255)
def __str__(self):
return self.name
class Song(models.Model):
title = models.CharField(max_length=255)
artist = models.CharField(max_length=255)
performer = models.ForeignKey(Performer)
... | [
"django.db.models.IntegerField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((73, 105), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (89, 105), False, 'from django.db import models\n'), ((195, 227), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (211, 227), False, 'from django.db ... |
import os
import subprocess
def compile_schemas():
for file in os.listdir("."):
if file.endswith(".proto"):
print(file)
subprocess.run(["protoc", "--python_out=.", file])
| [
"subprocess.run",
"os.listdir"
] | [((69, 84), 'os.listdir', 'os.listdir', (['"""."""'], {}), "('.')\n", (79, 84), False, 'import os\n'), ((158, 208), 'subprocess.run', 'subprocess.run', (["['protoc', '--python_out=.', file]"], {}), "(['protoc', '--python_out=.', file])\n", (172, 208), False, 'import subprocess\n')] |
# read delta G values from equilibrator_results.tsv
infile = open('equilibrator_results.tsv', 'r')
import numpy as np
def read_dg(infile):
dg_list = []
for line in infile:
if not line.startswith("'"): # skips line with headers
pass
else:
line = line.strip("\n")
line_list = line.split("\t")
dg = lin... | [
"numpy.array"
] | [((408, 425), 'numpy.array', 'np.array', (['dg_list'], {}), '(dg_list)\n', (416, 425), True, 'import numpy as np\n')] |
import os
def get_icons():
icons = {}
icons_walk = os.walk("src/icons")
_, authors, _ = next(icons_walk)
for root, _, files in icons_walk:
author = os.path.split(root)[-1]
icons[author] = files
return icons
def generate_js(icons):
lines = []
all_icons = []
for author,... | [
"os.walk",
"os.path.split"
] | [((61, 81), 'os.walk', 'os.walk', (['"""src/icons"""'], {}), "('src/icons')\n", (68, 81), False, 'import os\n'), ((174, 193), 'os.path.split', 'os.path.split', (['root'], {}), '(root)\n', (187, 193), False, 'import os\n')] |
import time
from easydict import EasyDoct as edict
## Init
__C = edict()
cfg = __C
## seed Value
__C.SEED = 2021
## datasets: X, Y
__C.DATASET = None
## networks: X, Y
__C.NET = None
## gpu id
__C.GPU_ID = [0]
## learning rate
__C.LR = 0
# LR scheduler
## training settings
__C.MAX_EPOCH = 0
## experiment
now =... | [
"easydict.EasyDoct",
"time.localtime"
] | [((67, 74), 'easydict.EasyDoct', 'edict', ([], {}), '()\n', (72, 74), True, 'from easydict import EasyDoct as edict\n'), ((350, 366), 'time.localtime', 'time.localtime', ([], {}), '()\n', (364, 366), False, 'import time\n')] |
from lib.data.model.shared.abstract_board import AbstractBoard
from lib.data.model.shared.cell import Cell
from lib.data.model.shared.player import Player
class TicTacToeBoard(AbstractBoard):
def __init__(self, size):
self.height = self.width = size
self.board = [[Cell(j, i) for i in range(size)] ... | [
"lib.data.model.shared.cell.Cell"
] | [((287, 297), 'lib.data.model.shared.cell.Cell', 'Cell', (['j', 'i'], {}), '(j, i)\n', (291, 297), False, 'from lib.data.model.shared.cell import Cell\n')] |
import torch
import numpy as np
import torch.nn as nn
import torch.distributed as dist
import torch.nn.functional as F
from torch import Tensor
from typing import Any
from typing import Dict
from typing import Tuple
from typing import Optional
from cftool.misc import update_dict
from cftool.misc import shallow_copy_d... | [
"torch.nn.GELU",
"torch.nn.init.constant_",
"torch.nn.Sequential",
"numpy.array",
"torch.nn.BatchNorm1d",
"torch.sum",
"torch.nn.init.trunc_normal_",
"torch.nn.functional.softmax",
"numpy.arange",
"numpy.linspace",
"torch.cuda.amp.autocast",
"numpy.concatenate",
"torch.nn.Identity",
"torch... | [((1525, 1537), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1533, 1537), True, 'import numpy as np\n'), ((1714, 1767), 'numpy.arange', 'np.arange', (['(epochs * num_step_per_epoch - warmup_iters)'], {}), '(epochs * num_step_per_epoch - warmup_iters)\n', (1723, 1767), True, 'import numpy as np\n'), ((1904, 1947)... |
from __future__ import absolute_import
# external modules
from past.builtins import basestring
import numpy as num
# ANUGA modules
import anuga.utilities.log as log
from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a, \
netcdf_float
from .asc2dem import asc2dem
... | [
"numpy.where",
"numpy.fliplr",
"anuga.file.netcdf.NetCDFFile",
"os.path.splitext",
"numpy.linspace",
"anuga.utilities.log.critical"
] | [((1287, 1322), 'anuga.file.netcdf.NetCDFFile', 'NetCDFFile', (['filename', 'netcdf_mode_r'], {}), '(filename, netcdf_mode_r)\n', (1297, 1322), False, 'from anuga.file.netcdf import NetCDFFile\n'), ((2004, 2044), 'numpy.where', 'num.where', (['(Z == NODATA_value)', 'num.nan', 'Z'], {}), '(Z == NODATA_value, num.nan, Z)... |
import os
from utils import *
wbt = wbt_setup()
__all__ = ['steep_areas',
'geomorphological_fluvial_flood_hazard_areas',
]
def geomorphological_fluvial_flood_hazard_areas(dem, output_prefix, buffer_distance, facc_threshold = 1000, remove_temp_outputs = True):
"""
Calculates F... | [
"os.path.join"
] | [((2138, 2174), 'os.path.join', 'os.path.join', (['wbt.work_dir', 'out_fill'], {}), '(wbt.work_dir, out_fill)\n', (2150, 2174), False, 'import os\n'), ((2194, 2230), 'os.path.join', 'os.path.join', (['wbt.work_dir', 'out_fdir'], {}), '(wbt.work_dir, out_fdir)\n', (2206, 2230), False, 'import os\n'), ((2250, 2286), 'os.... |
# Generated by Django 2.2.13 on 2021-07-05 06:50
import datetime
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0007_auto_20210705_0041'),
]
operations = [
migrations.AlterField(
mod... | [
"datetime.datetime",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((430, 478), 'datetime.datetime', 'datetime.datetime', (['(2021)', '(7)', '(5)', '(9)', '(49)', '(59)', '(711519)'], {}), '(2021, 7, 5, 9, 49, 59, 711519)\n', (447, 478), False, 'import datetime\n'), ((649, 697), 'datetime.datetime', 'datetime.datetime', (['(2021)', '(7)', '(5)', '(9)', '(49)', '(59)', '(711519)'], {}... |
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from datetime import datetime
from mojitobooks import db, ma, app
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
public_id = db.Column(db.String(50), unique=True)
username = db.Column(db.String(20), unique=True, null... | [
"mojitobooks.db.relationship",
"mojitobooks.db.ForeignKey",
"itsdangerous.TimedJSONWebSignatureSerializer",
"mojitobooks.db.Column",
"mojitobooks.db.String"
] | [((169, 208), 'mojitobooks.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (178, 208), False, 'from mojitobooks import db, ma, app\n'), ((647, 710), 'mojitobooks.db.Column', 'db.Column', (['db.DateTime'], {'nullable': '(False)', 'default': 'datetime.utcnow'}), '... |
from htm_rl.modules.htm.pattern_memory import PatternMemory
from htm.bindings.sdr import SDR
import numpy as np
from tqdm import tqdm
EPS = 1e-12
def get_labels(pm: PatternMemory, data, input_size):
labels = dict()
input_pattern = SDR(input_size)
for i, item in enumerate(data):
input_pattern.spa... | [
"numpy.intersect1d",
"numpy.union1d",
"numpy.random.choice",
"htm.bindings.sdr.SDR",
"htm_rl.modules.htm.pattern_memory.PatternMemory",
"numpy.setdiff1d",
"numpy.arange",
"numpy.random.shuffle"
] | [((243, 258), 'htm.bindings.sdr.SDR', 'SDR', (['input_size'], {}), '(input_size)\n', (246, 258), False, 'from htm.bindings.sdr import SDR\n'), ((491, 506), 'htm.bindings.sdr.SDR', 'SDR', (['input_size'], {}), '(input_size)\n', (494, 506), False, 'from htm.bindings.sdr import SDR\n'), ((2326, 2349), 'htm_rl.modules.htm.... |
from typing import List
import pytest
from pathlib import Path
from graphtik.sphinxext import DocFilesPurgatory, _image_formats
@pytest.fixture
def img_docs() -> List[str]:
return [f"d{i}" for i in range(3)]
@pytest.fixture
def img_files(tmpdir) -> List[Path]:
files = [tmpdir.join(f"f{i}") for i in range(... | [
"graphtik.sphinxext.DocFilesPurgatory",
"pathlib.Path"
] | [((486, 505), 'graphtik.sphinxext.DocFilesPurgatory', 'DocFilesPurgatory', ([], {}), '()\n', (503, 505), False, 'from graphtik.sphinxext import DocFilesPurgatory, _image_formats\n'), ((375, 382), 'pathlib.Path', 'Path', (['i'], {}), '(i)\n', (379, 382), False, 'from pathlib import Path\n')] |
import os
import jwt
from datetime import datetime,timedelta
from django.urls import reverse
from rest_framework import status
from authors.apps.authentication.models import User
from authors.apps.authentication.tests.base import BaseTest
from authors.settings import SECRET_KEY
from authors.apps.authentication.tests.te... | [
"django.urls.reverse"
] | [((2098, 2148), 'django.urls.reverse', 'reverse', (['"""password-reset"""'], {'kwargs': "{'token': token}"}), "('password-reset', kwargs={'token': token})\n", (2105, 2148), False, 'from django.urls import reverse\n'), ((2895, 2945), 'django.urls.reverse', 'reverse', (['"""password-reset"""'], {'kwargs': "{'token': toke... |
"""
xml parser
This is the xml parser for use with the cli_parse module and action plugin
https://github.com/martinblech/xmltodict
"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.module_utils._text import to_native
from ansible.module_utils.basic import missing_... | [
"ansible.module_utils.basic.missing_required_lib",
"xmltodict.parse",
"ansible.module_utils._text.to_native"
] | [((1913, 1940), 'xmltodict.parse', 'xmltodict.parse', (['cli_output'], {}), '(cli_output)\n', (1928, 1940), False, 'import xmltodict\n'), ((947, 980), 'ansible.module_utils.basic.missing_required_lib', 'missing_required_lib', (['"""xmltodict"""'], {}), "('xmltodict')\n", (967, 980), False, 'from ansible.module_utils.ba... |
from collections import namedtuple
from itertools import chain
from typing import List, Dict, Tuple, Any
from valacefgen import utils
from valacefgen.vala import VALA_TYPES, VALA_ALIASES, GLIB_TYPES
TypeInfo = utils.TypeInfo
EnumValue = namedtuple("EnumValue", 'c_name vala_name comment')
class Type:
def __init_... | [
"collections.namedtuple",
"valacefgen.utils.reformat_comment",
"valacefgen.utils.vala_comment",
"valacefgen.utils.parse_c_type",
"valacefgen.utils.bare_c_type"
] | [((239, 290), 'collections.namedtuple', 'namedtuple', (['"""EnumValue"""', '"""c_name vala_name comment"""'], {}), "('EnumValue', 'c_name vala_name comment')\n", (249, 290), False, 'from collections import namedtuple\n'), ((417, 448), 'valacefgen.utils.reformat_comment', 'utils.reformat_comment', (['comment'], {}), '(c... |
#import boto3
#import botocore
import sys
import os
import shutil
import json
import pickle
import lmdb
import subprocess
import argparse
import time
import datetime
import S3
import concurrent.futures
import requests
import subprocess
import pymongo
map_size = 100 * 1024 * 1024 * 1024
# default endpoint
endpoint_pd... | [
"json.loads",
"requests.post",
"argparse.ArgumentParser",
"json.dumps",
"os.path.join",
"datetime.datetime.now",
"lmdb.open",
"os.path.basename",
"shutil.rmtree",
"S3.S3",
"os.walk"
] | [((4294, 4328), 'requests.post', 'requests.post', (['url'], {'files': 'the_file'}), '(url, files=the_file)\n', (4307, 4328), False, 'import requests\n'), ((5417, 5442), 'os.path.basename', 'os.path.basename', (['file_in'], {}), '(file_in)\n', (5433, 5442), False, 'import os\n'), ((6236, 6322), 'argparse.ArgumentParser'... |
import gsyIO
str_filename = gsyIO.save_image()
print(str_filename)
index_ext = str_filename.rfind('.')
print(index_ext)
str_time = str_filename[:index_ext] + '_time' + str_filename[(index_ext):]
print(str_time)
# from tkinter import filedialog
# from tkinter import *
# root = Tk()
# root.filename = filedialo... | [
"gsyIO.save_image"
] | [((29, 47), 'gsyIO.save_image', 'gsyIO.save_image', ([], {}), '()\n', (45, 47), False, 'import gsyIO\n')] |
# -*- coding: utf-8 -*-
__version__ = "0.1.0"
version_info = tuple([int(num) for num in __version__.split('.')])
import os
import gevent
import zmq.green as zmq
from geventwebsocket.handler import WebSocketHandler
import paste.urlparser
import msgpack
import json
def main():
'''Set up zmq context and greenlets ... | [
"gevent.sleep",
"os.path.dirname",
"zmq.green.Context",
"msgpack.loads",
"gevent.spawn"
] | [((416, 429), 'zmq.green.Context', 'zmq.Context', ([], {}), '()\n', (427, 429), True, 'import zmq.green as zmq\n'), ((481, 514), 'gevent.spawn', 'gevent.spawn', (['zmq_server', 'context'], {}), '(zmq_server, context)\n', (493, 514), False, 'import gevent\n'), ((1450, 1468), 'gevent.sleep', 'gevent.sleep', (['(0.05)'], ... |
import pytest
import tempfile
import os
import io
import logging
from cellpy import log
from cellpy import prms
from cellpy import prmreader
from . import fdv
log.setup_logging(default_level="DEBUG")
config_file_txt = """---
Batch:
color_style_label: seaborn-deep
dpi: 300
fig_extension: png
figure_type: unlim... | [
"cellpy.prmreader._read_prm_file",
"io.StringIO",
"os.path.join",
"tempfile.mkdtemp",
"cellpy.prmreader._write_prm_file",
"cellpy.cellreader.CellpyData",
"pytest.fixture",
"cellpy.log.setup_logging"
] | [((160, 200), 'cellpy.log.setup_logging', 'log.setup_logging', ([], {'default_level': '"""DEBUG"""'}), "(default_level='DEBUG')\n", (177, 200), False, 'from cellpy import log\n'), ((2902, 2930), 'io.StringIO', 'io.StringIO', (['config_file_txt'], {}), '(config_file_txt)\n', (2913, 2930), False, 'import io\n'), ((2934, ... |
import nltk
from rouge import Rouge
def padding_sequence(sentence, length=200, padding="<padding>"):
sentence = sentence[:length]
return sentence + [padding]*(length-len(sentence))
_rouge = Rouge()
def rouge_score(s1, s2):
return 0 if not s1 or not s2 else _rouge.calc_score([s1], [s2])
def get_fake_ans... | [
"rouge.Rouge",
"nltk.word_tokenize"
] | [((202, 209), 'rouge.Rouge', 'Rouge', ([], {}), '()\n', (207, 209), False, 'from rouge import Rouge\n'), ((606, 627), 'nltk.word_tokenize', 'nltk.word_tokenize', (['t'], {}), '(t)\n', (624, 627), False, 'import nltk\n')] |
# included from libs/combination.py
"""
Combination
Not fastest but PyPy compatible version
"""
MOD = 998_244_353
K = 301
def makeInverseTable(K=K, MOD=MOD):
"""calc i^-1 for i in [1, K] mod MOD. MOD should be prime
>>> invs = makeInverseTable(10)
>>> [i * invs[i] % MOD for i in range(1, 10)]
[1, 1, ... | [
"doctest.testmod",
"doctest.run_docstring_examples",
"sys.exit"
] | [((3846, 3863), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (3861, 3863), False, 'import doctest\n'), ((4428, 4438), 'sys.exit', 'sys.exit', ([], {}), '()\n', (4436, 4438), False, 'import sys\n'), ((3952, 3999), 'doctest.run_docstring_examples', 'doctest.run_docstring_examples', (['g[k]', 'g'], {'name': 'k'... |
# -*- coding: utf-8 -*-
import io
import json
import requests
import time
# Add your feedly API credentials
user_id = ''
access_token = ''
def get_saved_items(user_id, access_token, continuation = None):
headers = {'Authorization' : 'OAuth ' + access_token}
url = 'https://cloud.feedly.com/v3/streams/conten... | [
"json.dump",
"time.strftime",
"requests.get",
"io.open"
] | [((494, 528), 'requests.get', 'requests.get', (['url'], {'headers': 'headers'}), '(url, headers=headers)\n', (506, 528), False, 'import requests\n'), ((1128, 1168), 'io.open', 'io.open', (['filename', '"""a"""'], {'encoding': '"""UTF-8"""'}), "(filename, 'a', encoding='UTF-8')\n", (1135, 1168), False, 'import io\n'), (... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# ade:
# Asynchronous Differential Evolution.
#
# Copyright (C) 2018-19 by <NAME>,
# http://edsuom.com/ade
#
# See edsuom.com for API documentation as well as information about
# Ed's background and other projects, software and otherwise.
#
# Licensed under the Apache Li... | [
"numpy.abs",
"asynqueue.process.ProcessQueue",
"twisted.internet.reactor.stop",
"numpy.square",
"numpy.exp",
"yampex.plot.Plotter",
"ade.de.DifferentialEvolution",
"asynqueue.process.ProcessQueue.cores",
"twisted.internet.reactor.run",
"ade.population.Population",
"twisted.internet.reactor.callW... | [((9904, 9934), 'twisted.internet.reactor.callWhenRunning', 'reactor.callWhenRunning', (['r.run'], {}), '(r.run)\n', (9927, 9934), False, 'from twisted.internet import reactor, defer\n'), ((9939, 9952), 'twisted.internet.reactor.run', 'reactor.run', ([], {}), '()\n', (9950, 9952), False, 'from twisted.internet import r... |
"""Calculations involving a pair of Cu atoms
"""
from typing import Union, Callable
import numpy as np
from ase import Atoms
from ase.units import Ang
try:
from Morse import MorsePotential
from util import map_func
except ModuleNotFoundError:
from .Morse import MorsePotential
from .util import map_fun... | [
"ase.Atoms",
"Morse.MorsePotential",
"numpy.linspace",
"util.map_func"
] | [((574, 590), 'Morse.MorsePotential', 'MorsePotential', ([], {}), '()\n', (588, 590), False, 'from Morse import MorsePotential\n'), ((599, 662), 'ase.Atoms', 'Atoms', (['"""2Cu"""'], {'positions': '[(0.0, 0.0, 0.0), (0.0, 0.0, d0 * Ang)]'}), "('2Cu', positions=[(0.0, 0.0, 0.0), (0.0, 0.0, d0 * Ang)])\n", (604, 662), Fa... |
import bplights
import time
import random
import math
l = bplights.BPLights(300)
l.off()
m = bplights.BPNanoKontrol()
m.sliders[0] = 1
m.knobs[0] = 1
dq = math.pi * 6.0 / l.npixels
dt = 0.1
t = 0
for i in range(10000):
t = t + dt
if (t > 2 * math.pi):
t = t - 2 * math.pi
dt = 0.005 + 0.3 ... | [
"bplights.BPNanoKontrol",
"bplights.BPLights",
"time.sleep",
"math.sin"
] | [((60, 82), 'bplights.BPLights', 'bplights.BPLights', (['(300)'], {}), '(300)\n', (77, 82), False, 'import bplights\n'), ((96, 120), 'bplights.BPNanoKontrol', 'bplights.BPNanoKontrol', ([], {}), '()\n', (118, 120), False, 'import bplights\n'), ((596, 612), 'time.sleep', 'time.sleep', (['(0.02)'], {}), '(0.02)\n', (606,... |
import asyncio
class Barrier(object):
def __init__(self, parties, action=lambda: None):
self._parties = parties
self._action = action
self._cond = asyncio.Condition()
self._count = 0
async def wait(self):
self._count += 1
with (await self._cond):
if... | [
"asyncio.Condition"
] | [((177, 196), 'asyncio.Condition', 'asyncio.Condition', ([], {}), '()\n', (194, 196), False, 'import asyncio\n')] |
# -*- coding: utf-8 -*-
"""
Created on Fri May 5 16:20:14 2017
@author: <NAME>
Program for WOS Cited References Analysis
"""
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from collections import Counter
df = pd.read_pickle('concatenated.pkl')
df = df.dropna(subset = ['PY','CR']) # Get rid... | [
"pandas.read_pickle",
"matplotlib.pyplot.hist",
"numpy.unique",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"collections.Counter",
"numpy.array",
"numpy.zeros",
"matplotlib.pyplot.figure",
"pandas.DataFrame",
"numpy.arange"
] | [((238, 272), 'pandas.read_pickle', 'pd.read_pickle', (['"""concatenated.pkl"""'], {}), "('concatenated.pkl')\n", (252, 272), True, 'import pandas as pd\n'), ((413, 424), 'numpy.zeros', 'np.zeros', (['a'], {}), '(a)\n', (421, 424), True, 'import numpy as np\n'), ((1901, 1917), 'collections.Counter', 'Counter', (['journ... |
import logging
import time
import selenium
from selenium.webdriver.common.by import By
import testutils
def test_project_file_browser(driver: selenium.webdriver, *args, **kwargs):
"""
Test that a file can be dragged and dropped into code, input data,
and output data in a project.
Args:
driv... | [
"testutils.unique_dataset_name",
"testutils.FileBrowserElements",
"testutils.prep_py3_minimal_base",
"time.sleep",
"testutils.DatasetElements",
"testutils.GuideElements",
"testutils.log_in",
"logging.info"
] | [((339, 378), 'testutils.prep_py3_minimal_base', 'testutils.prep_py3_minimal_base', (['driver'], {}), '(driver)\n', (370, 378), False, 'import testutils\n'), ((440, 504), 'logging.info', 'logging.info', (['f"""Navigating to Code for project: {project_title}"""'], {}), "(f'Navigating to Code for project: {project_title}... |