code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pygame
import sys
import random
def opponent_animation():
if opponent.top > ball.y:
opponent.top -= opponent_speed
if opponent.top < ball.y:
opponent.top += opponent_speed
if opponent.bottom >= screen_height:
opponent.bottom = screen_height
if opponent.top <= 0:
... | [
"pygame.draw.aaline",
"random.choice",
"sys.exit",
"pygame.init",
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.time.Clock",
"pygame.font.SysFont",
"pygame.draw.ellipse",
"pygame.draw.rect",
"pygame.display.set_caption",
"pygame.Color",
"pyg... | [((1265, 1278), 'pygame.init', 'pygame.init', ([], {}), '()\n', (1276, 1278), False, 'import pygame\n'), ((1287, 1306), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (1304, 1306), False, 'import pygame\n'), ((1357, 1411), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(screen_width, screen_heigh... |
import operator
from functools import reduce
from typing import overload
from typing import Tuple
from typing import Type
from typing import Union
import torch
SizeType = Union[torch.Size, Tuple[int, ...]]
def prod(x):
if not x:
return 1
else:
return reduce(operator.mul, x)
def repeat_roll... | [
"functools.reduce",
"torch.empty_like",
"torch.arange"
] | [((441, 465), 'torch.arange', 'torch.arange', (['shape[dim]'], {}), '(shape[dim])\n', (453, 465), False, 'import torch\n'), ((279, 302), 'functools.reduce', 'reduce', (['operator.mul', 'x'], {}), '(operator.mul, x)\n', (285, 302), False, 'from functools import reduce\n'), ((2611, 2630), 'torch.empty_like', 'torch.empty... |
"""
Автор: <NAME>
Группа: КБ-161
Вариант: 11
Дата создания: 19/04/2018
Python Version: 3.6
"""
import math
import sys
import warnings
import numpy as np
import matplotlib.pyplot as plt
# Constants
accuracy = 0.00001
START_X = 0.2
END_X = 0.8
START_Y = 1
END_Y = 3
x = [0.35, 0.41, 0.47, 0.51, 0.56,... | [
"matplotlib.pyplot.grid",
"numpy.linalg.det",
"matplotlib.pyplot.axhline",
"numpy.array",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.axvline",
"matplotlib.pyplot.show"
] | [((1141, 1155), 'matplotlib.pyplot.grid', 'plt.grid', (['(True)'], {}), '(True)\n', (1149, 1155), True, 'import matplotlib.pyplot as plt\n'), ((1160, 1202), 'matplotlib.pyplot.axis', 'plt.axis', (['[START_X, END_X, START_Y, END_Y]'], {}), '([START_X, END_X, START_Y, END_Y])\n', (1168, 1202), True, 'import matplotlib.py... |
import pandas as pd
import numpy as np
from scipy.stats import skew
df_test = pd.read_csv("../../test.csv")
df_train = pd.read_csv("../../train.csv")
TARGET = 'SalePrice'
#删除缺失值特征
#对存在大量缺失值的特征进行删除
#对于缺失值,不同情况不同分析 高特征的低缺失值可以尝试填充估计;高缺失值的可以通过回归估计计算
#低特征的低缺失值可以不做处理;高缺失值的可直接剔除字段
#通过观察发现出现缺失值的字段的相关系数都很低,特征都不明显,因此可以删除
to... | [
"pandas.read_csv",
"pandas.DataFrame",
"numpy.log",
"numpy.array",
"pandas.get_dummies",
"numpy.log1p",
"pandas.concat"
] | [((79, 108), 'pandas.read_csv', 'pd.read_csv', (['"""../../test.csv"""'], {}), "('../../test.csv')\n", (90, 108), True, 'import pandas as pd\n'), ((120, 150), 'pandas.read_csv', 'pd.read_csv', (['"""../../train.csv"""'], {}), "('../../train.csv')\n", (131, 150), True, 'import pandas as pd\n'), ((485, 547), 'pandas.conc... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from .device import device
class Critic(nn.Module):
def __init__(self, state_size, hidden_size, activ):
super().__init__()
dims = (state_size,) + hidden_size + (1,)
self.layers = nn.ModuleList([nn.Linear(d... | [
"torch.FloatTensor",
"torch.nn.Linear"
] | [((309, 335), 'torch.nn.Linear', 'nn.Linear', (['dim_in', 'dim_out'], {}), '(dim_in, dim_out)\n', (318, 335), True, 'import torch.nn as nn\n'), ((624, 648), 'torch.FloatTensor', 'torch.FloatTensor', (['state'], {}), '(state)\n', (641, 648), False, 'import torch\n')] |
# -*- coding: utf-8 -*-
"""
Test module for prometheus
@author: <NAME>
"""
from poseidon.helpers.prometheus import Prometheus
def test_Prometheus():
"""
Tests Prometheus
"""
p = Prometheus.get_metrics()
hosts = [{'active': 0, 'source': 'poseidon', 'role': 'unknown', 'state': 'unknown', 'ipv4_os': ... | [
"poseidon.helpers.prometheus.Prometheus",
"poseidon.helpers.prometheus.Prometheus.get_metrics"
] | [((196, 220), 'poseidon.helpers.prometheus.Prometheus.get_metrics', 'Prometheus.get_metrics', ([], {}), '()\n', (218, 220), False, 'from poseidon.helpers.prometheus import Prometheus\n'), ((1504, 1516), 'poseidon.helpers.prometheus.Prometheus', 'Prometheus', ([], {}), '()\n', (1514, 1516), False, 'from poseidon.helpers... |
# Unpack tests from CPython converted from doctest to unittest
import unittest
class UnpackTest(unittest.TestCase):
def test_basic(self):
t = (1, 2, 3)
a, b, c = t
self.assertEqual(a, 1)
self.assertEqual(b, 2)
self.assertEqual(c, 3)
l = [4, 5, 6]
a, b, c =... | [
"unittest.main"
] | [((2790, 2805), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2803, 2805), False, 'import unittest\n')] |
import os
import sys
sys.path.append(os.path.dirname(__file__))
print(sys.path)
import trade_strategy
from abupy import ABuSymbolPd
"""
标准库中的itertools提供了很多生成循环器的工具,其中很重要的用途是生成集合中所有可能方式的元素排列组合
在量化数据处理过程中经常需要使用itertools来完成数据的各种排列组合以寻找最有参数
"""
import itertools
"""
(1)permutations()函数,考虑顺序组合元素:
"""
items = [1,2,3]
for it... | [
"itertools.product",
"trade_strategy.TradeStrategy2.set_buy_change_threshold",
"itertools.combinations",
"os.path.dirname",
"itertools.permutations",
"trade_strategy.TradeStrategy2",
"itertools.combinations_with_replacement",
"trade_strategy.TradeStrategy2.set_keep_stock_threshold"
] | [((326, 355), 'itertools.permutations', 'itertools.permutations', (['items'], {}), '(items)\n', (348, 355), False, 'import itertools\n'), ((522, 554), 'itertools.combinations', 'itertools.combinations', (['items', '(2)'], {}), '(items, 2)\n', (544, 554), False, 'import itertools\n'), ((680, 729), 'itertools.combination... |
from torch import nn, optim
import torch
from .fit import set_determenistic
import numpy as np
class mlp(nn.Module):
def __init__(self, in_features, n_hidden, seed=None):
set_determenistic(seed)
super().__init__()
self.in_features = in_features
n_middle= i... | [
"torch.nn.Sigmoid",
"torch.nn.LSTM",
"numpy.array",
"torch.tensor",
"torch.nn.Linear",
"torch.set_grad_enabled",
"torch.zeros",
"torch.cat",
"torch.device"
] | [((385, 442), 'torch.nn.Linear', 'nn.Linear', ([], {'in_features': 'in_features', 'out_features': 'n_middle'}), '(in_features=in_features, out_features=n_middle)\n', (394, 442), False, 'from torch import nn, optim\n'), ((466, 520), 'torch.nn.Linear', 'nn.Linear', ([], {'in_features': 'n_middle', 'out_features': 'n_hidd... |
from __future__ import annotations
import typing
import toolstr
from . import cpmm_spec
from . import cpmm_trade
def print_pool_summary(
x_reserves: int | float,
y_reserves: int | float,
lp_total_supply: int | float | None = None,
x_name: str | None = None,
y_name: str | None = None,
fee_ra... | [
"toolstr.indent_to_str",
"toolstr.print_table",
"toolstr.format"
] | [((572, 601), 'toolstr.indent_to_str', 'toolstr.indent_to_str', (['indent'], {}), '(indent)\n', (593, 601), False, 'import toolstr\n'), ((4074, 4136), 'toolstr.print_table', 'toolstr.print_table', ([], {'rows': 'trades', 'labels': 'labels', 'indent': 'indent'}), '(rows=trades, labels=labels, indent=indent)\n', (4093, 4... |
"""Generic Rest Adapter datatype representation and management
The generic rest adapter "types" differ from the types used in the designer.
"""
from typing import Optional, Dict, Union, Type, Any
from enum import Enum
import json
import logging
from pydantic import create_model # pylint: disable=no-name-in-module... | [
"logging.getLogger",
"pandas.Series",
"json.loads",
"pydantic.create_model",
"pandas.DataFrame"
] | [((352, 379), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (369, 379), False, 'import logging\n'), ((577, 602), 'pandas.DataFrame', 'pd.DataFrame', ([], {'index': 'index'}), '(index=index)\n', (589, 602), True, 'import pandas as pd\n'), ((661, 679), 'pandas.Series', 'pd.Series', ([], {'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 11/10/2016 6:32 PM
# @Author : Max
# @File : inter.py
from flask import Blueprint
main = Blueprint('inter', __name__)
from . import error, refresh, md, list, article, chat, register, update
| [
"flask.Blueprint"
] | [((155, 183), 'flask.Blueprint', 'Blueprint', (['"""inter"""', '__name__'], {}), "('inter', __name__)\n", (164, 183), False, 'from flask import Blueprint\n')] |
from __future__ import unicode_literals
import atexit
import logging
import os
import re
import subprocess
from copy import copy
from os.path import join
from subprocess import list2cmdline
from humanfriendly import format_size, parse_size
from pickle_blosc import pickle, unpickle
from pickle_mixin import SlotPickleM... | [
"subprocess.check_output",
"logging.getLogger",
"subprocess.list2cmdline",
"re.compile",
"os.path.join",
"humanfriendly.format_size",
"futures.ProcessPoolExecutor",
"humanfriendly.parse_size",
"pickle_blosc.pickle",
"copy.copy",
"time.gmtime",
"atexit.register"
] | [((7386, 7418), 'atexit.register', 'atexit.register', (['_update_storage'], {}), '(_update_storage)\n', (7401, 7418), False, 'import atexit\n'), ((9622, 9685), 're.compile', 're.compile', (['"""^\\\\d\\\\d\\\\d\\\\d-\\\\d\\\\d-\\\\d\\\\d-\\\\d\\\\d-\\\\d\\\\d-\\\\d\\\\d$"""'], {}), "('^\\\\d\\\\d\\\\d\\\\d-\\\\d\\\\d-\... |
# %%
import pandas as pd
import numpy as np
from datetime import datetime
import os
import pickle
import matplotlib.pyplot as plt
import scipy.special as sc
from scipy.stats import norm
from scipy.stats import lognorm
import copy
import matplotlib.pyplot as plt
exec(open('../env_vars.py').read())
dir_data = os.envir... | [
"numpy.eye",
"os.path.realpath",
"numpy.array",
"numpy.random.seed",
"copy.deepcopy",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((558, 584), 'copy.deepcopy', 'copy.deepcopy', (['latent_data'], {}), '(latent_data)\n', (571, 584), False, 'import copy\n'), ((602, 627), 'copy.deepcopy', 'copy.deepcopy', (['clean_data'], {}), '(clean_data)\n', (615, 627), False, 'import copy\n'), ((1257, 1284), 'numpy.random.seed', 'np.random.seed', ([], {'seed': '... |
# Generated by Django 2.2.16 on 2020-09-17 11:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('forms', '0056_allow_blank_and_none'),
]
operations = [
migrations.AddField(
model_name='internetnewssheet',
name='m... | [
"django.db.models.CharField"
] | [((352, 425), 'django.db.models.CharField', 'models.CharField', ([], {'default': '""""""', 'max_length': '(255)', 'verbose_name': '"""Monitor Code"""'}), "(default='', max_length=255, verbose_name='Monitor Code')\n", (368, 425), False, 'from django.db import migrations, models\n'), ((595, 668), 'django.db.models.CharFi... |
from datetime import datetime, timedelta
from django.http import JsonResponse
from django.views.generic.base import TemplateView
from deploy.models import DeployPool
from envx.models import Env
from django.db.models import Count
def get_deploy_count(request):
return_list = []
now = datetime.now()
a_mont... | [
"deploy.models.DeployPool.objects.filter",
"django.http.JsonResponse",
"django.db.models.Count",
"envx.models.Env.objects.get",
"datetime.datetime.now",
"deploy.models.DeployPool.objects.values",
"datetime.timedelta"
] | [((295, 309), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (307, 309), False, 'from datetime import datetime, timedelta\n'), ((1291, 1328), 'django.http.JsonResponse', 'JsonResponse', (['return_list'], {'safe': '(False)'}), '(return_list, safe=False)\n', (1303, 1328), False, 'from django.http import JsonR... |
import re
from df_engine.core import Actor, Context
from langcodes import normalize_characters
from torch import norm, normal
from scenario.qcfg import g
from nltk import grammar, parse
import re
from lxml import etree
import urllib.request, gzip, io
import scenario.config as config
# Create the CFG grammar from a st... | [
"nltk.grammar.FeatureGrammar.fromstring",
"re.compile",
"re.sub",
"re.findall",
"nltk.parse.FeatureEarleyChartParser"
] | [((349, 385), 'nltk.grammar.FeatureGrammar.fromstring', 'grammar.FeatureGrammar.fromstring', (['g'], {}), '(g)\n', (382, 385), False, 'from nltk import grammar, parse\n'), ((3089, 3125), 'nltk.parse.FeatureEarleyChartParser', 'parse.FeatureEarleyChartParser', (['gram'], {}), '(gram)\n', (3119, 3125), False, 'from nltk ... |
import glob
import os
from typing import Tuple
import numpy as np
from PIL import Image
import tensorflow as tf
from models import resnet50
from tensorflow import lite as tf_lite
CHECKPOINT_DIR = './checkpoints/resnet50'
TF_LITE_MODEL = './tflite-models/resnet50.tflite'
def run_tflite(interpreter: tf_lite.Interpret... | [
"tensorflow.lite.Interpreter",
"numpy.mean",
"PIL.Image.open",
"numpy.asarray",
"models.resnet50",
"numpy.expand_dims",
"tensorflow.train.latest_checkpoint",
"glob.glob"
] | [((1054, 1098), 'glob.glob', 'glob.glob', (['"""./assets/imagenet-val-samples/*"""'], {}), "('./assets/imagenet-val-samples/*')\n", (1063, 1098), False, 'import glob\n'), ((1114, 1156), 'tensorflow.train.latest_checkpoint', 'tf.train.latest_checkpoint', (['CHECKPOINT_DIR'], {}), '(CHECKPOINT_DIR)\n', (1140, 1156), True... |
import dill
import pandas as pd
import pandas_datareader.data as web
class SP500Backtest(object):
def __init__(self):
try:
with open('SP500.pkl', 'rb') as file:
self.df = dill.load(file)
except FileNotFoundError:
self.df = web.DataReader('^GSPC', 'yahoo', s... | [
"pandas.DataFrame",
"dill.dump",
"pandas_datareader.data.DataReader",
"dill.load"
] | [((1247, 1299), 'pandas.DataFrame', 'pd.DataFrame', (['book'], {'columns': "['datetime', 'port_val']"}), "(book, columns=['datetime', 'port_val'])\n", (1259, 1299), True, 'import pandas as pd\n'), ((214, 229), 'dill.load', 'dill.load', (['file'], {}), '(file)\n', (223, 229), False, 'import dill\n'), ((286, 356), 'panda... |
# Copyright 2017 Rackspace US, 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 agreed to in wri... | [
"time.sleep"
] | [((3065, 3095), 'time.sleep', 'time.sleep', (['self.POLL_INTERVAL'], {}), '(self.POLL_INTERVAL)\n', (3075, 3095), False, 'import time\n')] |
# Generated by Django 3.1.4 on 2020-12-29 16:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='aunt',
name='spouse',
field=mod... | [
"django.db.models.CharField"
] | [((317, 372), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(100)', 'null': '(True)'}), '(blank=True, max_length=100, null=True)\n', (333, 372), False, 'from django.db import migrations, models\n'), ((492, 547), 'django.db.models.CharField', 'models.CharField', ([], {'blank':... |
#!/usr/bin/env python
"""PlayerPiano amazes your friends by running Python doctests in a fake interactive shell.
author: <NAME>
email: <EMAIL>
homepage: http://playerpiano.googlecode.com/
Original idea & minor tty frobage from <NAME>. Thanks Ian!
"""
import doctest
import termios
import tty
import sys
import argpar... | [
"sys.stdin.fileno",
"doctest.DocTestParser",
"importlib.import_module",
"argparse.ArgumentParser",
"re.compile",
"doctest.DocTestFinder",
"termios.tcsetattr",
"doctest._load_testfile",
"sys.exit",
"termios.tcgetattr",
"sys.stdin.read",
"tty.setraw"
] | [((1251, 1278), 're.compile', 're.compile', (['"""# *doctest.*$"""'], {}), "('# *doctest.*$')\n", (1261, 1278), False, 'import re\n'), ((574, 592), 'sys.stdin.fileno', 'sys.stdin.fileno', ([], {}), '()\n', (590, 592), False, 'import sys\n'), ((608, 635), 'termios.tcgetattr', 'termios.tcgetattr', (['stdin_fd'], {}), '(s... |
from instaloader import Instaloader, Profile
class InstaBot: # Exploring private methods and attributes
def __init__(self, username, password, account):
# User data
self.account = account
self.username = username
self.password = password
# User lists
self.__follow... | [
"instaloader.Instaloader",
"instaloader.Profile.from_username"
] | [((419, 432), 'instaloader.Instaloader', 'Instaloader', ([], {}), '()\n', (430, 432), False, 'from instaloader import Instaloader, Profile\n'), ((511, 566), 'instaloader.Profile.from_username', 'Profile.from_username', (['self.login.context', 'self.account'], {}), '(self.login.context, self.account)\n', (532, 566), Fal... |
from recon.core.module import BaseModule
from datetime import datetime
from urlparse import parse_qs
class Module(BaseModule):
meta = {
'name': 'Twitter Geolocation Search',
'author': '<NAME> (@LaNMaSteR53)',
'description': 'Searches Twitter for media in the specified proximity to a locati... | [
"datetime.datetime.strptime"
] | [((1691, 1759), 'datetime.datetime.strptime', 'datetime.strptime', (["tweet['created_at']", '"""%a %b %d %H:%M:%S +0000 %Y"""'], {}), "(tweet['created_at'], '%a %b %d %H:%M:%S +0000 %Y')\n", (1708, 1759), False, 'from datetime import datetime\n')] |
import click
import os
import pandas as pd
import torch
import logging
import random
import numpy as np
import logging
import ray
from itertools import tee
import pickle
from sklearn.metrics import roc_auc_score, precision_recall_curve, auc
from ray import tune
from ray.tune import track
from ray.tune.suggest.ax import... | [
"torch.manual_seed",
"ray.init",
"models.deepSVDD.DeepSVDD",
"click.option",
"sklearn.metrics.auc",
"os.path.join",
"sklearn.metrics.precision_recall_curve",
"random.seed",
"sklearn.metrics.roc_auc_score",
"ray.tune.grid_search",
"numpy.array",
"torch.cuda.is_available",
"click.Path",
"num... | [((4872, 4887), 'click.command', 'click.command', ([], {}), '()\n', (4885, 4887), False, 'import click\n'), ((5436, 5528), 'click.option', 'click.option', (['"""--seed"""'], {'type': 'int', 'default': '(0)', 'help': '"""Set seed. If -1, use randomization."""'}), "('--seed', type=int, default=0, help=\n 'Set seed. If... |
# Licensed under the BSD 3-Clause License
# Copyright (C) 2021 GeospaceLab (geospacelab)
# Author: <NAME>, Space Physics and Astronomy, University of Oulu
__author__ = "<NAME>"
__copyright__ = "Copyright 2021, GeospaceLab"
__license__ = "BSD-3-Clause License"
__email__ = "<EMAIL>"
__docformat__ = "reStructureText"
i... | [
"datetime.datetime",
"geospacelab.toolbox.utilities.pydatetime.get_diff_days",
"datetime.datetime.utcfromtimestamp",
"cftime.date2num",
"pathlib.Path",
"datetime.datetime.strptime",
"netCDF4.Dataset",
"datetime.timedelta",
"numpy.array",
"numpy.empty_like",
"re.findall"
] | [((5637, 5667), 'datetime.datetime', 'datetime.datetime', (['(2016)', '(3)', '(15)'], {}), '(2016, 3, 15)\n', (5654, 5667), False, 'import datetime\n'), ((5681, 5711), 'datetime.datetime', 'datetime.datetime', (['(2016)', '(3)', '(15)'], {}), '(2016, 3, 15)\n', (5698, 5711), False, 'import datetime\n'), ((1307, 1351), ... |
from django.db import models
class Category(models.Model):
name = models.CharField(
max_length=30,
null=False,
unique=True
)
icon = models.CharField(
max_length=50,
null=False,
unique=True
)
class Meta:
ordering = ["-name"] | [
"django.db.models.CharField"
] | [((71, 127), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)', 'null': '(False)', 'unique': '(True)'}), '(max_length=30, null=False, unique=True)\n', (87, 127), False, 'from django.db import models\n'), ((169, 225), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'... |
'''
Tools for generating fractals.
<NAME>, 2019
'''
import numpy;
import os;
import numba;
MAX_ITERATIONS=1000
NEXT_PLOT_NUM=0
# Wether or not to output information to the terminal when running.
PRINT_MESSAGES=True
# Have constantly updating filename
def NEXT_PLOT(suffix=''):
global NEXT_PLOT_NUM
NEXT... | [
"numpy.ones",
"numpy.absolute",
"os.path.isfile",
"tkinter.Canvas",
"numpy.zeros",
"numba.jit",
"numpy.linspace",
"tkinter.Tk",
"numpy.rot90"
] | [((610, 634), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (619, 634), False, 'import numba\n'), ((903, 927), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (912, 927), False, 'import numba\n'), ((499, 522), 'os.path.isfile', 'os.path.isfile', (['ret_val'], ... |
"""
服务端
我们使用 socket 模块的 socket 函数来创建一个 socket 对象。socket 对象可以通过调用其他函数来设置一个 socket 服务。
现在我们可以通过调用 bind(hostname, port) 函数来指定服务的 port(端口)。
接着,我们调用 socket 对象的 accept 方法。该方法等待客户端的连接,并返回 connection 对象,表示已连接到客户端。
完整代码如下:
"""
# 导入 socket、sys 模块
import socket
import sys
# 创建 socket 对象
server_socket = socket.socket(socket.AF... | [
"socket.gethostname",
"socket.socket"
] | [((297, 346), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (310, 346), False, 'import socket\n'), ((365, 385), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (383, 385), False, 'import socket\n')] |
import busio
import digitalio
import board
import adafruit_mcp3xxx.mcp3008 as MCP
from adafruit_mcp3xxx.analog_in import AnalogIn
class ADC:
# Its the same spi bus, cs object and mcp object for all ADC instances.
# The difference between instances is the channel attribute
# create the spi bus
_spi ... | [
"adafruit_mcp3xxx.mcp3008.MCP3008",
"busio.SPI",
"digitalio.DigitalInOut"
] | [((322, 382), 'busio.SPI', 'busio.SPI', ([], {'clock': 'board.SCK', 'MISO': 'board.MISO', 'MOSI': 'board.MOSI'}), '(clock=board.SCK, MISO=board.MISO, MOSI=board.MOSI)\n', (331, 382), False, 'import busio\n'), ((428, 460), 'digitalio.DigitalInOut', 'digitalio.DigitalInOut', (['board.D5'], {}), '(board.D5)\n', (450, 460)... |
from linlearn import BinaryClassifier, MultiClassifier
from linlearn.robust_means import Holland_catoni_estimator, gmom, alg2
import numpy as np
import gzip
import logging
import pickle
from datetime import datetime
import sys
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
from scipy.special ... | [
"logging.StreamHandler",
"gzip.open",
"numpy.log",
"numpy.array",
"numpy.einsum",
"os.cpu_count",
"logging.info",
"scipy.special.logsumexp",
"numpy.arange",
"linlearn.robust_means.Holland_catoni_estimator",
"os.path.exists",
"numpy.mean",
"itertools.chain.from_iterable",
"logging.FileHandl... | [((575, 635), 'logging.FileHandler', 'logging.FileHandler', ([], {'filename': '"""exp_archives/classif_exp.log"""'}), "(filename='exp_archives/classif_exp.log')\n", (594, 635), False, 'import logging\n'), ((653, 686), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (674, 686), ... |
## evolutionint.py
## <NAME>
from thesis_utils import *
from thesis_defaults import *
from thesis_poincare_utils import *
from thesis_plot_utils import *
from interval import interval, inf, imath
from intervals.IntervalN import IntervalN, _scalar
class EvolutionInt:
"""
Evolution functions defining a dynamic... | [
"intervals.IntervalN._scalar"
] | [((424, 437), 'intervals.IntervalN._scalar', '_scalar', (['(0.01)'], {}), '(0.01)\n', (431, 437), False, 'from intervals.IntervalN import IntervalN, _scalar\n')] |
###############################################################################
#cbam_deepest_coverage.py
#Given a bam file (and index) and a list of chromosomes, this returns the
# position with the highest coverage
# Uses samtools depth
#
#@author:<EMAIL>
#@version:0.1
#######################################... | [
"subprocess.run",
"optparse.OptionParser"
] | [((463, 486), 'optparse.OptionParser', 'optparse.OptionParser', ([], {}), '()\n', (484, 486), False, 'import optparse\n'), ((1525, 1698), 'subprocess.run', 'subprocess.run', (["['samtools depth -r %s %s/%s | sort -n -k 3 | tail -n 1' % (line, options.\n directory, options.input)]"], {'shell': '(True)', 'check': '(Tr... |
import argparse
import sys
from collections import defaultdict
from collections.abc import Sequence as AbstractSequence
from contextlib import suppress
from functools import partial
from typing import (
Any,
Callable,
Dict,
NamedTuple,
Optional,
Sequence,
Type,
TypeVar,
Union,
)
if ... | [
"argparse.ArgumentParser",
"functools.partial",
"contextlib.suppress",
"collections.defaultdict",
"typing.TypeVar"
] | [((873, 901), 'typing.TypeVar', 'TypeVar', (['"""_T"""'], {'bound': '"""Corgy"""'}), "('_T', bound='Corgy')\n", (880, 901), False, 'from typing import Any, Callable, Dict, NamedTuple, Optional, Sequence, Type, TypeVar, Union\n'), ((26443, 26469), 'functools.partial', 'partial', (['wrapper', 'var_name'], {}), '(wrapper,... |
"""Webapi views."""
from typing import Any, Dict, List, Iterable, Optional, cast, Tuple
from aiohttp import web
import time
from irisett import (
metadata,
bindata,
stats,
utils,
contact,
monitor_group,
object_models,
)
from irisett.webapi import (
errors,
)
from irisett.monitor.active... | [
"irisett.bindata.set_bindata",
"irisett.monitor_group.get_monitor_group",
"irisett.contact.get_all_contact_groups",
"irisett.monitor_group.monitor_group_exists",
"irisett.webapi.errors.NotFound",
"irisett.monitor_group.get_all_monitor_groups",
"irisett.contact.get_all_contacts_for_active_monitor",
"ir... | [((2033, 2060), 'irisett.object_models.asdict', 'object_models.asdict', (['model'], {}), '(model)\n', (2053, 2060), False, 'from irisett import metadata, bindata, stats, utils, contact, monitor_group, object_models\n'), ((2943, 2970), 'aiohttp.web.json_response', 'web.json_response', (['monitors'], {}), '(monitors)\n',... |
from django.contrib import admin
from product.modules.downloadable.models import DownloadableProduct, DownloadLink
admin.site.register(DownloadableProduct)
admin.site.register(DownloadLink)
| [
"django.contrib.admin.site.register"
] | [((116, 156), 'django.contrib.admin.site.register', 'admin.site.register', (['DownloadableProduct'], {}), '(DownloadableProduct)\n', (135, 156), False, 'from django.contrib import admin\n'), ((157, 190), 'django.contrib.admin.site.register', 'admin.site.register', (['DownloadLink'], {}), '(DownloadLink)\n', (176, 190),... |
import os
import IPython
import uuid
from pyspark.sql import DataFrame, SparkSession
from pyspark.sql.functions import mean, stddev, col, min, max , avg, skewness as skew, variance, sum, lit, round, length
from pyspark.sql.types import StringType, IntegerType
import math
import requests
import http.client
import json
f... | [
"json.loads",
"pyspark.sql.SparkSession.builder.getOrCreate",
"azure.identity.DefaultAzureCredential",
"os.getenv",
"requests.get",
"pyspark.sql.functions.col",
"pyspark.sql.functions.min",
"pyspark.sql.functions.stddev",
"pyspark.sql.functions.avg",
"pyspark.sql.functions.max",
"math.isnan"
] | [((617, 641), 'os.getenv', 'os.getenv', (['"""YGDRA_SCOPE"""'], {}), "('YGDRA_SCOPE')\n", (626, 641), False, 'import os\n'), ((765, 789), 'azure.identity.DefaultAzureCredential', 'DefaultAzureCredential', ([], {}), '()\n', (787, 789), False, 'from azure.identity import DefaultAzureCredential, ClientSecretCredential\n')... |
"""empty message
Revision ID: b823ccfc2d9b
Revises: <PASSWORD>
Create Date: 2021-08-10 05:37:19.652762
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
import app
import app.extensions
def upgrade(... | [
"sqlalchemy.VARCHAR",
"alembic.op.batch_alter_table"
] | [((479, 529), 'alembic.op.batch_alter_table', 'op.batch_alter_table', (['"""collaboration"""'], {'schema': 'None'}), "('collaboration', schema=None)\n", (499, 529), False, 'from alembic import op\n'), ((794, 844), 'alembic.op.batch_alter_table', 'op.batch_alter_table', (['"""collaboration"""'], {'schema': 'None'}), "('... |
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
from keras.layers import Flatten
from keras.layers.convolutional import Conv2D
from keras.layers.convolutional import MaxPooling2D
from keras.utils import np_utils
# load data
(X... | [
"keras.layers.Flatten",
"keras.datasets.mnist.load_data",
"keras.models.Sequential",
"keras.layers.convolutional.Conv2D",
"keras.utils.np_utils.to_categorical",
"keras.layers.convolutional.MaxPooling2D",
"keras.layers.Dense",
"keras.layers.Dropout"
] | [((357, 374), 'keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (372, 374), False, 'from keras.datasets import mnist\n'), ((699, 731), 'keras.utils.np_utils.to_categorical', 'np_utils.to_categorical', (['y_train'], {}), '(y_train)\n', (722, 731), False, 'from keras.utils import np_utils\n'), ((742,... |
import numpy
import matplotlib
import matplotlib.pyplot as plt
def plot_progress_kmeans(iteration, x_array, centroid_history, idx_history):
"""
A helper function that displays the progress of k-Means as it is running. It is intended for use
only with 2D data. It plots data points with colors assigned to e... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.xlabel",
"numpy.stack",
"matplotlib.colors.Normalize",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.title"
] | [((1049, 1092), 'matplotlib.colors.Normalize', 'matplotlib.colors.Normalize', ([], {'vmin': '(0)', 'vmax': '(2)'}), '(vmin=0, vmax=2)\n', (1076, 1092), False, 'import matplotlib\n'), ((1447, 1522), 'matplotlib.pyplot.grid', 'plt.grid', ([], {'b': '(True)', 'which': '"""major"""', 'axis': '"""both"""', 'linestyle': '"""... |
#!/usr/bin/env python
"""
wiggletools_commands.py
<NAME> / December 15, 2015
Writes wiggletools commands for computing mean bigwigs by tissue. Each set
of commands is numbered. They should be executed in order; some commands
in successive files depend on commands from previous files.
"""
import gzip
from collections i... | [
"argparse.ArgumentParser",
"os.makedirs",
"os.path.join",
"os.path.realpath",
"collections.defaultdict"
] | [((432, 535), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), '(description=__doc__, formatter_class=argparse.\n RawDescriptionHelpFormatter)\n', (455, 535), False, 'import argparse\n'), ((3249, 3266), 'collections.def... |
import sqlite3
db_con = sqlite3.connect("./manga_db.sqlite", detect_types=sqlite3.PARSE_DECLTYPES)
db_con.row_factory = sqlite3.Row
with db_con:
c = db_con.executescript("""
PRAGMA foreign_keys=off;
BEGIN TRANSACTION;
DROP INDEX IF EXISTS id_onpage_on_site;
... | [
"sqlite3.connect"
] | [((25, 99), 'sqlite3.connect', 'sqlite3.connect', (['"""./manga_db.sqlite"""'], {'detect_types': 'sqlite3.PARSE_DECLTYPES'}), "('./manga_db.sqlite', detect_types=sqlite3.PARSE_DECLTYPES)\n", (40, 99), False, 'import sqlite3\n')] |
#
# Copyright (C) 2014 Dell, 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 agreed to in wri... | [
"logging.getLogger",
"docker.utils.kwargs_from_env",
"six.itervalues",
"time.sleep",
"sys.stdout.flush",
"random.randint",
"sys.stdout.write"
] | [((1084, 1111), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1101, 1111), False, 'import logging\n'), ((18325, 18358), 'random.randint', 'random.randint', (['(1)', 'num_containers'], {}), '(1, num_containers)\n', (18339, 18358), False, 'import random\n'), ((1604, 1655), 'docker.utils.k... |
import numpy as np
from synthtext.config import load_cfg
class Curvature(object):
curve = lambda this, a: lambda x: a * x * x
differential = lambda this, a: lambda x: 2 * a * x
def __init__(self):
load_cfg(self)
def sample_curvature(self):
"""
Returns the functions for the ... | [
"synthtext.config.load_cfg",
"numpy.random.randn",
"numpy.random.rand"
] | [((222, 236), 'synthtext.config.load_cfg', 'load_cfg', (['self'], {}), '(self)\n', (230, 236), False, 'from synthtext.config import load_cfg\n'), ((396, 412), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (410, 412), True, 'import numpy as np\n'), ((473, 490), 'numpy.random.randn', 'np.random.randn', ([], {}... |
"""
Integrated gradient saliency maps
Created on 04/30/2020
@author: RH
"""
import saliency
import os
import sys
import cv2
import numpy as np
import tensorflow as tf
import data_input2 as data_input
# image to double
def im2double(im):
return cv2.normalize(im.astype('float'), None, 0.0, 1.0, cv2.NORM_MINMAX)
... | [
"InceptionV5.inceptionresnetv1",
"numpy.hstack",
"Scripts.Legacy.ResNet.resnet",
"InceptionV1.googlenet",
"tensorflow.nn.softmax",
"data_input2.DataSet",
"tensorflow.Graph",
"tensorflow.placeholder",
"tensorflow.Session",
"saliency.IntegratedGradients",
"InceptionV4.inceptionv4",
"tensorflow.C... | [((426, 472), 'cv2.applyColorMap', 'cv2.applyColorMap', (['heatmap_x', 'cv2.COLORMAP_JET'], {}), '(heatmap_x, cv2.COLORMAP_JET)\n', (443, 472), False, 'import cv2\n'), ((544, 580), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'name': '"""x"""'}), "(tf.float32, name='x')\n", (558, 580), True, 'import te... |
import curses
from .components_base import ComponentsBase
from const import const
from util import helper
class TimelineHeaderWindow(ComponentsBase):
def __init__(self, parent, screen, nlines, ncols, begin_y, begin_x):
super().__init__(parent, screen, nlines, ncols, begin_y, begin_x)
def draw(self... | [
"curses.color_pair"
] | [((372, 419), 'curses.color_pair', 'curses.color_pair', (['const.COLOR_SET_HEADER_STYLE'], {}), '(const.COLOR_SET_HEADER_STYLE)\n', (389, 419), False, 'import curses\n'), ((464, 511), 'curses.color_pair', 'curses.color_pair', (['const.COLOR_SET_HEADER_STYLE'], {}), '(const.COLOR_SET_HEADER_STYLE)\n', (481, 511), False,... |
"""
python utilities for neuron
"""
# internal python imports
import os
# third party imports
import numpy as np
import matplotlib
# local (our) imports
def get_backend():
"""
Returns the currently used backend. Default is tensorflow unless the
NEURITE_BACKEND environment variable is set to 'pytorch'.
... | [
"numpy.unique",
"os.environ.get",
"matplotlib.colors.ListedColormap",
"numpy.exp",
"numpy.issubdtype",
"numpy.zeros",
"numpy.max",
"numpy.array"
] | [((786, 803), 'numpy.unique', 'np.unique', (['labels'], {}), '(labels)\n', (795, 803), True, 'import numpy as np\n'), ((826, 865), 'numpy.issubdtype', 'np.issubdtype', (['labels.dtype', 'np.integer'], {}), '(labels.dtype, np.integer)\n', (839, 865), True, 'import numpy as np\n'), ((2274, 2288), 'numpy.unique', 'np.uniq... |
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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 ag... | [
"schematizer.api.requests.requests_v1.CreateConsumerGroupDataSourceRequest",
"schematizer.logic.registration_repository.register_consumer_group_data_source",
"schematizer.models.ConsumerGroup.get_all",
"schematizer.api.responses.responses_v1.get_consumer_group_response_from_consumer_group",
"schematizer.api... | [((1152, 1247), 'pyramid.view.view_config', 'view_config', ([], {'route_name': '"""api.v1.get_consumer_groups"""', 'request_method': '"""GET"""', 'renderer': '"""json"""'}), "(route_name='api.v1.get_consumer_groups', request_method='GET',\n renderer='json')\n", (1163, 1247), False, 'from pyramid.view import view_con... |
__author__ = 'Arseniy'
from model.contact import Contact
from selenium.webdriver.support.select import Select
import re
class ContactHelper:
def __init__(self, app):
self.app = app
def load_home_page(self):
wd = self.app.wd
if len(wd.find_elements_by_link_text("Last name")) > 0:
... | [
"model.contact.Contact",
"re.search"
] | [((15622, 15803), 'model.contact.Contact', 'Contact', ([], {'id': 'id', 'firstname': 'firstname', 'lastname': 'lastname', 'home_num': 'home_num', 'mobile_num': 'mobile_num', 'work_num': 'work_num', 'phone2': 'phone2', 'email': 'email', 'email2': 'email2', 'email3': 'email3'}), '(id=id, firstname=firstname, lastname=las... |
import base64
import datetime
import json
import logging
import urllib.parse
import OpenSSL.crypto as crypto
import aiohttp
import pytz
import requests
import esia_client.exceptions
logger = logging.getLogger(__name__)
class FoundLocation(esia_client.exceptions.EsiaError):
def __init__(self, location: str, *ar... | [
"logging.getLogger",
"OpenSSL.crypto._lib.PKCS7_sign",
"aiohttp.client.ClientSession",
"base64.urlsafe_b64decode",
"base64.urlsafe_b64encode",
"OpenSSL.crypto._bio_to_string",
"OpenSSL.crypto._new_mem_buf",
"requests.request",
"datetime.datetime.now",
"OpenSSL.crypto._lib.i2d_PKCS7_bio"
] | [((194, 221), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (211, 221), False, 'import logging\n'), ((3790, 3881), 'OpenSSL.crypto._lib.PKCS7_sign', 'crypto._lib.PKCS7_sign', (['crt._x509', 'pkey._pkey', 'crypto._ffi.NULL', 'bio_in', 'PKCS7_DETACHED'], {}), '(crt._x509, pkey._pkey, crypt... |
# -*- coding: utf-8 -*-
import pdfkit
import sys
reload(sys);
sys.setdefaultencoding("utf8")
options = {
'page-size': 'Letter',
'margin-top': '0.75in',
'margin-right': '0.75in',
'margin-bottom': '0.75in',
'margin-left': '0.75in',
'encoding': "UTF-8",
'custom-header' : [
('Accept-Enc... | [
"pdfkit.from_file",
"sys.setdefaultencoding"
] | [((63, 93), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf8"""'], {}), "('utf8')\n", (85, 93), False, 'import sys\n'), ((370, 429), 'pdfkit.from_file', 'pdfkit.from_file', (['sys.argv[1]', 'sys.argv[2]'], {'options': 'options'}), '(sys.argv[1], sys.argv[2], options=options)\n', (386, 429), False, 'import... |
'''
Author: <NAME> (@abodh_ltd)
MSEE, South Dakota State University
Last updated: August 26, 2020
'''
import numpy as np
import torch
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('Agg')
import pdb
from datetime import date, datetime
import os
import time
from data_loading import loading, separate_... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"torch.nn.MSELoss",
"torch.cuda.is_available",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"model.Simple1DCNN",
"matplotlib.pyplot.yticks",
"numpy.random.seed",
"os.mkdir",
"utils.testing",
"torch.abs"... | [((185, 206), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (199, 206), False, 'import matplotlib\n'), ((672, 692), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (689, 692), False, 'import torch\n'), ((695, 712), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', ... |
from django.contrib import admin
from .models import (
bangla_newspaper,
english_newspaper,
job_website,
magazines,
indian_bangla_newspaper,
news_channel,
note
)
# Register your models here.
admin.site.site_header = 'Online NEWS'
admin.site.register(bangla_newspaper)
admin.site.register(en... | [
"django.contrib.admin.site.register"
] | [((260, 297), 'django.contrib.admin.site.register', 'admin.site.register', (['bangla_newspaper'], {}), '(bangla_newspaper)\n', (279, 297), False, 'from django.contrib import admin\n'), ((298, 336), 'django.contrib.admin.site.register', 'admin.site.register', (['english_newspaper'], {}), '(english_newspaper)\n', (317, 3... |
import pytest
import pypipegraph as ppg
import pandas as pd
from mbf_genomics import DelayedDataFrame
from mbf_comparisons import Comparisons, venn, Log2FC
from mbf_qualitycontrol.testing import assert_image_equal
@pytest.mark.usefixtures("new_pipegraph_no_qc")
class TestVenn:
def test_venn_from_logfcs(self):
... | [
"mbf_comparisons.Comparisons",
"pypipegraph.run_pipegraph",
"mbf_qualitycontrol.testing.assert_image_equal",
"mbf_comparisons.Log2FC",
"pytest.mark.usefixtures",
"pandas.DataFrame",
"mbf_comparisons.venn.plot_venn"
] | [((217, 263), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""new_pipegraph_no_qc"""'], {}), "('new_pipegraph_no_qc')\n", (240, 263), False, 'import pytest\n'), ((712, 764), 'mbf_comparisons.Comparisons', 'Comparisons', (['d', "{'a': ['a'], 'b': ['b'], 'c': ['c']}"], {}), "(d, {'a': ['a'], 'b': ['b'], 'c': ... |
#!/usr/bin/env python3
"""
Script Name: ipaddresstools.py
Script Type: Python
Updated By: <NAME>
Date Written 1/11/2015
Description:
Collection of tools for IP Address's
"""
import logging
import re as __re
import ipaddress as __ipaddress
import random as __random
LOGGER = logging.getLogger(__name__)
__mask_... | [
"logging.getLogger",
"random.randrange",
"ipaddress.ip_network",
"re.compile"
] | [((283, 310), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (300, 310), False, 'import logging\n'), ((5093, 5367), 're.compile', '__re.compile', (['"""^((22[0-3])|(2[0-1][0-9])|(1[0-9][0-9])|([1-9]?[0-9]))\\\\.((25[0-5])|(2[0-4][0-9])|(1[0-9][0-9])|([1-9]?[0-9]))\\\\.((25[0-5])|(2[0-4][0... |
'''
Exercício Python 106: Faça um mini-sistema que utilize o Interactive Help do Python. O usuário vai digitar o comando e
o manual vai aparecer. Quando o usuário digitar a palavra 'FIM', o programa se encerrará. Importante: use cores.
'''
from time import sleep
cor = ('\033[m', # 0- sem cor
'\033[97;41m... | [
"time.sleep"
] | [((622, 630), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (627, 630), False, 'from time import sleep\n'), ((783, 791), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (788, 791), False, 'from time import sleep\n')] |
"""
test_utils.py
"""
import sys
import os
import pytest
import shutil
# define location of input files for testing
mydir = os.path.dirname(os.path.abspath(__file__))
# import functions to aid testing
sys.path.append(os.path.join(os.path.dirname(__file__), 'helpers'))
from helper import *
from quanformer.utils impor... | [
"os.path.abspath",
"os.path.dirname",
"sys.path.insert",
"os.path.join"
] | [((141, 166), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (156, 166), False, 'import os\n'), ((1095, 1160), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/limvt/Documents/quanformer/quanformer"""'], {}), "(0, '/home/limvt/Documents/quanformer/quanformer')\n", (1110, 1160), False,... |
# -*- coding: utf-8 -*-
import unittest
import math
import sys
import aglab
from definition import test
class StateTestCase(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
self.state = aglab.State(test)
#print
def test__init(self):
state = self.st... | [
"math.isnan",
"aglab.State",
"aglab.Reward",
"unittest.TestCase.setUp"
] | [((182, 211), 'unittest.TestCase.setUp', 'unittest.TestCase.setUp', (['self'], {}), '(self)\n', (205, 211), False, 'import unittest\n'), ((233, 250), 'aglab.State', 'aglab.State', (['test'], {}), '(test)\n', (244, 250), False, 'import aglab\n'), ((6339, 6357), 'math.isnan', 'math.isnan', (['player'], {}), '(player)\n',... |
import datetime
import h5py
import numpy as np
import os
import pytest
import random
import string
import time
import tempfile
import unittest
from labrad import types as T
from labrad import units as U
from twisted.internet import task
from datavault import backend, errors
def _unique_filename(suffix='.hdf5'):
... | [
"datavault.backend.CsvListData",
"numpy.int32",
"labrad.units.Complex",
"datavault.backend.Independent",
"datavault.backend.time_to_str",
"datavault.backend.IniData",
"datetime.datetime",
"twisted.internet.task.Clock",
"datavault.backend.labrad_urldecode",
"numpy.asarray",
"datavault.backend.lab... | [((329, 376), 'tempfile.mktemp', 'tempfile.mktemp', ([], {'prefix': '"""dvtest"""', 'suffix': 'suffix'}), "(prefix='dvtest', suffix=suffix)\n", (344, 376), False, 'import tempfile\n'), ((4492, 4577), 'datavault.backend.Independent', 'backend.Independent', ([], {'label': '"""FirstVariable"""', 'shape': '(1,)', 'datatype... |
from guillotina.interfaces import IAddOn
from zope.interface import implementer
@implementer(IAddOn)
class Addon(object):
""" Prototype of an Addon plugin
"""
@classmethod
def install(cls, container, request):
pass
@classmethod
def uninstall(cls, container, request):
pass
| [
"zope.interface.implementer"
] | [((83, 102), 'zope.interface.implementer', 'implementer', (['IAddOn'], {}), '(IAddOn)\n', (94, 102), False, 'from zope.interface import implementer\n')] |
'''
requests is available on pip
homepage: http://docs.python-requests.org/en/master/
'''
import requests
def print_details(request):
print("Various attributes on the request object (get):")
print("-----------------------------------------------")
print("apparent_encoding:")
print(request.apparent_enco... | [
"requests.get"
] | [((980, 997), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (992, 997), False, 'import requests\n')] |
import os
from cairosvg import svg2svg
def splitter(text, filters):
splitted = []
counter = 0
for letterindex in range(len(text)):
if text[letterindex] in filters:
splitted.append(text[counter:letterindex])
splitted.append(text[letterindex])
counter = letterindex+1
return splitted
def fix_file(fi... | [
"cairosvg.svg2svg",
"os.listdir",
"os.path.isdir"
] | [((1123, 1139), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (1133, 1139), False, 'import os\n'), ((489, 506), 'cairosvg.svg2svg', 'svg2svg', ([], {'url': 'file'}), '(url=file)\n', (496, 506), False, 'from cairosvg import svg2svg\n'), ((1165, 1188), 'os.path.isdir', 'os.path.isdir', (['filename'], {}), '(fil... |
import io
from ccs.ast import flatten
from ccs.dnf import to_dnf
from ccs.parser import Parser
def dnfify(string: str):
expr = Parser().parse_selector(io.StringIO(string))
return to_dnf(flatten(expr))
def test_dnf():
assert str(dnfify("a b, c d")) == "a b, c d"
def test_cnf():
assert str(dnfify("... | [
"ccs.parser.Parser",
"io.StringIO",
"ccs.ast.flatten"
] | [((158, 177), 'io.StringIO', 'io.StringIO', (['string'], {}), '(string)\n', (169, 177), False, 'import io\n'), ((197, 210), 'ccs.ast.flatten', 'flatten', (['expr'], {}), '(expr)\n', (204, 210), False, 'from ccs.ast import flatten\n'), ((134, 142), 'ccs.parser.Parser', 'Parser', ([], {}), '()\n', (140, 142), False, 'fro... |
# encoding=utf-8
import numpy as np
import pyqtgraph.opengl as gl
from pyqtgraph.Qt import QtCore, QtGui
class plot3d(object):
def __init__(self, title='null'):
"""
:param title:
"""
self.glview = gl.GLViewWidget()
coord = gl.GLAxisItem()
coord.setSize(1, 1, 1)
... | [
"pyqtgraph.Qt.QtGui.QVBoxLayout",
"pyqtgraph.opengl.GLLinePlotItem",
"numpy.ones",
"pyqtgraph.Qt.QtGui.QWidget",
"pyqtgraph.Qt.QtGui.QPushButton",
"numpy.random.rand",
"pyqtgraph.opengl.GLScatterPlotItem",
"pyqtgraph.opengl.GLViewWidget",
"numpy.max",
"numpy.array",
"pyqtgraph.Qt.QtGui.QApplicat... | [((2740, 2764), 'numpy.maximum', 'np.maximum', (['(1 - ratio)', '(0)'], {}), '(1 - ratio, 0)\n', (2750, 2764), True, 'import numpy as np\n'), ((2777, 2801), 'numpy.maximum', 'np.maximum', (['(ratio - 1)', '(0)'], {}), '(ratio - 1, 0)\n', (2787, 2801), True, 'import numpy as np\n'), ((2910, 2932), 'pyqtgraph.Qt.QtGui.QA... |
# Copyright © 2019 <NAME>
# MIT License
"""
awesome_bib_builder
===================
Parses contents of ``bib/*.bib`` files, creating citations.
"""
from .reference import Reference
from .bibliography import Bibliography
from liquid import Liquid
import os
def run(
template="static/README.md", bib_directory="b... | [
"os.listdir",
"os.path.join",
"liquid.Liquid"
] | [((712, 737), 'os.listdir', 'os.listdir', (['bib_directory'], {}), '(bib_directory)\n', (722, 737), False, 'import os\n'), ((1468, 1482), 'liquid.Liquid', 'Liquid', (['readme'], {}), '(readme)\n', (1474, 1482), False, 'from liquid import Liquid\n'), ((770, 802), 'os.path.join', 'os.path.join', (['bib_directory', 'dir']... |
from flask import Blueprint, render_template, request, redirect, url_for, flash
from jade_ims.models import db, SaleBill, Product, Stock
leavestockbill = Blueprint('leavestockbill', __name__)
@leavestockbill.route('/stock/leave')
def leave_stock():
data = []
salebill_data = SaleBill.query.all()
for i in ... | [
"flask.render_template",
"flask.flash",
"flask.url_for",
"jade_ims.models.db.session.add",
"jade_ims.models.SaleBill.query.all",
"jade_ims.models.db.session.delete",
"jade_ims.models.db.session.commit",
"jade_ims.models.Product.query.get",
"flask.Blueprint"
] | [((155, 192), 'flask.Blueprint', 'Blueprint', (['"""leavestockbill"""', '__name__'], {}), "('leavestockbill', __name__)\n", (164, 192), False, 'from flask import Blueprint, render_template, request, redirect, url_for, flash\n'), ((286, 306), 'jade_ims.models.SaleBill.query.all', 'SaleBill.query.all', ([], {}), '()\n', ... |
from plenum.common.messages.fields import MapField, \
NonNegativeNumberField, NonEmptyStringField, FixedLengthField, IterableField, SignatureField
from plenum.config import SIGNATURE_FIELD_LIMIT
from sovtoken.messages.fields import PublicInputsField, \
PublicOutputsField
class FeesStructureField(MapField):
... | [
"plenum.common.messages.fields.NonEmptyStringField",
"plenum.common.messages.fields.SignatureField",
"sovtoken.messages.fields.PublicOutputsField",
"sovtoken.messages.fields.PublicInputsField",
"plenum.common.messages.fields.NonNegativeNumberField"
] | [((557, 576), 'sovtoken.messages.fields.PublicInputsField', 'PublicInputsField', ([], {}), '()\n', (574, 576), False, 'from sovtoken.messages.fields import PublicInputsField, PublicOutputsField\n'), ((601, 621), 'sovtoken.messages.fields.PublicOutputsField', 'PublicOutputsField', ([], {}), '()\n', (619, 621), False, 'f... |
import pandas as pd
from tabulate import tabulate
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from scipy.interpolate import interp1d
#sns.set()
#sns.color_palette("mako")
df = pd.read_csv('bias_classifier.csv')
df = df.replace({'vanilla': 'Vanilla', 'end': 'EnD', 'rebias': 'ReBias', 'rubi... | [
"numpy.radians",
"tabulate.tabulate",
"numpy.mean",
"matplotlib.pyplot.savefig",
"pandas.read_csv",
"scipy.interpolate.interp1d",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.rc",
"matplotlib.pyplot.tight_layout",
"numpy.std",
"matplotlib.pyplot.subplot",
"numpy.arange",
"matplot... | [((207, 241), 'pandas.read_csv', 'pd.read_csv', (['"""bias_classifier.csv"""'], {}), "('bias_classifier.csv')\n", (218, 241), True, 'import pandas as pd\n'), ((1326, 1350), 'matplotlib.rc', 'rc', (['"""axes"""'], {'titlesize': '(18)'}), "('axes', titlesize=18)\n", (1328, 1350), False, 'from matplotlib import rc\n'), ((... |
import math
print('{:^7} {:^7} {:^7}'.format('x', 'm', 'e'))
print('{:-^7} {:-^7} {:-^7}'.format('', '', ''))
for x in [0.1, 0.5, 4.0]:
m, e = math.frexp(x)
print('{:7.2f} {:7.2f} {:7d}'.format(x, m, e))
| [
"math.frexp"
] | [((149, 162), 'math.frexp', 'math.frexp', (['x'], {}), '(x)\n', (159, 162), False, 'import math\n')] |
import json
import os
import traceback
from celery import shared_task
from interface import implements
import pdfkit
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from ...base.interfaces.plugin import Plugin
from ...models import GenericConfig
from ...shorteners.yaus import YausShortner
fr... | [
"os.path.exists",
"json.loads",
"os.getenv",
"pdfkit.from_string",
"json.dumps",
"pydrive.drive.GoogleDrive",
"pydrive.auth.GoogleAuth",
"dotenv.load_dotenv",
"interface.implements",
"traceback.print_exc",
"os.remove"
] | [((458, 483), 'dotenv.load_dotenv', 'load_dotenv', (['"""../../.env"""'], {}), "('../../.env')\n", (469, 483), False, 'from dotenv import load_dotenv\n'), ((502, 520), 'interface.implements', 'implements', (['Plugin'], {}), '(Plugin)\n', (512, 520), False, 'from interface import implements\n'), ((835, 863), 'json.loads... |
import cloudpickle
import os
import numpy as np
import transformations as tf
import zlib, cPickle as pickle
#### For ZMQ ####
def send_zipped_pickle(socket, obj, flags=0, protocol=-1):
"""pickle an object, and zip the pickle before sending it"""
p = pickle.dumps(obj, protocol)
z = zlib.compress(p)
ret... | [
"numpy.abs",
"numpy.arccos",
"transformations.transformations.quaternion_from_matrix",
"cPickle.loads",
"os.path.join",
"zlib.compress",
"transformations.quaternion_matrix",
"transformations.quaternion_from_matrix",
"numpy.array",
"cPickle.dumps",
"transformations.transformations.quaternion_matr... | [((260, 287), 'cPickle.dumps', 'pickle.dumps', (['obj', 'protocol'], {}), '(obj, protocol)\n', (272, 287), True, 'import zlib, cPickle as pickle\n'), ((296, 312), 'zlib.compress', 'zlib.compress', (['p'], {}), '(p)\n', (309, 312), False, 'import zlib, cPickle as pickle\n'), ((482, 500), 'zlib.decompress', 'zlib.decompr... |
# Copyright 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | [
"gearman.GearmanAdminClient"
] | [((779, 804), 'gearman.GearmanAdminClient', 'AdminClient', (['Server.hosts'], {}), '(Server.hosts)\n', (790, 804), True, 'from gearman import GearmanAdminClient as AdminClient\n')] |
# import os
# from flask import Flask, render_template, send_from_directory
# app = Flask(__name__)
# @app.route("/")
# def index():
# return render_template("index.html")
# if __name__ == '__main__':
# app.run(debug = True)
# === bokeh demo at below ===
# embedding the graph to html
from flask ... | [
"bokeh.embed.components",
"flask.render_template",
"bokeh.plotting.figure",
"flask.Flask"
] | [((472, 487), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (477, 487), False, 'from flask import Flask, render_template, request\n'), ((523, 531), 'bokeh.plotting.figure', 'figure', ([], {}), '()\n', (529, 531), False, 'from bokeh.plotting import figure\n'), ((766, 840), 'bokeh.embed.components', 'compon... |
from __future__ import absolute_import, unicode_literals, print_function, division
import logging
logger = logging.getLogger(__name__)
MODEL_SRID = 4326
DATUM_CHOICES = [
(MODEL_SRID, 'WGS84'),
(4283, 'GDA94'),
(4203, 'AGD84'),
(4202, 'AGD66'),
(28348, 'GDA94 / MGA zone 48'),
(28349, 'GDA94 ... | [
"logging.getLogger"
] | [((109, 136), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (126, 136), False, 'import logging\n')] |
"""
These tests are the test fits that come with C mpfit
"""
import mpyfit
import unittest
import numpy
class LinearFunction( unittest.TestCase):
@staticmethod
def func(p, args):
x, y, error = args
return (y - p[0] - p[1]*x)/error
def test_fit(self):
x = numpy.array([-1.7237128E... | [
"numpy.ones",
"mpyfit.fit",
"numpy.asarray",
"numpy.exp",
"numpy.array",
"unittest.main"
] | [((6204, 6219), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6217, 6219), False, 'import unittest\n'), ((296, 435), 'numpy.array', 'numpy.array', (['[-1.7237128, 1.8712276, -0.96608055, -0.28394297, 1.3416969, 1.3757038, -\n 1.3703436, 0.042581975, -0.14970151, 0.82065094]'], {}), '([-1.7237128, 1.8712276, -... |
# Generated by Django 2.1.5 on 2019-01-17 21:49
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('tests', '0009_article_related_articles'),
]
operations = [
migrations.CreateMode... | [
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((392, 485), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (408, 485), False, 'from django.db import migrations, models\... |
import requests
from gitamite import glearn, moodle
class Moodle:
s = requests.session()
username = 'username_here'
password = '<PASSWORD>'
def isMoodleLoggedIn(self):
return moodle.isMoodleLoggedIn(self)
def getMoodleHomepage(self):
return moodle.getMoodleHomepage(self)
def ... | [
"gitamite.moodle.getUpcomingActivities",
"requests.session",
"gitamite.moodle.logoutMoodle",
"gitamite.moodle.getMoodleHomepage",
"gitamite.glearn.isGlearnLoggedIn",
"gitamite.glearn.getTimetable",
"gitamite.glearn.getCourses",
"gitamite.glearn.loginGlearn",
"gitamite.moodle.loginMoodle",
"gitamit... | [((75, 93), 'requests.session', 'requests.session', ([], {}), '()\n', (91, 93), False, 'import requests\n'), ((547, 565), 'requests.session', 'requests.session', ([], {}), '()\n', (563, 565), False, 'import requests\n'), ((201, 230), 'gitamite.moodle.isMoodleLoggedIn', 'moodle.isMoodleLoggedIn', (['self'], {}), '(self)... |
'''
Copyright <2021> <<NAME>>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMA... | [
"rhinoscriptsyntax.ClipboardText",
"rhinoscriptsyntax.GetPoint"
] | [((634, 690), 'rhinoscriptsyntax.GetPoint', 'rs.GetPoint', (['"""Pick point to find Coordinate information"""'], {}), "('Pick point to find Coordinate information')\n", (645, 690), True, 'import rhinoscriptsyntax as rs\n'), ((1024, 1047), 'rhinoscriptsyntax.ClipboardText', 'rs.ClipboardText', (['coord'], {}), '(coord)\... |
import argparse
import ast
import codecs
import encodings
import io
import sys
import tokenize
import warnings
from typing import Match
from typing import Optional
from typing import Sequence
from typing import Set
from typing import Tuple
import tokenize_rt
def _ast_parse(contents_text: str) -> ast.Module:
# in... | [
"tokenize_rt.tokens_to_src",
"encodings.search_function",
"tokenize_rt.src_to_tokens",
"tokenize_rt.Offset",
"argparse.ArgumentParser",
"tokenize.cookie_re.sub",
"tokenize_rt.reversed_enumerate",
"tokenize_rt.Token",
"warnings.catch_warnings",
"codecs.register",
"warnings.simplefilter",
"codec... | [((1628, 1661), 'encodings.search_function', 'encodings.search_function', (['"""utf8"""'], {}), "('utf8')\n", (1653, 1661), False, 'import encodings\n'), ((586, 634), 'tokenize_rt.Offset', 'tokenize_rt.Offset', (['node.lineno', 'node.col_offset'], {}), '(node.lineno, node.col_offset)\n', (604, 634), False, 'import toke... |
#<pycode(py_kernwin_idaview)>
#-------------------------------------------------------------------------
# IDAViewWrapper
#-------------------------------------------------------------------------
import _ida_kernwin
class IDAViewWrapper(CustomIDAMemo):
"""
Deprecated. Use View_Hook... | [
"_ida_kernwin.pyidag_bind",
"_ida_kernwin.pyidag_unbind"
] | [((773, 803), '_ida_kernwin.pyidag_bind', '_ida_kernwin.pyidag_bind', (['self'], {}), '(self)\n', (797, 803), False, 'import _ida_kernwin\n'), ((897, 929), '_ida_kernwin.pyidag_unbind', '_ida_kernwin.pyidag_unbind', (['self'], {}), '(self)\n', (923, 929), False, 'import _ida_kernwin\n')] |
#!/usr/bin/python3
import re
import math
from os import system, name
import operator
# At this point I'm just making a math interpeter
# import the readline module for arrow functionality if it exists
try:
import readline
readline.set_history_length(100)
except ImportError:
pass
STATS_GRAPH = False
c... | [
"math.pow",
"os.system",
"readline.set_history_length",
"re.compile"
] | [((2955, 2991), 're.compile', 're.compile', (['"""^(\\\\d+d\\\\d+(?=( |$)))+"""'], {}), "('^(\\\\d+d\\\\d+(?=( |$)))+')\n", (2965, 2991), False, 'import re\n'), ((3011, 3035), 're.compile', 're.compile', (['"""^\\\\d+(?=d)"""'], {}), "('^\\\\d+(?=d)')\n", (3021, 3035), False, 'import re\n'), ((3055, 3079), 're.compile'... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="fall3dutil",
version="1.7",
author="<NAME>",
author_email="<EMAIL>",
description="Utilities for the FALL3D model",
long_description=long_description,
long_description_content_type... | [
"setuptools.find_packages"
] | [((401, 427), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (425, 427), False, 'import setuptools\n')] |
#!/usr/bin/python
from setuptools import setup
with open('README.rst', 'r') as f:
long_description = f.read()
setup(
name='rfc3161ng_async',
version='3.0-dev',
license='MIT',
url='https://github.com/nicholasamorim/rfc3161ng_async',
description='Python 3.7+ implementation of the RFC3161 specifi... | [
"setuptools.setup"
] | [((116, 1088), 'setuptools.setup', 'setup', ([], {'name': '"""rfc3161ng_async"""', 'version': '"""3.0-dev"""', 'license': '"""MIT"""', 'url': '"""https://github.com/nicholasamorim/rfc3161ng_async"""', 'description': '"""Python 3.7+ implementation of the RFC3161 specification, using pyasn1, tornado or aiohttp"""', 'long... |
import os
import pandas as pd
import numpy as np
from sklearn.metrics import precision_recall_curve
from sklearn.metrics import average_precision_score
import matplotlib.pyplot as plt
import arviz as az
def make_dir_if_necessary(directory):
if not os.path.exists(directory):
os.makedirs(directory)
class ... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.fill_between",
"numpy.argsort",
"numpy.array",
"numpy.arange",
"numpy.mean",
"os.path.exists",
"arviz.hpd",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.linspace",
"pandas.DataFrame",
"matplotlib.pyplot.ylim",
"sklearn.metrics.... | [((1263, 1280), 'numpy.array', 'np.array', (['history'], {}), '(history)\n', (1271, 1280), True, 'import numpy as np\n'), ((1298, 1325), 'numpy.mean', 'np.mean', (['history_np'], {'axis': '(0)'}), '(history_np, axis=0)\n', (1305, 1325), True, 'import numpy as np\n'), ((1342, 1368), 'numpy.std', 'np.std', (['history_np'... |
from setuptools import setup
setup(
name="metabot2txt",
version="0.0.1",
description="convert images of well structured tables to text",
url="https://github.com/HeitorBoschirolli/metabot2txt",
author="<NAME>",
author_email="<EMAIL>",
license="MIT",
classifiers=[
"License :: OSI ... | [
"setuptools.setup"
] | [((30, 614), 'setuptools.setup', 'setup', ([], {'name': '"""metabot2txt"""', 'version': '"""0.0.1"""', 'description': '"""convert images of well structured tables to text"""', 'url': '"""https://github.com/HeitorBoschirolli/metabot2txt"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""MIT""... |
from keras.layers import Input, Dense, Flatten, Concatenate, Conv2D, Dropout
from keras.losses import mean_squared_error
from keras.models import Model, clone_model, load_model
from keras.optimizers import SGD, Adam, RMSprop
import numpy as np
class RandomAgent(object):
def __init__(self, color=1):
self.... | [
"numpy.mean",
"keras.layers.Conv2D",
"keras.layers.Flatten",
"keras.models.clone_model",
"numpy.random.choice",
"keras.layers.Concatenate",
"numpy.squeeze",
"numpy.stack",
"keras.layers.Input",
"numpy.random.randint",
"numpy.sum",
"keras.models.Model",
"numpy.array",
"numpy.std",
"keras.... | [((523, 546), 'numpy.random.choice', 'np.random.choice', (['moves'], {}), '(moves)\n', (539, 546), True, 'import numpy as np\n'), ((1270, 1284), 'keras.optimizers.RMSprop', 'RMSprop', ([], {'lr': 'lr'}), '(lr=lr)\n', (1277, 1284), False, 'from keras.optimizers import SGD, Adam, RMSprop\n'), ((1306, 1313), 'keras.models... |
# -*- coding: utf-8 -*-
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope th... | [
"logging.getLogger",
"os.path.exists",
"json.loads",
"conu.utils.graceful_get",
"conu.backend.buildah.container.BuildahRunBuilder",
"conu.utils.run_cmd",
"conu.apidefs.backend.get_backend_tmpdir",
"conu.utils.filesystem.Volume.create_from_tuple",
"conu.backend.buildah.container.BuildahContainer",
... | [((1341, 1368), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1358, 1368), False, 'import logging\n'), ((2271, 2286), 'conu.apidefs.metadata.ImageMetadata', 'ImageMetadata', ([], {}), '()\n', (2284, 2286), False, 'from conu.apidefs.metadata import ImageMetadata\n'), ((2301, 2340), 'conu... |
#!/usr/bin/env python
"""Python wrapper module for the GROMACS pdb2gmx module
"""
import sys
import json
import configuration.settings as settings
from command_wrapper import cmd_wrapper
from tools import file_utils as fu
class Pdb2gmx(object):
"""Wrapper class for the 5.1.2 version of the GROMACS pdb2gmx module.... | [
"json.loads",
"tools.file_utils.get_logs",
"configuration.settings.YamlReader",
"tools.file_utils.zip_top",
"tools.file_utils.add_step_mutation_path_to_name",
"command_wrapper.cmd_wrapper.CmdWrapper"
] | [((2262, 2329), 'tools.file_utils.get_logs', 'fu.get_logs', ([], {'path': 'self.path', 'mutation': 'self.mutation', 'step': 'self.step'}), '(path=self.path, mutation=self.mutation, step=self.step)\n', (2273, 2329), True, 'from tools import file_utils as fu\n'), ((2361, 2447), 'tools.file_utils.add_step_mutation_path_to... |
from setuptools import setup
import re
from io import open
# Get the current version
version = None
with open('plexiglas/__init__.py') as handle:
for line in handle.readlines():
if line.startswith('__version__'):
version = re.findall("'([^']+?)'", line)[0]
break
if version is None:... | [
"os.path.join",
"setuptools.setup",
"io.open",
"os.path.dirname",
"re.findall"
] | [((1077, 2030), 'setuptools.setup', 'setup', ([], {'name': '"""plexiglas"""', 'version': 'version', 'packages': "['plexiglas']", 'package_dir': "{'plexiglas': 'plexiglas'}", 'url': '"""https://github.com/andrey-yantsen/plexiglass"""', 'license': '"""MIT"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'd... |
from datetime import date
ano = int(input('Ano de nascimento: '))
atual = date.today().year
idade = atual - ano
print('Atletas nascidos em {} tem {} anos em {}.'.format(ano, idade, atual))
if idade <= 9:
print('Sua categoria é a MIRIM.')
elif idade <= 14:
print('Sua categoria é a INFANTIL.')
elif idade... | [
"datetime.date.today"
] | [((76, 88), 'datetime.date.today', 'date.today', ([], {}), '()\n', (86, 88), False, 'from datetime import date\n')] |
# 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 agreed to in writing, software
# distributed under t... | [
"structurizr.view.relationship_view.RelationshipViewIO.from_orm",
"structurizr.view.relationship_view.RelationshipView.hydrate",
"structurizr.view.relationship_view.RelationshipView"
] | [((821, 873), 'structurizr.view.relationship_view.RelationshipView', 'RelationshipView', ([], {'id': '"""id1"""', 'order': '"""5"""', 'response': '(True)'}), "(id='id1', order='5', response=True)\n", (837, 873), False, 'from structurizr.view.relationship_view import RelationshipView, RelationshipViewIO\n'), ((883, 916)... |
#
# This file is part of Python Client Library for STAC.
# Copyright (C) 2019 INPE.
#
# Python Client Library for STAC is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#
"""STAC Catalog module."""
import json
from pkg_resources import ... | [
"json.loads",
"pkg_resources.resource_string"
] | [((1586, 1660), 'pkg_resources.resource_string', 'resource_string', (['__name__', 'f"""jsonschemas/{self.stac_version}/catalog.json"""'], {}), "(__name__, f'jsonschemas/{self.stac_version}/catalog.json')\n", (1601, 1660), False, 'from pkg_resources import resource_string\n'), ((1679, 1697), 'json.loads', 'json.loads', ... |
from make_datasets_spark import DatasetConverter
from pyspark.sql import SparkSession
import pyspark.sql.functions as F
from pyspark.sql.functions import udf
from pyspark.sql.types import ArrayType, DoubleType, StringType, IntegerType
from pyspark.sql.window import Window
from pyspark.sql.functions import dense_rank
i... | [
"logging.getLogger",
"pyspark.sql.functions.lit",
"json.loads",
"pyspark.sql.types.DoubleType",
"pyspark.sql.functions.unix_timestamp",
"pyspark.sql.types.IntegerType",
"pyspark.sql.functions.col",
"numpy.array",
"pyspark.sql.types.StringType"
] | [((402, 429), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (419, 429), False, 'import logging\n'), ((1314, 1352), 'pyspark.sql.functions.unix_timestamp', 'F.unix_timestamp', (['col_event_time', 'frmt'], {}), '(col_event_time, frmt)\n', (1330, 1352), True, 'import pyspark.sql.functions a... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2019-05-20 16:13
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('oauth', '0001_initial'),
]
operations = [
migrations.RemoveField(
mode... | [
"django.db.migrations.DeleteModel",
"django.db.migrations.RemoveField"
] | [((280, 340), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""oathqquser"""', 'name': '"""user"""'}), "(model_name='oathqquser', name='user')\n", (302, 340), False, 'from django.db import migrations\n'), ((385, 426), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([]... |
#!/usr/bin/env python
import json
class BooksOfTheBible:
"""
Data class containing the books of the Bible and the Chapters
"""
def __init__(self, input_file):
ifile = open(input_file,'r')
rawData = ''.join(ifile.readlines())
self.data = json.loads(rawData)
def returnBooks... | [
"json.loads"
] | [((279, 298), 'json.loads', 'json.loads', (['rawData'], {}), '(rawData)\n', (289, 298), False, 'import json\n')] |
# -*- coding: utf-8 -*-
# @Time : 2021/5/31 14:54
# @Author : WuBingTai
import subprocess
import os
from math import ceil
pkg_name = "com.myzaker.ZAKER_Phone"
cpu = []
men = []
flow = [[], []]
def top_cpu(pkg_name):
cmd = "adb shell dumpsys cpuinfo | grep " + pkg_name
temp = []
# cmd = "adb shell top... | [
"subprocess.Popen",
"os.popen"
] | [((1232, 1283), 'os.popen', 'os.popen', (["('adb shell cat /proc/' + pid + '/net/dev')"], {}), "('adb shell cat /proc/' + pid + '/net/dev')\n", (1240, 1283), False, 'import os\n'), ((385, 471), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'shell': '(True)', 'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE'... |
import cv2
import numpy as np
import imutils
import time
import easygopigo3
import config as cfg
import bleScanner as ble
# from bleCommunication.bleScanner import DeviceScanner
from threading import Thread
from collections import OrderedDict
from picamera.array import PiRGBArray
from utils import findC... | [
"config.GPG.reset_all",
"cv2.imshow",
"utils.getFilteredColorMask",
"utils.drawBoxes",
"cv2.destroyAllWindows",
"utils.cameraInit",
"utils.findCenterOfBiggestBox",
"picamera.array.PiRGBArray",
"utils.getBoundingBoxes",
"cv2.waitKey",
"collections.OrderedDict",
"utils.findCameraDistance",
"ut... | [((5446, 5469), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (5467, 5469), False, 'import cv2\n'), ((808, 820), 'utils.cameraInit', 'cameraInit', ([], {}), '()\n', (818, 820), False, 'from utils import findCameraDistance, horizontalPositionControl_PID, distanceControl_PID, findRssiDistance, rectA... |
import unittest
# unittest.TestCase.assertEqual(20, 20)
class SomaOperador(unittest.TestCase):
def principal(self):
self.assertEqual(21, 20)
if __name__ == '__name__':
unittest.main()
| [
"unittest.main"
] | [((188, 203), 'unittest.main', 'unittest.main', ([], {}), '()\n', (201, 203), False, 'import unittest\n')] |
import discord
import json
from config import config
bot = config.bot()
def get_role(role, ctx):
return discord.utils.get(ctx.guild.roles, name=role)
def roles():
with open("Moderating/Perms/roles.json") as file:
return json.load(file)
async def is_muted(user):
return get_role(role="Muted", c... | [
"json.load",
"config.config.bot",
"discord.utils.get"
] | [((60, 72), 'config.config.bot', 'config.bot', ([], {}), '()\n', (70, 72), False, 'from config import config\n'), ((111, 156), 'discord.utils.get', 'discord.utils.get', (['ctx.guild.roles'], {'name': 'role'}), '(ctx.guild.roles, name=role)\n', (128, 156), False, 'import discord\n'), ((241, 256), 'json.load', 'json.load... |
import concurrent.futures
import os
import pickle
import sys
from functools import partial
from pathlib import Path
from typing import Callable, List, Tuple
import librosa
import librosa.display
import numpy as np
from omegaconf import OmegaConf, DictConfig
from tqdm.auto import tqdm
def parallel(func: Callable, arr... | [
"librosa.feature.melspectrogram",
"pickle.dump",
"os.makedirs",
"pathlib.Path",
"librosa.feature.delta",
"omegaconf.OmegaConf.load",
"librosa.power_to_db",
"functools.partial",
"librosa.effects.trim"
] | [((1529, 1709), 'librosa.feature.melspectrogram', 'librosa.feature.melspectrogram', (['audio'], {'sr': 'config.sampling_rate', 'n_mels': 'config.n_mels', 'hop_length': 'config.hop_length', 'n_fft': 'config.n_fft', 'fmin': 'config.fmin', 'fmax': 'config.fmax'}), '(audio, sr=config.sampling_rate, n_mels=\n config.n_me... |