code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | [
"django.db.models.OneToOneField",
"django.db.models.FloatField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.ManyToManyField",
"django.db.models.FileField",
"django.db.models.BooleanField",
"django.db.models.ImageField",
"django.d... | [((210, 267), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (241, 267), False, 'from django.db import models, migrations\n'), ((13564, 13611), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'to': '"""api.Tag... |
import importlib.metadata as ilmd
from textwrap import dedent
def main():
for key in ["flake8.extension", "flake8.report"]:
print(
dedent(
f"""
{key}
{'=' * len(key)}
{ilmd.entry_points().get(key, "(none)")}
"""
)
)
if __name__ == "__main__":
... | [
"importlib.metadata.entry_points"
] | [((239, 258), 'importlib.metadata.entry_points', 'ilmd.entry_points', ([], {}), '()\n', (256, 258), True, 'import importlib.metadata as ilmd\n')] |
from aiogram import types
from aiogram.dispatcher import FSMContext
from aiogram.dispatcher.filters import Command
from antiplagiat import Antiplagiat
from data.config import ADVEGO_TOKEN
from loader import dp, _
api = Antiplagiat(ADVEGO_TOKEN)
async def antiplagiator(text):
result = api.unique_text_add(text)
... | [
"loader._",
"antiplagiat.Antiplagiat",
"loader.dp.message_handler",
"aiogram.dispatcher.filters.Command"
] | [((221, 246), 'antiplagiat.Antiplagiat', 'Antiplagiat', (['ADVEGO_TOKEN'], {}), '(ADVEGO_TOKEN)\n', (232, 246), False, 'from antiplagiat import Antiplagiat\n'), ((916, 959), 'loader.dp.message_handler', 'dp.message_handler', ([], {'state': '"""process_plagiat"""'}), "(state='process_plagiat')\n", (934, 959), False, 'fr... |
'''
Testers use 3 approaches for Dropdown controls in web test automation using Selenium.
1. Using Selenium's Select class as it provides higher level methods.
2. Using sendKeys() method of WebElement.
3. (Especially for custom select controls) - Click the drop down control and then click the option.
Arjuna tries to ... | [
"arjuna.revised.tpi.guiauto.helpers.With.id",
"arjuna.revised.tpi.guiauto.helpers.With.link_text",
"arjuna.revised.tpi.Arjuna.init",
"arjuna.revised.tpi.Arjuna.get_central_config"
] | [((644, 657), 'arjuna.revised.tpi.Arjuna.init', 'Arjuna.init', ([], {}), '()\n', (655, 657), False, 'from arjuna.revised.tpi import Arjuna\n'), ((742, 769), 'arjuna.revised.tpi.Arjuna.get_central_config', 'Arjuna.get_central_config', ([], {}), '()\n', (767, 769), False, 'from arjuna.revised.tpi import Arjuna\n'), ((878... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from dataclasses import dataclass
from ax.exceptions.core import UserInputError
from ax.modelbridge.generation_strategy import GenerationSt... | [
"ax.exceptions.core.UserInputError",
"dataclasses.dataclass"
] | [((432, 454), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (441, 454), False, 'from dataclasses import dataclass\n'), ((952, 1040), 'ax.exceptions.core.UserInputError', 'UserInputError', (['"""SchedulerOptions.total_trials may not be None in BenchmarkMethod."""'], {}), "(\n 'S... |
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is... | [
"torch.manual_seed",
"loguru.logger.info",
"argparse.ArgumentParser",
"torch.rand",
"torch.max",
"time.perf_counter",
"torch.min",
"torch.cuda.synchronize",
"torch.tensor",
"open3d.geometry.TriangleMesh",
"bvh_distance_queries.BVH",
"psbody.mesh.Mesh",
"open3d.geometry.PointCloud",
"open3d... | [((1194, 1214), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (1206, 1214), False, 'import torch\n'), ((1229, 1308), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\... |
import PIL.Image,PIL.ImageDraw,PIL.ImageFont,PIL.ImageFilter
import random
#随机字母
def rndchar():
return chr(random.randint(65, 90))
#random.randint()函数生成随机数字,数字范围为在65 到90内,在此范围内的美国标准信息编码是大写的A-Z
#chr(kk) 函数,kk为整数,asc编码值,函数返回asc编码为kk 的对应的字符
#随机颜色1
def rndcolor():
return random.randint(64, 255),random.randint(64... | [
"random.randint"
] | [((112, 134), 'random.randint', 'random.randint', (['(65)', '(90)'], {}), '(65, 90)\n', (126, 134), False, 'import random\n'), ((279, 302), 'random.randint', 'random.randint', (['(64)', '(255)'], {}), '(64, 255)\n', (293, 302), False, 'import random\n'), ((303, 326), 'random.randint', 'random.randint', (['(64)', '(255)... |
# Advent of Code 2015
#
# From https://adventofcode.com/2015/day/12
import json
import re
filename = ''
data = [re.findall(r'(-?\d+)', row.strip()) for row in open(f'../inputs/Advent2015_12{filename}.json', 'r')]
print(f"AoC 2015 Day 12, Part 1 answer is {sum(int(x[0]) for x in data if x)}")
with open(f'../inputs/A... | [
"json.load"
] | [((380, 400), 'json.load', 'json.load', (['read_file'], {}), '(read_file)\n', (389, 400), False, 'import json\n')] |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.ads.google_ads.v0.proto.resources import keyword_view_pb2 as google_dot_ads_dot_googleads__v0_dot_proto_dot_resources_dot_keyword__view__pb2
from google.ads.google_ads.v0.proto.services import keyword_view_service_pb2 as goog... | [
"grpc.method_handlers_generic_handler",
"grpc.unary_unary_rpc_method_handler"
] | [((1892, 2009), 'grpc.method_handlers_generic_handler', 'grpc.method_handlers_generic_handler', (['"""google.ads.googleads.v0.services.KeywordViewService"""', 'rpc_method_handlers'], {}), "(\n 'google.ads.googleads.v0.services.KeywordViewService', rpc_method_handlers)\n", (1928, 2009), False, 'import grpc\n'), ((149... |
from typing import Optional
from werkzeug.security import check_password_hash
from .models.user import User
def authenticate(username, password) -> Optional[User]:
user = User.find_by_username(username)
if user and check_password_hash(user.hashed_password, password):
return user
return None
de... | [
"werkzeug.security.check_password_hash"
] | [((227, 278), 'werkzeug.security.check_password_hash', 'check_password_hash', (['user.hashed_password', 'password'], {}), '(user.hashed_password, password)\n', (246, 278), False, 'from werkzeug.security import check_password_hash\n')] |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='django-git',
version='0.1.0',
description='Get git information for your django repository',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
url='https://github.com/spapas/django-git/',
zip_safe=False... | [
"setuptools.find_packages"
] | [((367, 420), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests.*', 'tests', 'sample']"}), "(exclude=['tests.*', 'tests', 'sample'])\n", (380, 420), False, 'from setuptools import setup, find_packages\n')] |
from __future__ import print_function
from astrometry.util.fits import *
import pylab as plt
import numpy as np
from glob import glob
from astrometry.util.plotutils import *
from astrometry.libkd.spherematch import *
from astrometry.util.resample import *
from astrometry.util.util import *
ps = PlotSequence('cosmos')
... | [
"pylab.title",
"numpy.log10",
"pylab.hist",
"numpy.sqrt",
"pylab.subplot",
"numpy.round",
"numpy.flatnonzero",
"pylab.xlabel",
"pylab.legend",
"numpy.zeros",
"numpy.deg2rad",
"glob.glob",
"pylab.xlim",
"pylab.clf",
"pylab.suptitle",
"pylab.imshow"
] | [((4483, 4558), 'numpy.flatnonzero', 'np.flatnonzero', (['((galdepthA[yy, xx] > thresh) * (galdepthB[yy, xx] > thresh))'], {}), '((galdepthA[yy, xx] > thresh) * (galdepthB[yy, xx] > thresh))\n', (4497, 4558), True, 'import numpy as np\n'), ((4795, 4870), 'numpy.flatnonzero', 'np.flatnonzero', (['((galdepthA[yy, xx] > t... |
import yaml
class ModelYaml():
FileName = "model.yaml"
def __init__(
self,
yamlText: str
):
o = yaml.load(
yamlText,
Loader=yaml.SafeLoader
)
ModelYaml._shouldNotEmpty(o, [
"version",
"kind",
"nam... | [
"yaml.load",
"yaml.dump"
] | [((143, 186), 'yaml.load', 'yaml.load', (['yamlText'], {'Loader': 'yaml.SafeLoader'}), '(yamlText, Loader=yaml.SafeLoader)\n', (152, 186), False, 'import yaml\n'), ((488, 503), 'yaml.dump', 'yaml.dump', (['self'], {}), '(self)\n', (497, 503), False, 'import yaml\n')] |
import time
import pytest
@pytest.mark.parametrize("index", range(7))
def test_cat(index):
"""Perform several tests with varying execution times."""
time.sleep(0.2 + (index * 0.1))
assert True
| [
"time.sleep"
] | [((158, 187), 'time.sleep', 'time.sleep', (['(0.2 + index * 0.1)'], {}), '(0.2 + index * 0.1)\n', (168, 187), False, 'import time\n')] |
import gym
import numpy as np
import matplotlib.pyplot as plt
def policy(state, theta):
""" TODO: return probabilities for actions under softmax action selection """
h = state @ theta
return np.exp(h)/np.sum(np.exp(h))
def generate_episode(env, theta, display=False):
""" enerates one episode and ret... | [
"matplotlib.pyplot.savefig",
"numpy.random.rand",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.exp",
"numpy.zeros",
"matplotlib.pyplot.title",
"gym.make",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((913, 933), 'numpy.random.rand', 'np.random.rand', (['(4)', '(2)'], {}), '(4, 2)\n', (927, 933), True, 'import numpy as np\n'), ((2139, 2162), 'gym.make', 'gym.make', (['"""CartPole-v1"""'], {}), "('CartPole-v1')\n", (2147, 2162), False, 'import gym\n'), ((2200, 2221), 'matplotlib.pyplot.plot', 'plt.plot', (['mean_ep... |
import unittest
from ghostwriter import app, mm
#
# Post basic test fixture(?)
# Copyright (C) 2017 <NAME>
#
class PostArticleTestCase(unittest.TestCase):
from flask import json
def setUp(self):
mm.setDatabaseURI('sqlite:////tmp/unittest.db')
mm.init()
mm.create()
self.app ... | [
"datetime.datetime",
"ghostwriter.mm.drop",
"json.loads",
"ghostwriter.mm.init",
"ghostwriter.app.test_client",
"ghostwriter.mm.setDatabaseURI",
"ghostwriter.Post.Post",
"ghostwriter.Post.PostManager",
"ghostwriter.mm.create",
"ghostwriter.User.User",
"ghostwriter.UserManager.UserManager"
] | [((217, 264), 'ghostwriter.mm.setDatabaseURI', 'mm.setDatabaseURI', (['"""sqlite:////tmp/unittest.db"""'], {}), "('sqlite:////tmp/unittest.db')\n", (234, 264), False, 'from ghostwriter import app, mm\n'), ((273, 282), 'ghostwriter.mm.init', 'mm.init', ([], {}), '()\n', (280, 282), False, 'from ghostwriter import app, m... |
import os
import path
def get_location(text):
lines = text.split("\n")
res = []
for line in lines:
if not line.startswith("~~ location"):
break
_, _, key, path = line.split()
res.append((key, path))
return res
def render(text, key):
lines = text.split("\n")
... | [
"os.listdir"
] | [((1029, 1045), 'os.listdir', 'os.listdir', (['"""./"""'], {}), "('./')\n", (1039, 1045), False, 'import os\n')] |
import argparse
import os
import pika
from decouple import config
import importlib
simple_queue_read = importlib.import_module('simple_queue_read')
simple_queue_publish = importlib.import_module('simple_queue_publish')
URL = config('URL')
url = os.environ.get('CLOUDAMQP_URL', URL)
params = pika.URLParameters(url)
pa... | [
"importlib.import_module",
"argparse.ArgumentParser",
"pika.URLParameters",
"decouple.config",
"os.environ.get",
"pika.BlockingConnection"
] | [((104, 148), 'importlib.import_module', 'importlib.import_module', (['"""simple_queue_read"""'], {}), "('simple_queue_read')\n", (127, 148), False, 'import importlib\n'), ((172, 219), 'importlib.import_module', 'importlib.import_module', (['"""simple_queue_publish"""'], {}), "('simple_queue_publish')\n", (195, 219), F... |
from __future__ import annotations
from .__version__ import __version__ # noqa
from .lib import export
from typing import Type, TypeVar, List, Dict
import praw # type: ignore
import requests
__all__ = [] # type: List
__header__ = 'plex_posters'
# __section__ = 'module'
T_movie_poster_porn_scraper = TypeVar(
'... | [
"praw.Reddit",
"requests.get",
"typing.TypeVar"
] | [((306, 379), 'typing.TypeVar', 'TypeVar', (['"""T_movie_poster_porn_scraper"""'], {'bound': '"""movie_poster_porn_scraper"""'}), "('T_movie_poster_porn_scraper', bound='movie_poster_porn_scraper')\n", (313, 379), False, 'from typing import Type, TypeVar, List, Dict\n'), ((1359, 1448), 'praw.Reddit', 'praw.Reddit', ([]... |
#!/usr/bin/env python
from __future__ import division, unicode_literals
import argparse
from onmt.translate.Translator import make_translator
import onmt.io
import onmt.translate
import onmt
import onmt.ModelConstructor
import onmt.modules
import onmt.opts
import timeit
def main(opt):
translator = mak... | [
"onmt.opts.translate_opts",
"argparse.ArgumentParser",
"timeit.default_timer",
"onmt.translate.Translator.make_translator",
"onmt.opts.add_md_help_argument"
] | [((317, 356), 'onmt.translate.Translator.make_translator', 'make_translator', (['opt'], {'report_score': '(True)'}), '(opt, report_score=True)\n', (332, 356), False, 'from onmt.translate.Translator import make_translator\n'), ((374, 396), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (394, 396), Fal... |
# Generated by Django 2.2.16 on 2020-10-13 20:06
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('measurement', '0017_auto_20200609_0533'),
]
operations = [
migrations.RemoveIndex(
model_name='measurement',
name='measurem... | [
"django.db.migrations.RemoveIndex"
] | [((232, 324), 'django.db.migrations.RemoveIndex', 'migrations.RemoveIndex', ([], {'model_name': '"""measurement"""', 'name': '"""measurement_endtime_e347a7_idx"""'}), "(model_name='measurement', name=\n 'measurement_endtime_e347a7_idx')\n", (254, 324), False, 'from django.db import migrations\n'), ((364, 454), 'djan... |
from setuptools import setup
install_requires = ['beautifulsoup4',
'simplejson',
'slacker',
'jira',
'requests',
'websocket-client']
setup(name='linkbot',
install_requires=install_requires,
description='slac... | [
"setuptools.setup"
] | [((234, 362), 'setuptools.setup', 'setup', ([], {'name': '"""linkbot"""', 'install_requires': 'install_requires', 'description': '"""slackbot listening for mentions of jira issues, etc"""'}), "(name='linkbot', install_requires=install_requires, description=\n 'slackbot listening for mentions of jira issues, etc')\n"... |
# Generated by Django 2.2.5 on 2019-10-01 15:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("build", "0029_build_org_note")]
operations = [
migrations.AddField(
model_name="build", name="priority", field=models.IntegerField(default=0)... | [
"django.db.models.IntegerField"
] | [((290, 320), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)'}), '(default=0)\n', (309, 320), False, 'from django.db import migrations, models\n')] |
# Generated by Django 3.0.2 on 2020-01-25 19:30
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('restaurant', '0003_recipe_ingreiends'),
]
operations = [
migrations.RemoveField(
model_name='recipe',
name='ingreiends',
... | [
"django.db.migrations.RemoveField"
] | [((229, 291), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""recipe"""', 'name': '"""ingreiends"""'}), "(model_name='recipe', name='ingreiends')\n", (251, 291), False, 'from django.db import migrations\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-10-08 01:12
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations... | [
"django.db.models.FloatField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.FileField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((310, 367), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (341, 367), False, 'from django.db import migrations, models\n'), ((9689, 9798), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', ... |
# routes for front-end part of project
from flask import url_for, render_template, request
from server import app
@app.route('/', methods = ['GET'])
def index_page():
return render_template('/front-end/index.html')
@app.route('/login', methods = ['GET'])
def login_page():
return render_templat... | [
"flask.render_template",
"flask.request.args.get",
"server.app.route",
"flask.url_for"
] | [((126, 157), 'server.app.route', 'app.route', (['"""/"""'], {'methods': "['GET']"}), "('/', methods=['GET'])\n", (135, 157), False, 'from server import app\n'), ((236, 272), 'server.app.route', 'app.route', (['"""/login"""'], {'methods': "['GET']"}), "('/login', methods=['GET'])\n", (245, 272), False, 'from server imp... |
from uff.ic.mell.sentimentembedding.utils.data_converstion_utils import convert_tensor2array
from uff.ic.mell.sentimentembedding.modelos.modelo import Modelo
import pandas as pd
import numpy as np
import torch
from enum import Enum
from tokenizers import ByteLevelBPETokenizer
class ModeloTransformer(Modelo):
# m... | [
"torch.mean",
"torch.unsqueeze",
"torch.tensor",
"enum.Enum",
"tokenizers.ByteLevelBPETokenizer",
"pandas.DataFrame",
"torch.no_grad"
] | [((569, 637), 'enum.Enum', 'Enum', (['"""METHOD"""', '"""CONTEXT_CONCAT CONTEXT_LAST CONTEXT_CLS STATIC_AVG"""'], {}), "('METHOD', 'CONTEXT_CONCAT CONTEXT_LAST CONTEXT_CLS STATIC_AVG')\n", (573, 637), False, 'from enum import Enum\n'), ((6246, 6287), 'torch.mean', 'torch.mean', (['embeddings_palavras[0]'], {'dim': '(0)... |
import editdistance
class EditDistanceService:
INSTACE = None
@classmethod
def create(cls):
if cls.INSTACE is None:
cls.INSTACE = EditDistanceService()
@classmethod
def instance(cls):
if cls.INSTACE is None:
cls.create()
return cls.INSTACE
def... | [
"editdistance.eval"
] | [((367, 400), 'editdistance.eval', 'editdistance.eval', (['words1', 'words2'], {}), '(words1, words2)\n', (384, 400), False, 'import editdistance\n')] |
import gym
from tf_rl.common.memory import ReplayBuffer
size = 100000
env = gym.make("CartPole-v0")
memory = ReplayBuffer(size=size, traj_dir="./traj/")
state = env.reset()
action = env.action_space.sample()
next_state, reward, done, info = env.step(action)
env.close()
for _ in range(size):
memory.add(state, acti... | [
"tf_rl.common.memory.ReplayBuffer",
"gym.make"
] | [((76, 99), 'gym.make', 'gym.make', (['"""CartPole-v0"""'], {}), "('CartPole-v0')\n", (84, 99), False, 'import gym\n'), ((109, 152), 'tf_rl.common.memory.ReplayBuffer', 'ReplayBuffer', ([], {'size': 'size', 'traj_dir': '"""./traj/"""'}), "(size=size, traj_dir='./traj/')\n", (121, 152), False, 'from tf_rl.common.memory ... |
import numpy as np
import pandas as pd
from sklearn.model_selection import StratifiedKFold
import lightgbm as lgb
import xgboost as xgb
# read dataset
df_train = pd.read_csv('train.csv')
df_test = pd.read_csv('test.csv')
# gini function
def gini(actual, pred, cmpcol = 0, sortcol = 1):
assert( len(actual) == len(p... | [
"pandas.read_csv",
"xgboost.train",
"lightgbm.train",
"sklearn.model_selection.StratifiedKFold",
"numpy.lexsort",
"lightgbm.Dataset",
"pandas.DataFrame",
"xgboost.DMatrix",
"numpy.zeros_like"
] | [((163, 187), 'pandas.read_csv', 'pd.read_csv', (['"""train.csv"""'], {}), "('train.csv')\n", (174, 187), True, 'import pandas as pd\n'), ((198, 221), 'pandas.read_csv', 'pd.read_csv', (['"""test.csv"""'], {}), "('test.csv')\n", (209, 221), True, 'import pandas as pd\n'), ((1012, 1060), 'sklearn.model_selection.Stratif... |
import os
import re
import warnings
from uuid import uuid4, UUID
import shapely.geometry
import geopandas as gpd
import pandas as pd
import numpy as np
from geojson import LineString, Point, Polygon, Feature, FeatureCollection, MultiPolygon
try:
import simplejson as json
except ImportError:
import json
from ... | [
"json.loads",
"geojson.FeatureCollection",
"uuid.UUID",
"os.path.isabs",
"os.makedirs",
"geojson.Feature",
"os.path.join",
"warnings.catch_warnings",
"uuid.uuid4",
"warnings.simplefilter",
"geopandas.GeoDataFrame.from_dict",
"pandas.DataFrame",
"re.search"
] | [((3981, 4016), 'pandas.DataFrame', 'pd.DataFrame', (['uris'], {'columns': "['uri']"}), "(uris, columns=['uri'])\n", (3993, 4016), True, 'import pandas as pd\n'), ((9949, 10001), 'geopandas.GeoDataFrame.from_dict', 'gpd.GeoDataFrame.from_dict', (['features'], {'orient': '"""index"""'}), "(features, orient='index')\n", ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models
import torchvision.datasets.folder
import torchvision.transforms as transforms
import torchvision.transforms.functional as Ft
from pytorch_transformers import BertTokenizer
import os
import db
from PIL import Image
import cv2
i... | [
"numpy.uint8",
"numpy.prod",
"numpy.copyto",
"sys.path.insert",
"numpy.sqrt",
"qa_classifier",
"cv2.rectangle",
"fast_rcnn.test.im_detect",
"torchvision.transforms.functional.to_pil_image",
"torch.LongTensor",
"numpy.hstack",
"numpy.log",
"time.sleep",
"torch.exp",
"numpy.argsort",
"to... | [((380, 424), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""./bottom-up-attention/"""'], {}), "(0, './bottom-up-attention/')\n", (395, 424), False, 'import sys\n'), ((425, 482), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""./bottom-up-attention/caffe/python/"""'], {}), "(0, './bottom-up-attention/caffe/pytho... |
import cv2
import numpy as np
from pyautogui import screenshot
from pyautogui import size as get_screen_size
from core.screen.screen_rectangle import ScreenRectangle
class ScreenshotImage:
def __init__(self, in_region: ScreenRectangle = None):
screen_width, screen_height = get_screen_size()
regio... | [
"cv2.threshold",
"numpy.array",
"pyautogui.screenshot",
"pyautogui.size"
] | [((289, 306), 'pyautogui.size', 'get_screen_size', ([], {}), '()\n', (304, 306), True, 'from pyautogui import size as get_screen_size\n'), ((554, 591), 'pyautogui.screenshot', 'screenshot', ([], {'region': 'region_coordinates'}), '(region=region_coordinates)\n', (564, 591), False, 'from pyautogui import screenshot\n'),... |
from typing import (List,
Tuple)
from tests.utils import (RawPointsList,
RawPolygon,
enum_to_values)
from wagyu.bound import Bound as PortedBound
from wagyu.box import Box as PortedBox
from wagyu.edge import Edge as PortedEdge
from wagyu.enums impor... | [
"tests.utils.enum_to_values",
"wagyu.point.Point",
"wagyu.local_minimum.LocalMinimumList"
] | [((1781, 1811), 'tests.utils.enum_to_values', 'enum_to_values', (['PortedEdgeSide'], {}), '(PortedEdgeSide)\n', (1795, 1811), False, 'from tests.utils import RawPointsList, RawPolygon, enum_to_values\n'), ((1832, 1862), 'tests.utils.enum_to_values', 'enum_to_values', (['PortedFillKind'], {}), '(PortedFillKind)\n', (184... |
#!/usr/bin/env python3
import glob
import json
import xml.dom.minidom as minidom
import json
install = minidom.parse('build/install.rdf')
ta = install.getElementsByTagNameNS('*', 'targetApplication')[0]
with open('schema/supported.json') as f:
min_version = json.load(f)
for client, version in min_version.items():... | [
"json.load",
"xml.dom.minidom.parse"
] | [((105, 139), 'xml.dom.minidom.parse', 'minidom.parse', (['"""build/install.rdf"""'], {}), "('build/install.rdf')\n", (118, 139), True, 'import xml.dom.minidom as minidom\n'), ((263, 275), 'json.load', 'json.load', (['f'], {}), '(f)\n', (272, 275), False, 'import json\n')] |
import urllib.request
import json
import sys
import os
data = ''
url = sys.argv[1]
output_folder = sys.argv[2]
file_name = sys.argv[3]
with urllib.request.urlopen(url) as response:
data = response.read().decode('utf-8')
index = 1
filename = output_folder + '/' + file_name + '.json'
os.makedirs(os.path.dirname(fil... | [
"os.path.dirname"
] | [((301, 326), 'os.path.dirname', 'os.path.dirname', (['filename'], {}), '(filename)\n', (316, 326), False, 'import os\n')] |
from pprint import pprint
import argparse
def parse_args():
parser = argparse.ArgumentParser()
# Data input settings
parser.add_argument('--dataset', type=str, default='Semantic_Segmentation_Dataset/', help='name of dataset')
# Optimization: General
parser.add_argument('--bs', type=int, default = ... | [
"pprint.pprint",
"argparse.ArgumentParser"
] | [((75, 100), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (98, 100), False, 'import argparse\n'), ((1607, 1641), 'pprint.pprint', 'pprint', (['"""parsed input parameters:"""'], {}), "('parsed input parameters:')\n", (1613, 1641), False, 'from pprint import pprint\n'), ((1646, 1657), 'pprint.p... |
# Copyright 2016-2020 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Torque backend
#
# - Initial version submitted by <NAME>, <NAME> (VUB)
#
import re
import os
import time
import reframe.u... | [
"reframe.core.exceptions.JobSchedulerError",
"os.path.exists",
"reframe.core.exceptions.JobError",
"os.path.join",
"reframe.core.logging.getlogger",
"re.sub",
"reframe.core.backends.register_scheduler",
"time.time",
"re.search"
] | [((753, 781), 'reframe.core.backends.register_scheduler', 'register_scheduler', (['"""torque"""'], {}), "('torque')\n", (771, 781), False, 'from reframe.core.backends import register_scheduler\n'), ((2071, 2202), 'reframe.core.exceptions.JobSchedulerError', 'JobSchedulerError', (['f"""qstat failed with exit code {compl... |
import random
import logging
import numpy as np
import tensorflow as tf
class DeepQNetworkModel:
def __init__(self,
session,
layers_size,
memory,
default_batch_size=None,
default_learning_rate=None,
default_epsil... | [
"tensorflow.compat.v1.placeholder",
"tensorflow.compat.v1.variable_scope",
"logging.debug",
"tensorflow.compat.v1.get_variable_scope",
"tensorflow.compat.v1.train.AdamOptimizer",
"numpy.argmax",
"logging.info",
"numpy.squeeze",
"tensorflow.reduce_max",
"tensorflow.exp",
"numpy.zeros",
"tensorf... | [((8348, 8363), 'random.random', 'random.random', ([], {}), '()\n', (8361, 8363), False, 'import random\n'), ((10521, 10590), 'tensorflow.compat.v1.placeholder', 'tf.compat.v1.placeholder', ([], {'shape': '(None, output_size)', 'dtype': 'tf.float32'}), '(shape=(None, output_size), dtype=tf.float32)\n', (10545, 10590), ... |
"""
Training utilities.
Author: <NAME> (<EMAIL>)
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import glob
import os
import sys
import tensorflow as tf
import time
from google.protobuf.text_format import Merge, MessageToString
from fewshot.data.data... | [
"os.path.exists",
"os.makedirs",
"os.path.join",
"os.path.isdir",
"google.protobuf.text_format.MessageToString",
"time.time",
"fewshot.data.data_factory.get_dataset"
] | [((849, 893), 'os.path.join', 'os.path.join', (['save_folder', '"""config.prototxt"""'], {}), "(save_folder, 'config.prototxt')\n", (861, 893), False, 'import os\n'), ((776, 802), 'os.path.isdir', 'os.path.isdir', (['save_folder'], {}), '(save_folder)\n', (789, 802), False, 'import os\n'), ((808, 832), 'os.makedirs', '... |
# The original GA algorithm is here:
import numpy as np, random, operator, pandas as pd, matplotlib.pyplot as plt
import math
class City:
def __init__(self, x, y):
self.x = x
self.y = y
def distance(self, city):
xDis = abs(self.x - city.x)
yDis = abs(self.y - city.y)
... | [
"random.sample",
"matplotlib.pyplot.savefig",
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.clf",
"numpy.asarray",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"operator.itemgetter",
"random.random"
] | [((4760, 4774), 'numpy.asarray', 'np.asarray', (['l1'], {}), '(l1)\n', (4770, 4774), True, 'import numpy as np, random, operator, pandas as pd, matplotlib.pyplot as plt\n'), ((4779, 4788), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (4786, 4788), True, 'import numpy as np, random, operator, pandas as pd, matp... |
import sys
import yahooscraper as ys
from datetime import datetime, date
from urllib.parse import urljoin
# Environment variables
USERNAME_ENV = 'YAHOO_USERNAME'
PASSWORD_ENV = '<PASSWORD>'
# Command-line args
REQUIRED_ARGS = [
'<league_id>',
'<team_id>'
]
OPTIONAL_ARGS = []
# Error messages
LOGIN_ERROR_MS... | [
"datetime.datetime.strptime",
"yahooscraper.fantasy.team.league",
"yahooscraper.fantasy.team.url",
"yahooscraper.fantasy.team.team",
"datetime.date.today"
] | [((1473, 1485), 'datetime.date.today', 'date.today', ([], {}), '()\n', (1483, 1485), False, 'from datetime import datetime, date\n'), ((1901, 1938), 'yahooscraper.fantasy.team.league', 'ys.fantasy.team.league', (['response.text'], {}), '(response.text)\n', (1923, 1938), True, 'import yahooscraper as ys\n'), ((1950, 198... |
import sys
import os
from .gdb import Gdb
from .oocd import Oocd
from .hw_specific import *
# useful if there is some variety of naming
hw_names = {
"esp32s2beta": "Esp32_S2",
"esp32s2_beta": "Esp32_S2",
"esp32_s2beta": "Esp32_S2",
"esp32_s2_beta": "Esp32_S2",
"esp32s2": "Esp32_S2",
"esp32-s2"... | [
"os.path.dirname",
"os.path.splitext",
"os.path.join"
] | [((525, 550), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (540, 550), False, 'import os\n'), ((574, 604), 'os.path.join', 'os.path.join', (['p', '"""hw_specific"""'], {}), "(p, 'hw_specific')\n", (586, 604), False, 'import os\n'), ((649, 668), 'os.path.splitext', 'os.path.splitext', (['f']... |
import FWCore.ParameterSet.Config as cms
from RecoJets.JetProducers.PFClusterJetParameters_cfi import *
from RecoJets.JetProducers.AnomalousCellParameters_cfi import *
ak4PFClusterJets = cms.EDProducer(
"FastjetJetProducer",
PFClusterJetParameters,
AnomalousCellParameters,
jetAlgorithm = cms.string("A... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.double"
] | [((307, 327), 'FWCore.ParameterSet.Config.string', 'cms.string', (['"""AntiKt"""'], {}), "('AntiKt')\n", (317, 327), True, 'import FWCore.ParameterSet.Config as cms\n'), ((348, 363), 'FWCore.ParameterSet.Config.double', 'cms.double', (['(0.4)'], {}), '(0.4)\n', (358, 363), True, 'import FWCore.ParameterSet.Config as cm... |
#!/usr/bin/env python3
import argparse
import os
import subprocess
import sys
from shutil import copyfile
from parser import parse, generate_ast, apply_transformations, ASTDump
from parse_debug import process_debug_info
def parse_args(argv):
parser = argparse.ArgumentParser(description='Simplified CC1 frontend')... | [
"os.path.exists",
"parser.ASTDump",
"argparse.ArgumentParser",
"parser.parse",
"subprocess.Popen",
"subprocess.run",
"os.remove",
"shutil.copyfile",
"subprocess.call",
"parse_debug.process_debug_info",
"os.path.basename",
"parser.apply_transformations",
"parser.generate_ast"
] | [((258, 320), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Simplified CC1 frontend"""'}), "(description='Simplified CC1 frontend')\n", (281, 320), False, 'import argparse\n'), ((1640, 1665), 'subprocess.call', 'subprocess.call', (['cpp_args'], {}), '(cpp_args)\n', (1655, 1665), False, ... |
# AUTOGENERATED FILE - DO NOT MODIFY!
# This file generated by Djinni from constants.djinni
from djinni.support import MultiSet # default imported in all files
from djinni.exception import CPyException # default imported in all files
from djinni.pycffi_marshal import CPyPrimitive, CPyRecord, CPyString
from PyCFFIlib_c... | [
"djinni.support.MultiSet"
] | [((548, 558), 'djinni.support.MultiSet', 'MultiSet', ([], {}), '()\n', (556, 558), False, 'from djinni.support import MultiSet\n')] |
import boto3
from botocore.config import Config
from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import ensure_csrf_cookie
from rest_framework import status
... | [
"django.shortcuts.render",
"misc.serializers.FileSerializer",
"django.core.management.call_command",
"sequences.models.Sequence.objects.get",
"django.http.HttpResponse",
"botocore.config.Config",
"django.shortcuts.get_object_or_404",
"django.utils.decorators.method_decorator",
"rest_framework.respon... | [((911, 940), 'django.shortcuts.render', 'render', (['request', '"""index.html"""'], {}), "(request, 'index.html')\n", (917, 940), False, 'from django.shortcuts import get_object_or_404, render\n'), ((2818, 2854), 'django.utils.decorators.method_decorator', 'method_decorator', (['ensure_csrf_cookie'], {}), '(ensure_csr... |
import torch
import torch.nn.functional as F
def focal_loss(input: torch.Tensor, target: torch.Tensor, alpha: float = 0.25, gamma: float = 2, reduction: str = 'none'):
pt = F.softmax(input, dim=-1)
log_pt = F.log_softmax(input, dim=-1)
loss = F.nll_loss(alpha * (1 - pt).pow(gamma) * log_pt, target, reduct... | [
"torch.minimum",
"torch.nn.functional.softmax",
"torch.nn.functional.log_softmax"
] | [((179, 203), 'torch.nn.functional.softmax', 'F.softmax', (['input'], {'dim': '(-1)'}), '(input, dim=-1)\n', (188, 203), True, 'import torch.nn.functional as F\n'), ((217, 245), 'torch.nn.functional.log_softmax', 'F.log_softmax', (['input'], {'dim': '(-1)'}), '(input, dim=-1)\n', (230, 245), True, 'import torch.nn.func... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"autograd.numpy.isscalar",
"autograd.numpy.ones",
"autograd.numpy.log",
"collections.namedtuple",
"autograd.tracer.isbox",
"autograd.numpy.all",
"autograd.numpy.result_type",
"autograd.numpy.unique",
"autograd.numpy.array",
"autograd.numpy.shape",
"autograd.numpy.broadcast",
"functools.partial... | [((1775, 1819), 'functools.partial', 'functools.partial', (['_is_constant_val'], {'val': '(0.0)'}), '(_is_constant_val, val=0.0)\n', (1792, 1819), False, 'import functools\n'), ((1838, 1882), 'functools.partial', 'functools.partial', (['_is_constant_val'], {'val': '(1.0)'}), '(_is_constant_val, val=1.0)\n', (1855, 1882... |
#coding=utf-8
from core.interface.action import server_action
from core.helper.creator import create_action
from core.helper.globalvar import global_const
import os
class smng:
def __init__(self):
global_const().set_value('BASEDIR', os.path.dirname(__file__))
def run(self):
try:
ac... | [
"core.helper.globalvar.global_const",
"os.path.dirname",
"core.helper.creator.create_action"
] | [((246, 271), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (261, 271), False, 'import os\n'), ((327, 342), 'core.helper.creator.create_action', 'create_action', ([], {}), '()\n', (340, 342), False, 'from core.helper.creator import create_action\n'), ((210, 224), 'core.helper.globalvar.globa... |
#!/usr/bin/env python3
"""
Copyright 2018 <NAME> (<EMAIL>)
https://github.com/rrwick/Bacsort
This script uses FastANI output to generate a PHYLIP distance matrix suitable for quicktree.
This file is part of Bacsort. Bacsort is free software: you can redistribute it and/or modify it
under the terms of the GNU General ... | [
"argparse.ArgumentParser"
] | [((880, 959), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Distance matrix from pairwise identities"""'}), "(description='Distance matrix from pairwise identities')\n", (903, 959), False, 'import argparse\n')] |
from django.http import HttpResponse
from django.shortcuts import render, redirect, get_object_or_404
import json
from django.core.serializers.json import DjangoJSONEncoder
from rbac.models import Menu, Role
from system.models import SystemSetup
from users.models import Structure
from system.forms import *
from django... | [
"django.shortcuts.render",
"rbac.models.Role.objects.values",
"json.loads",
"rbac.models.Role.objects.filter",
"json.dumps",
"rbac.models.Menu.objects.all",
"django.shortcuts.get_object_or_404",
"system.models.SystemSetup.getSystemSetupLastData",
"rbac.models.Menu.getMenuByRequestUrl",
"rbac.model... | [((461, 508), 'rbac.models.Menu.getMenuByRequestUrl', 'Menu.getMenuByRequestUrl', ([], {'url': 'request.path_info'}), '(url=request.path_info)\n', (485, 508), False, 'from rbac.models import Menu, Role\n'), ((573, 623), 'django.shortcuts.render', 'render', (['request', '"""system/rbac/role-list.html"""', 'ret'], {}), "... |
import re
import importlib.util
import sys
from .options import Option
def clean_spaces(text: str) -> str:
return re.sub(r'\s+', ' ', text).strip()
def patch_options(options, kwargs):
return {
k: options[v.key] if isinstance(v, Option) else v
for k, v in kwargs.items()
}
def wrap_globa... | [
"re.sub"
] | [((120, 145), 're.sub', 're.sub', (['"""\\\\s+"""', '""" """', 'text'], {}), "('\\\\s+', ' ', text)\n", (126, 145), False, 'import re\n')] |
# write your code here
import sys
import os
import hashlib
args = sys.argv
print(sys.argv)
if len(args) < 2:
print("Directory is not specified")
sys.exit()
else:
file_ext = ''
file_ext = input('Enter file format:')
sort = input('\nSize sorting options:\n1. Descending\n2. Ascending\n\nEnter a sorti... | [
"os.remove",
"os.path.join",
"os.walk",
"sys.exit"
] | [((155, 165), 'sys.exit', 'sys.exit', ([], {}), '()\n', (163, 165), False, 'import sys\n'), ((502, 522), 'os.walk', 'os.walk', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (509, 522), False, 'import os\n'), ((1734, 1744), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1742, 1744), False, 'import sys\n'), ((2782, 2792), 'sys.e... |
# ------------------------------------------------------------------------------
# Copyright 2020 Forschungszentrum Jülich GmbH
# "Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements; and to You under the Apache License, Version 2.0. "
#
# Forschungszentrum Jülich
# In... | [
"EBRAINS_InterscaleHUB.refactored_modular.interscalehub_mediator.spike_to_rate",
"time.sleep",
"numpy.array",
"mpi4py.MPI.Status",
"numpy.empty",
"os.getpid"
] | [((4387, 4409), 'numpy.empty', 'np.empty', (['(1)'], {'dtype': '"""b"""'}), "(1, dtype='b')\n", (4395, 4409), True, 'import numpy as np\n'), ((4425, 4447), 'numpy.empty', 'np.empty', (['(1)'], {'dtype': '"""i"""'}), "(1, dtype='i')\n", (4433, 4447), True, 'import numpy as np\n'), ((4488, 4500), 'mpi4py.MPI.Status', 'MP... |
#Import
import warnings; warnings.simplefilter('ignore') #for PCoA warnings
import pandas as pd
import numpy as np
#import data
from biom import load_table
from skbio.stats import subsample_counts
#MOCK data generation
from gneiss.util import match
from gneiss.sort import niche_sort
from simulations import block_diag... | [
"biom.load_table",
"simulations.build_block_model",
"pandas.read_table",
"gneiss.sort.niche_sort",
"warnings.simplefilter",
"pandas.MultiIndex.from_tuples",
"pandas.concat"
] | [((26, 57), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (47, 57), False, 'import warnings\n'), ((567, 586), 'biom.load_table', 'load_table', (['in_biom'], {}), '(in_biom)\n', (577, 586), False, 'from biom import load_table\n'), ((1253, 1314), 'pandas.read_table', 'pd.read_t... |
class ProjectListing(object):
@staticmethod
def list_projects(redis_connection):
"""Returns a list of projects store in redis with their
creation timestamps
Arguments:
redis_connection {RedisConnection} -- Redis connection to use as a provider for data
Returns:
... | [
"foundations_contrib.utils.string_from_bytes"
] | [((566, 589), 'foundations_contrib.utils.string_from_bytes', 'string_from_bytes', (['name'], {}), '(name)\n', (583, 589), False, 'from foundations_contrib.utils import string_from_bytes\n')] |
import tensorflow as tf
import numpy as np
import resnet_block
def LeakyRelu(x, leak=0.2, name="LeakyRelu"):
with tf.variable_scope(name):
leak_c = tf.constant(0.1)
leak = tf.Variable(leak_c)
f1 = 0.5 * (1 + leak)
f2 = 0.5 * (1 - leak)
return f1 * x + f2 * tf.abs(x)
def... | [
"numpy.sqrt",
"tensorflow.shape",
"tensorflow.nn.moments",
"resnet_block.identity_block",
"tensorflow.cast",
"tensorflow.random_normal",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.concat",
"tensorflow.nn.conv2d",
"tensorflow.variable_scope",
"tensorflow.Variable",
"tensorflo... | [((584, 597), 'tensorflow.nn.relu', 'tf.nn.relu', (['x'], {}), '(x)\n', (594, 597), True, 'import tensorflow as tf\n'), ((608, 628), 'tensorflow.constant', 'tf.constant', (['[255.0]'], {}), '([255.0])\n', (619, 628), True, 'import tensorflow as tf\n'), ((640, 658), 'tensorflow.minimum', 'tf.minimum', (['x', 'Max'], {})... |
#!/usr/bin/env python
"""
package
Implementation for the package command that handles helping set up and
manipulate packages for use with cirrus.
Commands:
package init - Initialise a new repo with a basic cirrus.conf file
add the appropriate setup, manifest and requirements files
package sublime-project - Assist... | [
"cirrus.package_container.init_container",
"cirrus.twine_helpers.register_package",
"cirrus.logger.get_logger",
"argparse.Namespace",
"sys.exit",
"cirrus.git_tools.commit_files_optional_push",
"os.path.exists",
"inspect.getsourcefile",
"argparse.ArgumentParser",
"pystache.render",
"cirrus._2to3.... | [((1249, 1261), 'cirrus.logger.get_logger', 'get_logger', ([], {}), '()\n', (1259, 1261), False, 'from cirrus.logger import get_logger\n'), ((2660, 2766), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""git cirrus package command: initialises cirrus for an existing git repo"""'}), "(description=\n... |
from setuptools import setup
setup(
name='optool',
version='1.9.4',
py_modules=['optool'],
install_requires=[
'numpy','matplotlib'
]
)
| [
"setuptools.setup"
] | [((30, 136), 'setuptools.setup', 'setup', ([], {'name': '"""optool"""', 'version': '"""1.9.4"""', 'py_modules': "['optool']", 'install_requires': "['numpy', 'matplotlib']"}), "(name='optool', version='1.9.4', py_modules=['optool'],\n install_requires=['numpy', 'matplotlib'])\n", (35, 136), False, 'from setuptools im... |
# Copyright (c) 2016-2018, University of Idaho
# All rights reserved.
#
# <NAME> (<EMAIL>)
#
# The project described was supported by NSF award number IIA-1301792
# from the NSF Idaho EPSCoR Program and by the National Science Foundation.
import os
from os.path import exists as _exists
from os.path import join as _joi... | [
"wepppy.nodb.Rhem.getInstance",
"os.path.join",
"numpy.array",
"wepppy.nodb.watershed.Watershed.getInstance",
"os.path.abspath",
"wepppy.rhem.out.RhemSummary"
] | [((1829, 1860), 'os.path.join', '_join', (['self.wd', '"""rhempost.nodb"""'], {}), "(self.wd, 'rhempost.nodb')\n", (1834, 1860), True, 'from os.path import join as _join\n'), ((1912, 1948), 'os.path.join', '_join', (['self.wd', '"""rhempost.nodb.lock"""'], {}), "(self.wd, 'rhempost.nodb.lock')\n", (1917, 1948), True, '... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Documentation string"""
__authors__ = ["Person1", "Person2"]
__email__ = "<EMAIL>"
__copyright__ = "<NAME>"
__credits__ = ["Person1", "Person2", "Person3"]
__version__ = "0.1"
__license__ = "MIT"
# This file is subject to the terms and conditions defi... | [
"file_funcs.load_json",
"sys.exit"
] | [((590, 611), 'file_funcs.load_json', 'load_json', (['input_path'], {}), '(input_path)\n', (599, 611), False, 'from file_funcs import dump_json, load_json\n'), ((1671, 1682), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (1679, 1682), False, 'import sys\n')] |
from django.shortcuts import render,get_object_or_404, redirect
from django.http import HttpResponseRedirect, HttpResponse, JsonResponse
from monitor.models import Machine, Crash, Testcase, Profile, DupCrash
from track.models import Issue
from django.http import Http404
from django.conf import settings
from django.core... | [
"django.shortcuts.render",
"monitor.models.Machine.objects.get",
"django.template.defaultfilters.date",
"django.http.JsonResponse",
"monitor.models.DupCrash.objects.filter",
"django.template.defaultfilters.filesizeformat",
"monitor.models.Profile.objects.get",
"monitor.models.Machine.objects.filter",
... | [((1231, 1252), 'monitor.models.Profile.objects.all', 'Profile.objects.all', ([], {}), '()\n', (1250, 1252), False, 'from monitor.models import Machine, Crash, Testcase, Profile, DupCrash\n'), ((1266, 1305), 'monitor.models.Profile.objects.get', 'Profile.objects.get', ([], {'owner': 'request.user'}), '(owner=request.us... |
from functools import partial
from keyword import iskeyword
from typing import Tuple, Final, Callable, Any, List, Generator, NoReturn, Dict
from chained.type_utils.meta import ChainedMeta
def _call_monkey_patcher(self, *args, **kwargs):
"""LambdaExpr.__call__ monkey patcher"""
return self.eval()(*args, **kwa... | [
"keyword.iskeyword",
"functools.partial"
] | [((1182, 1217), 'functools.partial', 'partial', (['_call_monkey_patcher', 'self'], {}), '(_call_monkey_patcher, self)\n', (1189, 1217), False, 'from functools import partial\n'), ((11821, 11836), 'keyword.iskeyword', 'iskeyword', (['name'], {}), '(name)\n', (11830, 11836), False, 'from keyword import iskeyword\n')] |
import pandas as pd
from nilearn.signal import clean
from nilearn.interfaces.fmriprep import load_confounds_strategy, load_confounds
from fmriprep_denoise.data.atlas import create_atlas_masker, get_atlas_dimensions
def generate_timeseries_per_dimension(atlas_name, output, benchmark_strategies,
... | [
"nilearn.signal.clean",
"fmriprep_denoise.data.atlas.create_atlas_masker",
"nilearn.interfaces.fmriprep.load_confounds",
"pandas.read_csv",
"fmriprep_denoise.data.atlas.get_atlas_dimensions",
"pandas.DataFrame",
"nilearn.interfaces.fmriprep.load_confounds_strategy",
"pandas.concat"
] | [((373, 405), 'fmriprep_denoise.data.atlas.get_atlas_dimensions', 'get_atlas_dimensions', (['atlas_name'], {}), '(atlas_name)\n', (393, 405), False, 'from fmriprep_denoise.data.atlas import create_atlas_masker, get_atlas_dimensions\n'), ((2361, 2391), 'pandas.DataFrame', 'pd.DataFrame', (['clean_timeseries'], {}), '(cl... |
import json
import json
import hashlib
from pydantic import BaseModel, validator
from typing import List, Optional
from speckle.base.resource import ResourceBaseSchema
from speckle.resources.objects import SpeckleObject
from speckle.schemas import Interval
NAME = 'line'
class Schema(SpeckleObject):
type: Optional... | [
"speckle.schemas.Interval"
] | [((436, 446), 'speckle.schemas.Interval', 'Interval', ([], {}), '()\n', (444, 446), False, 'from speckle.schemas import Interval\n')] |
import os
import xmlrpclib
from sfa.util.faults import *
from sfa.util.plxrn import PlXrn
from sfa.util.sfaticket import SfaTicket
from sfa.util.version import version_core
def GetVersion(api):
return version_core({'interface':'component',
'testbed':'myplc'})
def init_server():
from ... | [
"sfa.util.version.version_core",
"xmlrpclib.dumps",
"sfa.server.sfa_component_setup.get_trusted_certs",
"sfa.util.plxrn.PlXrn",
"sfa.server.sfa_component_setup.get_node_key",
"sfa.server.sfa_component_setup.get_credential",
"sfa.util.sfaticket.SfaTicket"
] | [((207, 267), 'sfa.util.version.version_core', 'version_core', (["{'interface': 'component', 'testbed': 'myplc'}"], {}), "({'interface': 'component', 'testbed': 'myplc'})\n", (219, 267), False, 'from sfa.util.version import version_core\n'), ((1855, 1886), 'sfa.util.sfaticket.SfaTicket', 'SfaTicket', ([], {'string': 't... |
import pytest
import sqlite3
from database_helpers import create_sample_user_records # noqa
def test_pokemon_insert_valid_record_no_users(sqlite_conn):
"""Validate that we fail to insert a valid record into the 'pokemons' table when there is no corresponding
user in the 'users' table"""
cursor = sqlite_... | [
"database_helpers.create_sample_user_records",
"pytest.raises"
] | [((786, 825), 'database_helpers.create_sample_user_records', 'create_sample_user_records', (['sqlite_conn'], {}), '(sqlite_conn)\n', (812, 825), False, 'from database_helpers import create_sample_user_records\n'), ((1630, 1669), 'database_helpers.create_sample_user_records', 'create_sample_user_records', (['sqlite_conn... |
from pettingzoo import AECEnv
from pettingzoo.utils import agent_selector
from pettingzoo.utils import wrappers
from pettingzoo.utils.conversions import parallel_wrapper_fn
from gym_stag_hunt.envs.hunt import HuntEnv
from gym.spaces import Box
import cv2
import numpy as np
def env(grid_size=(5, 5), screen_size=(600,... | [
"pettingzoo.utils.agent_selector",
"pettingzoo.utils.wrappers.OrderEnforcingWrapper",
"pettingzoo.utils.wrappers.AssertOutOfBoundsWrapper",
"pettingzoo.utils.conversions.parallel_wrapper_fn",
"gym_stag_hunt.envs.hunt.HuntEnv",
"gym.spaces.Box",
"pettingzoo.utils.wrappers.CaptureStdoutWrapper",
"cv2.re... | [((1548, 1572), 'pettingzoo.utils.conversions.parallel_wrapper_fn', 'parallel_wrapper_fn', (['env'], {}), '(env)\n', (1567, 1572), False, 'from pettingzoo.utils.conversions import parallel_wrapper_fn\n'), ((1356, 1395), 'pettingzoo.utils.wrappers.CaptureStdoutWrapper', 'wrappers.CaptureStdoutWrapper', (['env_init'], {}... |
from pykivdroid import mActivity,WindowManagerNLayoutParams,Window,run_on_ui_thread,View
@run_on_ui_thread
def set_full_screen():
return mActivity.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_FULLSCREEN
|View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
... | [
"pykivdroid.mActivity.getWindow"
] | [((142, 163), 'pykivdroid.mActivity.getWindow', 'mActivity.getWindow', ([], {}), '()\n', (161, 163), False, 'from pykivdroid import mActivity, WindowManagerNLayoutParams, Window, run_on_ui_thread, View\n')] |
import os
from oic.utils.jwt import JWT
from oic.utils.keyio import build_keyjar
from oic.utils.keyio import keybundle_from_local_file
__author__ = "roland"
BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "data/keys"))
keys = [
{"type": "RSA", "key": os.path.join(BASE_PATH, "cert.key"), "us... | [
"oic.utils.keyio.build_keyjar",
"os.path.dirname",
"oic.utils.jwt.JWT",
"os.path.join"
] | [((468, 486), 'oic.utils.keyio.build_keyjar', 'build_keyjar', (['keys'], {}), '(keys)\n', (480, 486), False, 'from oic.utils.keyio import build_keyjar\n'), ((751, 774), 'oic.utils.jwt.JWT', 'JWT', (['keyjar'], {'iss': 'issuer'}), '(keyjar, iss=issuer)\n', (754, 774), False, 'from oic.utils.jwt import JWT\n'), ((202, 22... |
import numpy as np
import pandas as pd
import decorators
from scipy import optimize
import settings
import utility_functions as utilfunc
import agent_mutation
import PySAM.Battwatts as battery
import PySAM.BatteryTools as batt_tools
import PySAM.Utilityrate5 as utility
import PySAM.Cashloan as cashloan
#===========... | [
"settings.init_model_settings",
"PySAM.Utilityrate5.default",
"numpy.array",
"agent_mutation.elec.get_and_apply_agent_load_profiles",
"pandas.notnull",
"PySAM.Battwatts.default",
"numpy.where",
"PySAM.Cashloan.default",
"scipy.optimize.minimize_scalar",
"PySAM.BatteryTools.size_li_ion_battery",
... | [((411, 432), 'utility_functions.get_logger', 'utilfunc.get_logger', ([], {}), '()\n', (430, 432), True, 'import utility_functions as utilfunc\n'), ((55274, 55332), 'decorators.fn_timer', 'decorators.fn_timer', ([], {'logger': 'logger', 'tab_level': '(2)', 'prefix': '""""""'}), "(logger=logger, tab_level=2, prefix='')\... |
# Copyright 2005-2010 Wesabe, 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... | [
"os.path.dirname",
"os.path.join"
] | [((617, 642), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (632, 642), False, 'import os\n'), ((1170, 1202), 'os.path.join', 'os.path.join', (['fixtures', 'filename'], {}), '(fixtures, filename)\n', (1182, 1202), False, 'import os\n')] |
"""doufo.convert
abstract class of `dataType` converters.
Example:
Todo:
Author:
"""
from .function import func
from functools import wraps, cmp_to_key
from multipledispatch import Dispatcher
from typing import Callable, TypeVar
__all__ = ['converters', 'convert_to', 'convert']
T = TypeVar('T')
B = TypeVa... | [
"functools.cmp_to_key",
"typing.TypeVar"
] | [((297, 309), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (304, 309), False, 'from typing import Callable, TypeVar\n'), ((314, 326), 'typing.TypeVar', 'TypeVar', (['"""B"""'], {}), "('B')\n", (321, 326), False, 'from typing import Callable, TypeVar\n'), ((1013, 1043), 'functools.cmp_to_key', 'cmp_to_key'... |
import re, os, copy
PAREMETER_PATTERN = '{{%s}}'
def convert_value_for_environment(value: object) -> str:
if str(value).lower() == 'true': value = '1'
elif str(value).lower() == 'false': value = '0'
return str(value)
def set_environment_variables(environs:dict):
if environs:
for key, value in... | [
"os.getcwd",
"copy.copy",
"os.path.basename",
"os.path.abspath",
"re.findall"
] | [((1012, 1044), 're.findall', 're.findall', (['title_regex', 'content'], {}), '(title_regex, content)\n', (1022, 1044), False, 'import re, os, copy\n'), ((1149, 1181), 're.findall', 're.findall', (['title_regex', 'content'], {}), '(title_regex, content)\n', (1159, 1181), False, 'import re, os, copy\n'), ((5823, 5869), ... |
# -*- coding: utf-8 -*-
# pragma pylint: disable=unused-argument, no-self-use
# (c) Copyright IBM Corp. 2010, 2018. All Rights Reserved.
""" Resilient functions component to run a Cisco AMP for endpoints query - get events """
# Set up:
# Destination: a Queue named "amp_get_events".
# Manual Action: Execute a REST q... | [
"logging.getLogger",
"resilient_circuits.handler",
"json.dumps",
"fn_cisco_amp4ep.lib.amp_client.Ampclient",
"resilient_circuits.FunctionError",
"resilient_circuits.StatusMessage",
"datetime.datetime.now",
"fn_cisco_amp4ep.lib.amp_ratelimit.AmpRateLimit",
"resilient_circuits.function",
"fn_cisco_a... | [((739, 753), 'fn_cisco_amp4ep.lib.amp_ratelimit.AmpRateLimit', 'AmpRateLimit', ([], {}), '()\n', (751, 753), False, 'from fn_cisco_amp4ep.lib.amp_ratelimit import AmpRateLimit\n'), ((5038, 5055), 'resilient_circuits.handler', 'handler', (['"""reload"""'], {}), "('reload')\n", (5045, 5055), False, 'from resilient_circu... |
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
import os
import shutil
import sys
from commitsan.git import (REPOS_PATH, CalledProcessError,
git_cmd, git_revlist, mkdir_p)
from commitsan.worker import job
f... | [
"commitsan.git.git_revlist",
"commitsan.git.git_cmd",
"os.path.join",
"commitsan.worker.job",
"commitsan.git.mkdir_p",
"shutil.rmtree",
"commitsan.checks.check_all"
] | [((461, 466), 'commitsan.worker.job', 'job', ([], {}), '()\n', (464, 466), False, 'from commitsan.worker import job\n'), ((859, 864), 'commitsan.worker.job', 'job', ([], {}), '()\n', (862, 864), False, 'from commitsan.worker import job\n'), ((925, 952), 'commitsan.git.git_revlist', 'git_revlist', (['repo', '*commits'],... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: physics.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _refle... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.descriptor.EnumValueDescriptor"
] | [((480, 506), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (504, 506), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((1885, 1976), 'google.protobuf.descriptor.EnumValueDescriptor', '_descriptor.EnumValueDescriptor', ([], {'name': '"""ODE"""', 'i... |
"""Run all of the unit tests for this package over and over,
in order to provide for better profiling."""
from __future__ import print_function
def main():
import sys, os, gc, time
dirname = os.path.split(__file__)
sys.path.append(dirname)
import runtests
gc.set_debug(gc.DEBUG_LEAK)
star... | [
"time.clock",
"gc.set_debug",
"os.path.split",
"runtests.main",
"sys.getrefcount",
"sys.exit",
"gc.get_objects",
"sys.path.append"
] | [((205, 228), 'os.path.split', 'os.path.split', (['__file__'], {}), '(__file__)\n', (218, 228), False, 'import sys, os, gc, time\n'), ((233, 257), 'sys.path.append', 'sys.path.append', (['dirname'], {}), '(dirname)\n', (248, 257), False, 'import sys, os, gc, time\n'), ((283, 310), 'gc.set_debug', 'gc.set_debug', (['gc.... |
import argparse
import functools
import sys
from tornado import (
httpclient,
ioloop,
)
def add_package_to_path():
if not (__name__ == "__main__" and __package__ == ""):
return
import os
sys.path.append(os.path.abspath(os.path.join(
os.path.abspath(__file__),
"..",
... | [
"argparse.ArgumentParser",
"tornado.httpclient.AsyncHTTPClient.configure",
"tornado.ioloop.IOLoop.current",
"thuum.runners.QuantityRunner",
"thuum.runners.DurationRunner",
"tornado.ioloop.PeriodicCallback",
"functools.partial",
"sys.exit",
"os.path.abspath",
"thuum.stats.Tracker"
] | [((3541, 3613), 'tornado.httpclient.AsyncHTTPClient.configure', 'httpclient.AsyncHTTPClient.configure', (['None'], {'max_clients': 'args.concurrency'}), '(None, max_clients=args.concurrency)\n', (3577, 3613), False, 'from tornado import httpclient, ioloop\n'), ((1666, 1729), 'argparse.ArgumentParser', 'argparse.Argumen... |
# Generated by Django 3.1.2 on 2021-02-15 05:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('profiles', '0008_whoiswatching_person_avatar'),
]
operations = [
migrations.AddField(
model_name='whoiswatching',
na... | [
"django.db.models.CharField"
] | [((353, 395), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)', 'null': '(True)'}), '(max_length=30, null=True)\n', (369, 395), False, 'from django.db import migrations, models\n')] |
from pathlib import Path
import os
import re
from decimal import Decimal
import csv
import numpy
from Utils import TextProcessingUtils
from Utils import DefinedConstants
def readEmbeddingsFromTxtFile(inFile):
w2v = {}
with open(inFile, "r") as f:
for l in f.readlines():
if not l.strip():
... | [
"Utils.DefinedConstants.CNGstrategy.replace",
"Utils.TextProcessingUtils.getCleanEmbeddingModelTokens",
"os.walk",
"os.path.join",
"re.match",
"numpy.zeros",
"decimal.Decimal"
] | [((1639, 1656), 'os.walk', 'os.walk', (['inFolder'], {}), '(inFolder)\n', (1646, 1656), False, 'import os\n'), ((1706, 1735), 're.match', 're.match', (['regFilter', 'filename'], {}), '(regFilter, filename)\n', (1714, 1735), False, 'import re\n'), ((7973, 7993), 'numpy.zeros', 'numpy.zeros', (['numBins'], {}), '(numBins... |
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="NewUser")
@attr.s(auto_attribs=True)
class NewUser:
""" """
password: str
permissions: List[str]
roles: List[str]
username: str
email: Union[Unset, str] = UNS... | [
"attr.s",
"typing.TypeVar"
] | [((115, 144), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': '"""NewUser"""'}), "('T', bound='NewUser')\n", (122, 144), False, 'from typing import Any, Dict, List, Type, TypeVar, Union, cast\n'), ((148, 173), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)'}), '(auto_attribs=True)\n', (154, 173), False, 'import... |
from ai_safety_gridworlds.environments.shared import safety_game
from collections import defaultdict
import experiments.environment_helper as environment_helper
import numpy as np
class ModelFreeAUPAgent:
name = "Model-free AUP"
pen_epsilon, AUP_epsilon = .2, .9 # chance of choosing greedy action in training... | [
"numpy.clip",
"numpy.copy",
"numpy.random.choice",
"numpy.random.random",
"experiments.environment_helper.run_episode",
"numpy.zeros",
"experiments.environment_helper.derive_possible_rewards",
"collections.defaultdict"
] | [((1883, 1926), 'numpy.zeros', 'np.zeros', (['(self.trials, self.episodes / 10)'], {}), '((self.trials, self.episodes / 10))\n', (1891, 1926), True, 'import numpy as np\n'), ((2065, 2076), 'numpy.zeros', 'np.zeros', (['(4)'], {}), '(4)\n', (2073, 2076), True, 'import numpy as np\n'), ((1547, 1594), 'experiments.environ... |
import tensorflow as tf
from tensorflow.keras.models import Model, Sequential
from tensorflow.keras.layers import Conv2D, BatchNormalization, ReLU, GlobalAveragePooling2D, Dropout
class ASPP(Model):
def __init__(self, filters, dilation_rates=[3, 6, 9]):
super().__init__()
self.aspp1 = ASPPConv(fil... | [
"tensorflow.shape",
"tensorflow.keras.layers.Conv2D",
"tensorflow.image.resize",
"tensorflow.keras.layers.ReLU",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.GlobalAveragePooling2D"
] | [((1264, 1357), 'tensorflow.keras.layers.Conv2D', 'Conv2D', (['filters', 'kernel_size'], {'padding': '"""SAME"""', 'dilation_rate': 'dilation_rate', 'use_bias': '(False)'}), "(filters, kernel_size, padding='SAME', dilation_rate=dilation_rate,\n use_bias=False)\n", (1270, 1357), False, 'from tensorflow.keras.layers i... |
from calendar import timegm
from flask_login import UserMixin, login_user
from datetime import datetime
import flask_socketio as sio
from .Permissions import Permissions
from .Token import Token
from .database import Database
from .Room import Room, ROOMS
from .Logger import Logger
from .. import config
from .Layout i... | [
"flask_login.login_user",
"datetime.datetime.now"
] | [((9066, 9082), 'flask_login.login_user', 'login_user', (['user'], {}), '(user)\n', (9076, 9082), False, 'from flask_login import UserMixin, login_user\n'), ((3830, 3844), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (3842, 3844), False, 'from datetime import datetime\n'), ((4728, 4742), 'datetime.datetim... |
from sportsdb_setup import HGETestSetup, HGETestSetupArgs
from run_hge import HGE
import graphql
import multiprocessing
import json
import os
import docker
import ruamel.yaml as yaml
import cpuinfo
import subprocess
import threading
import time
import datetime
from colorama import Fore, Style
from plot import run_dash_... | [
"run_hge.HGE",
"boto3.client",
"multiprocessing.cpu_count",
"time.sleep",
"sportsdb_setup.HGETestSetupArgs.set_arg_parse_options",
"graphql.parse",
"cpuinfo.get_cpu_info",
"pathlib.Path",
"json.dumps",
"webbrowser.open_new_tab",
"subprocess.check_output",
"json.loads",
"sportsdb_setup.HGETes... | [((447, 472), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (462, 472), False, 'import os\n'), ((515, 528), 'urllib.parse.urlparse', 'urlparse', (['uri'], {}), '(uri)\n', (523, 528), False, 'from urllib.parse import urlparse, urlunparse\n'), ((544, 572), 'os.path.join', 'os.path.join', (['p.... |
import six
import time
import signal
import multiprocessing
from functools import partial
import numpy as np
from astropy.utils.console import (_get_stdout, isatty, isiterable,
human_file_size, _CAN_RESIZE_TERMINAL,
terminal_size, color_print, human... | [
"astropy.utils.console.color_print",
"astropy.utils.console.terminal_size",
"signal.signal",
"astropy.utils.console.human_time",
"astropy.utils.console.human_file_size",
"numpy.floor",
"multiprocessing.cpu_count",
"astropy.utils.console.isatty",
"functools.partial",
"multiprocessing.Pool",
"astr... | [((3767, 3793), 'astropy.utils.console.isiterable', 'isiterable', (['total_or_items'], {}), '(total_or_items)\n', (3777, 3793), False, 'from astropy.utils.console import _get_stdout, isatty, isiterable, human_file_size, _CAN_RESIZE_TERMINAL, terminal_size, color_print, human_time\n'), ((4200, 4211), 'time.time', 'time.... |
import numpy
from keras.models import Sequential
from keras.layers import Dense
#loading pima indians dataset from the csv
# fix random seed for reproducibility
numpy.random.seed(7)
dataset = numpy.loadtxt(
"./data/pima-indians-diabetes.csv", delimiter=","
)
#split into input (X) and (Y) variables
X = dataset[:,... | [
"keras.layers.Dense",
"numpy.loadtxt",
"numpy.random.seed",
"keras.models.Sequential"
] | [((162, 182), 'numpy.random.seed', 'numpy.random.seed', (['(7)'], {}), '(7)\n', (179, 182), False, 'import numpy\n'), ((193, 257), 'numpy.loadtxt', 'numpy.loadtxt', (['"""./data/pima-indians-diabetes.csv"""'], {'delimiter': '""","""'}), "('./data/pima-indians-diabetes.csv', delimiter=',')\n", (206, 257), False, 'import... |
"""security converge queries
Revision ID: e37912a26567
Revises: 42b4c9e01447
Create Date: 2020-12-16 12:15:28.291777
"""
# revision identifiers, used by Alembic.
revision = "e37912a26567"
down_revision = "42b4c9e01447"
from alembic import op
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.orm import Sess... | [
"rabbitai.migrations.shared.security_converge.get_reversed_new_pvms",
"alembic.op.get_bind",
"rabbitai.migrations.shared.security_converge.migrate_roles",
"sqlalchemy.orm.Session",
"rabbitai.migrations.shared.security_converge.Pvm",
"rabbitai.migrations.shared.security_converge.add_pvms",
"rabbitai.migr... | [((534, 562), 'rabbitai.migrations.shared.security_converge.Pvm', 'Pvm', (['"""QueryView"""', '"""can_list"""'], {}), "('QueryView', 'can_list')\n", (537, 562), False, 'from rabbitai.migrations.shared.security_converge import add_pvms, get_reversed_new_pvms, get_reversed_pvm_map, migrate_roles, Pvm\n'), ((597, 625), 'r... |
###
# MD5 encryption example.
#
# License - MIT.
####
import os
import hashlib
# Main function.
def main():
# {
teststr = 'To be No.1'
hmd5 = hashlib.md5()
hmd5.update(teststr.encode(encoding = 'UTF-8'))
print('Source data:\t' + teststr)
print('Dest data:\t' + hmd5.hexdigest())
# }
# Program... | [
"hashlib.md5"
] | [((155, 168), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (166, 168), False, 'import hashlib\n')] |
from dataclasses import dataclass
from typing import Optional
from bohr.config.pathconfig import PathConfig, load_config_dict_from_file
from bohr.fs import find_project_root
from bohr.util.paths import AbsolutePath
@dataclass(frozen=True)
class AppConfig:
verbose: bool
paths: PathConfig
@staticmethod
... | [
"bohr.config.pathconfig.PathConfig.load",
"bohr.config.pathconfig.load_config_dict_from_file",
"dataclasses.dataclass",
"bohr.fs.find_project_root"
] | [((219, 241), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (228, 241), False, 'from dataclasses import dataclass\n'), ((473, 513), 'bohr.config.pathconfig.load_config_dict_from_file', 'load_config_dict_from_file', (['project_root'], {}), '(project_root)\n', (499, 513), False, 'fr... |
import os
configVars = ['env','implementation_name','ssh_ansible_user','ansible_private_key_path','application_host','app_address_space','dns_name','proto','database_host','database_password','<PASSWORD>_admin_password','<PASSWORD>_password','trampoline_secret','backup_storage_key','badger_admin_password','<PASSWORD>g... | [
"os.getenv"
] | [((665, 679), 'os.getenv', 'os.getenv', (['key'], {}), '(key)\n', (674, 679), False, 'import os\n')] |
import pytest
from backend.common.models.team import Team
from backend.common.models.tests.util import (
CITY_STATE_COUNTRY_PARAMETERS,
LOCATION_PARAMETERS,
)
@pytest.mark.parametrize("key", ["frc177", "frc1"])
def test_valid_key_names(key: str) -> None:
assert Team.validate_key_name(key) is True
@pyte... | [
"pytest.mark.parametrize",
"backend.common.models.team.Team",
"backend.common.models.team.Team.validate_key_name"
] | [((171, 221), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""key"""', "['frc177', 'frc1']"], {}), "('key', ['frc177', 'frc1'])\n", (194, 221), False, 'import pytest\n'), ((316, 381), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""key"""', "['bcr077', 'frc 011', 'frc711\\\\']"], {}), "('key', [... |
import glob
import pickle
import sys
import msprime as msp
import numpy as np
import os
import multiprocessing as mp
import shutil
import random
import copy
import argparse
import h5py
import allel
import time
from sklearn.neighbors import NearestNeighbors
from sklearn.utils import resample
import matplotlib as mpl
m... | [
"matplotlib.use"
] | [((319, 333), 'matplotlib.use', 'mpl.use', (['"""pdf"""'], {}), "('pdf')\n", (326, 333), True, 'import matplotlib as mpl\n')] |
import gurulhutils
import random
def init( keys ):
global db
status, database = gurulhutils.db_init( keys["Database"] )
db = database.get_collection("taylorswiftdb")
return status
def help():
return "Look what you made me do."
def recursion( word ):
c = db.find_one( { "_word" : word } )
po... | [
"gurulhutils.db_init",
"random.choices"
] | [((89, 126), 'gurulhutils.db_init', 'gurulhutils.db_init', (["keys['Database']"], {}), "(keys['Database'])\n", (108, 126), False, 'import gurulhutils\n'), ((550, 591), 'random.choices', 'random.choices', ([], {'population': 'pop', 'weights': 'w'}), '(population=pop, weights=w)\n', (564, 591), False, 'import random\n')] |
import os
from flask import Blueprint, request, jsonify
from math import exp
bp = Blueprint('app', __name__)
MODEL_COEFFICIENTS = {
'CarrierAA': -0.0019204985425103213,
'CarrierAS': -0.84841944514035605,
'CarrierB6': 0.12241821143901417,
'CarrierDL': -0.13261989508615579,
'CarrierEV': -0.010973177444743456,
'C... | [
"flask.request.get_json",
"flask.Blueprint",
"math.exp"
] | [((84, 110), 'flask.Blueprint', 'Blueprint', (['"""app"""', '__name__'], {}), "('app', __name__)\n", (93, 110), False, 'from flask import Blueprint, request, jsonify\n'), ((3935, 3963), 'flask.request.get_json', 'request.get_json', ([], {'force': '(True)'}), '(force=True)\n', (3951, 3963), False, 'from flask import Blu... |
from app import app
if __name__ == '__main__':
app = app.Session() | [
"app.app.Session"
] | [((58, 71), 'app.app.Session', 'app.Session', ([], {}), '()\n', (69, 71), False, 'from app import app\n')] |
# Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... | [
"mindspore.train.serialization.load_checkpoint",
"numpy.argmax",
"src.dataset.classification_dataset",
"mindspore.save_checkpoint",
"mindspore.train.serialization.load_param_into_net",
"src.c3d_model.C3D",
"mindspore.Tensor",
"mindspore.communication.management.get_rank"
] | [((1565, 1662), 'src.dataset.classification_dataset', 'classification_dataset', (['config.batch_size', '(1)'], {'shuffle': '(True)', 'repeat_num': '(1)', 'drop_remainder': '(True)'}), '(config.batch_size, 1, shuffle=True, repeat_num=1,\n drop_remainder=True)\n', (1587, 1662), False, 'from src.dataset import classifi... |
# -*- coding: utf-8 -*-
"""
======
Slider
======
A slideshow component which may be similar to Album but with difference that
a slide item can have HTML content.
Slide items are ordered from their ``order`` field value. Items with a zero
value for their order will be ordered in an almost arbitrary order (mostly
depen... | [
"django.core.validators.FileExtensionValidator",
"django.utils.html.strip_tags",
"cmsplugin_blocks.choices_helpers.get_slider_template_choices",
"django.db.models.ForeignKey",
"django.utils.translation.gettext_lazy",
"cmsplugin_blocks.choices_helpers.get_slider_default_template"
] | [((2410, 2488), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Slider'], {'related_name': '"""slide_item"""', 'on_delete': 'models.CASCADE'}), "(Slider, related_name='slide_item', on_delete=models.CASCADE)\n", (2427, 2488), False, 'from django.db import models\n'), ((969, 979), 'django.utils.translation.gettext... |