code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
from PIL import Image
from pycocotools.coco import COCO
from torch.utils import data
class COCODataset(data.Dataset):
def __init__(self, images_path, ann_path, split='train', transform=None):
self.coco = COCO(ann_path)
self.image_path = images_path
self.ids = list(self.coco.imgs... | [
"pycocotools.coco.COCO",
"os.path.join"
] | [((229, 243), 'pycocotools.coco.COCO', 'COCO', (['ann_path'], {}), '(ann_path)\n', (233, 243), False, 'from pycocotools.coco import COCO\n'), ((695, 735), 'os.path.join', 'os.path.join', (['self.image_path', 'file_name'], {}), '(self.image_path, file_name)\n', (707, 735), False, 'import os\n')] |
"""
This script gather functions related to the SZ spectrum
"""
import numpy as np
import astropy.units as u
from astropy import constants as const
from astropy.cosmology import Planck15 as cosmo
#===================================================
#========== CMB intensity
#========================================... | [
"numpy.array",
"numpy.exp",
"numpy.transpose",
"numpy.sum"
] | [((11551, 11587), 'numpy.transpose', 'np.transpose', (['theta_ei', '(1, 0, 2, 3)'], {}), '(theta_ei, (1, 0, 2, 3))\n', (11563, 11587), True, 'import numpy as np\n'), ((4546, 8066), 'numpy.array', 'np.array', (['[[[-18.1317 + x * 0], [99.7038 + x * 0], [-60.7438 + x * 0], [1051.43 + x *\n 0], [-2867.34 + x * 0], [773... |
# -*- coding: utf-8 -*-
from sae import storage
class SaeStorage(object):
def __init__(self, app=None):
self.app = app
if app is not None:
self.init_app(app)
def init_app(self, app):
access_key = app.config.get('SAE_ACCESS_KEY', storage.ACCESS_KEY)
secret_key = ap... | [
"sae.storage.Connection"
] | [((520, 572), 'sae.storage.Connection', 'storage.Connection', (['access_key', 'secret_key', 'app_name'], {}), '(access_key, secret_key, app_name)\n', (538, 572), False, 'from sae import storage\n')] |
# PhysiBoSS Tab
import os
from ipywidgets import Layout, Label, Text, Checkbox, Button, HBox, VBox, Box, \
FloatText, BoundedIntText, BoundedFloatText, HTMLMath, Dropdown, interactive, Output
from collections import deque, Counter
import xml.etree.ElementTree as ET
import matplotlib.pyplot as plt
from matplotlib.co... | [
"ipywidgets.interactive",
"copy.deepcopy",
"xml.etree.ElementTree.parse",
"numpy.sum",
"csv.reader",
"scipy.io.loadmat",
"collections.Counter",
"numpy.zeros",
"numpy.transpose",
"ipywidgets.Box",
"os.path.isfile",
"matplotlib.pyplot.figure",
"numpy.array",
"ipywidgets.Label",
"ipywidgets... | [((1211, 1238), 'os.path.isfile', 'os.path.isfile', (['config_file'], {}), '(config_file)\n', (1225, 1238), False, 'import os\n'), ((2007, 2169), 'ipywidgets.interactive', 'interactive', (['self.create_area_chart'], {'frame': '(0, max_frames)', 'percentage': '(0.0, 10.0)', 'total': '(False)', 'cell_line': 'self.cell_li... |
import enum
import mesh
from tri_mesh_viewer import TriMeshViewer
import parametrization
from matplotlib import pyplot as plt
def analysisPlots(m, uvs, figsize=(8,4), bins=200):
plt.figure(figsize=figsize)
plt.subplot(1, 2, 1)
for label, uv in uvs.items():
distortion = parametrization.conformalDist... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.legend",
"tri_mesh_viewer.TriMeshViewer",
"parametrization.scaleFactor",
"parametrization.conformalDistortion",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout"
] | [((183, 210), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (193, 210), True, 'from matplotlib import pyplot as plt\n'), ((215, 235), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(1)', '(2)', '(1)'], {}), '(1, 2, 1)\n', (226, 235), True, 'from matplotlib import pyplot ... |
import os
import os.path
import shutil
# 1
def countFilesOfType(top, extension):
"""inputs: top: a String directory
extension: a String file extension
returns a count of files with a given extension in the directory
top and its subdirectories"""
count = 0
filename... | [
"os.walk",
"os.scandir"
] | [((836, 851), 'os.scandir', 'os.scandir', (['top'], {}), '(top)\n', (846, 851), False, 'import os\n'), ((1506, 1521), 'os.scandir', 'os.scandir', (['top'], {}), '(top)\n', (1516, 1521), False, 'import os\n'), ((2540, 2555), 'os.scandir', 'os.scandir', (['top'], {}), '(top)\n', (2550, 2555), False, 'import os\n'), ((364... |
# -*- coding: utf-8 -*-
import sys
import importlib
import time
sys.path.append('plugins/')
PCRC = None
PREFIX = '!!PCRC'
# 0=guest 1=user 2=helper 3=admin
Permission = 1
def permission(server, info, perm):
if info.is_user:
if info.source == 1:
return True
elif server.get_permission_l... | [
"sys.path.append",
"importlib.import_module",
"time.sleep"
] | [((65, 92), 'sys.path.append', 'sys.path.append', (['"""plugins/"""'], {}), "('plugins/')\n", (80, 92), False, 'import sys\n'), ((426, 467), 'importlib.import_module', 'importlib.import_module', (['"""PCRC-MCDR.PCRC"""'], {}), "('PCRC-MCDR.PCRC')\n", (449, 467), False, 'import importlib\n'), ((1533, 1548), 'time.sleep'... |
import timeit
from typing import Union
import numpy as np
import pandas as pd
import copy
from carla.evaluation.distances import get_distances
from carla.evaluation.nearest_neighbours import yNN, yNN_prob, yNN_dist
from carla.evaluation.manifold import yNN_manifold, sphere_manifold
from carla.evaluation.process_nans ... | [
"pandas.DataFrame",
"carla.evaluation.recourse_time.recourse_time_taken",
"copy.deepcopy",
"timeit.default_timer",
"carla.evaluation.success_rate.success_rate",
"carla.evaluation.diversity.individual_diversity",
"carla.evaluation.diversity.avg_diversity",
"carla.evaluation.manifold.sphere_manifold",
... | [((2440, 2462), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (2460, 2462), False, 'import timeit\n'), ((2556, 2578), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (2576, 2578), False, 'import timeit\n'), ((2813, 2836), 'copy.deepcopy', 'copy.deepcopy', (['factuals'], {}), '(fact... |
# -*- coding: utf-8 -*-
"""
Automation task as a AppDaemon App for Home Assistant
This little app controls the ambient light when Kodi plays video,
dimming some lights and turning off others, and returning to the
initial state when the playback is finished.
In addition, it also sends notifications when starting the v... | [
"datetime.timedelta",
"urllib.parse.unquote_plus"
] | [((6077, 6119), 'datetime.timedelta', 'dt.timedelta', ([], {'hours': "(item['runtime'] / 3600)"}), "(hours=item['runtime'] / 3600)\n", (6089, 6119), True, 'import datetime as dt\n'), ((4381, 4405), 'datetime.timedelta', 'dt.timedelta', ([], {'minutes': '(30)'}), '(minutes=30)\n', (4393, 4405), True, 'import datetime as... |
import sys
from fp_lib.common import cliparser
from fp_lib.common import log
from fpstackutils.commands import nova
LOG = log.getLogger(__name__)
def main():
cli_parser = cliparser.SubCliParser('Python Nova Utils')
cli_parser.register_clis(nova.ResourcesInit,
nova.VMCleanup, nov... | [
"fp_lib.common.cliparser.SubCliParser",
"fp_lib.common.log.getLogger"
] | [((124, 147), 'fp_lib.common.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (137, 147), False, 'from fp_lib.common import log\n'), ((179, 222), 'fp_lib.common.cliparser.SubCliParser', 'cliparser.SubCliParser', (['"""Python Nova Utils"""'], {}), "('Python Nova Utils')\n", (201, 222), False, 'from f... |
from nltk.stem import WordNetLemmatizer
from nltk.corpus import stopwords
# Note: Must download stuff for stopwords:
# showing info https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/index.xml
import re
import string
from typing import Dict
from data_classes import *
def preprocess(docs: Dict[str,str], **kwargs... | [
"re.escape",
"re.sub",
"nltk.corpus.stopwords.words",
"nltk.stem.WordNetLemmatizer"
] | [((2002, 2021), 'nltk.stem.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (2019, 2021), False, 'from nltk.stem import WordNetLemmatizer\n'), ((2420, 2450), 're.sub', 're.sub', (['"""\\\\d"""', '""""""', 'current_doc'], {}), "('\\\\d', '', current_doc)\n", (2426, 2450), False, 'import re\n'), ((1959, 1985), ... |
from sklearn.cluster import KMeans
from random import randint
import numpy as np
import csv
import matplotlib.pyplot as plt
matriz = []
arrayCriacaoCentroides = []
with open('dataset_iris.csv') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
largPetala = (row['larguraPetala'])
... | [
"matplotlib.pyplot.show",
"random.randint",
"csv.DictReader",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"sklearn.cluster.KMeans",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((432, 448), 'numpy.array', 'np.array', (['matriz'], {}), '(matriz)\n', (440, 448), True, 'import numpy as np\n'), ((2352, 2362), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2360, 2362), True, 'import matplotlib.pyplot as plt\n'), ((221, 244), 'csv.DictReader', 'csv.DictReader', (['csvfile'], {}), '(csvfi... |
""" 個股月營收資訊 """
import re
import sys
import pdb
import pandas as pd
from stock_web_crawler import stock_crawler, delete_header, excel_formatting
import global_vars
def main():
global_vars.initialize_proxy()
""" valid input formats """
# inputs = "台積電 聯電"
# inputs = "2330 2314"
# inputs = "台積電... | [
"stock_web_crawler.excel_formatting",
"re.split",
"global_vars.initialize_proxy",
"pandas.Series",
"stock_web_crawler.stock_crawler",
"stock_web_crawler.delete_header",
"pandas.ExcelWriter",
"sys.exit"
] | [((182, 212), 'global_vars.initialize_proxy', 'global_vars.initialize_proxy', ([], {}), '()\n', (210, 212), False, 'import global_vars\n'), ((543, 567), 're.split', 're.split', (['delims', 'inputs'], {}), '(delims, inputs)\n', (551, 567), False, 'import re\n'), ((421, 432), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n... |
"""
********************************************************************************
* Name: tethys_app_quota.py
* Author: tbayer, mlebarron
* Created On: April 2, 2019
* Copyright: (c) Aquaveo 2018
********************************************************************************
"""
import logging
from django.db impor... | [
"django.db.models.ForeignKey",
"logging.getLogger"
] | [((436, 475), 'logging.getLogger', 'logging.getLogger', (["('tethys.' + __name__)"], {}), "('tethys.' + __name__)\n", (453, 475), False, 'import logging\n'), ((649, 703), 'django.db.models.ForeignKey', 'models.ForeignKey', (['TethysApp'], {'on_delete': 'models.CASCADE'}), '(TethysApp, on_delete=models.CASCADE)\n', (666... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2018 <NAME> <<EMAIL>>
#
# Distributed under terms of the MIT license.
import hoomd
import hoomd.simple_force
import hoomd.md
import numpy as np
context = hoomd.context.initialize("--notice-level=10 --mode=cpu")
uc = hoomd.lattice.unitcell... | [
"hoomd.simple_force.SimpleForce",
"hoomd.md.update.enforce2d",
"hoomd.md.nlist.cell",
"hoomd.md.constrain.rigid",
"hoomd.lattice.unitcell",
"hoomd.context.initialize",
"hoomd.run",
"hoomd.group.rigid_center",
"hoomd.init.create_lattice",
"hoomd.md.integrate.mode_standard"
] | [((236, 292), 'hoomd.context.initialize', 'hoomd.context.initialize', (['"""--notice-level=10 --mode=cpu"""'], {}), "('--notice-level=10 --mode=cpu')\n", (260, 292), False, 'import hoomd\n'), ((298, 500), 'hoomd.lattice.unitcell', 'hoomd.lattice.unitcell', ([], {'N': '(1)', 'a1': '[3, 0, 0]', 'a2': '[0, 3, 0]', 'a3': '... |
import logging
from typing import List
import matplotlib.pyplot as plt
import numpy as np
import streamlit as st
from matplotlib.animation import FuncAnimation
from scipy import integrate
from utils.objects import Body
logger = logging.getLogger(__name__)
# Arbitrary value for G (gravitational constant)
G = 1
def... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"scipy.integrate.ode",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.axes",
"streamlit.sidebar.progress",
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.figure",
"numpy.linspace",
"streamlit.pyplot",
"logging.getLogger"
] | [((231, 258), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (248, 258), False, 'import logging\n'), ((4142, 4165), 'numpy.linspace', 'np.linspace', (['t0', 't1', 'dt'], {}), '(t0, t1, dt)\n', (4153, 4165), True, 'import numpy as np\n'), ((4667, 4689), 'streamlit.sidebar.progress', 'st.si... |
"""Provide a generic class for novelWriter item file representation.
Copyright (c) 2022 <NAME>
For further information see https://github.com/peter88213/yw2nw
Published under the MIT License (https://opensource.org/licenses/mit-license.php)
"""
import os
from pywriter.pywriter_globals import ERROR
class Nw... | [
"os.path.dirname",
"os.path.normpath"
] | [((894, 929), 'os.path.dirname', 'os.path.dirname', (['self._prj.filePath'], {}), '(self._prj.filePath)\n', (909, 929), False, 'import os\n'), ((1414, 1446), 'os.path.normpath', 'os.path.normpath', (['self._filePath'], {}), '(self._filePath)\n', (1430, 1446), False, 'import os\n'), ((2128, 2160), 'os.path.normpath', 'o... |
import sys
from operator import itemgetter
import numpy as np
import cv2
import math
import matplotlib.pyplot as plt
# -----------------------------#
# 计算原始输入图像
# 每一次缩放的比例
# -----------------------------#
def calculateScales(img):
copy_img = img.copy()
pr_scale = 1.0
h, w, _ = copy_img.shape
if ... | [
"numpy.maximum",
"numpy.empty",
"cv2.warpAffine",
"numpy.mean",
"numpy.linalg.norm",
"numpy.linalg.svd",
"cv2.getRotationMatrix2D",
"cv2.invertAffineTransform",
"numpy.multiply",
"numpy.std",
"numpy.swapaxes",
"numpy.reshape",
"numpy.repeat",
"numpy.minimum",
"numpy.fix",
"numpy.square... | [((984, 1011), 'numpy.swapaxes', 'np.swapaxes', (['cls_prob', '(0)', '(1)'], {}), '(cls_prob, 0, 1)\n', (995, 1011), True, 'import numpy as np\n'), ((1022, 1044), 'numpy.swapaxes', 'np.swapaxes', (['roi', '(0)', '(2)'], {}), '(roi, 0, 2)\n', (1033, 1044), True, 'import numpy as np\n'), ((1171, 1202), 'numpy.where', 'np... |
# Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | [
"numpy.sum",
"numpy.abs",
"numpy.allclose",
"numpy.ones",
"numpy.arange",
"numpy.linalg.norm",
"numpy.exp",
"numpy.diag",
"pytest.raises",
"hypothesis.strategies.complex_numbers",
"hypothesis.strategies.integers",
"mrmustard.physics.fock.dm_to_ket",
"scipy.special.factorial",
"numpy.tanh",... | [((901, 944), 'hypothesis.strategies.floats', 'st.floats', ([], {'min_value': '(0)', 'max_value': '(2 * np.pi)'}), '(min_value=0, max_value=2 * np.pi)\n', (910, 944), True, 'from hypothesis import settings, given, strategies as st\n'), ((1475, 1488), 'numpy.diag', 'np.diag', (['diag'], {}), '(diag)\n', (1482, 1488), Tr... |
#!/usr/bin/env python3
import os,sys,glob,multiprocessing,time,csv,math,pprint
from parsl.app.app import python_app
from os.path import *
from mappgene.subscripts import *
@python_app(executors=['worker'])
def run_ivar(params):
subject_dir = params['work_dir']
subject = basename(subject_dir)
input_reads =... | [
"parsl.app.app.python_app",
"os.rename",
"pprint.pformat",
"time.time"
] | [((174, 206), 'parsl.app.app.python_app', 'python_app', ([], {'executors': "['worker']"}), "(executors=['worker'])\n", (184, 206), False, 'from parsl.app.app import python_app\n'), ((903, 914), 'time.time', 'time.time', ([], {}), '()\n', (912, 914), False, 'import os, sys, glob, multiprocessing, time, csv, math, pprint... |
# http://github.com/timestocome/
# build a markov chain and use it to predict Alice In Wonderland/Through the Looking Glass text
import numpy as np
import pickle
from collections import Counter
import markovify # https://github.com/jsvine/markovify
################################################################... | [
"markovify.Text"
] | [((635, 669), 'markovify.Text', 'markovify.Text', (['data'], {'state_size': '(3)'}), '(data, state_size=3)\n', (649, 669), False, 'import markovify\n')] |
# Kokeillaan mediaanin ja keskiarvon eroa. Kuvissa (30kpl) on oppilaita
# satunnaisissa kohdissa, ja kamera oli jalustalla luokkahuoneessa. Otetaan
# toisaalta keskiarvot ja toisaalta mediaanit pikseliarvoista.
# Lopputulokset ovat hyvin erilaiset!
#
# <NAME> huhtikuu 2021
# Matlab -> Python Ville Tilvis kesäkuu 2021
... | [
"matplotlib.pyplot.subplot",
"numpy.abs",
"matplotlib.pyplot.show",
"numpy.median",
"numpy.power",
"matplotlib.pyplot.imshow",
"numpy.zeros",
"matplotlib.pyplot.axis",
"numpy.max",
"numpy.mean",
"matplotlib.pyplot.imsave",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.imread",
"numpy.concate... | [((479, 504), 'numpy.zeros', 'np.zeros', (['[2000, 2997, 3]'], {}), '([2000, 2997, 3])\n', (487, 504), True, 'import numpy as np\n'), ((515, 540), 'numpy.zeros', 'np.zeros', (['[2000, 2997, 3]'], {}), '([2000, 2997, 3])\n', (523, 540), True, 'import numpy as np\n'), ((547, 577), 'numpy.zeros', 'np.zeros', (['[2000, 299... |
import numpy as np
import gym
from reps.acreps import acREPS
np.random.seed(1337)
env = gym.make('Pendulum-RL-v1')
env._max_episode_steps = 250
env.unwrapped.dt = 0.05
env.unwrapped.sigma = 1e-4
# env.seed(1337)
acreps = acREPS(env=env, kl_bound=0.1, discount=0.985, lmbda=0.95,
scale=[1., 1., 8.0, 2... | [
"reps.acreps.acREPS",
"numpy.random.seed",
"gym.make",
"matplotlib.pyplot.show",
"matplotlib.pyplot.subplots"
] | [((63, 83), 'numpy.random.seed', 'np.random.seed', (['(1337)'], {}), '(1337)\n', (77, 83), True, 'import numpy as np\n'), ((91, 117), 'gym.make', 'gym.make', (['"""Pendulum-RL-v1"""'], {}), "('Pendulum-RL-v1')\n", (99, 117), False, 'import gym\n'), ((225, 365), 'reps.acreps.acREPS', 'acREPS', ([], {'env': 'env', 'kl_bo... |
from sage.all import RDF, CDF, matrix, prod
import scipy.linalg
import numpy as np
def column_space_intersection(*As, tol, orthonormal=False):
r"""
Return a matrix with orthonormal columns spanning the intersection of the
column spaces of the given matrices.
INPUT:
- ``*As`` -- matrices with a fi... | [
"numpy.linalg.matrix_rank",
"numpy.sum",
"sage.all.ZZ.random_element"
] | [((2226, 2245), 'numpy.sum', 'np.sum', (['(1 - Σ < tol)'], {}), '(1 - Σ < tol)\n', (2232, 2245), True, 'import numpy as np\n'), ((5203, 5222), 'numpy.linalg.matrix_rank', 'matrix_rank', (['A', 'tol'], {}), '(A, tol)\n', (5214, 5222), False, 'from numpy.linalg import matrix_rank\n'), ((5226, 5245), 'numpy.linalg.matrix_... |
try:
from setuptools.core import setup
except ImportError:
from distutils.core import setup
__version__ = '0.1.0'
setup(
name='pyneurovault_upload',
version='0.1.0',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/ljchang/pyneurovault_upload',
packages=['pyneurovault_u... | [
"distutils.core.setup"
] | [((124, 694), 'distutils.core.setup', 'setup', ([], {'name': '"""pyneurovault_upload"""', 'version': '"""0.1.0"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/ljchang/pyneurovault_upload"""', 'packages': "['pyneurovault_upload']", 'license': '"""MIT"""', 'install_requires':... |
"""User Write Stage API Views"""
from rest_framework.viewsets import ModelViewSet
from authentik.core.api.used_by import UsedByMixin
from authentik.flows.api.stages import StageSerializer
from authentik.stages.user_write.models import UserWriteStage
class UserWriteStageSerializer(StageSerializer):
"""UserWriteSt... | [
"authentik.stages.user_write.models.UserWriteStage.objects.all"
] | [((592, 620), 'authentik.stages.user_write.models.UserWriteStage.objects.all', 'UserWriteStage.objects.all', ([], {}), '()\n', (618, 620), False, 'from authentik.stages.user_write.models import UserWriteStage\n')] |
import asyncio
from threading import Thread
async def production_task():
i = 0
while 1:
# 将consumption这个协程每秒注册一个到运行在线程中的循环,thread_loop每秒会获得一个一直打印i的无限循环任务
asyncio.run_coroutine_threadsafe(consumption(i),
thread_loop) # 注意:run_coroutine_threadsafe... | [
"threading.Thread",
"asyncio.get_event_loop",
"asyncio.sleep",
"asyncio.set_event_loop",
"asyncio.new_event_loop"
] | [((658, 682), 'asyncio.new_event_loop', 'asyncio.new_event_loop', ([], {}), '()\n', (680, 682), False, 'import asyncio\n'), ((714, 760), 'threading.Thread', 'Thread', ([], {'target': 'start_loop', 'args': '(thread_loop,)'}), '(target=start_loop, args=(thread_loop,))\n', (720, 760), False, 'from threading import Thread\... |
'''
This file is a modification of the file below to enable map save
https://github.com/simondlevy/PyRoboViz/blob/master/roboviz/__init__.py
roboviz.py - Python classes for displaying maps and robots
Requires: numpy, matplotlib
Copyright (C) 2018 <NAME>
This file is part of PyRoboViz.
PyRoboViz is free software: ... | [
"matplotlib.pyplot.title",
"numpy.radians",
"matplotlib.lines.Line2D",
"numpy.frombuffer",
"matplotlib.pyplot.draw",
"matplotlib.pyplot.figure",
"matplotlib.use",
"numpy.arange",
"numpy.sin",
"numpy.cos",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.gcf",
"datetime.datetime.now"
] | [((1023, 1046), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (1037, 1046), False, 'import matplotlib\n'), ((2046, 2093), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 10)', 'facecolor': '"""white"""'}), "(figsize=(10, 10), facecolor='white')\n", (2056, 2093), True, 'impor... |
#!/usr/bin/env python
# coding: utf-8
# # Import libraries and data
#
# Dataset was obtained in the capstone project description (direct link [here](https://d3c33hcgiwev3.cloudfront.net/_429455574e396743d399f3093a3cc23b_capstone.zip?Expires=1530403200&Signature=FECzbTVo6TH7aRh7dXXmrASucl~Cy5mlO94P7o0UXygd13S~Afi38FqC... | [
"matplotlib.pyplot.title",
"numpy.isin",
"numpy.random.seed",
"numpy.sum",
"numpy.abs",
"pandas.read_csv",
"numpy.isnan",
"numpy.argsort",
"matplotlib.pyplot.figure",
"numpy.ndarray",
"pandas.DataFrame",
"numpy.empty_like",
"numpy.random.choice",
"numpy.average",
"numpy.log2",
"sklearn... | [((1069, 1158), 'pandas.read_csv', 'pd.read_csv', (['"""data/capstone/Capstone Data - Office Products - Items.csv"""'], {'index_col': '(0)'}), "('data/capstone/Capstone Data - Office Products - Items.csv',\n index_col=0)\n", (1080, 1158), True, 'import pandas as pd\n'), ((1173, 1264), 'pandas.read_csv', 'pd.read_csv... |
import torch.nn as nn
from UNIQ.quantize import act_quantize, act_noise, check_quantization
import torch.nn.functional as F
class ActQuant(nn.Module):
def __init__(self, quatize_during_training=False, noise_during_training=False, quant=False, noise=False,
bitwidth=32):
super(ActQuant, se... | [
"UNIQ.quantize.act_noise.apply",
"UNIQ.quantize.act_quantize.apply",
"torch.nn.functional.relu"
] | [((953, 993), 'UNIQ.quantize.act_quantize.apply', 'act_quantize.apply', (['input', 'self.bitwidth'], {}), '(input, self.bitwidth)\n', (971, 993), False, 'from UNIQ.quantize import act_quantize, act_noise, check_quantization\n'), ((1111, 1181), 'UNIQ.quantize.act_noise.apply', 'act_noise.apply', (['input'], {'bitwidth':... |
import random
import arcade
from badwing.constants import *
from badwing.effect import Effect
from badwing.particle import AnimatedAlphaParticle
#TODO: Some of this will go up into ParticleEffect
class Firework(Effect):
def __init__(self, position=(0,0), r1=30, r2=40):
super().__init__(position)
... | [
"arcade.EmitBurst",
"random.randint",
"random.uniform",
"arcade.rand_in_circle",
"random.choice"
] | [((335, 357), 'random.randint', 'random.randint', (['r1', 'r2'], {}), '(r1, r2)\n', (349, 357), False, 'import random\n'), ((976, 1005), 'random.choice', 'random.choice', (['SPARK_TEXTURES'], {}), '(SPARK_TEXTURES)\n', (989, 1005), False, 'import random\n'), ((1099, 1128), 'arcade.EmitBurst', 'arcade.EmitBurst', (['sel... |
# Lint as: python3
# Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | [
"tensorflow.python.util.all_util.remove_undocumented"
] | [((1616, 1663), 'tensorflow.python.util.all_util.remove_undocumented', 'remove_undocumented', (['__name__', '_allowed_symbols'], {}), '(__name__, _allowed_symbols)\n', (1635, 1663), False, 'from tensorflow.python.util.all_util import remove_undocumented\n')] |
"""all routes"""
from flask import Blueprint
from flask_restful import Api
from .questions.views import Questions, Question, UpdateTitle, UpdateQuestion
VERSION_UNO = Blueprint('api', __name__, url_prefix='/api/v1')
API = Api(VERSION_UNO)
API.add_resource(Questions, '/questions')
API.add_resource(Question, '/question... | [
"flask_restful.Api",
"flask.Blueprint"
] | [((169, 217), 'flask.Blueprint', 'Blueprint', (['"""api"""', '__name__'], {'url_prefix': '"""/api/v1"""'}), "('api', __name__, url_prefix='/api/v1')\n", (178, 217), False, 'from flask import Blueprint\n'), ((224, 240), 'flask_restful.Api', 'Api', (['VERSION_UNO'], {}), '(VERSION_UNO)\n', (227, 240), False, 'from flask_... |
#coding=utf-8
#import libs
import MergeNew_cmd
import MergeNew_sty
import Fun
import os
import tkinter
from tkinter import *
import tkinter.ttk
import tkinter.font
#Add your Varial Here: (Keep This Line of comments)
#Define UI Class
class MergeNew:
def __init__(self,root,isTKroot = True):
uiName = self... | [
"MergeNew_cmd.Button_7_onCommand",
"tkinter.Canvas",
"MergeNew_cmd.Button_4_onCommand",
"tkinter.Button",
"Fun.CenterDlg",
"tkinter.Listbox",
"tkinter.Entry",
"tkinter.font.Font",
"MergeNew_cmd.Button_2_onCommand",
"Fun.Register",
"Fun.AddTKVariable",
"MergeNew_cmd.Button_5_onCommand",
"Merg... | [((5187, 5199), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (5197, 5199), False, 'import tkinter\n'), ((348, 385), 'Fun.Register', 'Fun.Register', (['uiName', '"""UIClass"""', 'self'], {}), "(uiName, 'UIClass', self)\n", (360, 385), False, 'import Fun\n'), ((425, 450), 'MergeNew_sty.SetupStyle', 'MergeNew_sty.SetupSt... |
#!/usr/bin/env python
from setuptools import setup, find_packages
VERSION = '0.2'
with open('README.md') as readme:
long_description = readme.read()
setup(
name='sentry-scrapy',
version=VERSION,
description='Scrapy integration with Sentry SDK (unofficial)',
long_description=long_description,
... | [
"setuptools.find_packages"
] | [((431, 446), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (444, 446), False, 'from setuptools import setup, find_packages\n')] |
import pymongo
from .mongod import Mongod
class MongoClient(pymongo.MongoClient):
def __init__(self, host=None, port=None, **kwargs):
self._mongod = Mongod()
self._mongod.start()
super().__init__(self._mongod.connection_string, **kwargs)
def close(self):
self._mongod.stop()
... | [
"logging.basicConfig"
] | [((497, 537), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (516, 537), False, 'import logging\n')] |
# Generated by Django 3.0.5 on 2020-04-15 10:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ipam', '0036_standardize_description'),
('netbox_ddns', '0002_add_ttl'),
]
operations = [
migration... | [
"django.db.models.OneToOneField",
"django.db.models.PositiveIntegerField",
"django.db.models.PositiveSmallIntegerField",
"django.db.models.AutoField",
"django.db.models.DateTimeField"
] | [((409, 479), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)'}), '(auto_created=True, primary_key=True, serialize=False)\n', (425, 479), False, 'from django.db import migrations, models\n'), ((514, 549), 'django.db.models.DateTimeField', ... |
import os
import shutil
import sys
import django
from django.apps import apps
from django.conf import settings
from django.test.utils import get_runner
def manage_model(model):
model._meta.managed = True
if __name__ == '__main__':
os.environ['DJANGO_SETTINGS_MODULE'] = 'schedulesy.settings.unittest'
dj... | [
"django.test.utils.get_runner",
"django.setup",
"sys.exit",
"shutil.rmtree"
] | [((318, 332), 'django.setup', 'django.setup', ([], {}), '()\n', (330, 332), False, 'import django\n'), ((769, 789), 'django.test.utils.get_runner', 'get_runner', (['settings'], {}), '(settings)\n', (779, 789), False, 'from django.test.utils import get_runner\n'), ((987, 1041), 'shutil.rmtree', 'shutil.rmtree', (['setti... |
from nltk.sentiment.vader import SentimentIntensityAnalyzer
dir= 'C:\\Users\\asmazi01\\dir_path'
commentfile= 'input.txt'
delim ='\t'
fname = dir + '\\' + commentfile
with open(fname, encoding='utf-8', errors='ignore') as f:
sentences = f.readlines()
sid = SentimentIntensityAnalyzer()
totalCompoundScore = 0.0
tota... | [
"nltk.sentiment.vader.SentimentIntensityAnalyzer"
] | [((261, 289), 'nltk.sentiment.vader.SentimentIntensityAnalyzer', 'SentimentIntensityAnalyzer', ([], {}), '()\n', (287, 289), False, 'from nltk.sentiment.vader import SentimentIntensityAnalyzer\n')] |
"""meals dinner many2many
Revision ID: 00034ea37afb
Revises: <PASSWORD>
Create Date: 2019-12-16 11:54:41.895663
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
# ##... | [
"alembic.op.drop_table",
"sqlalchemy.Float",
"sqlalchemy.NUMERIC",
"alembic.op.drop_column",
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.String",
"sqlalchemy.TEXT",
"sqlalchemy.Integer"
] | [((656, 681), 'alembic.op.drop_table', 'op.drop_table', (['"""airports"""'], {}), "('airports')\n", (669, 681), False, 'from alembic import op\n'), ((1061, 1092), 'alembic.op.drop_column', 'op.drop_column', (['"""users"""', '"""role"""'], {}), "('users', 'role')\n", (1075, 1092), False, 'from alembic import op\n'), ((1... |
import unittest
from test import AppTest
class TestVersion(AppTest):
@staticmethod
def make_version_request(client, token):
return client.get(
'/version/',
headers={'Authorization': token})
def test_version(self, client, auth_provider):
r = TestVersion.make_versio... | [
"unittest.main"
] | [((711, 726), 'unittest.main', 'unittest.main', ([], {}), '()\n', (724, 726), False, 'import unittest\n')] |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import, unicode_literals
import argparse
from logging import getLogger, Formatter, StreamHandler
import os
import sys
from esanpy import analyzers
from esanpy import elasticsearch
from esanpy.core import ESRUNNER_VERSION, DEFAULT_CLUSTE... | [
"logging.Formatter",
"logging.StreamHandler",
"argparse.ArgumentParser",
"logging.getLogger"
] | [((698, 717), 'logging.getLogger', 'getLogger', (['"""esanpy"""'], {}), "('esanpy')\n", (707, 717), False, 'from logging import getLogger, Formatter, StreamHandler\n'), ((755, 796), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'None'}), '(description=None)\n', (778, 796), False, 'import ar... |
import psutil
import binascii
import socket
import ipaddress
"""
**Module Overview:**
This module will interact with Tor to get real time statistical and analytical information.
|-is_alive - check tor process is alive or killed
|-is_valid_ipv4_address-check for valid ip address
|-authenticate- cookie authentication o... | [
"psutil.process_iter",
"ipaddress.ip_network",
"binascii.b2a_hex",
"socket.socket",
"ipaddress.ip_address"
] | [((1643, 1664), 'psutil.process_iter', 'psutil.process_iter', ([], {}), '()\n', (1662, 1664), False, 'import psutil\n'), ((2183, 2232), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (2196, 2232), False, 'import socket\n'), ((2566, 2585), 'bin... |
import paramiko
from src.server_base import ServerBase
from src.ssh_server_interface import SshServerInterface
from src.shell import Shell
class SshServer(ServerBase):
def __init__(self, host_key_file, host_key_file_password=None):
super(SshServer, self).__init__()
self._host_key = paramiko.RSAK... | [
"src.shell.Shell",
"paramiko.RSAKey.from_private_key_file",
"src.ssh_server_interface.SshServerInterface",
"paramiko.Transport"
] | [((307, 383), 'paramiko.RSAKey.from_private_key_file', 'paramiko.RSAKey.from_private_key_file', (['host_key_file', 'host_key_file_password'], {}), '(host_key_file, host_key_file_password)\n', (344, 383), False, 'import paramiko\n'), ((509, 535), 'paramiko.Transport', 'paramiko.Transport', (['client'], {}), '(client)\n'... |
# import our libraries
import time
import datetime
# get today's date
today = date.today()
print(today)
# create a custom date
future_date = date(2020, 1, 31)
print(future_date)
# let's create a time stamp
time_stamp = time.time()
print(time_stamp)
# create a date from a timestamp
date_stamp = date.fromtimestamp(ti... | [
"datetime.date",
"datetime.date.today",
"datetime.date.fromtimestamp",
"datetime.time.time",
"datetime.time",
"datetime.datetime.combine"
] | [((79, 91), 'datetime.date.today', 'date.today', ([], {}), '()\n', (89, 91), False, 'from datetime import datetime, date, time\n'), ((143, 160), 'datetime.date', 'date', (['(2020)', '(1)', '(31)'], {}), '(2020, 1, 31)\n', (147, 160), False, 'from datetime import datetime, date, time\n'), ((222, 233), 'datetime.time.tim... |
import socket
import time
import struct
import os
import numpy
import sys
with open(sys.argv[1], "rb") as f:
data = f.read()[8:]
datarts = numpy.array(struct.unpack("{}Q".format(len(data) // 8), data))
nEvents = 8
HOST = 'localhost' # The remote host
PORT = 6666 # The same port as used by the se... | [
"socket.socket",
"time.sleep"
] | [((330, 379), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (343, 379), False, 'import socket\n'), ((586, 622), 'time.sleep', 'time.sleep', (['(datarts[index] / 1000000)'], {}), '(datarts[index] / 1000000)\n', (596, 622), False, 'import time\... |
"""
Various round-to-integer helpers.
"""
import math
import functools
import logging
log = logging.getLogger(__name__)
__all__ = [
"noRound",
"otRound",
"maybeRound",
"roundFunc",
]
def noRound(value):
return value
def otRound(value):
"""Round float value to nearest integer towards ``+Infinity``.
The Open... | [
"functools.partial",
"math.floor",
"logging.getLogger"
] | [((94, 121), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (111, 121), False, 'import logging\n'), ((1521, 1584), 'functools.partial', 'functools.partial', (['maybeRound'], {'tolerance': 'tolerance', 'round': 'round'}), '(maybeRound, tolerance=tolerance, round=round)\n', (1538, 1584), Fa... |
from keras.preprocessing.image import img_to_array
from keras.models import load_model
import imutils
import cv2
import numpy as np
import sys
# parameters for loading data and images
detection_model_path = 'haarcascade_files/haarcascade_frontalface_default.xml'
emotion_model_path = 'models/_mini_XCEPTION.106-0.65.hdf... | [
"keras.models.load_model",
"cv2.putText",
"cv2.waitKey",
"cv2.destroyAllWindows",
"numpy.expand_dims",
"cv2.rectangle",
"cv2.imread",
"keras.preprocessing.image.img_to_array",
"numpy.max",
"cv2.CascadeClassifier",
"sys.exit",
"cv2.imshow",
"cv2.resize"
] | [((425, 468), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['detection_model_path'], {}), '(detection_model_path)\n', (446, 468), False, 'import cv2\n'), ((490, 535), 'keras.models.load_model', 'load_model', (['emotion_model_path'], {'compile': '(False)'}), '(emotion_model_path, compile=False)\n', (500, 535), Fal... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="positional_encodings",
version="5.0.0",
author="<NAME>",
author_email="<EMAIL>",
description="1D, 2D, and 3D Sinusodal Positional Encodings in PyTorch",
long_description=long_descripti... | [
"setuptools.find_packages"
] | [((454, 480), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (478, 480), False, 'import setuptools\n')] |
import pytest
import json
from collections import OrderedDict
from gendata import gen_permutations, gen_random, prepare_col_opts
@pytest.fixture
def col_opts_test_data_one_level():
col_opts = OrderedDict()
col_opts["Col0"] = {
"Value0_A": 0.1,
"Value0_B": 0.2,
"Value0_C": 0.7
}
... | [
"collections.OrderedDict",
"gendata.gen_permutations"
] | [((198, 211), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (209, 211), False, 'from collections import OrderedDict\n'), ((2304, 2343), 'gendata.gen_permutations', 'gen_permutations', (["test_data['col_opts']"], {}), "(test_data['col_opts'])\n", (2320, 2343), False, 'from gendata import gen_permutations, ... |
import matplotlib.pyplot as plt
import plotly.graph_objects as go
from plotly.subplots import make_subplots
class PieChart:
"""
Class which defines a PieChart graph.
Attributes:
__fig : fig ; reference to diagram (which contains all graphs)
__max_rows : int... | [
"plotly.graph_objects.Pie",
"matplotlib.pyplot.axis",
"plotly.subplots.make_subplots",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.pie"
] | [((1212, 1301), 'plotly.subplots.make_subplots', 'make_subplots', ([], {'rows': 'rows', 'cols': 'cols', 'specs': 'specs_l', 'subplot_titles': 'titles_sub_graphs'}), '(rows=rows, cols=cols, specs=specs_l, subplot_titles=\n titles_sub_graphs)\n', (1225, 1301), False, 'from plotly.subplots import make_subplots\n'), ((1... |
from ehr_functions.models.types._sklearn import SKLearnModel
from sklearn.linear_model import ElasticNet as EN
import numpy as np
class ElasticNet(SKLearnModel):
def __init__(self, round_output=False, **kwargs):
super().__init__(EN, kwargs)
self.round_output = round_output
def predict(self, x... | [
"numpy.round"
] | [((410, 426), 'numpy.round', 'np.round', (['output'], {}), '(output)\n', (418, 426), True, 'import numpy as np\n')] |
import logging
import traceback
from django.conf import settings
from sparrow_cloud.dingtalk.sender import send_message
from sparrow_cloud.middleware.base.base_middleware import MiddlewareMixin
logger = logging.getLogger(__name__)
MESSAGE_LINE = """
##### <font color=\"info\"> 服务名称: {service_name}</font> #####
> 进程异... | [
"sparrow_cloud.dingtalk.sender.send_message",
"traceback.format_exc",
"logging.getLogger"
] | [((204, 231), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (221, 231), False, 'import logging\n'), ((779, 801), 'traceback.format_exc', 'traceback.format_exc', ([], {}), '()\n', (799, 801), False, 'import traceback\n'), ((1042, 1129), 'sparrow_cloud.dingtalk.sender.send_message', 'send_... |
# Generated by Django 3.2.4 on 2021-07-05 08:53
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Audio_store1',
fields=[
('id', models.BigAu... | [
"django.db.models.FileField",
"django.db.models.BigAutoField",
"django.db.models.CharField",
"django.db.models.FloatField",
"django.db.models.IntegerField"
] | [((308, 404), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (327, 404), False, 'from django.db import migrations, m... |
import time
from collections import defaultdict
from dataclasses import dataclass
from logging import getLogger
from typing import Optional
@dataclass
class Bucket:
value: int = 0
last_updated_at: Optional[int] = None
def increment(self, timestamp: int):
self.value += 1
self.last_updated_... | [
"logging.getLogger",
"time.time"
] | [((1056, 1080), 'logging.getLogger', 'getLogger', ([], {'name': '"""metrix"""'}), "(name='metrix')\n", (1065, 1080), False, 'from logging import getLogger\n'), ((1314, 1325), 'time.time', 'time.time', ([], {}), '()\n', (1323, 1325), False, 'import time\n'), ((2329, 2340), 'time.time', 'time.time', ([], {}), '()\n', (23... |
from __future__ import annotations
from typing import Iterable, Optional, Union
import materia as mtr
import numpy as np
import scipy.linalg
__all__ = [
"Identity",
"Inversion",
"Reflection",
"ProperRotation",
"ImproperRotation",
"SymmetryOperation",
]
class SymmetryOperation:
def __ini... | [
"materia.rotation_matrix",
"numpy.trace",
"numpy.abs",
"numpy.log",
"numpy.eye",
"materia.normalize",
"numpy.allclose",
"numpy.triu_indices",
"numpy.isclose",
"numpy.array",
"numpy.cos",
"numpy.sign",
"numpy.linalg.det",
"materia.periodicity",
"numpy.arccos",
"numpy.diag"
] | [((1568, 1589), 'numpy.trace', 'np.trace', (['self.matrix'], {}), '(self.matrix)\n', (1576, 1589), True, 'import numpy as np\n'), ((1904, 1938), 'numpy.isclose', 'np.isclose', (['(self.tr * self.det)', '(-1)'], {}), '(self.tr * self.det, -1)\n', (1914, 1938), True, 'import numpy as np\n'), ((2202, 2225), 'numpy.triu_in... |
# 7old
# search engine algorithm
# that gets data from DB
import sqlite3 as sl
def searchdb(q):
con = sl.connect("results.db")
cur = con.cursor()
rows = cur.execute("SELECT * FROM RESULT ORDER BY title")
result = []
for row in rows:
if (q in row[1] # URL
and row[1].count('/')... | [
"sqlite3.connect"
] | [((110, 134), 'sqlite3.connect', 'sl.connect', (['"""results.db"""'], {}), "('results.db')\n", (120, 134), True, 'import sqlite3 as sl\n')] |
from django.conf.urls import url
from Basic_app import views
from pathlib import Path
urlpatterns = [
# The about page will be the homepage
url(r'^$',views.AboutView.as_view(),name='about'),
# Creating contact page
url(r'^contact/$',views.Contact_View,name='contact_create'),
# Contact confirmati... | [
"Basic_app.views.ContactConfirmed.as_view",
"Basic_app.views.ProjectUpdate.as_view",
"Basic_app.views.ProjectList.as_view",
"django.conf.urls.url",
"Basic_app.views.ProjectDetailView.as_view",
"Basic_app.views.ProjectCreate.as_view",
"Basic_app.views.AboutView.as_view",
"Basic_app.views.ProjectDelete.... | [((234, 294), 'django.conf.urls.url', 'url', (['"""^contact/$"""', 'views.Contact_View'], {'name': '"""contact_create"""'}), "('^contact/$', views.Contact_View, name='contact_create')\n", (237, 294), False, 'from django.conf.urls import url\n'), ((160, 185), 'Basic_app.views.AboutView.as_view', 'views.AboutView.as_view... |
import chess
import chess.polyglot
import random
def play_from_opening_book(
book, max_depth=10, fen=chess.STARTING_FEN, random_seed=None
):
"""Play out moves from an opening book and return the resulting board.
From the given `fen` starting position, draw weighted random moves from the opening book
... | [
"chess.Board",
"random.seed",
"chess.polyglot.MemoryMappedReader"
] | [((1262, 1278), 'chess.Board', 'chess.Board', (['fen'], {}), '(fen)\n', (1273, 1278), False, 'import chess\n'), ((1224, 1248), 'random.seed', 'random.seed', (['random_seed'], {}), '(random_seed)\n', (1235, 1248), False, 'import random\n'), ((1289, 1328), 'chess.polyglot.MemoryMappedReader', 'chess.polyglot.MemoryMapped... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from std_msgs.msg import Float64
if __name__ == "__main__":
rospy.init_node("fake_battery_percentage")
pub = rospy.Publisher("battery_percentage", Float64, queue_size=1)
battery_percentage = rospy.get_param("~battery_percentage", 100)
pub... | [
"rospy.Publisher",
"rospy.Rate",
"rospy.get_param",
"rospy.is_shutdown",
"rospy.init_node"
] | [((125, 167), 'rospy.init_node', 'rospy.init_node', (['"""fake_battery_percentage"""'], {}), "('fake_battery_percentage')\n", (140, 167), False, 'import rospy\n'), ((183, 243), 'rospy.Publisher', 'rospy.Publisher', (['"""battery_percentage"""', 'Float64'], {'queue_size': '(1)'}), "('battery_percentage', Float64, queue_... |
from django.contrib import admin
from .models import (
Building,
BuildingPart,
Container,
EmailToken,
FullContainerReport,
TankTakeoutCompany,
)
class ContainerAdmin(admin.ModelAdmin):
readonly_fields = [
"mass",
"activated_at",
"avg_fill_time",
"calc_avg_f... | [
"django.contrib.admin.site.register"
] | [((1337, 1383), 'django.contrib.admin.site.register', 'admin.site.register', (['Container', 'ContainerAdmin'], {}), '(Container, ContainerAdmin)\n', (1356, 1383), False, 'from django.contrib import admin\n'), ((1384, 1428), 'django.contrib.admin.site.register', 'admin.site.register', (['Building', 'BuildingAdmin'], {})... |
# Copyright (c) 2015-2020, Oracle and/or its affiliates. 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
#
# Unle... | [
"os.system",
"numpy.random.RandomState"
] | [((775, 799), 'numpy.random.RandomState', 'np.random.RandomState', (['(1)'], {}), '(1)\n', (796, 799), True, 'import numpy as np\n'), ((2026, 2040), 'os.system', 'os.system', (['cmd'], {}), '(cmd)\n', (2035, 2040), False, 'import os\n'), ((1788, 1802), 'os.system', 'os.system', (['cmd'], {}), '(cmd)\n', (1797, 1802), F... |
#!/usr/bin/env python3
# Process raw CSV data and output Parquet
# Author: <NAME> (November 2020)
import argparse
from pyspark.sql import SparkSession
def main():
args = parse_args()
spark = SparkSession \
.builder \
.appName("movie-ratings-csv-to-parquet") \
.getOrCreate()
fo... | [
"pyspark.sql.SparkSession.builder.appName",
"argparse.ArgumentParser"
] | [((975, 1044), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Arguments required for script."""'}), "(description='Arguments required for script.')\n", (998, 1044), False, 'import argparse\n'), ((205, 265), 'pyspark.sql.SparkSession.builder.appName', 'SparkSession.builder.appName', (['""... |
import collections
import os
import pandas as pd
from catalyst.dl import ConfigExperiment
from segmentation_models_pytorch.encoders import get_preprocessing_fn
from sklearn.model_selection import train_test_split
from src.augmentations import get_transforms
from src.dataset import CloudDataset
class Exp... | [
"os.path.join",
"sklearn.model_selection.train_test_split",
"src.augmentations.get_transforms",
"collections.OrderedDict",
"segmentation_models_pytorch.encoders.get_preprocessing_fn"
] | [((2662, 2719), 'segmentation_models_pytorch.encoders.get_preprocessing_fn', 'get_preprocessing_fn', (['encoder_name'], {'pretrained': '"""imagenet"""'}), "(encoder_name, pretrained='imagenet')\n", (2682, 2719), False, 'from segmentation_models_pytorch.encoders import get_preprocessing_fn\n'), ((3814, 3839), 'collectio... |
############ This program is not successful ##############
import pandas as pd
import numpy as np
import argparse
import pandas as pd
from datetime import datetime
import tensorflow as tf
# from tensorflow import keras
from tensorflow.keras.layers import Input, Embedding, Dense, Flatten, Activation, concatenate
# fr... | [
"tensorflow.keras.backend.function",
"train.Wide_and_Deep"
] | [((1626, 1645), 'train.Wide_and_Deep', 'Wide_and_Deep', (['mode'], {}), '(mode)\n', (1639, 1645), False, 'from train import Wide_and_Deep\n'), ((1704, 1813), 'tensorflow.keras.backend.function', 'tf.keras.backend.function', (['[wide_deep_net.model.layers[0].input]', '[wide_deep_net.model.layers[3].output]'], {}), '([wi... |
from django.contrib import admin
from accounts.models import UserGroup, UserProfile
# Register your models here.
class UserAdmin(admin.ModelAdmin):
pass
class GroupAdmin(admin.ModelAdmin):
pass
admin.site.register(UserProfile, UserAdmin)
admin.site.register(UserGroup, GroupAdmin) | [
"django.contrib.admin.site.register"
] | [((219, 262), 'django.contrib.admin.site.register', 'admin.site.register', (['UserProfile', 'UserAdmin'], {}), '(UserProfile, UserAdmin)\n', (238, 262), False, 'from django.contrib import admin\n'), ((264, 306), 'django.contrib.admin.site.register', 'admin.site.register', (['UserGroup', 'GroupAdmin'], {}), '(UserGroup,... |
import os
import subprocess
import time
import logging
from re import sub
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-p", "--path", dest="root_path",
help="set root path to start search", metavar="PATH")
(options, args) = parser.parse_args()
root_path = options.roo... | [
"subprocess.Popen",
"logging.basicConfig",
"optparse.OptionParser",
"os.walk",
"subprocess.STARTUPINFO",
"time.time",
"logging.shutdown",
"os.path.join",
"re.sub"
] | [((118, 132), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (130, 132), False, 'from optparse import OptionParser\n'), ((358, 495), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(asctime)s %(levelname)s %(message)s"""', 'filename': '"""SVNUpdate.log"""', 'file... |
import requests
import pytest
import subprocess
from datetime import datetime
from helpers import wait_for_grafana_url_generation, create_job
from helpers import stop_job, MANAGER_URL, VISUALIZER_URL, get_jobs, delete_job
from helpers import restart_container, wait_for_job_complete
from helpers.fixtures import job_pay... | [
"helpers.restart_container",
"helpers.wait_for_job_complete",
"helpers.create_job",
"helpers.get_jobs",
"helpers.stop_job",
"datetime.datetime.strptime",
"requests.get",
"requests.post",
"helpers.wait_for_grafana_url_generation"
] | [((668, 729), 'requests.post', 'requests.post', (["(MANAGER_URL + '/submissions')"], {'json': 'job_payload'}), "(MANAGER_URL + '/submissions', json=job_payload)\n", (681, 729), False, 'import requests\n'), ((1101, 1127), 'helpers.create_job', 'create_job', (['MANAGER_URL', '(1)'], {}), '(MANAGER_URL, 1)\n', (1111, 1127... |
#!/usr/bin/env
# -*- coding: utf-8 -*-
# Módulo de Gauss:
# Métodos de calculo da solução de um sistema linear por eliminação de gauss
# Método para calculo do erro da solução de gauss em relação a solução real
import numpy as np
import construtor
import solve
# Calcula o vetor solução pelo método de Ga... | [
"solve.v_sol",
"numpy.max",
"construtor.vetor",
"numpy.array",
"construtor.matriz"
] | [((1625, 1654), 'construtor.matriz', 'construtor.matriz', (['q', 'x', 'h', 'n'], {}), '(q, x, h, n)\n', (1642, 1654), False, 'import construtor\n'), ((1666, 1702), 'construtor.vetor', 'construtor.vetor', (['r', 'x', 'h', 'n', 'a_', 'b_'], {}), '(r, x, h, n, a_, b_)\n', (1682, 1702), False, 'import construtor\n'), ((263... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020. Distributed under the terms of the MIT License.
import re
from dataclasses import dataclass
from typing import List, Optional
from monty.json import MSONable
@dataclass(frozen=True)
class Defect(MSONable):
name: str
charges: tuple
@property
def str_lis... | [
"re.search",
"dataclasses.dataclass"
] | [((210, 232), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (219, 232), False, 'from dataclasses import dataclass\n'), ((1190, 1219), 're.search', 're.search', (['keyword', 'full_name'], {}), '(keyword, full_name)\n', (1199, 1219), False, 'import re\n')] |
"""
百度词法分析API,补全未识别出的:
pip install baidu-aip
"""
import time
import os
import sys
import codecs
import json
import traceback
from tqdm import tqdm
from aip import AipNlp
sys.path.insert(0, './') # 定义搜索路径的优先顺序,序号从0开始,表示最大优先级
from data import baidu_config # noqa
""" 你的 APPID AK SK """
APP_ID = baidu_config.APP_ID # ... | [
"tqdm.tqdm",
"traceback.print_exc",
"codecs.open",
"json.loads",
"sys.path.insert",
"json.dumps",
"time.sleep",
"myClue.tools.file.read_file_texts",
"aip.AipNlp"
] | [((171, 195), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""./"""'], {}), "(0, './')\n", (186, 195), False, 'import sys\n'), ((445, 480), 'aip.AipNlp', 'AipNlp', (['APP_ID', 'API_KEY', 'SECRET_KEY'], {}), '(APP_ID, API_KEY, SECRET_KEY)\n', (451, 480), False, 'from aip import AipNlp\n'), ((1695, 1721), 'myClue.tool... |
from NXController import Controller
ctr = Controller()
for i in range(30):
ctr.A()
if i == 0:
ctr.RIGHT()
ctr.RIGHT()
else:
ctr.LEFT()
ctr.LEFT()
ctr.LEFT()
ctr.UP()
ctr.RIGHT(0.4)
ctr.A()
ctr.close() | [
"NXController.Controller"
] | [((43, 55), 'NXController.Controller', 'Controller', ([], {}), '()\n', (53, 55), False, 'from NXController import Controller\n')] |
from support import *
import chat
def main():
#Creating Login Page
global val, w, root,top,username,name
root = tk.Tk()
username = tk.StringVar()
name = tk.StringVar()
#root.attributes('-fullscreen',True)
top = Toplevel1 (root)
init(root, top)
root.mainloop()
def authenticatio... | [
"chat.main"
] | [((882, 917), 'chat.main', 'chat.main', (['name_info', 'username_info'], {}), '(name_info, username_info)\n', (891, 917), False, 'import chat\n')] |
# -*- coding: utf-8 -*-
# @date 2016/06/03
# @author <EMAIL>
# @desc custom methods of the query class in Flask-SQLAlchemy
# @record
#
from flask import request
from flask_sqlalchemy import (
BaseQuery,
Model,
_BoundDeclarativeMeta,
SQLAlchemy as BaseSQLAlchemy,
_QueryProperty)
from sqlalchemy.ext... | [
"flask.request.environ.get",
"sqlalchemy.ext.declarative.declarative_base",
"flask_sqlalchemy._QueryProperty"
] | [((2552, 2693), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {'cls': 'MyModel', 'name': '"""Model"""', 'metadata': 'metadata', 'metaclass': '_BoundDeclarativeMeta', 'constructor': '_my_declarative_constructor'}), "(cls=MyModel, name='Model', metadata=metadata, metaclass=\n _BoundDeclarativ... |
# coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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/lice... | [
"os.path.join",
"datasets.SplitGenerator",
"pandas.read_csv",
"datasets.features.ClassLabel",
"datasets.Value",
"datasets.DatasetInfo",
"datasets.Version"
] | [((1756, 1781), 'datasets.Version', 'datasets.Version', (['"""1.1.0"""'], {}), "('1.1.0')\n", (1772, 1781), False, 'import datasets\n'), ((9638, 9792), 'datasets.DatasetInfo', 'datasets.DatasetInfo', ([], {'description': '_DESCRIPTION', 'features': 'features', 'supervised_keys': 'None', 'homepage': '_HOMEPAGE', 'licens... |
from sys import maxsize
from riskGame.classes.evaluations.sigmoidEval import SigmoidEval
from riskGame.classes.agent.passive_agent import Passive
class RTAStar:
def __init__(self, evaluation_heuristic=SigmoidEval()):
self.__hash_table = {}
self.__evaluate = evaluation_heuristic
self.__pas... | [
"riskGame.classes.agent.passive_agent.Passive",
"riskGame.classes.evaluations.sigmoidEval.SigmoidEval"
] | [((208, 221), 'riskGame.classes.evaluations.sigmoidEval.SigmoidEval', 'SigmoidEval', ([], {}), '()\n', (219, 221), False, 'from riskGame.classes.evaluations.sigmoidEval import SigmoidEval\n'), ((333, 342), 'riskGame.classes.agent.passive_agent.Passive', 'Passive', ([], {}), '()\n', (340, 342), False, 'from riskGame.cla... |
from mylib.mymodule import get_quotes
from mymodule.ryonage_bot import RyonageBot
def get_lucky(bot, m):
pre = ""
suf = ""
name = m.author.name if m.author.nick is None else m.author.nick
#元気状態なら
if bot.dying_hp < bot.get_hp():
pre = f"{name}さんのラッキーアイテムは・・・・・・『"
quotes = [
... | [
"mylib.mymodule.get_quotes"
] | [((10282, 10300), 'mylib.mymodule.get_quotes', 'get_quotes', (['quotes'], {}), '(quotes)\n', (10292, 10300), False, 'from mylib.mymodule import get_quotes\n')] |
from typing import Optional, List, Dict
from cle.address_translator import AddressTranslator
from sortedcontainers import SortedDict
from .plugin import KnowledgeBasePlugin
# TODO: Serializable
class Patch:
def __init__(self, addr, new_bytes, comment: Optional[str]=None):
self.addr = addr
self.n... | [
"sortedcontainers.SortedDict",
"cle.address_translator.AddressTranslator.from_mva"
] | [((1099, 1111), 'sortedcontainers.SortedDict', 'SortedDict', ([], {}), '()\n', (1109, 1111), False, 'from sortedcontainers import SortedDict\n'), ((3410, 3486), 'cle.address_translator.AddressTranslator.from_mva', 'AddressTranslator.from_mva', (['patch.addr', 'self._kb._project.loader.main_object'], {}), '(patch.addr, ... |
"""manager.py"""
import logging
from googleapiclient import errors
import gtm_manager.account
class GTMManager(gtm_manager.base.GTMBase):
"""Authenticates a users base gtm access.
"""
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.accounts_service = self.service.accounts... | [
"logging.error"
] | [((912, 932), 'logging.error', 'logging.error', (['error'], {}), '(error)\n', (925, 932), False, 'import logging\n')] |
"""
Datacube interop functions are here
"""
import numpy as np
from itertools import chain
from types import SimpleNamespace
from datacube.storage.storage import measurement_paths
from datacube.utils import uri_to_local_path
from datacube.api import GridWorkflow
def flatmap(f, items):
return chain.from_iterable(m... | [
"datacube.storage.storage.measurement_paths",
"numpy.array",
"datacube.utils.uri_to_local_path",
"datacube.api.GridWorkflow"
] | [((621, 663), 'datacube.api.GridWorkflow', 'GridWorkflow', (['index'], {'grid_spec': 'p.grid_spec'}), '(index, grid_spec=p.grid_spec)\n', (633, 663), False, 'from datacube.api import GridWorkflow\n'), ((2234, 2255), 'datacube.storage.storage.measurement_paths', 'measurement_paths', (['ds'], {}), '(ds)\n', (2251, 2255),... |
import os
import time
import torch
import torch.optim
import torch.nn.functional as F
import torch.nn.init as init
from torch.autograd import Variable
from loss.ssd_loss import SSDLoss
from metrics.voc_eval import voc_eval
from modellibs.s3fd.box_coder import S3FDBoxCoder
from utils.average_meter import AverageMeter
c... | [
"torch.nn.CrossEntropyLoss",
"torch.load",
"torch.no_grad",
"os.path.join"
] | [((1875, 1908), 'os.path.join', 'os.path.join', (['save_dir', 'file_name'], {}), '(save_dir, file_name)\n', (1887, 1908), False, 'import os\n'), ((789, 816), 'torch.nn.CrossEntropyLoss', 'torch.nn.CrossEntropyLoss', ([], {}), '()\n', (814, 816), False, 'import torch\n'), ((856, 883), 'torch.nn.CrossEntropyLoss', 'torch... |
# Generated by Django 2.2.4 on 2019-11-03 14:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recupero', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='prestacion',
name='nomenclador',
... | [
"django.db.models.TextField",
"django.db.migrations.RemoveField",
"django.db.models.CharField",
"django.db.models.PositiveIntegerField",
"django.db.models.DecimalField"
] | [((225, 292), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""prestacion"""', 'name': '"""nomenclador"""'}), "(model_name='prestacion', name='nomenclador')\n", (247, 292), False, 'from django.db import migrations, models\n'), ((445, 510), 'django.db.models.DecimalField', 'models.De... |
from opensearch import osfeedparser
import logging
logger = logging.getLogger(__name__)
class Results(object):
def __init__(self, query, agent=None):
self.agent = agent
self._fetch(query)
self._iter = 0
def __iter__(self):
self._iter = 0
return self
def __len__(... | [
"opensearch.osfeedparser.opensearch_parse",
"logging.getLogger"
] | [((62, 89), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (79, 89), False, 'import logging\n'), ((1548, 1600), 'opensearch.osfeedparser.opensearch_parse', 'osfeedparser.opensearch_parse', (['url'], {'agent': 'self.agent'}), '(url, agent=self.agent)\n', (1577, 1600), False, 'from opensear... |
#
# Tests for Overworld character inventory
#
import sys
sys.path.append('../components')
from items import NewInventory as Inventory
from items import NewItem as Item
from items import Material
class Test_Inventory:
def setup_class(cls):
cls.inv = Inventory()
def test_construction(self):
... | [
"sys.path.append",
"items.NewItem",
"items.NewInventory",
"items.Material"
] | [((58, 90), 'sys.path.append', 'sys.path.append', (['"""../components"""'], {}), "('../components')\n", (73, 90), False, 'import sys\n'), ((269, 280), 'items.NewInventory', 'Inventory', ([], {}), '()\n', (278, 280), True, 'from items import NewInventory as Inventory\n'), ((545, 551), 'items.NewItem', 'Item', ([], {}), ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from compas_mobile_robot_reloc.utils import _ensure_rhino
from pytest import raises
def test__ensure_rhino():
with raises(ImportError):
_ensure_rhino()
| [
"compas_mobile_robot_reloc.utils._ensure_rhino",
"pytest.raises"
] | [((231, 250), 'pytest.raises', 'raises', (['ImportError'], {}), '(ImportError)\n', (237, 250), False, 'from pytest import raises\n'), ((260, 275), 'compas_mobile_robot_reloc.utils._ensure_rhino', '_ensure_rhino', ([], {}), '()\n', (273, 275), False, 'from compas_mobile_robot_reloc.utils import _ensure_rhino\n')] |
from os.path import (
expanduser,
join as join_path
)
from IPython.display import HTML
from tqdm.notebook import tqdm as log_progress
from naeval.const import (
NEWS, WIKI, FICTION, SOCIAL, POETRY,
DATASET, JL, GZ
)
from naeval.io import (
format_jl,
parse_jl,
load_gz_lines,
dump_gz... | [
"os.path.expanduser"
] | [((591, 629), 'os.path.expanduser', 'expanduser', (['"""~/proj/corus-data/gramru"""'], {}), "('~/proj/corus-data/gramru')\n", (601, 629), False, 'from os.path import expanduser, join as join_path\n'), ((1441, 1479), 'os.path.expanduser', 'expanduser', (['"""~/proj/naeval/data/lemma"""'], {}), "('~/proj/naeval/data/lemm... |
import requests
from bs4 import BeautifulSoup
import re
import webbrowser
import time
from qbittorrent import Client
movie = input("Enter What You Want To Download : ")
movie_name = movie
if(len(movie.split()) > 1):
movie = movie.split()
movie = '%20'.join(movie)
else:
movie = movie
url ... | [
"bs4.BeautifulSoup",
"qbittorrent.Client",
"requests.get"
] | [((399, 416), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (411, 416), False, 'import requests\n'), ((452, 493), 'bs4.BeautifulSoup', 'BeautifulSoup', (['htmlcontent', '"""html.parser"""'], {}), "(htmlcontent, 'html.parser')\n", (465, 493), False, 'from bs4 import BeautifulSoup\n'), ((1528, 1554), 'request... |
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from skimage import transform
from skimage.transform import estimate_transform
source = np.array([(129, 72),
(302, 76),
(90, 185),
(326, 193)])
target = np.array([[0, 0... | [
"matplotlib.pyplot.show",
"numpy.ones_like",
"numpy.array",
"numpy.linalg.inv",
"skimage.transform.warp",
"skimage.transform.estimate_transform",
"numpy.dot",
"matplotlib.pyplot.imread",
"matplotlib.pyplot.subplots"
] | [((182, 237), 'numpy.array', 'np.array', (['[(129, 72), (302, 76), (90, 185), (326, 193)]'], {}), '([(129, 72), (302, 76), (90, 185), (326, 193)])\n', (190, 237), True, 'import numpy as np\n'), ((305, 355), 'numpy.array', 'np.array', (['[[0, 0], [400, 0], [0, 400], [400, 400]]'], {}), '([[0, 0], [400, 0], [0, 400], [40... |
import StringIO
import unittest
import iq.combine_overlap_stats
class TestCombineOverlapStats(unittest.TestCase):
def test_simple(self):
exons = ['A1CF\t1\t2\t50.00\tALT1,ALT2', 'A2M\t3\t4\t75.00\t']
cds = ['A2M\t5\t6\t83.33\tALT3']
target = StringIO.StringIO()
log = StringIO.Strin... | [
"unittest.main",
"StringIO.StringIO"
] | [((1237, 1252), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1250, 1252), False, 'import unittest\n'), ((272, 291), 'StringIO.StringIO', 'StringIO.StringIO', ([], {}), '()\n', (289, 291), False, 'import StringIO\n'), ((306, 325), 'StringIO.StringIO', 'StringIO.StringIO', ([], {}), '()\n', (323, 325), False, 'im... |
"""
Test that computes the refined mean field approximation for the two-choice model
(with order 1 and 2 and a few parameter)
Compare the computed value with a value already stored in a pickle file
"""
import pickle
import numpy as np
from approximately_equal import approximately_equal
import os
PWD=os.getcwd()
if PW... | [
"sys.path.append",
"src.rmf_tool.DDPP",
"pickle.dump",
"os.getcwd",
"numpy.zeros",
"pickle.load",
"approximately_equal.approximately_equal"
] | [((303, 314), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (312, 314), False, 'import os\n'), ((425, 447), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (440, 447), False, 'import sys\n'), ((448, 468), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (463, 468), False, 'impor... |
import os
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
def build_chrome_driver(download_dir: str, headless=True,window_size=(1920,1080)):
os.makedirs(download_dir, exist_ok=True)
options = webdriver.ChromeOptions()
if headless:
options.add_argument("headless")
... | [
"selenium.webdriver.ChromeOptions",
"os.makedirs",
"selenium.webdriver.Chrome"
] | [((179, 219), 'os.makedirs', 'os.makedirs', (['download_dir'], {'exist_ok': '(True)'}), '(download_dir, exist_ok=True)\n', (190, 219), False, 'import os\n'), ((234, 259), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (257, 259), False, 'from selenium import webdriver\n'), ((700, 765),... |
import time
import numpy as np
from sklearn.model_selection import train_test_split
from keras.optimizers import Adam
from keras.utils import plot_model
from CNNTripletModel import build_network, build_model
from BatchBuilder import get_batch_random_demo
input_shape = (28, 28, 1)
evaluate_every = 5
n_val = 5
batc... | [
"numpy.load",
"CNNTripletModel.build_network",
"sklearn.model_selection.train_test_split",
"keras.optimizers.Adam",
"time.time",
"keras.utils.plot_model",
"BatchBuilder.get_batch_random_demo",
"CNNTripletModel.build_model"
] | [((340, 404), 'numpy.load', 'np.load', (['"""/Users/niklastecklenburg/Desktop/Test/Data/images.npy"""'], {}), "('/Users/niklastecklenburg/Desktop/Test/Data/images.npy')\n", (347, 404), True, 'import numpy as np\n'), ((414, 478), 'numpy.load', 'np.load', (['"""/Users/niklastecklenburg/Desktop/Test/Data/labels.npy"""'], ... |
import numpy as np
from torch.optim.lr_scheduler import _LRScheduler
from torch.utils.data.dataset import Dataset
from math import cos, pi
import librosa
from scipy.io import wavfile
import random
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
s... | [
"numpy.sum",
"numpy.maximum",
"numpy.abs",
"numpy.clip",
"numpy.argsort",
"numpy.random.randint",
"librosa.power_to_db",
"numpy.mean",
"numpy.arange",
"numpy.pad",
"numpy.power",
"numpy.cumsum",
"math.cos",
"numpy.hanning",
"numpy.log10",
"numpy.random.beta",
"random.uniform",
"num... | [((6190, 6204), 'numpy.array', 'np.array', (['gain'], {}), '(gain)\n', (6198, 6204), True, 'import numpy as np\n'), ((9986, 10011), 'numpy.flatnonzero', 'np.flatnonzero', (['(truth > 0)'], {}), '(truth > 0)\n', (10000, 10011), True, 'import numpy as np\n'), ((10332, 10367), 'numpy.zeros', 'np.zeros', (['num_classes'], ... |
import numpy as np
import matplotlib.pyplot as plt
def make_pulses(data, T, pulse):
widen = np.zeros(len(data) * T, dtype=np.complex64)
for idx, val in enumerate(widen):
if idx % T == 0:
widen[idx] = data[ idx//T ]
return np.array(np.convolve(widen, pulse, 'full'), dtype=np.complex64)... | [
"numpy.random.seed",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.zeros",
"numpy.ones",
"numpy.sinc",
"numpy.array",
"numpy.cos",
"numpy.random.choice",
"numpy.convolve",
"numpy.concatenate"
] | [((374, 408), 'numpy.zeros', 'np.zeros', (['size'], {'dtype': 'np.complex64'}), '(size, dtype=np.complex64)\n', (382, 408), True, 'import numpy as np\n'), ((617, 632), 'matplotlib.pyplot.plot', 'plt.plot', (['pulse'], {}), '(pulse)\n', (625, 632), True, 'import matplotlib.pyplot as plt\n'), ((637, 647), 'matplotlib.pyp... |
from django.shortcuts import render
from ..model import SessionMaker, ManagementScenario
from ..model import (LITTLE_DELL_VOLUME,
LITTLE_DELL_RELEASE,
LITTLE_DELL_SPILL,
MOUNTAIN_DELL_VOLUME,
MOUNTAIN_DELL_RELEASE,
... | [
"django.shortcuts.render"
] | [((3333, 3418), 'django.shortcuts.render', 'render', (['request', '"""parleys_creek_management/results/results_viewer.html"""', 'context'], {}), "(request, 'parleys_creek_management/results/results_viewer.html', context\n )\n", (3339, 3418), False, 'from django.shortcuts import render\n')] |
#! /usr/bin/python3
# run this from the root of a git repository with the command-line arguments
# described in the usage statement below
import sys
import subprocess
import os
AUTHOR = "<NAME> <<EMAIL>>"
TIMEZONE = "-0700"
DESIRED_COMMIT_MESSAGE = "added self-referential commit hash using magic"
DESIRED_COMMIT_TIME... | [
"subprocess.check_output",
"os.makedirs",
"sys.exit"
] | [((4359, 4393), 'os.makedirs', 'os.makedirs', (["(out_dir + '/prefixes')"], {}), "(out_dir + '/prefixes')\n", (4370, 4393), False, 'import os\n'), ((4394, 4428), 'os.makedirs', 'os.makedirs', (["(out_dir + '/suffixes')"], {}), "(out_dir + '/suffixes')\n", (4405, 4428), False, 'import os\n'), ((772, 783), 'sys.exit', 's... |
#!/usr/bin/env python
# coding: utf-8
import logging
import argparse
import importlib
from tropiac.utils import make_cloudformation_client, load_config, get_log_level
LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(funcName) '
'-35s %(lineno) -5d: %(message)s')
LOGGER = logging.getLogger(__name__)
def... | [
"argparse.ArgumentParser",
"logging.getLogger"
] | [((288, 315), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (305, 315), False, 'import logging\n'), ((342, 367), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (365, 367), False, 'import argparse\n')] |
"""
This program is the interface and driver for tsrFinder
"""
import os
import sys
import argparse
import multiprocessing
from collections import defaultdict
from multiprocessing import Pool
from PolTools.utils.constants import tsr_finder_location
from PolTools.utils.tsr_finder_step_four_from_rocky import run_step_... | [
"argparse.ArgumentParser",
"PolTools.utils.tsr_finder_step_four_from_rocky.run_step_four",
"argparse.ArgumentTypeError",
"collections.defaultdict",
"os.path.isfile",
"sys.stderr.write",
"multiprocessing.Pool",
"PolTools.utils.remove_files.remove_files",
"sys.exit",
"multiprocessing.cpu_count"
] | [((609, 823), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""PolTools tsrFinder"""', 'description': "('Find transcription start regions\\n' + 'More information can be found at ' +\n 'https://geoffscollins.github.io/PolTools/tsrFinder.html')"}), '(prog=\'PolTools tsrFinder\', description=\n ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 <NAME>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
... | [
"morphforge.simulation.neuron.core.neuronsimulationenvironment.NEURONEnvironment.currentclamps.register_plugin",
"morphforge.simulation.neuron.hocmodbuilders.hocmodutils.HocModUtils.create_record_from_object",
"morphforge.simulation.neuron.hocmodbuilders.HocBuilder.CurrentClamp"
] | [((3720, 3825), 'morphforge.simulation.neuron.core.neuronsimulationenvironment.NEURONEnvironment.currentclamps.register_plugin', 'NEURONEnvironment.currentclamps.register_plugin', (['CurrentClampStepChange', 'NEURONCurrentClampStepChange'], {}), '(CurrentClampStepChange,\n NEURONCurrentClampStepChange)\n', (3767, 38... |
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.views import View
from django.... | [
"django.urls.reverse",
"django.utils.decorators.method_decorator"
] | [((635, 667), 'django.utils.decorators.method_decorator', 'method_decorator', (['login_required'], {}), '(login_required)\n', (651, 667), False, 'from django.utils.decorators import method_decorator\n'), ((2245, 2277), 'django.utils.decorators.method_decorator', 'method_decorator', (['login_required'], {}), '(login_req... |