code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
Copyright (C) 2021 <NAME>
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. You should have received a
copy... | [
"QuantLib.Rounding",
"unittest.TextTestRunner",
"unittest.TestSuite",
"unittest.makeSuite",
"QuantLib.EURCurrency",
"QuantLib.Currency"
] | [((1628, 1648), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (1646, 1648), False, 'import unittest\n'), ((954, 967), 'QuantLib.Currency', 'ql.Currency', ([], {}), '()\n', (965, 967), True, 'import QuantLib as ql\n'), ((1164, 1180), 'QuantLib.EURCurrency', 'ql.EURCurrency', ([], {}), '()\n', (1178, 1180... |
#!/usr/bin/env python3
"""This is an example to train a task with TRPO algorithm.
It uses an LSTM-based recurrent policy.
Here it runs CartPole-v1 environment with 100 iterations.
Results:
AverageReturn: 100
RiseTime: itr 13
"""
from metarl.experiment import run_experiment
from metarl.np.baselines import Lin... | [
"metarl.tf.envs.TfEnv",
"metarl.tf.policies.CategoricalLSTMPolicy",
"metarl.np.baselines.LinearFeatureBaseline",
"metarl.tf.optimizers.FiniteDifferenceHvp",
"metarl.tf.experiment.LocalTFRunner",
"metarl.experiment.run_experiment"
] | [((1611, 1665), 'metarl.experiment.run_experiment', 'run_experiment', (['run_task'], {'snapshot_mode': '"""last"""', 'seed': '(1)'}), "(run_task, snapshot_mode='last', seed=1)\n", (1625, 1665), False, 'from metarl.experiment import run_experiment\n'), ((886, 932), 'metarl.tf.experiment.LocalTFRunner', 'LocalTFRunner', ... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"singa.autograd.Conv2d",
"singa.autograd.relu",
"singa.autograd.softmax_cross_entropy",
"singa.autograd.MaxPool2d",
"singa.autograd.ReLU",
"singa.autograd.SeparableConv2d",
"singa.autograd.BatchNorm2d",
"singa.autograd.Linear",
"singa.autograd.add",
"singa.autograd.flatten"
] | [((3919, 3940), 'singa.autograd.add', 'autograd.add', (['y', 'skip'], {}), '(y, skip)\n', (3931, 3940), False, 'from singa import autograd\n'), ((4439, 4493), 'singa.autograd.Conv2d', 'autograd.Conv2d', (['num_channels', '(32)', '(3)', '(2)', '(0)'], {'bias': '(False)'}), '(num_channels, 32, 3, 2, 0, bias=False)\n', (4... |
import unittest
from tests.test_support import TestSupport
from mock import Mock
from maskgen.masks.donor_rules import VideoDonor, AudioDonor, AllStreamDonor, AllAudioStreamDonor, \
VideoDonorWithoutAudio, InterpolateDonor,AudioZipDonor
from maskgen.video_tools import get_type_of_segment, get_start_time_from_segme... | [
"unittest.main",
"numpy.sum",
"maskgen.video_tools.get_type_of_segment",
"maskgen.video_tools.get_start_time_from_segment",
"numpy.zeros",
"maskgen.video_tools.get_end_frame_from_segment",
"numpy.ones",
"mock.Mock",
"maskgen.video_tools.get_start_frame_from_segment",
"maskgen.video_tools.get_end_t... | [((9585, 9600), 'unittest.main', 'unittest.main', ([], {}), '()\n', (9598, 9600), False, 'import unittest\n'), ((501, 507), 'mock.Mock', 'Mock', ([], {}), '()\n', (505, 507), False, 'from mock import Mock\n'), ((3326, 3332), 'mock.Mock', 'Mock', ([], {}), '()\n', (3330, 3332), False, 'from mock import Mock\n'), ((6064,... |
#%% -*- coding: utf-8 -*-
"""
Created on Sun Apr 26 02:47:57 2020
plot sherical hermonics in 3D with radial colormap
http://balbuceosastropy.blogspot.com/2015/06/spherical-harmonics-in-python.html
"""
from __future__ import division
import scipy as sci
import scipy.special as sp
import numpy as np
import matplotlib... | [
"scipy.special.sph_harm",
"matplotlib.colors.Normalize",
"matplotlib.cm.ScalarMappable",
"matplotlib.cm.jet",
"numpy.sin",
"numpy.cos"
] | [((1230, 1260), 'matplotlib.cm.ScalarMappable', 'cm.ScalarMappable', ([], {'cmap': 'cm.jet'}), '(cmap=cm.jet)\n', (1247, 1260), False, 'from matplotlib import cm, colors\n'), ((1908, 1926), 'matplotlib.colors.Normalize', 'colors.Normalize', ([], {}), '()\n', (1924, 1926), False, 'from matplotlib import cm, colors\n'), ... |
from flask import Flask
from pycoingecko import CoinGeckoAPI
from time import sleep
from threading import Timer
cg = CoinGeckoAPI()
app = Flask(__name__)
coin_data = {}
coins_to_fetch = ["bitcoin", "ethereum", "litecoin", "monero", "dogecoin", "cardano", "tezos", "stellar"]
#Credit for RepeatedTimer class goes to Me... | [
"flask.Flask",
"threading.Timer",
"pycoingecko.CoinGeckoAPI"
] | [((118, 132), 'pycoingecko.CoinGeckoAPI', 'CoinGeckoAPI', ([], {}), '()\n', (130, 132), False, 'from pycoingecko import CoinGeckoAPI\n'), ((139, 154), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (144, 154), False, 'from flask import Flask\n'), ((958, 989), 'threading.Timer', 'Timer', (['self.interval', ... |
import grpc
import MFTApi_pb2
import MFTApi_pb2_grpc
channel = grpc.insecure_channel('localhost:7004')
stub = MFTApi_pb2_grpc.MFTApiServiceStub(channel)
download_request = MFTApi_pb2.HttpDownloadApiRequest(sourceStoreId ="remote-ssh-storage",
sourcePath= "/tmp/a.txt",
... | [
"grpc.insecure_channel",
"MFTApi_pb2.HttpDownloadApiRequest",
"MFTApi_pb2_grpc.MFTApiServiceStub"
] | [((64, 103), 'grpc.insecure_channel', 'grpc.insecure_channel', (['"""localhost:7004"""'], {}), "('localhost:7004')\n", (85, 103), False, 'import grpc\n'), ((111, 153), 'MFTApi_pb2_grpc.MFTApiServiceStub', 'MFTApi_pb2_grpc.MFTApiServiceStub', (['channel'], {}), '(channel)\n', (144, 153), False, 'import MFTApi_pb2_grpc\n... |
from flask import Flask, render_template, request, session, redirect, url_for
from models import db, User#, Places
from forms import SignupForm, LoginForm
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:edzh@localhost:5432/rubix'
db.init_app(app)
app.secret_key = "development-key... | [
"models.db.session.commit",
"flask.session.pop",
"models.db.init_app",
"flask.Flask",
"models.db.session.add",
"forms.SignupForm",
"models.User.query.filter_by",
"flask.url_for",
"flask.render_template",
"forms.LoginForm",
"models.User"
] | [((162, 177), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (167, 177), False, 'from flask import Flask, render_template, request, session, redirect, url_for\n'), ((269, 285), 'models.db.init_app', 'db.init_app', (['app'], {}), '(app)\n', (280, 285), False, 'from models import db, User\n'), ((361, 390), '... |
import uuid
from django.db import models
from . import conf
class Item(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
owner = models.PositiveIntegerField(db_index=True)
storage = models.IntegerField(default=0)
data = models.JSONField(default=dict)
... | [
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.PositiveIntegerField",
"django.db.models.BigAutoField",
"django.db.models.JSONField",
"django.db.models.IntegerField",
"django.db.models.UUIDField"
] | [((101, 171), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'primary_key': '(True)', 'default': 'uuid.uuid4', 'editable': '(False)'}), '(primary_key=True, default=uuid.uuid4, editable=False)\n', (117, 171), False, 'from django.db import models\n'), ((185, 227), 'django.db.models.PositiveIntegerField', 'models... |
import os
import json
import pprint
import shutil
from _notebooks.notebook import Notebook
from topfarm.easy_drivers import EasyDriverBase
# def get_cells(nb):
# cells = []
# for cell in nb['cells']:
# if cell['cell_type'] == 'code' and len(cell['source']) > 0 and '%%include' in cell['source'][0]:
# ... | [
"os.makedirs",
"os.path.isdir",
"os.path.dirname",
"_notebooks.notebook.Notebook",
"shutil.rmtree",
"os.listdir"
] | [((1524, 1547), 'os.path.isdir', 'os.path.isdir', (['dst_path'], {}), '(dst_path)\n', (1537, 1547), False, 'import os\n'), ((1652, 1688), 'os.makedirs', 'os.makedirs', (['dst_path'], {'exist_ok': '(True)'}), '(dst_path, exist_ok=True)\n', (1663, 1688), False, 'import os\n'), ((804, 829), 'os.path.dirname', 'os.path.dir... |
import urllib.request as request
url = 'https://ipinfo.io'
username = 'username'
password = 'password'
proxy = f'http://{username}:{password}@gate.<EMAIL>:7000'
query = request.build_opener(request.ProxyHandler({'http': proxy, 'https': proxy}))
print(query.open(url).read())
| [
"urllib.request.ProxyHandler"
] | [((195, 248), 'urllib.request.ProxyHandler', 'request.ProxyHandler', (["{'http': proxy, 'https': proxy}"], {}), "({'http': proxy, 'https': proxy})\n", (215, 248), True, 'import urllib.request as request\n')] |
'''
Translate expressions to SMT import format.
'''
from Z3 import Z3
class UnsatisfiableException(Exception):
pass
# NOTE(JY): Think about if the solver needs to know about everything for
# negative constraints. I don't think so because enough things should be
# concrete that this doesn't matter.
def solve(const... | [
"Z3.Z3"
] | [((829, 833), 'Z3.Z3', 'Z3', ([], {}), '()\n', (831, 833), False, 'from Z3 import Z3\n')] |
import os
from setuptools import setup, find_packages
# Utility function to read the README file.
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='ovirt-scheduler-proxy',
version=read('VERSION').strip(),
license='ASL2',
description='oVirt Scheduler... | [
"os.path.dirname",
"setuptools.find_packages"
] | [((464, 484), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (477, 484), False, 'from setuptools import setup, find_packages\n'), ((146, 171), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (161, 171), False, 'import os\n')] |
#!/usr/bin/env python
# -------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses t... | [
"os.walk",
"os.path.exists",
"os.environ.get",
"shutil.copyfile",
"os.path.join",
"sys.exit"
] | [((1195, 1226), 'os.environ.get', 'os.environ.get', (['"""SYSTEMDS_ROOT"""'], {}), "('SYSTEMDS_ROOT')\n", (1209, 1226), False, 'import os\n'), ((1576, 1601), 'os.environ.get', 'environ.get', (['"""SPARK_ROOT"""'], {}), "('SPARK_ROOT')\n", (1587, 1601), False, 'from os import environ\n'), ((1856, 1869), 'os.walk', 'os.w... |
import unicodedata
import re
import urllib
_slugify_strip_re = re.compile(r'[^\w\s-]')
_slugify_hyphenate_re = re.compile(r'[-\s]+')
def slugify(value):
slug = unicode(_slugify_strip_re.sub('', normalize(value)).strip().lower())
slug = _slugify_hyphenate_re.sub('-', slug)
if not slug:
return quo... | [
"unicodedata.normalize",
"re.compile"
] | [((64, 88), 're.compile', 're.compile', (['"""[^\\\\w\\\\s-]"""'], {}), "('[^\\\\w\\\\s-]')\n", (74, 88), False, 'import re\n'), ((112, 133), 're.compile', 're.compile', (['"""[-\\\\s]+"""'], {}), "('[-\\\\s]+')\n", (122, 133), False, 'import re\n'), ((462, 497), 'unicodedata.normalize', 'unicodedata.normalize', (['"""... |
"""
Common sub models for lubricants
"""
import numpy as np
__all__ = ['constant_array_property', 'roelands', 'barus', 'nd_barus', 'nd_roelands', 'dowson_higginson',
'nd_dowson_higginson']
def constant_array_property(value: float):
""" Produce a closure that returns an index able constant value
... | [
"numpy.exp",
"numpy.ones_like",
"numpy.log"
] | [((1879, 1892), 'numpy.log', 'np.log', (['eta_0'], {}), '(eta_0)\n', (1885, 1892), True, 'import numpy as np\n'), ((3063, 3076), 'numpy.log', 'np.log', (['eta_0'], {}), '(eta_0)\n', (3069, 3076), True, 'import numpy as np\n'), ((3193, 3249), 'numpy.exp', 'np.exp', (['(ln_eta_0 * (-1 + (1 + p_all * nd_pressure) ** z))']... |
import os
import shutil
from pathlib import Path
import conda_content_trust.signing as cct_signing
class RepoSigner:
def sign_repodata(self, repodata_fn, pkg_mgr_key):
final_fn = self.in_folder / "repodata_signed.json"
print("copy", repodata_fn, final_fn)
shutil.copyfile(repodata_fn, fina... | [
"shutil.copyfile",
"os.path.isfile",
"os.path.join",
"pathlib.Path"
] | [((287, 325), 'shutil.copyfile', 'shutil.copyfile', (['repodata_fn', 'final_fn'], {}), '(repodata_fn, final_fn)\n', (302, 325), False, 'import shutil\n'), ((545, 590), 'os.path.join', 'os.path.join', (['self.in_folder', '"""repodata.json"""'], {}), "(self.in_folder, 'repodata.json')\n", (557, 590), False, 'import os\n'... |
import numpy as np
from gradient_boosting import *
def test_train_predict():
X_train, y_train = load_dataset("data/tiny.rent.train")
X_val, y_val = load_dataset("data/tiny.rent.test")
y_mean, trees = gradient_boosting_mse(X_train, y_train, 5, max_depth=2, nu=0.1)
assert(np.around(y_mean, decimals=4)== 3... | [
"numpy.around"
] | [((287, 316), 'numpy.around', 'np.around', (['y_mean'], {'decimals': '(4)'}), '(y_mean, decimals=4)\n', (296, 316), True, 'import numpy as np\n')] |
import struct
from collections import namedtuple
def read_1(f):
return f.read(1)[0]
def read_2(f):
return struct.unpack('<H', f.read(2))[0]
def read_4(f):
return struct.unpack('<I', f.read(4))[0]
def read_8(f):
return struct.unpack('<Q', f.read(8))[0]
def read_buffer(f):
length = read_4(f)
retu... | [
"collections.namedtuple"
] | [((434, 467), 'collections.namedtuple', 'namedtuple', (['"""LogMessage"""', "['msg']"], {}), "('LogMessage', ['msg'])\n", (444, 467), False, 'from collections import namedtuple\n'), ((475, 526), 'collections.namedtuple', 'namedtuple', (['"""Open"""', "['flags', 'mode', 'fd', 'path']"], {}), "('Open', ['flags', 'mode', ... |
from catalogo.models import Categoria, Produto
class Gerencia_categoria():
def Cria_categoria(request):
nome = request.POST.get("nome")
slug = request.POST.get("slug")
Categoria.objects.create(nome=nome, slug=slug)
def Atualiza_categoria(request, slug):
nome = request.POST.... | [
"catalogo.models.Produto.objects.get",
"catalogo.models.Categoria.objects.get",
"catalogo.models.Categoria.objects.create"
] | [((197, 243), 'catalogo.models.Categoria.objects.create', 'Categoria.objects.create', ([], {'nome': 'nome', 'slug': 'slug'}), '(nome=nome, slug=slug)\n', (221, 243), False, 'from catalogo.models import Categoria, Produto\n'), ((352, 384), 'catalogo.models.Categoria.objects.get', 'Categoria.objects.get', ([], {'slug': '... |
# Adaptation from https://github.com/williamjameshandley/spherical_kde
# For the rule of thumb : https://arxiv.org/pdf/1306.0517.pdf
# Exact risk improvement of bandwidth selectors for kernel density estimation with directional data
# <NAME>
import math
import scipy.optimize
import scipy.special
import torch
from .ge... | [
"torch.ones_like",
"torch.logsumexp",
"torch.any",
"torch.empty",
"math.cosh",
"torch.exp",
"math.sinh",
"torch.matmul",
"torch.log",
"torch.tensor"
] | [((554, 570), 'torch.any', 'torch.any', (['(x < 0)'], {}), '(x < 0)\n', (563, 570), False, 'import torch\n'), ((2256, 2308), 'torch.tensor', 'torch.tensor', (['(1 / bandwidth ** 2)'], {'device': 'self.device'}), '(1 / bandwidth ** 2, device=self.device)\n', (2268, 2308), False, 'import torch\n'), ((2539, 2617), 'torch.... |
from django.shortcuts import redirect
from learn.services.choice import random_choice, rythm_choice
def choose_rythm_notation_exercise(request, dictionary_pk):
if request.user.is_authenticated():
translation = rythm_choice(dictionary_pk, request.user)
else:
translation = random_choice(diction... | [
"django.shortcuts.redirect",
"learn.services.choice.random_choice",
"learn.services.choice.rythm_choice"
] | [((435, 526), 'django.shortcuts.redirect', 'redirect', (['"""learn:exercise"""'], {'dictionary_pk': 'dictionary_pk', 'translation_pk': 'translation.id'}), "('learn:exercise', dictionary_pk=dictionary_pk, translation_pk=\n translation.id)\n", (443, 526), False, 'from django.shortcuts import redirect\n'), ((225, 266),... |
# -*- coding: UTF-8 -*-
#
# Copyright (C) 2008-2011 <NAME> <<EMAIL>>.
#
# 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 2 of the License, or
# (at your option) any later version.
... | [
"ctypes.c_double",
"math.sqrt",
"ctypes.byref",
"numpy.empty",
"solvcon.dependency.getcdll"
] | [((2530, 2592), 'math.sqrt', 'sqrt', (['(((ga - 1) * Ms ** 2 + 2) / (2 * ga * Ms ** 2 - (ga - 1)))'], {}), '(((ga - 1) * Ms ** 2 + 2) / (2 * ga * Ms ** 2 - (ga - 1)))\n', (2534, 2592), False, 'from math import sqrt\n'), ((2773, 2791), 'math.sqrt', 'sqrt', (['self.ratio_T'], {}), '(self.ratio_T)\n', (2777, 2791), False,... |
from lexical_analyzer.assignment_analyzer import analyze
if __name__ == '__main__':
assignment_statements = []
# get string statements from file
with open('test-cases.txt', 'r') as file:
for line in file:
assignment_statements.append(line.rstrip('\n'))
# lexically analyze
... | [
"lexical_analyzer.assignment_analyzer.analyze"
] | [((342, 372), 'lexical_analyzer.assignment_analyzer.analyze', 'analyze', (['assignment_statements'], {}), '(assignment_statements)\n', (349, 372), False, 'from lexical_analyzer.assignment_analyzer import analyze\n')] |
#!/usr/bin/env python
# <NAME> (<EMAIL>)
# Fri Jul 23 16:27:08 EDT 2021
#import xarray as xr, numpy as np, pandas as pd
import os.path
import matplotlib.pyplot as plt
#more imports
#from PIL import Image
import random
from matplotlib import image
#
#
#start from here
dice = range(1,6+1)
idir = os.path.dirname(__file_... | [
"matplotlib.image.imread",
"matplotlib.pyplot.close",
"matplotlib.pyplot.axis",
"random.choice",
"matplotlib.pyplot.ion"
] | [((343, 362), 'random.choice', 'random.choice', (['dice'], {}), '(dice)\n', (356, 362), False, 'import random\n'), ((516, 525), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (523, 525), True, 'import matplotlib.pyplot as plt\n'), ((566, 581), 'matplotlib.pyplot.axis', 'plt.axis', (['"""off"""'], {}), "('off')\n... |
# -*- coding: utf-8 -*-
# mostly from: http://stackoverflow.com/questions/30552656/python-traveling-salesman-greedy-algorithm
# credit to cMinor
import math
import random
import itertools
def indexOrNeg(arrr, myvalue):
try:
return arrr.index(myvalue)
except:
return -1
def printTour(to... | [
"random.shuffle",
"time.clock"
] | [((2889, 2908), 'random.shuffle', 'random.shuffle', (['sol'], {}), '(sol)\n', (2903, 2908), False, 'import random\n'), ((8581, 8588), 'time.clock', 'clock', ([], {}), '()\n', (8586, 8588), False, 'from time import clock\n'), ((8679, 8686), 'time.clock', 'clock', ([], {}), '()\n', (8684, 8686), False, 'from time import ... |
import torch
def get_zero_count(matrix):
# A utility function to count the number of zeroes in a 2-D matrix
return torch.sum(matrix == 0).item()
def apply_mask_dict_to_weight_dict(mask_dict, weight_dict):
# mask_dict - a dictionary where keys are layer names (string) and values are masks (bytetensor) fo... | [
"torch.sum"
] | [((125, 147), 'torch.sum', 'torch.sum', (['(matrix == 0)'], {}), '(matrix == 0)\n', (134, 147), False, 'import torch\n')] |
from .tokens2ast.ast_builder import *
from .parse2tokens.parser import Parser, SyntaxException
from .ast2sql.ast2sqlconverter import Ast2SqlConverter
from .ast2sql.exceptions import *
from ..sql_engine.db_state_tracker import DBStateTracker
from colorama import *
__author__ = 'caioseguin', 'saltzm'
class Datalog2SqlC... | [
"traceback.print_exc"
] | [((1294, 1315), 'traceback.print_exc', 'traceback.print_exc', ([], {}), '()\n', (1313, 1315), False, 'import traceback\n')] |
# Generated by Django 2.2.3 on 2019-08-12 14:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('antiqueProjectApp', '0011_auto_20190812_1453'),
]
operations = [
migrations.AlterModelOptions(
name='antiquesale',
o... | [
"django.db.models.ManyToManyField",
"django.db.migrations.AlterModelOptions"
] | [((245, 367), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""antiquesale"""', 'options': "{'permissions': (('can_buy', 'Set antique as purchased'),)}"}), "(name='antiquesale', options={'permissions': ((\n 'can_buy', 'Set antique as purchased'),)})\n", (273, 367), False, '... |
# This file is a part of Arjuna
# Copyright 2015-2021 <NAME>
# Website: www.RahulVerma.net
# 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
# U... | [
"enum.auto",
"locale.locale_alias.keys",
"re.match"
] | [((919, 925), 'enum.auto', 'auto', ([], {}), '()\n', (923, 925), False, 'from enum import Enum, auto\n'), ((1028, 1034), 'enum.auto', 'auto', ([], {}), '()\n', (1032, 1034), False, 'from enum import Enum, auto\n'), ((1120, 1126), 'enum.auto', 'auto', ([], {}), '()\n', (1124, 1126), False, 'from enum import Enum, auto\n... |
#%%
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
import matplotlib.cm as cm
from tqdm import trange, tqdm
from sklearn.metrics import adjusted_rand_score
from argparse import ArgumentParser
from util.config_parser import ConfigParser_with_eval
#%% parse arguments
def... | [
"matplotlib.pyplot.title",
"tqdm.tqdm",
"util.config_parser.ConfigParser_with_eval",
"numpy.sum",
"argparse.ArgumentParser",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.suptitle",
"matplotlib.pyplot.subplot2grid",
"joblib.Parallel",
"numpy.loadtxt",
"matplotlib.pyplot.xticks",
"matplotlib.pypl... | [((449, 465), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (463, 465), False, 'from argparse import ArgumentParser\n'), ((2757, 2803), 'numpy.loadtxt', 'np.loadtxt', (['"""summary_files/log_likelihood.txt"""'], {}), "('summary_files/log_likelihood.txt')\n", (2767, 2803), True, 'import numpy as np\n'),... |
from __future__ import annotations
import logging
from pymodbus.client.sync import ModbusTcpClient
from pymodbus.exceptions import ModbusIOException
from givenergy_modbus.decoder import GivEnergyResponseDecoder
from givenergy_modbus.framer import GivEnergyModbusFramer
from givenergy_modbus.model.register import Hold... | [
"givenergy_modbus.pdu.WriteHoldingRegisterRequest",
"givenergy_modbus.transaction.GivEnergyTransactionManager",
"givenergy_modbus.decoder.GivEnergyResponseDecoder",
"logging.getLogger"
] | [((692, 722), 'logging.getLogger', 'logging.getLogger', (['__package__'], {}), '(__package__)\n', (709, 722), False, 'import logging\n'), ((1550, 1600), 'givenergy_modbus.transaction.GivEnergyTransactionManager', 'GivEnergyTransactionManager', ([], {'client': 'self'}), '(client=self, **kwargs)\n', (1577, 1600), False, ... |
import setuptools
requirements = []
with open('requirements.txt', 'r') as fh:
for line in fh:
requirements.append(line.strip())
with open("README.md", "r") as fh:
long_description = fh.read()
print(setuptools.find_packages(),)
setuptools.setup(
name="phlab",
version="0.0.0.dev6",
authors=... | [
"setuptools.find_packages"
] | [((217, 243), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (241, 243), False, 'import setuptools\n'), ((569, 595), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (593, 595), False, 'import setuptools\n')] |
# Generated by Django 3.1.3 on 2020-11-25 06:01
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('trains', '0009_auto_20201125_0840'),
]
operations = [
migrations.DeleteModel(
name='Station',
),
migrations.DeleteModel(... | [
"django.db.migrations.DeleteModel"
] | [((226, 264), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""Station"""'}), "(name='Station')\n", (248, 264), False, 'from django.db import migrations\n'), ((297, 339), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""TrainRoutes"""'}), "(name='TrainRoutes... |
import logging
from datetime import datetime
from sqlalchemy import Boolean, Column, DateTime, Integer, Unicode, func
from sqlalchemy.orm import relationship
from sqlalchemy.sql.elements import and_
from sqlalchemy.sql.schema import ForeignKey
from flexget import db_schema
from flexget.db_schema import versioned_base... | [
"sqlalchemy.sql.elements.and_",
"flexget.db_schema.upgrade",
"sqlalchemy.orm.relationship",
"flexget.db_schema.versioned_base",
"sqlalchemy.Column",
"sqlalchemy.sql.schema.ForeignKey",
"flexget.utils.database.entry_synonym",
"sqlalchemy.func.lower",
"logging.getLogger"
] | [((420, 450), 'logging.getLogger', 'logging.getLogger', (['plugin_name'], {}), '(plugin_name)\n', (437, 450), False, 'import logging\n'), ((458, 488), 'flexget.db_schema.versioned_base', 'versioned_base', (['plugin_name', '(0)'], {}), '(plugin_name, 0)\n', (472, 488), False, 'from flexget.db_schema import versioned_bas... |
import sys
import os
import logging
import argparse
from bs4 import BeautifulSoup
import requests
# Output data to stdout instead of stderr
log = logging.getLogger()
log.setLevel(logging.INFO)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.INFO)
log.addHandler(handler)
# Parse the argument for... | [
"os.makedirs",
"argparse.ArgumentParser",
"logging.StreamHandler",
"logging.info",
"requests.get",
"bs4.BeautifulSoup",
"sys.exit",
"logging.getLogger"
] | [((147, 166), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (164, 166), False, 'import logging\n'), ((205, 238), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (226, 238), False, 'import logging\n'), ((355, 380), 'argparse.ArgumentParser', 'argparse.ArgumentParse... |
"""Bridge for connecting a UI instance to nvim."""
import sys
from threading import Semaphore, Thread
from traceback import format_exc
class UIBridge(object):
"""UIBridge class. Connects a Nvim instance to a UI class."""
def connect(self, nvim, ui):
"""Connect nvim and the ui.
This will star... | [
"messages_from_ui.get_command_line_argument",
"traceback.format_exc"
] | [((1494, 1538), 'messages_from_ui.get_command_line_argument', 'messages_from_ui.get_command_line_argument', ([], {}), '()\n', (1536, 1538), False, 'import messages_from_ui\n'), ((3145, 3157), 'traceback.format_exc', 'format_exc', ([], {}), '()\n', (3155, 3157), False, 'from traceback import format_exc\n')] |
"""
Utility to execute command line processes.
"""
import subprocess
import os
import sys
import re
def execute( command ):
"""
Convenience function for executing commands as though
from the command line. The command is executed and the
results are returned as str list. For example,
command = ... | [
"subprocess.Popen"
] | [((741, 787), 'subprocess.Popen', 'subprocess.Popen', (['args'], {'stdout': 'subprocess.PIPE'}), '(args, stdout=subprocess.PIPE)\n', (757, 787), False, 'import subprocess\n')] |
import sqlite3
import sys
import requests
from lxml import html
from lxml import etree
from bs4 import BeautifulSoup
def get_contest_info(contest_id):
contest_info = {}
url = "https://codeforces.com/contest/"+contest_id
response = requests.get(url)
if response.status_code != 200:
sys.exit(0)
html_content = html... | [
"lxml.html.document_fromstring",
"sqlite3.connect",
"requests.get",
"bs4.BeautifulSoup",
"lxml.etree.tostring",
"sys.exit"
] | [((928, 956), 'sqlite3.connect', 'sqlite3.connect', (['"""sqlite.db"""'], {}), "('sqlite.db')\n", (943, 956), False, 'import sqlite3\n'), ((235, 252), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (247, 252), False, 'import requests\n'), ((316, 358), 'lxml.html.document_fromstring', 'html.document_fromstrin... |
import os
import matplotlib.pyplot as plt
from tensorflow import keras
from tensorflow.keras.models import Model
def plot_model(model: Model, path: str) -> None:
if not os.path.isfile(path):
keras.utils.plot_model(model, to_file=path, show_shapes=True)
def plot_learning_history(fit, metric: str = "accu... | [
"tensorflow.keras.utils.plot_model",
"matplotlib.pyplot.close",
"os.path.isfile",
"matplotlib.pyplot.subplots"
] | [((506, 544), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'ncols': '(2)', 'figsize': '(10, 4)'}), '(ncols=2, figsize=(10, 4))\n', (518, 544), True, 'import matplotlib.pyplot as plt\n'), ((1028, 1039), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '()\n', (1037, 1039), True, 'import matplotlib.pyplot as plt\... |
import pytest
import mackinac
@pytest.fixture(scope='module')
def test_model(b_theta_genome_id, b_theta_id):
# Reconstruct a model so there is a folder in the workspace.
stats = mackinac.create_patric_model(b_theta_genome_id, model_id=b_theta_id)
yield stats
mackinac.delete_patric_model(b_theta_id)
... | [
"mackinac.get_workspace_object_meta",
"mackinac.delete_workspace_object",
"mackinac.get_workspace_object_data",
"mackinac.create_patric_model",
"pytest.fixture",
"pytest.raises",
"mackinac.delete_patric_model",
"mackinac.put_workspace_object",
"mackinac.list_workspace_objects",
"pytest.mark.usefix... | [((34, 64), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (48, 64), False, 'import pytest\n'), ((322, 352), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (336, 352), False, 'import pytest\n'), ((457, 487), 'pytest.fixture', 'pytes... |
#!/usr/bin/env python
# encoding: utf-8
"""
@version: ??
@author: liangliangyy
@license: MIT Licence
@contact: <EMAIL>
@site: https://www.lylinux.net/
@software: PyCharm
@file: urls.py
@time: 2016/11/2 下午7:15
"""
from django.urls import path
from django.views.decorators.cache import cache_page
from website.utils im... | [
"website.utils.my_cache"
] | [((416, 451), 'website.utils.my_cache', 'my_cache', (['v.ServiceListView.as_view'], {}), '(v.ServiceListView.as_view)\n', (424, 451), False, 'from website.utils import my_cache\n'), ((499, 536), 'website.utils.my_cache', 'my_cache', (['v.ServiceDetailView.as_view'], {}), '(v.ServiceDetailView.as_view)\n', (507, 536), F... |
# Generated by Django 3.2.6 on 2021-08-04 18:09
import django.core.serializers.json
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('worlds', '0009_job_job_definition'),
]
operations = [
migrations.AlterField(
model_name='job... | [
"django.db.models.JSONField"
] | [((376, 476), 'django.db.models.JSONField', 'models.JSONField', ([], {'blank': '(True)', 'encoder': 'django.core.serializers.json.DjangoJSONEncoder', 'null': '(True)'}), '(blank=True, encoder=django.core.serializers.json.\n DjangoJSONEncoder, null=True)\n', (392, 476), False, 'from django.db import migrations, model... |
# -*- coding: utf-8 -*-
import click
import logging
from pathlib import Path
from dotenv import find_dotenv, load_dotenv
import netCDF4 as nc
import pickle as pk
import pandas as pd
import datetime
import os
import numpy as np
import sys
src_dir = os.path.join(os.getcwd(), 'src/data')
sys.path.append(src_dir)
from hel... | [
"sys.path.append",
"numpy.stack",
"logging.basicConfig",
"dotenv.find_dotenv",
"os.getcwd",
"click.option",
"numpy.ones",
"click.command",
"pathlib.Path",
"click.Path",
"numpy.tile",
"seq2seq_class.Seq2Seq_Class",
"helper.load_pkl",
"logging.getLogger"
] | [((287, 311), 'sys.path.append', 'sys.path.append', (['src_dir'], {}), '(src_dir)\n', (302, 311), False, 'import sys\n'), ((414, 438), 'sys.path.append', 'sys.path.append', (['src_dir'], {}), '(src_dir)\n', (429, 438), False, 'import sys\n'), ((2158, 2173), 'click.command', 'click.command', ([], {}), '()\n', (2171, 217... |
import pickle
import numpy as np
import pandas as pd
import shap
import matplotlib.pyplot as pl
shap.initjs()
json_path = "response.json"
model_path = "xgboost_primary_model.pkl"
AGE_GROUP_CUTOFFS = [0, 17, 30, 40, 50, 60, 70, 120]
AGE_GROUPS_TRANSFORMER = {1: 10, 2: 25, 3: 35, 4: 45, 5: 55, 6: 65, 7: 75}
AGE_COL =... | [
"pandas.read_csv",
"shap.summary_plot",
"pandas.read_json",
"shap.initjs",
"shap.TreeExplainer",
"shap.force_plot",
"numpy.round"
] | [((98, 111), 'shap.initjs', 'shap.initjs', ([], {}), '()\n', (109, 111), False, 'import shap\n'), ((802, 837), 'pandas.read_json', 'pd.read_json', (['json_path'], {'lines': '(True)'}), '(json_path, lines=True)\n', (814, 837), True, 'import pandas as pd\n'), ((1068, 1101), 'numpy.round', 'np.round', (['predictions[:, 1]... |
from cereal import car
from common.numpy_fast import mean, int_rnd
from opendbc.can.can_define import CANDefine
from selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser
from selfdrive.config import Conversions as CV
from selfdrive.car.ocelot.values import CAR, DBC, STEER_THRESHOLD, BUT... | [
"opendbc.can.can_define.CANDefine",
"common.numpy_fast.int_rnd",
"cereal.car.CarState.new_message",
"selfdrive.car.ocelot.values.BUTTON_STATES.copy",
"common.numpy_fast.mean",
"opendbc.can.parser.CANParser"
] | [((430, 474), 'opendbc.can.can_define.CANDefine', 'CANDefine', (["DBC[CP.carFingerprint]['chassis']"], {}), "(DBC[CP.carFingerprint]['chassis'])\n", (439, 474), False, 'from opendbc.can.can_define import CANDefine\n'), ((750, 770), 'selfdrive.car.ocelot.values.BUTTON_STATES.copy', 'BUTTON_STATES.copy', ([], {}), '()\n'... |
"""Data parsing tools"""
import json
import pandas as pd
## Data specific headers ##
# Global Positioning System Fix Data
# http://aprs.gids.nl/nmea/#gga
GGA_columns = ["nmea_type", "UTC_time", "latitude", "NS", "longitude", "EW", "quality", "n_satellites",
"horizontal_dilution", "altitude", "M", "... | [
"pandas.read_csv",
"pandas.to_datetime",
"json.loads"
] | [((1880, 1901), 'json.loads', 'json.loads', (['sbang[2:]'], {}), '(sbang[2:])\n', (1890, 1901), False, 'import json\n'), ((1911, 1999), 'pandas.read_csv', 'pd.read_csv', (['fp'], {'delimiter': "meta['delimiter']", 'comment': "meta['comment']", 'quotechar': '"""\\""""'}), '(fp, delimiter=meta[\'delimiter\'], comment=met... |
import sys
import os
print(os.getcwd())
sys.path.append("../")
from clustercode.ClusterEnsemble import ClusterEnsemble
from clustercode.clustering import cluster_analysis
# tpr = "/home/trl11/Virtual_Share/gromacs_test/npt.tpr"
# traj = "/home/trl11/Virtual_Share/gromacs_test/npt.xtc"
traj = "clustercode/tests/clust... | [
"sys.path.append",
"clustercode.ClusterEnsemble.ClusterEnsemble",
"os.getcwd"
] | [((41, 63), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (56, 63), False, 'import sys\n'), ((531, 571), 'clustercode.ClusterEnsemble.ClusterEnsemble', 'ClusterEnsemble', (['tpr', 'traj', "['CE', 'CM']"], {}), "(tpr, traj, ['CE', 'CM'])\n", (546, 571), False, 'from clustercode.ClusterEnsemble ... |
import os
import re
import cv2
import numpy as np
def gen_img_label_list(csv_list):
csv_f = open(csv_list, 'r')
lines = csv_f.readlines()
cnt_img = ''
cnt_label = ''
for i in lines:
img = i.strip().split(' ')[0]
score = float(i.strip().split(' ')[1])
b = [int(float(j)) for j... | [
"cv2.waitKey",
"cv2.imread",
"cv2.imshow"
] | [((507, 582), 'cv2.imread', 'cv2.imread', (["('../../DataFountain/GLODON_objDet/test_dataset/' + img + '.jpg')"], {}), "('../../DataFountain/GLODON_objDet/test_dataset/' + img + '.jpg')\n", (517, 582), False, 'import cv2\n'), ((827, 850), 'cv2.imshow', 'cv2.imshow', (['"""img"""', 'img_'], {}), "('img', img_)\n", (837,... |
from IMLearn.learners import UnivariateGaussian, MultivariateGaussian
import numpy as np
import plotly.graph_objects as go
import plotly.io as pio
from matplotlib import pyplot as plt
pio.templates.default = "simple_white"
SAMPLES = 1000
QUESTION_ONE_MEAN = 10
QUESTION_ONE_VAR = 1
QUESTION_ONE_SAMPLES_SKIP = 10
QUEST... | [
"IMLearn.learners.UnivariateGaussian",
"matplotlib.pyplot.show",
"numpy.random.seed",
"numpy.vectorize",
"IMLearn.learners.MultivariateGaussian",
"numpy.amax",
"numpy.mean",
"numpy.random.multivariate_normal",
"numpy.arange",
"numpy.array",
"numpy.random.normal",
"numpy.linspace",
"matplotli... | [((476, 543), 'numpy.random.normal', 'np.random.normal', (['QUESTION_ONE_MEAN', 'QUESTION_ONE_VAR'], {'size': 'SAMPLES'}), '(QUESTION_ONE_MEAN, QUESTION_ONE_VAR, size=SAMPLES)\n', (492, 543), True, 'import numpy as np\n'), ((570, 590), 'IMLearn.learners.UnivariateGaussian', 'UnivariateGaussian', ([], {}), '()\n', (588,... |
# Importing the libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# Importing our cancer dataset
dataset = pd.read_csv('breast_cancer_dataset.csv')
X = dataset.iloc[:, 1:9].values
Y = dataset.iloc[:, 9].values
# Encoding categorical data values
from sklearn.preprocessing impo... | [
"sklearn.preprocessing.StandardScaler",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.accuracy_score",
"sklearn.preprocessing.LabelEncoder",
"sklearn.linear_model.LogisticRegression",
"sklearn.metrics.confusion_matrix"
] | [((145, 185), 'pandas.read_csv', 'pd.read_csv', (['"""breast_cancer_dataset.csv"""'], {}), "('breast_cancer_dataset.csv')\n", (156, 185), True, 'import pandas as pd\n'), ((354, 368), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (366, 368), False, 'from sklearn.preprocessing import LabelEncode... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: <NAME>
# Contact: <EMAIL>
# Date: 18/12/2018
# This code preprocessed the Facebook wall post and the Webspam datasets in order to produce edgelists
# which can be then used to replicate the paper experiments using EvalNE.
from __future__ import division
import ... | [
"evalne.utils.preprocess.prep_graph",
"evalne.utils.preprocess.load_graph",
"evalne.utils.preprocess.save_graph",
"networkx.DiGraph",
"os.path.split"
] | [((676, 698), 'os.path.split', 'os.path.split', (['argv[1]'], {}), '(argv[1])\n', (689, 698), False, 'import os\n'), ((722, 744), 'os.path.split', 'os.path.split', (['argv[2]'], {}), '(argv[2])\n', (735, 744), False, 'import os\n'), ((834, 943), 'evalne.utils.preprocess.save_graph', 'pp.save_graph', (['G1'], {'output_p... |
from __future__ import absolute_import
from functools import wraps
from Queue import Queue
from celery.utils import cached_property
def coroutine(fun):
"""Decorator that turns a generator into a coroutine that is
started automatically, and that can send values back to the caller.
**Example coroutine th... | [
"Queue.Queue",
"functools.wraps"
] | [((1762, 1772), 'functools.wraps', 'wraps', (['fun'], {}), '(fun)\n', (1767, 1772), False, 'from functools import wraps\n'), ((2816, 2823), 'Queue.Queue', 'Queue', ([], {}), '()\n', (2821, 2823), False, 'from Queue import Queue\n')] |
import numpy as np
from lmfit.model import Model
class PDFdecayModel(Model):
r"""A model to describe the product of a decaying exponential and a Gaussian
with three parameters: ``amplitude``, ``xi``, and ``sigma``
.. math::
f(x; A, \xi, \sigma) = A e^{[-{|x|}/\xi]} e^{[{-{x^2}/{{2\sigma}^2}}]}
... | [
"numpy.exp"
] | [((601, 635), 'numpy.exp', 'np.exp', (['(-x ** 2 / (2 * sigma ** 2))'], {}), '(-x ** 2 / (2 * sigma ** 2))\n', (607, 635), True, 'import numpy as np\n')] |
from flask import Blueprint
sendmail = Blueprint('sendmail', __name__, template_folder='templates/sendmail')
from . import views
| [
"flask.Blueprint"
] | [((40, 109), 'flask.Blueprint', 'Blueprint', (['"""sendmail"""', '__name__'], {'template_folder': '"""templates/sendmail"""'}), "('sendmail', __name__, template_folder='templates/sendmail')\n", (49, 109), False, 'from flask import Blueprint\n')] |
# -*- coding: utf-8 -*-
import sys
#reload(sys)
#sys.setdefaultencoding('utf8')
#1.将问题ID和TOPIC对应关系保持到字典里:process question_topic_train_set.txt
#from:question_id,topics(topic_id1,topic_id2,topic_id3,topic_id4,topic_id5)
# to:(question_id,topic_id1)
# (question_id,topic_id2)
#read question_topic_train_set.txt
import ... | [
"random.shuffle",
"codecs.open"
] | [((546, 575), 'codecs.open', 'codecs.open', (['q_t', '"""r"""', '"""utf8"""'], {}), "(q_t, 'r', 'utf8')\n", (557, 575), False, 'import codecs\n'), ((1591, 1618), 'codecs.open', 'codecs.open', (['q', '"""r"""', '"""utf8"""'], {}), "(q, 'r', 'utf8')\n", (1602, 1618), False, 'import codecs\n'), ((4582, 4607), 'random.shuf... |
import pygame
import numpy as np
from collections import OrderedDict
from Utility.shape import Rectangle
from Utility import ui
from Level.generic_level import GenericLevel
class Level(GenericLevel):
def __init__(self, player, **kwargs):
super().__init__(**kwargs)
self.player = player... | [
"numpy.full",
"pygame.quit",
"pygame.image.load",
"pygame.draw.line",
"pygame.draw.circle",
"pygame.draw.rect",
"pygame.event.get",
"numpy.zeros",
"Utility.ui.message",
"pygame.display.flip",
"pygame.time.wait",
"pygame.display.update",
"collections.OrderedDict",
"Utility.shape.Rectangle",... | [((7700, 7870), 'Utility.ui.message', 'ui.message', ([], {'gameDisplay': 'self.gameDisplay', 'msg': '"""Yeah.!"""', 'x': '(self.gameDimension[0] // 2 - 50)', 'y': '(self.gameDimension[1] // 2 - 50)', 'color': '(100, 200, 100)', 'font_size': '(50)'}), "(gameDisplay=self.gameDisplay, msg='Yeah.!', x=self.gameDimension\n ... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time : 2022/1/29 10:35 上午
# @Author: zhoumengjie
# @File : pdfutils.py
import base64
import logging
import math
import os
import time
import pdfplumber
from pyecharts.components import Table
from pyecharts.options import ComponentTitleOpts
from selenium import webdrive... | [
"os.remove",
"wxcloudrun.bond.BondUtils.Crawler",
"pyecharts.components.Table",
"wxcloudrun.common.fingerprinter.add_finger_print",
"time.sleep",
"pdfplumber.open",
"selenium.webdriver.ChromeOptions",
"selenium.webdriver.Chrome",
"pyecharts.options.ComponentTitleOpts",
"logging.getLogger"
] | [((521, 545), 'logging.getLogger', 'logging.getLogger', (['"""log"""'], {}), "('log')\n", (538, 545), False, 'import logging\n'), ((557, 566), 'wxcloudrun.bond.BondUtils.Crawler', 'Crawler', ([], {}), '()\n', (564, 566), False, 'from wxcloudrun.bond.BondUtils import Crawler\n'), ((2156, 2175), 'os.remove', 'os.remove',... |
"""Reformats daily seaice data into regional xls file
This is for internal use by scientists.
"""
import calendar as cal
import os
import click
import pandas as pd
from . import util
import seaice.nasateam as nt
import seaice.logging as seaicelogging
import seaice.timeseries as sit
log = seaicelogging.init('seaice... | [
"pandas.DataFrame",
"seaice.logging.init",
"seaice.timeseries.daily",
"pandas.ExcelWriter",
"click.command",
"click.Path",
"os.path.join",
"seaice.logging.log_command"
] | [((294, 328), 'seaice.logging.init', 'seaicelogging.init', (['"""seaice.tools"""'], {}), "('seaice.tools')\n", (312, 328), True, 'import seaice.logging as seaicelogging\n'), ((545, 560), 'click.command', 'click.command', ([], {}), '()\n', (558, 560), False, 'import click\n'), ((727, 757), 'seaice.logging.log_command', ... |
"""Sample program that runs a sweep and records results."""
from pathlib import Path
from typing import Sequence
import numpy as np
from absl import app
from absl import flags
from differential_value_iteration import utils
from differential_value_iteration.algorithms import algorithms
from differential_value_iteration... | [
"differential_value_iteration.environments.micro.create_mrp1",
"differential_value_iteration.environments.micro.create_mrp2",
"differential_value_iteration.algorithms.algorithms.MDVI_Evaluation",
"pathlib.Path",
"differential_value_iteration.utils.run_alg",
"absl.flags.DEFINE_bool",
"differential_value_... | [((428, 506), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', ([], {'name': '"""plot_dir"""', 'default': '"""plots"""', 'help': '"""path to plot dir"""'}), "(name='plot_dir', default='plots', help='path to plot dir')\n", (447, 506), False, 'from absl import flags\n'), ((507, 585), 'absl.flags.DEFINE_integer', 'flags... |
from telebot import types
def my_input(bot, chat_id, txt, ResponseHandler):
message = bot.send_message(chat_id, text=txt)
bot.register_next_step_handler(message, ResponseHandler)
# -----------------------------------------------------------------------
def my_inputInt(bot, chat_id, txt, ResponseHandler):
... | [
"telebot.types.InlineKeyboardMarkup"
] | [((1295, 1323), 'telebot.types.InlineKeyboardMarkup', 'types.InlineKeyboardMarkup', ([], {}), '()\n', (1321, 1323), False, 'from telebot import types\n'), ((3887, 3915), 'telebot.types.InlineKeyboardMarkup', 'types.InlineKeyboardMarkup', ([], {}), '()\n', (3913, 3915), False, 'from telebot import types\n')] |
import fastNLP as FN
import argparse
import os
import random
import numpy
import torch
def get_argparser():
parser = argparse.ArgumentParser()
parser.add_argument('--lr', type=float, required=True)
parser.add_argument('--w_decay', type=float, required=True)
parser.add_argument('--lr_decay', type=float... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"torch.random.manual_seed",
"torch.cuda.manual_seed_all",
"numpy.random.randint",
"random.seed"
] | [((123, 148), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (146, 148), False, 'import argparse\n'), ((1092, 1109), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1103, 1109), False, 'import random\n'), ((1114, 1137), 'numpy.random.seed', 'numpy.random.seed', (['seed'], {}), '(seed... |
# -*- coding: utf-8 -*-
from django.db import models
class Nameable(models.Model):
name = models.CharField(max_length=40)
class Meta:
abstract = True
| [
"django.db.models.CharField"
] | [((97, 128), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(40)'}), '(max_length=40)\n', (113, 128), False, 'from django.db import models\n')] |
import sys
from random import randint
class SymbolSet:
def __init__(self, string: str, weight: int) -> None:
self.__str = string
self.__weight = weight
def getWeight(self) -> int:
return self.__weight
def getChar(self) -> str:
index = randint(0, len(self.__str) - 1)
... | [
"random.randint"
] | [((1848, 1875), 'random.randint', 'randint', (['(0)', '(totalWeight - 1)'], {}), '(0, totalWeight - 1)\n', (1855, 1875), False, 'from random import randint\n')] |
import requests
import pickle
import json
def make_call(location):
apikey = '<KEY>'
URL = 'https://api.weather.com/v2/pws/observations/current?apiKey={0}&stationId={1}&numericPrecision=decimal&format=json&units=e'.format(apikey, location)
headers = {
"User-Agent": "Mozilla/5.0 (Macintosh; ... | [
"json.loads",
"requests.get"
] | [((690, 724), 'requests.get', 'requests.get', (['URL'], {'headers': 'headers'}), '(URL, headers=headers)\n', (702, 724), False, 'import requests\n'), ((778, 799), 'json.loads', 'json.loads', (['r.content'], {}), '(r.content)\n', (788, 799), False, 'import json\n')] |
"""
check if any items that are ready for processing exist in extract queue
ready for processing = status set to 0
extract queue = mongodb db/collection: asdf->extracts
"""
# ----------------------------------------------------------------------------
import sys
import os
branch = sys.argv[1]
utils_dir = os.path... | [
"pymongo.MongoClient",
"os.path.abspath",
"config_utility.BranchConfig",
"sys.path.insert"
] | [((401, 430), 'sys.path.insert', 'sys.path.insert', (['(0)', 'utils_dir'], {}), '(0, utils_dir)\n', (416, 430), False, 'import sys\n'), ((482, 509), 'config_utility.BranchConfig', 'BranchConfig', ([], {'branch': 'branch'}), '(branch=branch)\n', (494, 509), False, 'from config_utility import BranchConfig\n'), ((903, 939... |
#!/usr/env/python python3
# -*- coding: utf-8 -*-
# @File : vad_util.py
# @Time : 2018/8/29 13:37
# @Software : PyCharm
import numpy as np
from math import log
import librosa
def mse(data):
return ((data ** 2).mean()) ** 0.5
def dBFS(data):
mse_data = mse(data)
if mse_data == 0.0:
retur... | [
"numpy.abs",
"librosa.output.write_wav",
"numpy.max",
"numpy.array",
"librosa.load",
"math.log"
] | [((973, 984), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (981, 984), True, 'import numpy as np\n'), ((1055, 1068), 'numpy.abs', 'np.abs', (['sound'], {}), '(sound)\n', (1061, 1068), True, 'import numpy as np\n'), ((1157, 1203), 'librosa.load', 'librosa.load', (['"""BAC009S0908W0161.wav"""'], {'sr': '(16000)'}), "... |
import os
import sys
import argparse
import logging
import tqdm
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from data.tokenizer import Tokenizer
from util.utils import load_bestmodel
def translate(args, ... | [
"data.tokenizer.Tokenizer",
"util.utils.load_bestmodel",
"torch.LongTensor",
"logging.info",
"torch.no_grad",
"os.path.join"
] | [((410, 462), 'os.path.join', 'os.path.join', (['args.final_model_path', '"""bestmodel.pth"""'], {}), "(args.final_model_path, 'bestmodel.pth')\n", (422, 462), False, 'import os\n'), ((778, 824), 'data.tokenizer.Tokenizer', 'Tokenizer', (['args.enc_language', 'args.enc_max_len'], {}), '(args.enc_language, args.enc_max_... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import argparse
import cv2, os
from fcos_core.config import cfg
from predictor import VisDroneDemo
import time
def main():
parser = argparse.ArgumentParser(description="PyTorch Object Detection Webcam Demo")
parser.add_argument(
... | [
"os.mkdir",
"fcos_core.config.cfg.merge_from_file",
"fcos_core.config.cfg.freeze",
"argparse.ArgumentParser",
"predictor.VisDroneDemo",
"cv2.waitKey",
"fcos_core.config.cfg.merge_from_list",
"os.path.exists",
"time.time",
"cv2.destroyAllWindows",
"os.path.join",
"os.listdir"
] | [((211, 286), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch Object Detection Webcam Demo"""'}), "(description='PyTorch Object Detection Webcam Demo')\n", (234, 286), False, 'import argparse\n'), ((1507, 1544), 'fcos_core.config.cfg.merge_from_file', 'cfg.merge_from_file', (['arg... |
import os
import shutil
from pdb import set_trace
from gym.envs.box2d.car_racing import CarRacing
import numpy as np
import pandas as pd
def find_roads():
path = './touching_tracks_tests'
# Check if dir exists TODO
if os.path.isdir(path):
# Remove files TODO
shutil.rmtree(path)
# Cre... | [
"os.mkdir",
"os.path.isdir",
"pdb.set_trace",
"shutil.rmtree",
"gym.envs.box2d.car_racing.CarRacing"
] | [((234, 253), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (247, 253), False, 'import os\n'), ((337, 351), 'os.mkdir', 'os.mkdir', (['path'], {}), '(path)\n', (345, 351), False, 'import os\n'), ((363, 554), 'gym.envs.box2d.car_racing.CarRacing', 'CarRacing', ([], {'allow_reverse': '(False)', 'show_info... |
import luigi
from ...abstract_method_exception import AbstractMethodException
from ...lib.test_environment.populate_data import PopulateEngineSmallTestDataToDatabase
from ...lib.test_environment.upload_exa_jdbc import UploadExaJDBC
from ...lib.test_environment.upload_virtual_schema_jdbc_adapter import UploadVirtualSch... | [
"luigi.Parameter"
] | [((1188, 1205), 'luigi.Parameter', 'luigi.Parameter', ([], {}), '()\n', (1203, 1205), False, 'import luigi\n')] |
import discord
import requests
import json
import asyncio
from os import environ
from discord.ext import commands
from io import StringIO
from urllib.request import urlopen
from twitch import TwitchClient
class Emojis:
def __init__(self, bot):
self.bot = bot
self.messages = []
... | [
"discord.ext.commands.command",
"json.loads",
"discord.Embed",
"asyncio.sleep",
"urllib.request.urlopen",
"requests.get",
"twitch.TwitchClient"
] | [((492, 566), 'discord.ext.commands.command', 'commands.command', ([], {'pass_context': '(True)', 'name': '"""emojis"""', 'aliases': "['e', 'emoji']"}), "(pass_context=True, name='emojis', aliases=['e', 'emoji'])\n", (508, 566), False, 'from discord.ext import commands\n'), ((335, 380), 'twitch.TwitchClient', 'TwitchCl... |
from dotenv import load_dotenv
from os.path import join, dirname
from dateutil import parser
from enum import Enum
from typing import List
import os
import urllib.request as url_request
import json
from dataclasses import dataclass
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
dotenv_pa... | [
"json.load",
"dateutil.parser.parse",
"os.path.dirname",
"urllib.request.urlopen",
"dotenv.load_dotenv",
"os.getenv"
] | [((357, 381), 'dotenv.load_dotenv', 'load_dotenv', (['dotenv_path'], {}), '(dotenv_path)\n', (368, 381), False, 'from dotenv import load_dotenv\n'), ((393, 423), 'os.getenv', 'os.getenv', (['"""ALPHA_VANTAGE_KEY"""'], {}), "('ALPHA_VANTAGE_KEY')\n", (402, 423), False, 'import os\n'), ((330, 347), 'os.path.dirname', 'di... |
import math
def isprime(x):
if x == 2:
return 1
if x < 2 or x % 2 == 0:
return 0
i = 3
while i <= math.sqrt(x):
if x % i == 0:
return 0
i += 2
return 1
n = int(input())
lst = list(map(int, input().split()))
print(sum([isprime(i) for i in lst]))
| [
"math.sqrt"
] | [((132, 144), 'math.sqrt', 'math.sqrt', (['x'], {}), '(x)\n', (141, 144), False, 'import math\n')] |
from approvaltests import verify
from database import DatabaseAccess
from product_service import validate_and_add
from response import ProductFormData
class FakeDatabase(DatabaseAccess):
def __init__(self):
self.product = None
def store_product(self, product):
self.product = product
... | [
"product_service.validate_and_add",
"approvaltests.verify",
"response.ProductFormData"
] | [((393, 452), 'response.ProductFormData', 'ProductFormData', (['"""Sample product"""', '"""Lipstick"""', '(5)', '(10)', '(False)'], {}), "('Sample product', 'Lipstick', 5, 10, False)\n", (408, 452), False, 'from response import ProductFormData\n'), ((503, 537), 'product_service.validate_and_add', 'validate_and_add', ([... |
#!/usr/bin/python
# -*- coding:utf-8 -*-
from LagouDb import LagouDb
class Analyzer(object):
def __init__(self):
self.db = LagouDb()
# 统计最受欢迎的工作
@staticmethod
def get_popular_jobs(since=None):
if since:
pass
else:
pass
# 统计职位在不同城市的薪资情况
def get_... | [
"LagouDb.LagouDb"
] | [((137, 146), 'LagouDb.LagouDb', 'LagouDb', ([], {}), '()\n', (144, 146), False, 'from LagouDb import LagouDb\n')] |
# Generated by Django 3.1.1 on 2020-09-10 21:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('formulario', '0004_auto_20200909_2313'),
]
operations = [
migrations.RemoveField(
model_name='mapeamento',
name='lin... | [
"django.db.migrations.RemoveField",
"django.db.models.URLField",
"django.db.migrations.DeleteModel"
] | [((238, 306), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""mapeamento"""', 'name': '"""links_fontes"""'}), "(model_name='mapeamento', name='links_fontes')\n", (260, 306), False, 'from django.db import migrations, models\n'), ((1003, 1039), 'django.db.migrations.DeleteModel', 'mi... |
# -*- coding: utf-8 -*-
"""Demonstrations of setting up models and visualising outputs."""
from __future__ import division
__authors__ = '<NAME>'
__license__ = 'MIT'
import sys
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.animation import FuncAnimation
import numpy as np
from pompy imp... | [
"matplotlib.pyplot.plot",
"pompy.processors.ConcentrationArrayGenerator",
"matplotlib.pyplot.scatter",
"pompy.processors.ConcentrationValueCalculator",
"matplotlib.pyplot.quiver",
"pompy.models.Rectangle",
"matplotlib.pyplot.imshow",
"numpy.random.RandomState",
"matplotlib.animation.FuncAnimation",
... | [((672, 708), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'figsize': 'fig_size'}), '(1, 1, figsize=fig_size)\n', (684, 708), True, 'import matplotlib.pyplot as plt\n'), ((1970, 1997), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (1991, 1997), True, 'import numpy a... |
from __future__ import annotations
import re
import string
from abc import ABC, abstractmethod
from dataclasses import dataclass
from fnmatch import fnmatchcase
from io import BytesIO
from typing import IO, Dict, List, Optional, Union
from pptx import Presentation
from pptx.chart.data import ChartData
from pptx.enum.... | [
"io.BytesIO",
"pptx.Presentation",
"string.Template",
"fnmatch.fnmatchcase",
"pptx.chart.data.ChartData",
"re.sub"
] | [((1578, 1610), 'pptx.Presentation', 'Presentation', (['self._path_or_file'], {}), '(self._path_or_file)\n', (1590, 1610), False, 'from pptx import Presentation\n'), ((3933, 3954), 'string.Template', 'string.Template', (['text'], {}), '(text)\n', (3948, 3954), False, 'import string\n'), ((8651, 8662), 'pptx.chart.data.... |
from setuptools import setup, find_packages
setup(
name='symspellpy',
packages=find_packages(exclude=['test']),
package_data={
'symspellpy': ['README.md', 'LICENSE']
},
version='0.9.0',
description='Keyboard layout aware version of SymSpell',
long_description=open('README.md').read(... | [
"setuptools.find_packages"
] | [((88, 119), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['test']"}), "(exclude=['test'])\n", (101, 119), False, 'from setuptools import setup, find_packages\n')] |
#!/usr/bin/env python3
import sys
import pytest
if __name__ == '__main__':
sys.exit(pytest.main(sys.argv[1:]))
| [
"pytest.main"
] | [((92, 117), 'pytest.main', 'pytest.main', (['sys.argv[1:]'], {}), '(sys.argv[1:])\n', (103, 117), False, 'import pytest\n')] |
# coding: utf-8
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from django import forms
from colaboradores.enums import AREAS
class FormColaborador(forms.Form):
nome = forms.CharField(max_length=100, required=True)
email = forms.CharField(m... | [
"django.forms.CharField",
"django.forms.ChoiceField"
] | [((244, 290), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(100)', 'required': '(True)'}), '(max_length=100, required=True)\n', (259, 290), False, 'from django import forms\n'), ((303, 349), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(100)', 'required': '(True)'}), '(max_leng... |
from django.db import models
import time
# Create your models here.
class words(models.Model):
word = models.CharField(max_length = 40, default = '', verbose_name = "单词")
symthm = models.CharField(max_length = 40, default = '', verbose_name = "音标")
chinese = models.CharField(max_length = 100, default = '', ... | [
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.DateField"
] | [((106, 168), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(40)', 'default': '""""""', 'verbose_name': '"""单词"""'}), "(max_length=40, default='', verbose_name='单词')\n", (122, 168), False, 'from django.db import models\n'), ((188, 250), 'django.db.models.CharField', 'models.CharField', ([], {'m... |
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import os
from .leafs import leafs
print("Reloaded preprocessing!")
def normalize(dataset):
'''normalize data so that over all imeges the pixels on place (x/y) have mean = 0 and are standart distributed'''
# calculate the mean
mean=np... | [
"numpy.save",
"matplotlib.pyplot.show",
"numpy.average",
"os.path.join",
"numpy.maximum",
"matplotlib.pyplot.imshow",
"os.walk",
"numpy.zeros",
"numpy.ones",
"PIL.Image.open",
"os.path.isfile",
"numpy.array",
"os.path.splitext",
"numpy.argwhere",
"matplotlib.pyplot.tight_layout",
"nump... | [((318, 350), 'numpy.zeros', 'np.zeros', (['dataset[0].image.shape'], {}), '(dataset[0].image.shape)\n', (326, 350), True, 'import numpy as np\n'), ((469, 501), 'numpy.zeros', 'np.zeros', (['dataset[0].image.shape'], {}), '(dataset[0].image.shape)\n', (477, 501), True, 'import numpy as np\n'), ((1774, 1806), 'os.walk',... |
import torch
import sys
import os
sys.path.append(os.getcwd())
sys.path.append(os.path.dirname(os.path.dirname(os.getcwd())))
from unimodals.MVAE import TSEncoder, TSDecoder # noqa
from utils.helper_modules import Sequential2 # noqa
from objective_functions.objectives_for_supervised_learning import MFM_objective # no... | [
"unimodals.MVAE.TSEncoder",
"datasets.affect.get_data.get_dataloader",
"training_structures.Supervised_Learning.train",
"torch.nn.MSELoss",
"unimodals.MVAE.TSDecoder",
"os.getcwd",
"fusions.common_fusions.Concat",
"torch.load",
"training_structures.Supervised_Learning.test",
"unimodals.common_mode... | [((859, 993), 'datasets.affect.get_data.get_dataloader', 'get_dataloader', (['"""/home/paul/MultiBench/mosi_raw.pkl"""'], {'task': '"""classification"""', 'robust_test': '(False)', 'max_pad': '(True)', 'max_seq_len': 'timestep'}), "('/home/paul/MultiBench/mosi_raw.pkl', task='classification',\n robust_test=False, ma... |
"""Command Line Interface of the nerblackbox package."""
import os
import subprocess
from os.path import join
import click
from typing import Dict, Any
from nerblackbox.modules.main import NerBlackBoxMain
################################################################################################################... | [
"subprocess.run",
"click.argument",
"os.getcwd",
"click.option",
"nerblackbox.modules.main.NerBlackBoxMain",
"os.environ.get",
"click.group",
"os.path.join"
] | [((457, 470), 'click.group', 'click.group', ([], {}), '()\n', (468, 470), False, 'import click\n'), ((472, 575), 'click.option', 'click.option', (['"""--data_dir"""'], {'default': '"""data"""', 'type': 'str', 'help': '"""[str] relative path of data directory"""'}), "('--data_dir', default='data', type=str, help=\n '... |
from config import logininfo
import re,json,time,configparser,logging,sys,os,requests,asyncio
def login(login_url, username, password):
#请求头
my_headers = {
'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36',
'Acce... | [
"logging.error",
"asyncio.get_event_loop",
"json.loads",
"logging.basicConfig",
"asyncio.sleep",
"requests.Session",
"logging.info",
"requests.get",
"asyncio.wait",
"configparser.ConfigParser",
"re.compile"
] | [((536, 554), 'requests.Session', 'requests.Session', ([], {}), '()\n', (552, 554), False, 'import re, json, time, configparser, logging, sys, os, requests, asyncio\n'), ((796, 811), 're.compile', 're.compile', (['reg'], {}), '(reg)\n', (806, 811), False, 'import re, json, time, configparser, logging, sys, os, requests... |
__author__ = "<NAME>"
__copyright__ = "Copyright 2020, <NAME>"
__email__ = "<EMAIL>"
__license__ = "BSD"
from snakemake.shell import shell
from os import path
import shutil
import tempfile
shell.executable("bash")
luascript = snakemake.params.get("lua_script")
if luascript:
luascriptprefix = "-lua {}".format(lu... | [
"snakemake.shell.shell.executable",
"snakemake.shell.shell"
] | [((192, 216), 'snakemake.shell.shell.executable', 'shell.executable', (['"""bash"""'], {}), "('bash')\n", (208, 216), False, 'from snakemake.shell import shell\n'), ((1002, 1162), 'snakemake.shell.shell', 'shell', (['"""(vcfanno {threadsprefix} {luascriptprefix} {basepathprefix} {conf} {incalls} | sed -e \'s/Number=A/N... |
import cv2 as cv
import numpy as np
image = cv.imread("boy.jpg",cv.IMREAD_COLOR) # we can even read it in grayscale image also
#image is the cv::mat object of the image
# COVERTING THE IMAGE TO GRAY SCLAE USING cvtColor method
gray_scale = cv.cvtColor(image, cv.COLOR_BGR2GRAY)
cv.imshow("Original Image",ima... | [
"cv2.cvtColor",
"cv2.waitKey",
"cv2.threshold",
"cv2.imread",
"cv2.imshow",
"cv2.resize"
] | [((48, 85), 'cv2.imread', 'cv.imread', (['"""boy.jpg"""', 'cv.IMREAD_COLOR'], {}), "('boy.jpg', cv.IMREAD_COLOR)\n", (57, 85), True, 'import cv2 as cv\n'), ((249, 286), 'cv2.cvtColor', 'cv.cvtColor', (['image', 'cv.COLOR_BGR2GRAY'], {}), '(image, cv.COLOR_BGR2GRAY)\n', (260, 286), True, 'import cv2 as cv\n'), ((290, 32... |
import random
import numpy as np
from utils import splitPoly
import matplotlib.patches as patches
import matplotlib.path as path
from matplotlib.transforms import Bbox
import cartopy.crs as ccrs
from spot import Spot
class Star:
# Stellar Radius in RSun, inclincation in degrees
# Limb darkening grid resolution... | [
"numpy.dstack",
"utils.splitPoly",
"matplotlib.patches.Path",
"cartopy.crs.RotatedPole",
"cartopy.crs.Geodetic",
"numpy.meshgrid",
"matplotlib.path.contains_points",
"matplotlib.transforms.Bbox",
"numpy.ma.masked_greater",
"numpy.column_stack",
"spot.Spot.gen_spot",
"numpy.ones",
"matplotlib... | [((1059, 1166), 'cartopy.crs.Globe', 'ccrs.Globe', ([], {'semimajor_axis': 'self.radius', 'semiminor_axis': 'self.radius', 'ellipse': '"""sphere"""', 'flattening': '(1e-09)'}), "(semimajor_axis=self.radius, semiminor_axis=self.radius, ellipse=\n 'sphere', flattening=1e-09)\n", (1069, 1166), True, 'import cartopy.crs... |
import json
import os
import shortuuid
from typing import List, NamedTuple, Optional
from .settings import LNBITS_PATH
class Extension(NamedTuple):
code: str
is_valid: bool
name: Optional[str] = None
short_description: Optional[str] = None
icon: Optional[str] = None
contributors: Optional[Li... | [
"shortuuid.uuid",
"json.load",
"os.path.join"
] | [((1493, 1509), 'shortuuid.uuid', 'shortuuid.uuid', ([], {}), '()\n', (1507, 1509), False, 'import shortuuid\n'), ((887, 907), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (896, 907), False, 'import json\n'), ((512, 551), 'os.path.join', 'os.path.join', (['LNBITS_PATH', '"""extensions"""'], {}), "(LN... |
"""
Create summary statistics / plots for runs from
evcouplings app
Authors:
<NAME>
"""
# chose backend for command-line usage
import matplotlib
matplotlib.use("Agg")
from collections import defaultdict
import filelock
import pandas as pd
import click
import matplotlib.pyplot as plt
from evcouplings.utils.system... | [
"pandas.DataFrame",
"click.argument",
"evcouplings.utils.config.read_config_file",
"filelock.FileLock",
"pandas.read_csv",
"matplotlib.pyplot.subplot2grid",
"click.command",
"collections.defaultdict",
"matplotlib.pyplot.figure",
"matplotlib.use",
"evcouplings.utils.system.valid_file"
] | [((149, 170), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (163, 170), False, 'import matplotlib\n'), ((13545, 13593), 'click.command', 'click.command', ([], {'context_settings': 'CONTEXT_SETTINGS'}), '(context_settings=CONTEXT_SETTINGS)\n', (13558, 13593), False, 'import click\n'), ((13610, 13... |
import shutil
import os
import argparse
import unittest
import io
from tokenizer.tokenizer import Tokenizer
class TestTokenizer(unittest.TestCase):
MODEL_DIR = os.path.expanduser('~/.cache/diaparser')
def setUp(self):
self.args = {
'lang': 'it',
'verbose': True
}
... | [
"io.StringIO",
"os.path.join",
"os.path.isdir",
"tokenizer.tokenizer.Tokenizer",
"os.path.expanduser"
] | [((167, 207), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.cache/diaparser"""'], {}), "('~/.cache/diaparser')\n", (185, 207), False, 'import os\n'), ((388, 416), 'tokenizer.tokenizer.Tokenizer', 'Tokenizer', (["self.args['lang']"], {}), "(self.args['lang'])\n", (397, 416), False, 'from tokenizer.tokenizer impor... |
"""
This file contains source code from another GitHub project. The comments made there apply. The source code
was licensed under the MIT License. The license text and a detailed reference can be found in the license
subfolder at models/east_open_cv/license. Many thanks to the author of the code.
For reasons of c... | [
"numpy.asarray",
"cv2.dnn.blobFromImage",
"time.time",
"cv2.dnn.readNet",
"numpy.sin",
"numpy.array",
"numpy.cos",
"cv2.resize"
] | [((1172, 1218), 'cv2.dnn.readNet', 'cv2.dnn.readNet', (['config.EAST_OPENCV_MODEL_PATH'], {}), '(config.EAST_OPENCV_MODEL_PATH)\n', (1187, 1218), False, 'import cv2\n'), ((2235, 2266), 'cv2.resize', 'cv2.resize', (['image', '(newW, newH)'], {}), '(image, (newW, newH))\n', (2245, 2266), False, 'import cv2\n'), ((2844, 2... |
from Class.rqlite import rqlite
import simple_acme_dns, requests, json, time, sys, os
class Cert(rqlite):
def updateCert(self,data):
print("updating",data[0])
response = self.execute(['UPDATE certs SET fullchain = ?,privkey = ?,updated = ? WHERE domain = ?',data[1],data[2],data[3],data[0]])
... | [
"requests.get",
"simple_acme_dns.ACMEClient",
"json.dumps",
"time.time"
] | [((328, 374), 'json.dumps', 'json.dumps', (['response'], {'indent': '(4)', 'sort_keys': '(True)'}), '(response, indent=4, sort_keys=True)\n', (338, 374), False, 'import simple_acme_dns, requests, json, time, sys, os\n'), ((1739, 1899), 'simple_acme_dns.ACMEClient', 'simple_acme_dns.ACMEClient', ([], {'domains': '[domai... |
from os import path
from setuptools import setup
from tools.generate_pyi import generate_pyi
def main():
# Generate .pyi files
import pyxtf.xtf_ctypes
generate_pyi(pyxtf.xtf_ctypes)
import pyxtf.vendors.kongsberg
generate_pyi(pyxtf.vendors.kongsberg)
# read the contents of README file
thi... | [
"os.path.dirname",
"tools.generate_pyi.generate_pyi",
"os.path.join",
"setuptools.setup"
] | [((165, 195), 'tools.generate_pyi.generate_pyi', 'generate_pyi', (['pyxtf.xtf_ctypes'], {}), '(pyxtf.xtf_ctypes)\n', (177, 195), False, 'from tools.generate_pyi import generate_pyi\n'), ((235, 272), 'tools.generate_pyi.generate_pyi', 'generate_pyi', (['pyxtf.vendors.kongsberg'], {}), '(pyxtf.vendors.kongsberg)\n', (247... |
#!/usr/bin/env python3
import argparse
from os import walk
from pprint import pprint
from re import fullmatch
from sys import argv
def is_excluded(file, excluded):
return any([fullmatch(ex, file) for ex in excluded])
def is_included(file, included):
return any([fullmatch(ex, file) for ex in included])
def... | [
"re.fullmatch",
"pprint.pprint",
"os.walk",
"argparse.ArgumentParser"
] | [((402, 416), 'os.walk', 'walk', (['root_dir'], {}), '(root_dir)\n', (406, 416), False, 'from os import walk\n'), ((1680, 1757), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Count files, lines, words and letters."""'}), "(description='Count files, lines, words and letters.')\n", (1703,... |
from unittest import TestCase
from unittest.mock import patch, mock_open
from datetime import datetime
import responses
from pygrocy import Grocy
from pygrocy.grocy import Product
from pygrocy.grocy import Group
from pygrocy.grocy import ShoppingListProduct
from pygrocy.grocy_api_client import CurrentStockResponse, Gro... | [
"responses.add",
"unittest.mock.patch",
"unittest.mock.mock_open",
"pygrocy.Grocy",
"pygrocy.grocy_api_client.CurrentStockResponse",
"pygrocy.grocy.Product",
"pygrocy.grocy_api_client.GrocyApiClient"
] | [((403, 442), 'pygrocy.Grocy', 'Grocy', (['"""https://example.com"""', '"""api_key"""'], {}), "('https://example.com', 'api_key')\n", (408, 442), False, 'from pygrocy import Grocy\n'), ((1571, 1666), 'responses.add', 'responses.add', (['responses.GET', '"""https://example.com:9192/api/chores"""'], {'json': 'resp', 'sta... |
# Copyright - Transporation, Bots, and Disability Lab - Carnegie Mellon University
# Released under MIT License
"""
Common Operations/Codes that are re-written on Baxter
"""
import numpy as np
from pyquaternion import Quaternion
from alloy.math import *
__all__ = [
'convert_joint_angles_to_numpy','transform_pose... | [
"pyquaternion.Quaternion",
"numpy.zeros"
] | [((595, 606), 'numpy.zeros', 'np.zeros', (['(7)'], {}), '(7)\n', (603, 606), True, 'import numpy as np\n'), ((1186, 1197), 'numpy.zeros', 'np.zeros', (['(6)'], {}), '(6)\n', (1194, 1197), True, 'import numpy as np\n'), ((1346, 1364), 'pyquaternion.Quaternion', 'Quaternion', (['p2[3:]'], {}), '(p2[3:])\n', (1356, 1364),... |
from django.conf.urls import url
from .views import impersonate, list_users, search_users, stop_impersonate
try:
# Django <=1.9
from django.conf.urls import patterns
except ImportError:
patterns = None
urlpatterns = [
url(r'^stop/$',
stop_impersonate,
name='impersonate-stop'),
url... | [
"django.conf.urls.patterns",
"django.conf.urls.url"
] | [((237, 294), 'django.conf.urls.url', 'url', (['"""^stop/$"""', 'stop_impersonate'], {'name': '"""impersonate-stop"""'}), "('^stop/$', stop_impersonate, name='impersonate-stop')\n", (240, 294), False, 'from django.conf.urls import url\n'), ((317, 417), 'django.conf.urls.url', 'url', (['"""^list/$"""', 'list_users', "{'... |