code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.db import models
from django.urls import reverse
from django.contrib.auth.models import User
from django.utils import timezone
import uuid
ANNOTATION = (
('asm', 'Asymmetry'),
('dst', 'Dystonia'),
('dsk', 'Dyskensia'),
('ebt', 'En Bloc Turning'),
('str', 'Short Stride Length'),
('mo... | [
"django.db.models.DateField",
"django.db.models.FloatField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.FileField",
"django.db.models.AutoField",
"django.db.models.PositiveIntegerField",
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.... | [((662, 696), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (678, 696), False, 'from django.db import models\n'), ((714, 777), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', 'help_text': '"""Patient first name"""'}), "(max_lengt... |
import datetime
import canal
from influxdb import InfluxDBClient
class IMU(canal.Measurement):
accelerometer_x = canal.IntegerField()
accelerometer_y = canal.IntegerField()
accelerometer_z = canal.IntegerField()
gyroscope_x = canal.IntegerField()
gyroscope_y = canal.IntegerField()
gyroscope_z... | [
"canal.Tag",
"influxdb.InfluxDBClient",
"canal.IntegerField",
"datetime.datetime.now",
"datetime.timedelta"
] | [((120, 140), 'canal.IntegerField', 'canal.IntegerField', ([], {}), '()\n', (138, 140), False, 'import canal\n'), ((163, 183), 'canal.IntegerField', 'canal.IntegerField', ([], {}), '()\n', (181, 183), False, 'import canal\n'), ((206, 226), 'canal.IntegerField', 'canal.IntegerField', ([], {}), '()\n', (224, 226), False,... |
#
# This file is part of ravstack. Ravstack is free software available under
# the terms of the MIT license. See the file "LICENSE" that was provided
# together with this source file for the licensing terms.
#
# Copyright (c) 2015 the ravstack authors. See the file "AUTHORS" for a
# complete list.
from __future__ impo... | [
"logging.getLogger",
"logging.NullHandler",
"logging.StreamHandler",
"logging.captureWarnings",
"logging.Formatter",
"logging.FileHandler"
] | [((463, 491), 'logging.getLogger', 'logging.getLogger', (['prog_name'], {}), '(prog_name)\n', (480, 491), False, 'import logging\n'), ((1240, 1259), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (1257, 1259), False, 'import logging\n'), ((2111, 2172), 'logging.getLogger', 'logging.getLogger', (['"""reques... |
import os.path
import zipfile
import pandas as pd
from collections import defaultdict
from graphdb_builder import builder_utils
#########################
# SMPDB database #
#########################
def parser(databases_directory, download=True):
config = builder_utils.get_config(config_name="smpdbConfig.ym... | [
"graphdb_builder.builder_utils.get_config",
"graphdb_builder.builder_utils.downloadDB",
"zipfile.ZipFile",
"pandas.read_csv",
"collections.defaultdict",
"graphdb_builder.builder_utils.remove_directory",
"graphdb_builder.builder_utils.checkDirectory"
] | [((268, 346), 'graphdb_builder.builder_utils.get_config', 'builder_utils.get_config', ([], {'config_name': '"""smpdbConfig.yml"""', 'data_type': '"""databases"""'}), "(config_name='smpdbConfig.yml', data_type='databases')\n", (292, 346), False, 'from graphdb_builder import builder_utils\n'), ((420, 436), 'collections.d... |
import time
#Timing stuff
lastTime = None
prevFrameTime = 0;
def waitFramerate(T): #TODO if we have enough time, call the garbage collector
global lastTime, prevFrameTime
ctime = time.monotonic()
if lastTime:
frameTime = ctime-lastTime #how long the last frame took
sleepTime = T-frameTime #how much time is rem... | [
"time.monotonic",
"time.sleep"
] | [((183, 199), 'time.monotonic', 'time.monotonic', ([], {}), '()\n', (197, 199), False, 'import time\n'), ((662, 683), 'time.sleep', 'time.sleep', (['sleepTime'], {}), '(sleepTime)\n', (672, 683), False, 'import time\n')] |
from __future__ import annotations
import re
from typing import Union
import warp.yul.ast as ast
from warp.yul.AstVisitor import AstVisitor
from warp.yul.WarpException import WarpException
class AstParser:
def __init__(self, text: str):
self.lines = text.splitlines()
if len(self.lines) == 0:
... | [
"warp.yul.ast.If",
"warp.yul.ast.Break",
"warp.yul.WarpException.WarpException",
"warp.yul.ast.Literal",
"warp.yul.ast.Identifier",
"warp.yul.ast.Continue",
"warp.yul.ast.VariableDeclaration",
"re.findall",
"warp.yul.ast.FunctionDefinition",
"warp.yul.ast.TypedName"
] | [((802, 847), 'warp.yul.ast.TypedName', 'ast.TypedName', ([], {'name': 'node_name', 'type': 'node_type'}), '(name=node_name, type=node_type)\n', (815, 847), True, 'import warp.yul.ast as ast\n'), ((1210, 1234), 'warp.yul.ast.Literal', 'ast.Literal', ([], {'value': 'value'}), '(value=value)\n', (1221, 1234), True, 'impo... |
# encoding: utf-8
'''
@author: <NAME>
@contact: <EMAIL>
@software: basenef
@file: doc_generator.py
@date: 4/13/2019
@desc:
'''
import os
import sys
import time
from getpass import getuser
import matplotlib
import numpy as np
import json
from srfnef import Image, MlemFull
matplotlib.use('Agg')
author = getuser()
de... | [
"srfnef.image_metric.nsd",
"getpass.getuser",
"matplotlib.pyplot.imshow",
"srfnef.image_metric.noise2",
"json.dumps",
"matplotlib.pyplot.plot",
"srfnef.image_metric.pos_dev",
"srfnef.image_metric.bg_visibility",
"srfnef.image_metric.crc2",
"numpy.round",
"srfnef.image_metric.standard_error",
"... | [((274, 295), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (288, 295), False, 'import matplotlib\n'), ((306, 315), 'getpass.getuser', 'getuser', ([], {}), '()\n', (313, 315), False, 'from getpass import getuser\n'), ((357, 368), 'time.time', 'time.time', ([], {}), '()\n', (366, 368), False, 'im... |
import requests
import json
class WordDefinition:
def __init__(self, word):
self.word = word
self.definisi = None
self.json_data = None
def url_data(self):
api_url = 'http://kateglo.com/api.php'
r = requests.get(api_url, params={
'format': 'json', 'phrase'... | [
"requests.get"
] | [((251, 320), 'requests.get', 'requests.get', (['api_url'], {'params': "{'format': 'json', 'phrase': self.word}"}), "(api_url, params={'format': 'json', 'phrase': self.word})\n", (263, 320), False, 'import requests\n')] |
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LIC... | [
"logging.getLogger",
"mock.patch",
"mock.Mock",
"mock.patch.object",
"oslo_config.cfg.CONF.set_override",
"neutron.common.utils.parse_mappings",
"networking_vsphere.tests.unit.drivers.fake_manager.MockNetworkManager",
"mock.MagicMock",
"networking_vsphere.agent.ovsvapp_agent.OVSvAppAgent"
] | [((5066, 5106), 'mock.patch', 'mock.patch', (['"""neutron.common.config.init"""'], {}), "('neutron.common.config.init')\n", (5076, 5106), False, 'import mock\n'), ((5112, 5161), 'mock.patch', 'mock.patch', (['"""neutron.common.config.setup_logging"""'], {}), "('neutron.common.config.setup_logging')\n", (5122, 5161), Fa... |
"""
This module provides classes that support observers, smart value handling and debug functions
All changes to values nominate an agent, and observers nominate the agent making changes they
are interested in.
It supercedes the pvars module
"""
import logging, sys, threading, pathlib, math, json
from enum import Enu... | [
"logging.StreamHandler",
"enum.auto",
"pathlib.Path",
"threading.Lock",
"logging.Formatter",
"json.dumps",
"pigpio.pi",
"json.load",
"math.isnan"
] | [((680, 690), 'enum.auto', 'enumauto', ([], {}), '()\n', (688, 690), True, 'from enum import Enum, auto as enumauto, Flag\n'), ((705, 715), 'enum.auto', 'enumauto', ([], {}), '()\n', (713, 715), True, 'from enum import Enum, auto as enumauto, Flag\n'), ((775, 785), 'enum.auto', 'enumauto', ([], {}), '()\n', (783, 785),... |
import sqlite3
import pytest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import tests.testsite.testapp.models as dm
from tests.sa_models import Base, Car, Child, Dog, Parent
@pytest.fixture(scope="session")
def engine():
print("NEW ENGINE")
engine = create_engine(
"s... | [
"tests.testsite.testapp.models.Child.objects.get",
"sqlalchemy.orm.sessionmaker",
"tests.sa_models.Base.metadata.create_all",
"sqlite3.connect",
"tests.sa_models.Car",
"tests.testsite.testapp.models.Parent.objects.get",
"tests.testsite.testapp.models.Car.objects.all",
"tests.sa_models.Parent",
"test... | [((212, 243), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (226, 243), False, 'import pytest\n'), ((493, 524), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (507, 524), False, 'import pytest\n'), ((693, 724), 'pytest.fixture'... |
"""Module containing session and auth logic."""
import collections.abc as abc_collections
import datetime
from contextlib import contextmanager
from logging import getLogger
import dateutil.parser
import requests
from . import __version__
from . import exceptions as exc
__url_cache__ = {}
__logs__ = getLogger(__pac... | [
"logging.getLogger",
"datetime.datetime.now",
"datetime.timedelta"
] | [((305, 327), 'logging.getLogger', 'getLogger', (['__package__'], {}), '(__package__)\n', (314, 327), False, 'from logging import getLogger\n'), ((8225, 8263), 'datetime.datetime.now', 'datetime.datetime.now', (['dateutil.tz.UTC'], {}), '(dateutil.tz.UTC)\n', (8246, 8263), False, 'import datetime\n'), ((9659, 9696), 'd... |
import theano
import theano.tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams
from theano.tensor.nnet.conv import conv2d
from theano.tensor.signal.downsample import max_pool_2d
from theano.tensor.shared_randomstreams import RandomStreams
import numpy as np
from toolbox import *
from modelbase import *
... | [
"theano.tensor.log",
"theano.tensor.mean",
"theano.tensor.argmax",
"theano.tensor.nnet.binary_crossentropy",
"theano.tensor.var",
"theano.tensor.dot"
] | [((2908, 2929), 'theano.tensor.argmax', 'T.argmax', (['pyx'], {'axis': '(1)'}), '(pyx, axis=1)\n', (2916, 2929), True, 'import theano.tensor as T\n'), ((1741, 1773), 'theano.tensor.mean', 'T.mean', (['h'], {'axis': '(0)', 'keepdims': '(True)'}), '(h, axis=0, keepdims=True)\n', (1747, 1773), True, 'import theano.tensor ... |
from typing import List
class Solution:
"""
BFS
"""
def canReach_1(self, arr: List[int], start: int) -> bool:
"""
Recursively.
"""
seen = set()
def helper(pos):
if not 0 <= pos < len(arr) or pos in seen:
return False
... | [
"collections.deque"
] | [((667, 681), 'collections.deque', 'deque', (['[start]'], {}), '([start])\n', (672, 681), False, 'from collections import deque\n')] |
import pygame
FPS = 60
BLOCK_SIZE = 48
COLOR_BACKGROUND = pygame.Color(0, 0, 0)
| [
"pygame.Color"
] | [((59, 80), 'pygame.Color', 'pygame.Color', (['(0)', '(0)', '(0)'], {}), '(0, 0, 0)\n', (71, 80), False, 'import pygame\n')] |
"""
Installs and configures neutron
"""
import logging
import os
import re
import uuid
from packstack.installer import utils
from packstack.installer import validators
from packstack.installer.utils import split_hosts
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
# Controller o... | [
"logging.debug",
"uuid.uuid4",
"packstack.modules.ospluginutils.getManifestTemplate",
"packstack.installer.utils.split_hosts",
"packstack.installer.utils.get_localhost_ip",
"packstack.modules.ospluginutils.appendManifestFile"
] | [((422, 465), 'logging.debug', 'logging.debug', (['"""plugin %s loaded"""', '__name__'], {}), "('plugin %s loaded', __name__)\n", (435, 465), False, 'import logging\n'), ((562, 617), 'logging.debug', 'logging.debug', (['"""Adding OpenStack Neutron configuration"""'], {}), "('Adding OpenStack Neutron configuration')\n",... |
from hyperopt import hp
# Define the search space here, e.g.
# from hyperopt.pyll.base import scope
# search_space = {
# 'epochs': hp.qloguniform('epochs', 0, 4, 2),
# 'max_df': hp.uniform('max_df', 1, 2),
# 'max_ngrams': scope.int(hp.quniform('max_ngram', 3, 9, 1))
# }
# Default search space: Try di... | [
"hyperopt.hp.qloguniform"
] | [((382, 415), 'hyperopt.hp.qloguniform', 'hp.qloguniform', (['"""epochs"""', '(0)', '(4)', '(2)'], {}), "('epochs', 0, 4, 2)\n", (396, 415), False, 'from hyperopt import hp\n')] |
"""
<NAME> S-2013A7PS189P
<NAME> -2013A7PS079P
<NAME> -2013A7PS039P
Artificial Intelligence Term Project
"""
import pickle
import BeautifulSoup
import re
import boto
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from google import search
def get_10_summary(query, source="google"):
... | [
"google.search"
] | [((579, 592), 'google.search', 'search', (['query'], {}), '(query)\n', (585, 592), False, 'from google import search\n')] |
# -*- coding: utf-8 -*-
from pep3143daemon import DaemonContext, PidFile
import signal
import os
import sys
import time
class Daemon:
def stop(self, pidfile):
try:
pid = open(pidfile).readline()
except IOError:
print("Daemon already gone, or pidfile was deleted manually")
... | [
"time.sleep",
"os.path.isfile",
"sys.exc_info",
"sys.exit",
"sys.stdout.flush",
"pep3143daemon.PidFile",
"sys.stdout.write"
] | [((455, 485), 'sys.stdout.write', 'sys.stdout.write', (['"""Waiting..."""'], {}), "('Waiting...')\n", (471, 485), False, 'import sys\n'), ((500, 524), 'os.path.isfile', 'os.path.isfile', (['self.pid'], {}), '(self.pid)\n', (514, 524), False, 'import os\n'), ((970, 992), 'sys.stdout.write', 'sys.stdout.write', (['"""Ok"... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('games', '0003_auto_20150725_1737'),
]
operations = [
migrations.AlterField(
model_name='game',
name=... | [
"django.db.models.URLField",
"django.db.models.CharField",
"django.db.models.TextField",
"django.db.models.IntegerField"
] | [((353, 380), 'django.db.models.TextField', 'models.TextField', ([], {'null': '(True)'}), '(null=True)\n', (369, 380), False, 'from django.db import models, migrations\n'), ((505, 535), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'null': '(True)'}), '(null=True)\n', (524, 535), False, 'from django.db ... |
import sys
import json
from os import path
from argparse import ArgumentParser
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))) + '/utils/')
from algorithm_utils import set_algorithms_output_data
from health_check_lib import HealthCheckLocalDT
def main():
# Parse arguments
parse... | [
"os.path.abspath",
"json.dumps",
"health_check_lib.HealthCheckLocalDT.load",
"argparse.ArgumentParser"
] | [((324, 340), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (338, 340), False, 'from argparse import ArgumentParser\n'), ((490, 523), 'os.path.abspath', 'path.abspath', (['args.local_step_dbs'], {}), '(args.local_step_dbs)\n', (502, 523), False, 'from os import path\n'), ((543, 577), 'health_check_lib.... |
import logging
from utils.common.datapipeline import DataPipeline
import boto3
import json
from copy import deepcopy
s3 = boto3.resource('s3')
bucket = s3.Bucket('tier-0')
def run(config=None):
orgs = []
for obj in bucket.objects.all():
key = str(obj.key)
if len(key.split("_")) != 3:
... | [
"json.loads",
"utils.common.datapipeline.DataPipeline",
"boto3.resource",
"copy.deepcopy",
"logging.info"
] | [((123, 143), 'boto3.resource', 'boto3.resource', (['"""s3"""'], {}), "('s3')\n", (137, 143), False, 'import boto3\n'), ((804, 838), 'logging.info', 'logging.info', (['"""\tWriting to table"""'], {}), "('\\tWriting to table')\n", (816, 838), False, 'import logging\n'), ((405, 421), 'json.loads', 'json.loads', (['data']... |
import math
import numpy as np
from matplotlib.patches import FancyArrowPatch
def home_has_possession(row):
if row.possessionTeam == row.homeTeamAbbr:
return True
return False
def calculate_team_sitation(row):
ball_string = 'football'
if row.team == ball_string:
return ball_string
... | [
"math.radians",
"math.sqrt",
"numpy.square"
] | [((3550, 3568), 'numpy.square', 'np.square', (['(x1 - x2)'], {}), '(x1 - x2)\n', (3559, 3568), True, 'import numpy as np\n'), ((3571, 3589), 'numpy.square', 'np.square', (['(y1 - y2)'], {}), '(y1 - y2)\n', (3580, 3589), True, 'import numpy as np\n'), ((2039, 2075), 'math.sqrt', 'math.sqrt', (['(delta ** 2 - y_delta ** ... |
#!/usr/bin/env python
# 標準ライブラリ
from pathlib import Path
from re import search, sub
from sys import exit, argv
from xml.etree import ElementTree as ET
import csv
# サードパーティライブラリ
from requests import get
from requests.exceptions import Timeout, RequestException
# ローカルなライブラリ
from constants import ENC_API_KEY, NTA_API_... | [
"pathlib.Path",
"csv.writer",
"crypt_string.decrypt_strings",
"requests.get",
"sys.exit",
"re.sub",
"xml.etree.ElementTree.fromstring",
"re.search"
] | [((2193, 2221), 'xml.etree.ElementTree.fromstring', 'ET.fromstring', (['response.text'], {}), '(response.text)\n', (2206, 2221), True, 'from xml.etree import ElementTree as ET\n'), ((4955, 4962), 'sys.exit', 'exit', (['(0)'], {}), '(0)\n', (4959, 4962), False, 'from sys import exit, argv\n'), ((1749, 1793), 'requests.g... |
# custom libs
from lib.args import getConf
# Python libs
from re import sub
from os import mkdir
from os.path import exists
from getpass import getuser
from socket import gethostname
def genFrame(file):
from classes.frame import Frame
from lib.array import getGrid
grid = getGrid(file)
return(Frame(len(grid[0]), l... | [
"os.path.exists",
"lib.args.getConf",
"lib.array.getGrid",
"os.mkdir",
"getpass.getuser",
"socket.gethostname"
] | [((277, 290), 'lib.array.getGrid', 'getGrid', (['file'], {}), '(file)\n', (284, 290), False, 'from lib.array import getGrid\n'), ((1007, 1021), 'os.path.exists', 'exists', (['tmpDir'], {}), '(tmpDir)\n', (1013, 1021), False, 'from os.path import exists\n'), ((1064, 1077), 'os.mkdir', 'mkdir', (['tmpDir'], {}), '(tmpDir... |
""" This module comes with functions to decide which poker player out
of all players has the best cards.
"""
import itertools
# full_list in [('A','A'),('B','B')...,('F','F')]
def results(full_list, public_card):
""" The results function takes a list of player cards and
the community cards (in the middle of... | [
"itertools.combinations"
] | [((864, 908), 'itertools.combinations', 'itertools.combinations', (['player_card_check', '(5)'], {}), '(player_card_check, 5)\n', (886, 908), False, 'import itertools\n')] |
from discord.ext.commands import Bot
from discord_components import DiscordComponents, Button, ButtonStyle, InteractionType
from asyncio import TimeoutError
bot = Bot("!")
@bot.event
async def on_ready():
DiscordComponents(bot)
print(f"Logged in as {bot.user}!")
@bot.command()
async def waitforclick(ctx):
... | [
"discord.ext.commands.Bot",
"discord_components.Button",
"discord_components.DiscordComponents"
] | [((164, 172), 'discord.ext.commands.Bot', 'Bot', (['"""!"""'], {}), "('!')\n", (167, 172), False, 'from discord.ext.commands import Bot\n'), ((212, 234), 'discord_components.DiscordComponents', 'DiscordComponents', (['bot'], {}), '(bot)\n', (229, 234), False, 'from discord_components import DiscordComponents, Button, B... |
# -*- coding: utf-8 -*-
# Author:Guzhongren
# created: 2017-05-08
import os
path = 'C:\\geoconFailed\\willfix\\'
for file in os.listdir(path):
if os.path.isfile(os.path.join(path,file))==True:
_file= file.split(".")
_file_name=_file[0]
_file_type=_file[1]
new_file_name=_file_name[:-... | [
"os.listdir",
"os.path.join"
] | [((126, 142), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (136, 142), False, 'import os\n'), ((166, 190), 'os.path.join', 'os.path.join', (['path', 'file'], {}), '(path, file)\n', (178, 190), False, 'import os\n'), ((356, 380), 'os.path.join', 'os.path.join', (['path', 'file'], {}), '(path, file)\n', (368, ... |
"""
Automatic speech recognition scenario
"""
import logging
from typing import Optional
from tqdm import tqdm
import numpy as np
from art.preprocessing.audio import LFilter, LFilterPyTorch
from armory.utils.config_loading import (
load_dataset,
load_model,
load_attack,
load_adversarial_dataset,
... | [
"logging.getLogger",
"armory.utils.config_loading.load_label_targeter",
"art.preprocessing.audio.LFilterPyTorch",
"armory.utils.export.SampleExporter",
"armory.utils.metrics.MetricsLogger.from_config",
"tqdm.tqdm",
"art.preprocessing.audio.LFilter",
"armory.utils.config_loading.load_defense_wrapper",
... | [((530, 557), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (547, 557), False, 'import logging\n'), ((2030, 2103), 'art.preprocessing.audio.LFilter', 'LFilter', ([], {'numerator_coef': 'numerator_coef', 'denominator_coef': 'denominator_coef'}), '(numerator_coef=numerator_coef, denominato... |
# file that contains db models to be exposed via a REST API
from models import room, survey, wifi_log, timetable, module # import db models
from app import app # import Flask app
from auth import auth # import Auth app to provide user authentificaiton
from flask import request # import request object to parse json req... | [
"flask_peewee.rest.RestAPI",
"flask_peewee.rest.UserAuthentication",
"flask.request.get_json",
"models.module.select",
"flask_peewee.rest.AdminAuthentication"
] | [((1384, 1408), 'flask_peewee.rest.UserAuthentication', 'UserAuthentication', (['auth'], {}), '(auth)\n', (1402, 1408), False, 'from flask_peewee.rest import RestAPI, UserAuthentication, RestrictOwnerResource, AdminAuthentication\n'), ((1453, 1478), 'flask_peewee.rest.AdminAuthentication', 'AdminAuthentication', (['aut... |
from django.urls import path
from purple_admin import views
urlpatterns = [
path('', views.cabinet, name='admin_panel_cabinet'),
# Адмника Наименований маршрутов
path('route_list', views.cabinet_list, {'type': 'route'}, name='admin_panel_route_list'),
path('route_add', views.cabinet_add, {'type': 'rou... | [
"django.urls.path"
] | [((82, 133), 'django.urls.path', 'path', (['""""""', 'views.cabinet'], {'name': '"""admin_panel_cabinet"""'}), "('', views.cabinet, name='admin_panel_cabinet')\n", (86, 133), False, 'from django.urls import path\n'), ((176, 269), 'django.urls.path', 'path', (['"""route_list"""', 'views.cabinet_list', "{'type': 'route'}... |
import tensorflow as tf
from os import path
import numpy as np
from scipy import misc
from styx_msgs.msg import TrafficLight
import cv2
import rospy
import tensorflow as tf
class CarlaModel(object):
def __init__(self, model_checkpoint):
self.sess = None
self.checkpoint = model_checkpoint
... | [
"numpy.abs",
"tensorflow.reset_default_graph",
"tensorflow.Session",
"tensorflow.GraphDef",
"tensorflow.import_graph_def",
"cv2.cvtColor",
"tensorflow.gfile.GFile",
"numpy.expand_dims",
"rospy.loginfo",
"tensorflow.get_default_graph"
] | [((417, 441), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (439, 441), True, 'import tensorflow as tf\n'), ((522, 535), 'tensorflow.GraphDef', 'tf.GraphDef', ([], {}), '()\n', (533, 535), True, 'import tensorflow as tf\n'), ((625, 677), 'tensorflow.import_graph_def', 'tf.import_graph_de... |
"""
``goless`` introduces go-like channels and select to Python,
built on top of Stackless Python (and maybe one day gevent).
Use :func:`goless.chan` to create a synchronous or buffered channel.
Use :func:`goless.select` like you would the ``Select`` function in Go's reflect package
(since Python lacks a switch/case st... | [
"sys.exc_info",
"traceback.format_exception"
] | [((900, 944), 'traceback.format_exception', 'traceback.format_exception', (['etype', 'value', 'tb'], {}), '(etype, value, tb)\n', (926, 944), False, 'import traceback\n'), ((1506, 1520), 'sys.exc_info', 'sys.exc_info', ([], {}), '()\n', (1518, 1520), False, 'import sys\n')] |
from distutils.core import setup
from setuptools import find_packages
with open('README.md', 'r') as fh:
long_description = fh.read()
setup(
name='pyroaman',
version='0.1.1',
license='MIT',
description='Roam Research with Python',
author = '<NAME>',
author_email='<EMAIL>',
url = 'https... | [
"setuptools.find_packages"
] | [((564, 596), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests']"}), "(exclude=['tests'])\n", (577, 596), False, 'from setuptools import find_packages\n')] |
# -*- coding: utf-8 -*-
# Copyright (c) 2021 The HERA Collaboration
# Licensed under the MIT License
"""Utilities for dealing with galaxy/QSO catalogs."""
import numpy as np
import matplotlib.pyplot as plt
from astropy.coordinates import SkyCoord
from .util import deg_per_hr
_xshooter_ref = "https://ui.adsabs.harva... | [
"numpy.array",
"matplotlib.pyplot.figure",
"astropy.coordinates.SkyCoord"
] | [((5676, 5709), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'num': 'num'}), '(num=num, **fig_kwargs)\n', (5686, 5709), True, 'import matplotlib.pyplot as plt\n'), ((8031, 8045), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (8039, 8045), True, 'import numpy as np\n'), ((7872, 7895), 'astropy.coordinates.Sk... |
from configparser import ConfigParser
from os import path
def create_config() -> None:
_config.add_section("Telegram")
_config.set("Telegram", "api_id", "you api_id here")
_config.set("Telegram", "api_hash", "you api_hash here")
_config.set("Telegram", "username", "magicBot")
_config.set("Telegram... | [
"os.path.dirname",
"os.path.exists",
"configparser.ConfigParser"
] | [((659, 673), 'configparser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (671, 673), False, 'from configparser import ConfigParser\n'), ((697, 719), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (709, 719), False, 'from os import path\n'), ((742, 760), 'os.path.exists', 'path.exists', (['_p... |
import location
import unittest
class LocationTest(unittest.TestCase):
def testToJson(self):
test_location = location.Location(name='foo',
local_ip_address={'en0': {'local_ip_address': '1.2.3.4'}})
test_json = test_location.to_json()
self.assertEqual(test_json['name'], 'foo')
self.assertEqual(... | [
"location.Location"
] | [((117, 209), 'location.Location', 'location.Location', ([], {'name': '"""foo"""', 'local_ip_address': "{'en0': {'local_ip_address': '1.2.3.4'}}"}), "(name='foo', local_ip_address={'en0': {'local_ip_address':\n '1.2.3.4'}})\n", (134, 209), False, 'import location\n')] |
"""*****************************************************************************************
MIT License
Copyright (c) 2022 <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to dea... | [
"numpy.linalg.matrix_rank",
"numpy.sqrt",
"numpy.hstack",
"numpy.log",
"Utils.UPPER_BOUND",
"Utils.computeDistanceToSubspace",
"numpy.array",
"numpy.count_nonzero",
"numpy.argsort",
"numpy.einsum",
"numpy.linalg.norm",
"numpy.arange",
"Utils.determineUpperBound",
"numpy.multiply",
"numpy... | [((2252, 2269), 'numpy.hstack', 'np.hstack', (['(p, 1)'], {}), '((p, 1))\n', (2261, 2269), True, 'import numpy as np\n'), ((4103, 4112), 'numpy.linalg.svd', 'la.svd', (['B'], {}), '(B)\n', (4109, 4112), True, 'from numpy import linalg as la\n'), ((4953, 4971), 'numpy.eye', 'np.eye', (['A.shape[0]'], {}), '(A.shape[0])\... |
#
# Defines data that is consumed by the header2whatever hooks/templates
# to modify the generated files
#
import enum
from typing import Dict, List, Tuple, Optional
from pydantic import validator
from .util import Model, _generating_documentation
class ParamData(Model):
"""Various ways to modify parameters"""
... | [
"pydantic.validator"
] | [((5578, 5610), 'pydantic.validator', 'validator', (['"""overloads"""'], {'pre': '(True)'}), "('overloads', pre=True)\n", (5587, 5610), False, 'from pydantic import validator\n'), ((10774, 10807), 'pydantic.validator', 'validator', (['"""attributes"""'], {'pre': '(True)'}), "('attributes', pre=True)\n", (10783, 10807),... |
# -*- coding: utf-8 -*-
"""
Module that implements the questions types
"""
import json
from . import errors
def question_factory(kind, *args, **kwargs):
for clazz in (Text, Password, Confirm, List, Checkbox):
if clazz.kind == kind:
return clazz(*args, **kwargs)
raise errors.UnknownQuesti... | [
"json.loads"
] | [((1173, 1198), 'json.loads', 'json.loads', (['question_json'], {}), '(question_json)\n', (1183, 1198), False, 'import json\n')] |
import os
import json
import string
from tkinter import filedialog, simpledialog
from tkinter import *
class CsvImporter(object):
def __init__(self):
self.csv_data = None
self.languages = []
def import_csv(self, csv_filename):
with open(csv_filename, 'r') as file:
self.csv... | [
"json.load",
"tkinter.simpledialog.askstring",
"json.dumps",
"tkinter.filedialog.askopenfilename"
] | [((2951, 3061), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {'title': '"""Select CSV file with translations"""', 'filetypes': "(('CSV Files', '*.csv'),)"}), "(title='Select CSV file with translations',\n filetypes=(('CSV Files', '*.csv'),))\n", (2977, 3061), False, 'from tkinter import f... |
import logic
import numpy as np
import gym
ACTION_MAP = {
0: 'up',
1: 'down',
2: 'left',
3: 'right'
}
class Env2048(gym.Env):
metadata = {'render.modes': ['human']}
def __init__(self, n=4, max_idle=100, seed=None):
super(Env2048, self).__init__()
self.n = n
self.max... | [
"numpy.eye",
"logic.left",
"numpy.random.choice",
"logic.game_state",
"gym.spaces.Discrete",
"gym.spaces.Box",
"logic.new_game",
"numpy.array",
"numpy.sum",
"logic.right",
"numpy.random.seed",
"logic.add_two",
"logic.up",
"numpy.log2",
"logic.down"
] | [((434, 456), 'gym.spaces.Discrete', 'gym.spaces.Discrete', (['(4)'], {}), '(4)\n', (453, 456), False, 'import gym\n'), ((490, 569), 'gym.spaces.Box', 'gym.spaces.Box', ([], {'low': '(0)', 'high': '(255)', 'shape': '(self.n, self.n, 2 ** n)', 'dtype': 'np.uint8'}), '(low=0, high=255, shape=(self.n, self.n, 2 ** n), dty... |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 13 12:55:47 2018
@name: CSVMachLearn.py
@description: 1D CNN using CSV vector for machine learning
@author: <NAME>
"""
from __future__ import absolute_import, division, print_function
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
fro... | [
"tensorflow.enable_eager_execution",
"tensorflow.GradientTape",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.MaxPooling1D",
"tensorflow.set_random_seed",
"matplotlib.lines.Line2D",
"tensorflow.keras.models.save_model",
"tensorflow.keras.layers.Reshape",
"sklearn.decomposition.PCA",
"t... | [((485, 512), 'tensorflow.enable_eager_execution', 'tf.enable_eager_execution', ([], {}), '()\n', (510, 512), True, 'import tensorflow as tf\n'), ((514, 532), 'tensorflow.set_random_seed', 'set_random_seed', (['(0)'], {}), '(0)\n', (529, 532), False, 'from tensorflow import set_random_seed\n'), ((5009, 5163), 'tensorfl... |
# -*- coding: utf-8 -*-
"""
Created on 2020/03/16
Feature selection: Relief-based feature selection algorithm.
------
@author: <NAME>
"""
import numpy as np
from sklearn import preprocessing
import os
from sklearn.externals import joblib
from el_classify_sensitive_person_train_validation import ClassifyFourKindOfPers... | [
"pandas.DataFrame",
"os.path.join",
"numpy.array",
"numpy.vstack",
"eslearn.utils.lc_evaluation_model_performances.eval_performance",
"el_classify_sensitive_person_train_validation.ClassifyFourKindOfPersonTrain",
"numpy.load"
] | [((2744, 2940), 'eslearn.utils.lc_evaluation_model_performances.eval_performance', 'eval_performance', (['selftest.label_test', 'selftest.prediction', 'selftest.decision'], {'accuracy_kfold': 'None', 'sensitivity_kfold': 'None', 'specificity_kfold': 'None', 'AUC_kfold': 'None', 'verbose': '(1)', 'is_showfig': '(0)'}), ... |
import random
cor = {
'fim':'\033[m',
'amarelo':'\033[1;033m',
'vermelho':'\033[1;031m',
'vermelhof':'\033[7;031m',
'azul':'\033[1;034m',
'verde':'\033[1;32m',
'verdef':'\033[7;32m',
'branco':'\033[1;030m'
}
print('''
Escolha uma das opções abaixo:
\t {}1{} {... | [
"random.shuffle"
] | [((718, 736), 'random.shuffle', 'random.shuffle', (['pc'], {}), '(pc)\n', (732, 736), False, 'import random\n')] |
from pandas.core.algorithms import mode
import torch
import torch.nn as nn
from albumentations import Compose,Resize,Normalize
from albumentations.pytorch import ToTensorV2
import wandb
import time
import torchvision
import torch.nn.functional as F
import torch.optim as optim
from torch.cuda.amp import autocast,GradSc... | [
"wandb.log",
"pandas.read_csv",
"wandb.init",
"torch.cuda.is_available",
"torch.cuda.amp.GradScaler",
"torch.cuda.amp.autocast",
"numpy.random.seed",
"build_model.Deformed_Darknet53",
"albumentations.Normalize",
"callbacks.EarlyStopping",
"torch.nn.BCEWithLogitsLoss",
"torch.optim.zero_grad",
... | [((585, 608), 'torch.manual_seed', 'torch.manual_seed', (['(2021)'], {}), '(2021)\n', (602, 608), False, 'import torch\n'), ((609, 629), 'numpy.random.seed', 'np.random.seed', (['(2021)'], {}), '(2021)\n', (623, 629), True, 'import numpy as np\n'), ((630, 647), 'random.seed', 'random.seed', (['(2021)'], {}), '(2021)\n'... |
import conftest
from asaprog import pac_encode
from asaprog.util import *
if __name__ == "__main__":
pac = {
'command': asaProgCommand.CHK_DEVICE.value,
'data': b'test'
}
res = pac_encode(pac)
print(res)
print(res[-1])
| [
"asaprog.pac_encode"
] | [((206, 221), 'asaprog.pac_encode', 'pac_encode', (['pac'], {}), '(pac)\n', (216, 221), False, 'from asaprog import pac_encode\n')] |
# -*- coding: UTF=8 -*-
__author__ = '<NAME>'
import glob
from appwebshare.scripts import config
def get_file_list():
without_dir = []
for i in glob.glob(config.DIR + '*.*') :
without_dir.append(i.replace(config.DIR, ""))
return without_dir | [
"glob.glob"
] | [((153, 182), 'glob.glob', 'glob.glob', (["(config.DIR + '*.*')"], {}), "(config.DIR + '*.*')\n", (162, 182), False, 'import glob\n')] |
import pytest
import checkout_sdk
from checkout_sdk.environment import Environment
from checkout_sdk.exception import CheckoutArgumentException
def test_should_create_four_sdk():
checkout_sdk.FourSdk() \
.secret_key('<KEY>') \
.public_key('<KEY>') \
.environment(Environment.sandbox()) \
... | [
"checkout_sdk.environment.Environment.production",
"checkout_sdk.environment.Environment.sandbox",
"checkout_sdk.FourSdk",
"pytest.raises"
] | [((613, 653), 'pytest.raises', 'pytest.raises', (['CheckoutArgumentException'], {}), '(CheckoutArgumentException)\n', (626, 653), False, 'import pytest\n'), ((804, 844), 'pytest.raises', 'pytest.raises', (['CheckoutArgumentException'], {}), '(CheckoutArgumentException)\n', (817, 844), False, 'import pytest\n'), ((294, ... |
import os.path as op
from urllib.request import urlretrieve
import matplotlib
import numpy as np
from numpy.testing import assert_allclose
import pytest
import hnn_core
from hnn_core import read_params, read_dipole, average_dipoles
from hnn_core import Network, jones_2009_model
from hnn_core.viz import plot_dipole
fr... | [
"hnn_core.jones_2009_model",
"hnn_core.dipole.Dipole",
"numpy.array",
"numpy.loadtxt",
"numpy.arange",
"os.path.exists",
"hnn_core.dipole.simulate_dipole",
"urllib.request.urlretrieve",
"numpy.random.random",
"numpy.testing.assert_allclose",
"hnn_core.average_dipoles",
"hnn_core.dipole._rmse",... | [((450, 471), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (464, 471), False, 'import matplotlib\n'), ((571, 600), 'os.path.dirname', 'op.dirname', (['hnn_core.__file__'], {}), '(hnn_core.__file__)\n', (581, 600), True, 'import os.path as op\n'), ((620, 667), 'os.path.join', 'op.join', (['hnn_c... |
from ..models import EntityOnServer, AccessToken, Organisation, Server, ServerUser, Key, KeyFetchEvent, AuditNote, AuditEvent, LoginAttempt
from django.template import Context, Template
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse
from uuid import uuid4
from datetime import... | [
"json.loads",
"django.template.Template",
"django.http.HttpResponse",
"uuid.uuid4",
"datetime.datetime.now",
"django.template.Context"
] | [((701, 725), 'json.loads', 'json.loads', (['request.body'], {}), '(request.body)\n', (711, 725), False, 'import json\n'), ((1429, 1443), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1441, 1443), False, 'from datetime import datetime\n'), ((2860, 2880), 'django.http.HttpResponse', 'HttpResponse', (['outp... |
from typing import List
from parser import parse_bytes, split_bytes_from_lines, get_bytes, parse_instruction_set, wrap_parsed_set
from reader import dump_file_hex_with_locs
class Translator:
"""
Class handling file translations from *.mpy to hex dumps and opcodes
"""
def __init__(self, file: str):
... | [
"parser.parse_instruction_set",
"parser.wrap_parsed_set",
"reader.dump_file_hex_with_locs"
] | [((565, 599), 'reader.dump_file_hex_with_locs', 'dump_file_hex_with_locs', (['self.file'], {}), '(self.file)\n', (588, 599), False, 'from reader import dump_file_hex_with_locs\n'), ((2269, 2298), 'parser.parse_instruction_set', 'parse_instruction_set', (['_bytes'], {}), '(_bytes)\n', (2290, 2298), False, 'from parser i... |
import json
import boto3 # Amazon S3 client library
s3 = boto3.resource('s3')
dynamodb = boto3.resource('dynamodb')
problems_table = dynamodb.Table('codebreaker-problems')
bucket = s3.Bucket('codebreaker-testdata')
def lambda_handler(event, context):
problemName = event['problemName']
testcaseCount = 0
fo... | [
"boto3.resource"
] | [((57, 77), 'boto3.resource', 'boto3.resource', (['"""s3"""'], {}), "('s3')\n", (71, 77), False, 'import boto3\n'), ((89, 115), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {}), "('dynamodb')\n", (103, 115), False, 'import boto3\n')] |
#!/usr/bin/env python
"""
Southern California Earthquake Center Broadband Platform
Copyright 2010-2017 Southern California Earthquake Center
These are acceptance tests for the broadband platforms
$Id: AcceptTests.py 1795 2017-02-09 16:23:34Z fsilva $
"""
from __future__ import division, print_function
# Import Python... | [
"os.path.exists",
"install_cfg.InstallCfg",
"os.listdir",
"bband_utils.runprog",
"bband_utils.mkdirs",
"seqnum.get_seq_num",
"shutil.copy2",
"sys.stderr.flush",
"os.path.join",
"optparse.OptionParser",
"new.instancemethod",
"cmp_bbp.cmp_bbp",
"sys.exit",
"sys.stdout.flush",
"unittest.Tex... | [((654, 666), 'install_cfg.InstallCfg', 'InstallCfg', ([], {}), '()\n', (664, 666), False, 'from install_cfg import InstallCfg\n'), ((781, 837), 'os.path.join', 'os.path.join', (['install.A_TEST_REF_DIR', 'accept_test_inputs'], {}), '(install.A_TEST_REF_DIR, accept_test_inputs)\n', (793, 837), False, 'import os\n'), ((... |
import torch
import torch.nn as nn
import torchvision.models as models
from torch.nn.utils.rnn import pack_padded_sequence as pack
from torch.nn.utils.rnn import pad_packed_sequence as unpack
from torch.autograd import Variable
class EncoderCNN(nn.Module):
def __init__(self, embed_size):
"""Load the pretr... | [
"torch.nn.Sequential",
"torch.nn.LSTM",
"torch.LongTensor",
"torch.nn.BatchNorm1d",
"torch.cat",
"torchvision.models.resnet152",
"torch.cuda.is_available",
"torch.nn.utils.rnn.pack_padded_sequence",
"torch.nn.Linear",
"torch.squeeze",
"torch.autograd.Variable",
"torch.nn.utils.rnn.pad_packed_s... | [((426, 459), 'torchvision.models.resnet152', 'models.resnet152', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (442, 459), True, 'import torchvision.models as models\n'), ((562, 585), 'torch.nn.Sequential', 'nn.Sequential', (['*modules'], {}), '(*modules)\n', (575, 585), True, 'import torch.nn as nn\n'), ((60... |
"""
Unit tests for the searcher module. Those tests mock the Entrez class
and do not make any sort of HTTP request.
"""
# pylint: disable=redefined-outer-name
import io
from pathlib import Path
from Bio import Entrez
from dbvirus_searcher import Searcher
def test_searcher_initialization(searcher):
"""
Tests a... | [
"dbvirus_searcher.Searcher",
"pathlib.Path",
"Bio.Entrez.esearch.assert_called_with",
"Bio.Entrez.efetch.assert_called",
"io.StringIO"
] | [((459, 493), 'dbvirus_searcher.Searcher', 'Searcher', (['"""<EMAIL>"""'], {'db': '"""other_db"""'}), "('<EMAIL>', db='other_db')\n", (467, 493), False, 'from dbvirus_searcher import Searcher\n'), ((911, 928), 'io.StringIO', 'io.StringIO', (['"""{}"""'], {}), "('{}')\n", (922, 928), False, 'import io\n'), ((1015, 1115)... |
#!/usr/bin/env python
"""Command line interface for the compact ACME library."""
import acme_lib
import argparse
import sys
import textwrap
def _gen_account_key(account_key, key_length, algorithm):
key = acme_lib.create_key(key_length=key_length, algorithm=algorithm)
acme_lib.write_file(account_key, key)
d... | [
"acme_lib.write_file",
"acme_lib.notify_challenges",
"textwrap.dedent",
"sys.exit",
"acme_lib.get_challenges",
"acme_lib.download_certificate",
"textwrap.indent",
"sys.stderr.write",
"acme_lib.create_key",
"acme_lib.get_csr_as_text",
"acme_lib.serialize_state",
"acme_lib.remove_challenges",
... | [((211, 274), 'acme_lib.create_key', 'acme_lib.create_key', ([], {'key_length': 'key_length', 'algorithm': 'algorithm'}), '(key_length=key_length, algorithm=algorithm)\n', (230, 274), False, 'import acme_lib\n'), ((279, 316), 'acme_lib.write_file', 'acme_lib.write_file', (['account_key', 'key'], {}), '(account_key, key... |
"""
VPC stack for running ConsoleMe on ECS
"""
import urllib.request
from aws_cdk import (
aws_ec2 as ec2,
core as cdk
)
class VPCStack(cdk.NestedStack):
"""
VPC stack for running ConsoleMe on ECS
"""
def __init__(self, scope: cdk.Construct, id: str, **kwargs) -> None:
super().__ini... | [
"aws_cdk.aws_ec2.SecurityGroup",
"aws_cdk.aws_ec2.Vpc",
"aws_cdk.aws_ec2.Port.tcp",
"aws_cdk.aws_ec2.Peer.ipv4"
] | [((395, 426), 'aws_cdk.aws_ec2.Vpc', 'ec2.Vpc', (['self', '"""Vpc"""'], {'max_azs': '(2)'}), "(self, 'Vpc', max_azs=2)\n", (402, 426), True, 'from aws_cdk import aws_ec2 as ec2, core as cdk\n'), ((485, 625), 'aws_cdk.aws_ec2.SecurityGroup', 'ec2.SecurityGroup', (['self', '"""LBSG"""'], {'vpc': 'vpc', 'description': '""... |
from torch import nn, optim
import torch
import model
import torch.nn.utils
import utils
import argparse
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
parser = argparse.ArgumentParser(description='training parameters')
parser.add_argument('--n_hid', type=int, default=128,
... | [
"model.train",
"utils.get_batch",
"model.parameters",
"argparse.ArgumentParser",
"torch.nn.MSELoss",
"torch.no_grad",
"torch.cuda.is_available",
"model.coRNN",
"model.eval"
] | [((186, 244), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""training parameters"""'}), "(description='training parameters')\n", (209, 244), False, 'import argparse\n'), ((1476, 1488), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (1486, 1488), False, 'from torch import nn, optim\n... |
import time
import asyncio
import sortedcontainers
from hailtop.utils import retry_transient_errors
class K8sCache:
def __init__(self, client, refresh_time, max_size=100):
self.client = client
self.refresh_time = refresh_time
self.max_size = max_size
self.secrets = {}
sel... | [
"time.time",
"sortedcontainers.SortedSet",
"asyncio.Lock",
"hailtop.utils.retry_transient_errors"
] | [((335, 397), 'sortedcontainers.SortedSet', 'sortedcontainers.SortedSet', ([], {'key': '(lambda id: self.secrets[id][1])'}), '(key=lambda id: self.secrets[id][1])\n', (361, 397), False, 'import sortedcontainers\n'), ((513, 584), 'sortedcontainers.SortedSet', 'sortedcontainers.SortedSet', ([], {'key': '(lambda id: self.... |
# Copyright (C) 2020 GreenWaves Technologies, SAS
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This progr... | [
"cmd2.with_argparser",
"graph.manipulations.formatter.insert_formatter",
"cmd2.Cmd2ArgumentParser",
"graph.manipulations.formatter.remove_formatter"
] | [((1549, 1608), 'cmd2.Cmd2ArgumentParser', 'Cmd2ArgumentParser', (['"""inserts image format node into graphs"""'], {}), "('inserts image format node into graphs')\n", (1567, 1608), False, 'from cmd2 import Cmd2ArgumentParser, with_argparser\n'), ((2194, 2228), 'cmd2.with_argparser', 'with_argparser', (['parser_imagefor... |
# USAGE
# python extract_embeddings.py --dataset dataset --embeddings output/embeddings.pickle \
# --detector face_detection_model --embedding-model openface_nn4.small2.v1.t7
# import the necessary packages
from imutils.face_utils import FaceAligner
from imutils import paths
import numpy as np
import argparse
import i... | [
"cv2.dnn.blobFromImage",
"PIL.Image.fromarray",
"cv2.dnn.readNetFromTorch",
"argparse.ArgumentParser",
"yolo.YOLO",
"pickle.dumps",
"keras.backend.learning_phase",
"numpy.asarray",
"dlib.shape_predictor",
"numpy.array",
"imutils.resize",
"cv2.waitKey",
"imutils.paths.list_images",
"numpy.e... | [((1650, 1675), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1673, 1675), False, 'import argparse\n'), ((2238, 2283), 'dlib.shape_predictor', 'dlib.shape_predictor', (["args['shape_predictor']"], {}), "(args['shape_predictor'])\n", (2258, 2283), False, 'import dlib\n'), ((2340, 2346), 'yolo.... |
"""route.py
Linux parsers for the following commands:
* route
"""
# python
import re
# metaparser
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import Schema, Any, Optional
from netaddr import IPAddress, IPNetwork
# =======================================================
# Sch... | [
"netaddr.IPNetwork",
"genie.metaparser.util.schemaengine.Any",
"genie.metaparser.util.schemaengine.Optional",
"re.compile"
] | [((2484, 2695), 're.compile', 're.compile', (['"""(?P<destination>[a-z0-9\\\\.\\\\:]+) +(?P<gateway>[a-z0-9\\\\.\\\\:_]+) +(?P<mask>[a-z0-9\\\\.\\\\:]+) +(?P<flags>[a-zA-Z]+) +(?P<metric>(\\\\d+)) +(?P<ref>(\\\\d+)) +(?P<use>(\\\\d+)) +(?P<interface>\\\\S+)"""'], {}), "(\n '(?P<destination>[a-z0-9\\\\.\\\\:]+) +(?P<... |
import json
import datetime
import requests
from nameko.web.handlers import http
from nameko.timer import timer
from statsd import StatsClient
from circuitbreaker import circuit
class DemoChassisService:
name = "demo_chassis_service"
statsd = StatsClient('localhost', 8125, prefix='simplebank-demo')
@htt... | [
"datetime.datetime.utcnow",
"circuitbreaker.circuit",
"json.dumps",
"requests.get",
"statsd.StatsClient",
"nameko.timer.timer",
"nameko.web.handlers.http"
] | [((254, 310), 'statsd.StatsClient', 'StatsClient', (['"""localhost"""', '(8125)'], {'prefix': '"""simplebank-demo"""'}), "('localhost', 8125, prefix='simplebank-demo')\n", (265, 310), False, 'from statsd import StatsClient\n'), ((317, 339), 'nameko.web.handlers.http', 'http', (['"""GET"""', '"""/health"""'], {}), "('GE... |
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
map = Basemap(projection='cyl')
map.drawmapboundary(fill_color='aqua')
map.fillcontinents(color='coral',lake_color='aqua')
map.drawcoastlines()
plt.show() | [
"mpl_toolkits.basemap.Basemap",
"matplotlib.pyplot.show"
] | [((80, 105), 'mpl_toolkits.basemap.Basemap', 'Basemap', ([], {'projection': '"""cyl"""'}), "(projection='cyl')\n", (87, 105), False, 'from mpl_toolkits.basemap import Basemap\n'), ((220, 230), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (228, 230), True, 'import matplotlib.pyplot as plt\n')] |
"""Unit tests for pynlpir's cli.py file."""
import os
import shutil
import stat
import unittest
try:
from urllib.error import URLError
from urllib.request import urlopen
except ImportError:
from urllib2 import URLError, urlopen
from click.testing import CliRunner
from pynlpir import cli
TEST_DIR = os.pat... | [
"urllib2.urlopen",
"pynlpir.cli.update_license_file",
"os.path.join",
"click.testing.CliRunner",
"os.getcwd",
"os.chmod",
"os.path.dirname",
"os.path.basename"
] | [((372, 416), 'os.path.join', 'os.path.join', (['TEST_DIR', '"""data"""', '"""NLPIR.user"""'], {}), "(TEST_DIR, 'data', 'NLPIR.user')\n", (384, 416), False, 'import os\n'), ((330, 355), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (345, 355), False, 'import os\n'), ((510, 538), 'urllib2.url... |
import logging
import ibmsecurity.utilities.tools
import time
logger = logging.getLogger(__name__)
requires_model = "Appliance"
def get(isamAppliance, check_mode=False, force=False):
"""
Retrieving the current FIPS Mode configuration
"""
return isamAppliance.invoke_get("Retrieving the current FIPS M... | [
"logging.getLogger",
"time.sleep"
] | [((72, 99), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (89, 99), False, 'import logging\n'), ((3746, 3768), 'time.sleep', 'time.sleep', (['check_freq'], {}), '(check_freq)\n', (3756, 3768), False, 'import time\n')] |
#!/usr/bin/env python
""" HIAS AI Model Data Augmentation Class.
Provides data augmentation methods.
MIT License
Copyright (c) 2021 Asociación de Investigacion en Inteligencia Artificial
Para la Leucemia <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associa... | [
"numpy.dstack",
"cv2.warpAffine",
"cv2.flip",
"numpy.float32",
"skimage.transform.AffineTransform",
"skimage.transform.warp",
"random.seed",
"cv2.equalizeHist",
"numpy.random.seed",
"cv2.cvtColor",
"scipy.ndimage.gaussian_filter",
"cv2.getRotationMatrix2D",
"random.randint"
] | [((1721, 1736), 'numpy.random.seed', 'seed', (['self.seed'], {}), '(self.seed)\n', (1725, 1736), False, 'from numpy.random import seed\n'), ((1921, 1959), 'cv2.cvtColor', 'cv2.cvtColor', (['data', 'cv2.COLOR_BGR2GRAY'], {}), '(data, cv2.COLOR_BGR2GRAY)\n', (1933, 1959), False, 'import cv2\n'), ((2139, 2176), 'cv2.cvtCo... |
from pytest import raises
from vedro._core._scenario_finder._file_filters import FileFilter
def test_file_filter():
with raises(Exception) as exc_info:
FileFilter()
assert exc_info.type is TypeError
assert "Can't instantiate abstract class FileFilter" in str(exc_info.value)
| [
"pytest.raises",
"vedro._core._scenario_finder._file_filters.FileFilter"
] | [((128, 145), 'pytest.raises', 'raises', (['Exception'], {}), '(Exception)\n', (134, 145), False, 'from pytest import raises\n'), ((167, 179), 'vedro._core._scenario_finder._file_filters.FileFilter', 'FileFilter', ([], {}), '()\n', (177, 179), False, 'from vedro._core._scenario_finder._file_filters import FileFilter\n'... |
# Program 8_plot_data_perstation.py written by <NAME> (<EMAIL>)
file_name= '8_plot_data_perstation.py'
# Uses receiver functions computed to produce a nice graph for every directory in DATARF
import obspy
from obspy import read
from obspy.core import Stream
from obspy.core import trace
import matplotlib.pyplot as plt
... | [
"obspy.read",
"numpy.abs",
"matplotlib.pyplot.ylabel",
"numpy.round",
"matplotlib.pyplot.xlabel",
"obspy.UTCDateTime",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.subplot",
"glob.glob",
"matplotlib.pyplot.show"
] | [((509, 532), 'glob.glob', 'glob.glob', (["(direc + '/*')"], {}), "(direc + '/*')\n", (518, 532), False, 'import glob\n'), ((713, 744), 'glob.glob', 'glob.glob', (["(stadir + '/*.PICKLE')"], {}), "(stadir + '/*.PICKLE')\n", (722, 744), False, 'import glob\n'), ((3703, 3723), 'matplotlib.pyplot.subplot', 'plt.subplot', ... |
# -*- coding: utf-8 -*-
################################################################################
# _____ _ _____ _ #
# / ____(_) / ____| | | #
# | | _ ___ ___ ___ | (___ _ _ ___... | [
"re.split",
"django.contrib.admin.site.register",
"json.loads"
] | [((9003, 9047), 'django.contrib.admin.site.register', 'admin.site.register', (['model', 'admin.ModelAdmin'], {}), '(model, admin.ModelAdmin)\n', (9022, 9047), False, 'from django.contrib import admin\n'), ((5406, 5467), 're.split', 're.split', (['""";|,|q=0.\\\\d"""', "request.META['HTTP_ACCEPT_LANGUAGE']"], {}), "(';|... |
import sys
import comtypes
from comtypes.client import CreateObject
try:
# Connecting | coneccion
xl = CreateObject("Excel.Application")
except (OSError, comtypes.COMError):
print("No tiene instalada el programa(Excel).")
sys.exit(-1)
xl.Visible = True
print (xl) | [
"comtypes.client.CreateObject",
"sys.exit"
] | [((112, 145), 'comtypes.client.CreateObject', 'CreateObject', (['"""Excel.Application"""'], {}), "('Excel.Application')\n", (124, 145), False, 'from comtypes.client import CreateObject\n'), ((236, 248), 'sys.exit', 'sys.exit', (['(-1)'], {}), '(-1)\n', (244, 248), False, 'import sys\n')] |
from selenium import webdriver
import time
chromedriver = "C:/Users/deniz/chromedriver/chromedriver"
driver = webdriver.Chrome(chromedriver)
driver.get('http://127.0.0.1:8000/')
dashboard = '//*[@id="accordionSidebar"]/li[1]/a'
sectors_1 = '//*[@id="sectors"]'
sectors_1_element = '//*[@id="sectors"]/option[4]'
add_s... | [
"selenium.webdriver.Chrome",
"time.sleep"
] | [((111, 141), 'selenium.webdriver.Chrome', 'webdriver.Chrome', (['chromedriver'], {}), '(chromedriver)\n', (127, 141), False, 'from selenium import webdriver\n'), ((528, 541), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (538, 541), False, 'import time\n'), ((590, 603), 'time.sleep', 'time.sleep', (['(5)'], {}),... |
import tensorflow as tf
from netensorflow.ann.ANN import ANN
from netensorflow.ann.macro_layer.MacroLayer import MacroLayer
from netensorflow.ann.macro_layer.layer_structure.InputLayerStructure import InputLayerStructure
from netensorflow.ann.macro_layer.layer_structure.LayerStructure import LayerStructure, LayerType
... | [
"netensorflow.ann.macro_layer.layer_structure.InputLayerStructure.InputLayerStructure",
"netensorflow.ann.macro_layer.layer_structure.layers.FullConnectedWithSoftmaxLayer.FullConnectedWithSoftmaxLayer",
"tensorflow.Session",
"netensorflow.ann.macro_layer.layer_structure.layers.FullConnected.FullConnected",
... | [((706, 718), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (716, 718), True, 'import tensorflow as tf\n'), ((779, 810), 'netensorflow.ann.macro_layer.layer_structure.layers.FullConnected.FullConnected', 'FullConnected', ([], {'inputs_amount': '(20)'}), '(inputs_amount=20)\n', (792, 810), False, 'from netensorf... |
import yaml
import os
### Sample Contents of config.yaml:
# 0002_info_leakage:
# category: Sifu C/C++
# points: 100
# description: Leave no trace
# vulnerability: CWE-14 * Information Leakage
# directory: Challenges/C_CPP/0002_info_leakage
# send_dir: true
# file: func_000... | [
"os.path.dirname",
"os.path.join",
"os.walk"
] | [((780, 805), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (795, 805), False, 'import os\n'), ((2197, 2210), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (2204, 2210), False, 'import os\n'), ((1088, 1112), 'os.path.join', 'os.path.join', (['path', 'file'], {}), '(path, file)\n', (1100,... |
import logging
class Logger(object):
stream_handler = logging.StreamHandler()
formatter = logging.Formatter("[%(levelname)s %(pathname)s:%(lineno)d] %(message)s")
stream_handler.setFormatter(formatter)
stream_handler.setLevel(logging.INFO)
my_logger = logging.Logger("arachne.runtime.rpc")
my_... | [
"logging.Logger",
"logging.Formatter",
"logging.StreamHandler"
] | [((60, 83), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (81, 83), False, 'import logging\n'), ((100, 172), 'logging.Formatter', 'logging.Formatter', (['"""[%(levelname)s %(pathname)s:%(lineno)d] %(message)s"""'], {}), "('[%(levelname)s %(pathname)s:%(lineno)d] %(message)s')\n", (117, 172), False... |
#pylint: disable = line-too-long
import os
import time
import board
import neopixel
import keypad
import usb_hid
import pwmio
import rainbowio
from adafruit_hid.keyboard import Keyboard
from pykey.keycode import KB_Keycode as KC
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
# Hardware definition: GPIO... | [
"adafruit_hid.keyboard.Keyboard",
"os.listdir",
"rainbowio.colorwheel",
"time.sleep",
"neopixel.NeoPixel",
"adafruit_hid.keyboard_layout_us.KeyboardLayoutUS",
"pwmio.PWMOut",
"keypad.KeyMatrix"
] | [((401, 473), 'neopixel.NeoPixel', 'neopixel.NeoPixel', (['pixel_pin', 'num_pixels'], {'brightness': '(1)', 'auto_write': '(False)'}), '(pixel_pin, num_pixels, brightness=1, auto_write=False)\n', (418, 473), False, 'import neopixel\n'), ((709, 761), 'pwmio.PWMOut', 'pwmio.PWMOut', (['board.SPEAKER'], {'variable_frequen... |
from pytest_factoryboy import register
from tests.factories.specification import (
CallbackFactory,
ComponentsFactory,
ContactFactory,
DiscriminatorFactory,
EncodingFactory,
ExampleFactory,
ExternalDocumentationFactory,
HeaderFactory,
InfoFactory,
LicenseFactory,
LinkFactory... | [
"pytest_factoryboy.register"
] | [((724, 748), 'pytest_factoryboy.register', 'register', (['OpenAPIFactory'], {}), '(OpenAPIFactory)\n', (732, 748), False, 'from pytest_factoryboy import register\n'), ((749, 770), 'pytest_factoryboy.register', 'register', (['InfoFactory'], {}), '(InfoFactory)\n', (757, 770), False, 'from pytest_factoryboy import regis... |
import logging
from os.path import expanduser, join
from unittest import mock
import pytest
from click.testing import CliRunner
from configparser import ConfigParser
from apparate.configure import configure
from apparate.cli_commands import upload, upload_and_update
logging.basicConfig(level=logging.INFO)
logger = ... | [
"logging.basicConfig",
"logging.getLogger",
"configparser.ConfigParser",
"unittest.mock.mock_open",
"unittest.mock.call",
"pytest.mark.fixture",
"click.testing.CliRunner",
"unittest.mock.patch",
"os.path.expanduser"
] | [((271, 310), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (290, 310), False, 'import logging\n'), ((320, 362), 'logging.getLogger', 'logging.getLogger', (['"""apparate.cli_commands"""'], {}), "('apparate.cli_commands')\n", (337, 362), False, 'import logging\n... |
# Flight duration model: Just distance
# In this exercise you'll build a regression model to predict flight duration (the duration column).
# For the moment you'll keep the model simple, including only the distance of the flight (the km column) as a predictor.
# The data are in flights. The first few records are disp... | [
"pyspark.ml.evaluation.RegressionEvaluator",
"pyspark.ml.regression.LinearRegression"
] | [((892, 929), 'pyspark.ml.regression.LinearRegression', 'LinearRegression', ([], {'labelCol': '"""duration"""'}), "(labelCol='duration')\n", (908, 929), False, 'from pyspark.ml.regression import LinearRegression\n'), ((1158, 1198), 'pyspark.ml.evaluation.RegressionEvaluator', 'RegressionEvaluator', ([], {'labelCol': '"... |
"""
Main Larch interpreter
Safe(ish) evaluator of python expressions, using ast module.
The emphasis here is on mathematical expressions, and so
numpy functions are imported if available and used.
"""
from __future__ import division, print_function
import os
import sys
import ast
import math
import numpy
from . ... | [
"os.path.exists",
"os.listdir",
"ast.Break",
"os.path.join",
"sys.exc_info",
"os.path.isdir",
"ast.dump",
"ast.parse",
"ast.BinOp",
"sys.path.append"
] | [((4539, 4588), 'os.path.join', 'os.path.join', (['site_config.sys_larchdir', '"""plugins"""'], {}), "(site_config.sys_larchdir, 'plugins')\n", (4551, 4588), False, 'import os\n'), ((4610, 4633), 'os.listdir', 'os.listdir', (['plugins_dir'], {}), '(plugins_dir)\n', (4620, 4633), False, 'import os\n'), ((6207, 6218), 'a... |
# Explicit API functions
from api_functions import api_function1, api_function2
from package3 import api_function3
# API Packages
import package1, package2
import package3
from package4 import api_class1
# Defined functions
def defined_function_1(d_f_arg1, d_f_arg2):
a = api_function1(d_f_arg1)
b = (api_fun... | [
"package4.api_class1.cl1_function1",
"api_functions.api_function1",
"package3.api_function3",
"package1.p1_function1",
"api_functions.api_function2",
"package3.p3_function1"
] | [((280, 303), 'api_functions.api_function1', 'api_function1', (['d_f_arg1'], {}), '(d_f_arg1)\n', (293, 303), False, 'from api_functions import api_function1, api_function2\n'), ((425, 440), 'api_functions.api_function1', 'api_function1', ([], {}), '()\n', (438, 440), False, 'from api_functions import api_function1, ap... |
"""Tests for making datasets for contradictory-claims."""
# -*- coding: utf-8 -*-
import os
import unittest
from contradictory_claims.data.make_dataset import load_drug_virus_lexicons, load_mancon_corpus_from_sent_pairs, \
load_med_nli, load_multi_nli
from .constants import drug_lex_path, mancon_sent_pairs, med... | [
"contradictory_claims.data.make_dataset.load_med_nli",
"contradictory_claims.data.make_dataset.load_mancon_corpus_from_sent_pairs",
"os.path.isfile",
"contradictory_claims.data.make_dataset.load_multi_nli",
"unittest.skip",
"contradictory_claims.data.make_dataset.load_drug_virus_lexicons"
] | [((677, 791), 'unittest.skip', 'unittest.skip', (['"""This test can be used to check that datasets are found at the correct locations locally"""'], {}), "(\n 'This test can be used to check that datasets are found at the correct locations locally'\n )\n", (690, 791), False, 'import unittest\n'), ((2057, 2146), 'u... |
# import modules
import numpy as np
import argparse
import cv2
# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-b", "--buffer", type=int, default=64,
help="max buffer size")
args = vars(ap.parse_args())
# define the lower and upper boundaries of ... | [
"numpy.ones",
"argparse.ArgumentParser",
"cv2.inRange",
"cv2.minEnclosingCircle",
"cv2.imshow",
"cv2.morphologyEx",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.moments",
"cv2.resize",
"cv2.GaussianBlur",
"cv2.waitKey"
] | [((125, 150), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (148, 150), False, 'import argparse\n'), ((853, 888), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0 + cv2.CAP_DSHOW)'], {}), '(0 + cv2.CAP_DSHOW)\n', (869, 888), False, 'import cv2\n'), ((3087, 3110), 'cv2.destroyAllWindows', 'cv2.des... |
# Generated by Django 3.2 on 2021-10-21 19:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('topics', '0002_alter_modelingprocess_modeling_type'),
]
operations = [
migrations.AddField(
model_name='topic',
name='... | [
"django.db.models.JSONField"
] | [((345, 375), 'django.db.models.JSONField', 'models.JSONField', ([], {'default': '"""{}"""'}), "(default='{}')\n", (361, 375), False, 'from django.db import migrations, models\n')] |
from CHECLabPy.plotting.setup import Plotter
from CHECLabPy.plotting.camera import CameraImage
from CHECLabPy.utils.files import create_directory
from CHECLabPy.utils.mapping import get_ctapipe_camera_geometry
from sstcam_sandbox import get_plot, get_data
from os.path import join
from matplotlib import pyplot as plt
fr... | [
"CHECLabPy.plotting.camera.CameraImage.from_mapping",
"sstcam_sandbox.get_plot",
"CHECOnsky.calib.obtain_cleaning_mask",
"numpy.tan",
"CHECLabPy.utils.mapping.get_ctapipe_camera_geometry",
"CHECLabPy.calib.TimeCalibrator",
"pandas.Timedelta",
"warnings.catch_warnings",
"numpy.max",
"sstcam_sandbox... | [((659, 682), 'mpl_toolkits.axes_grid1.make_axes_locatable', 'make_axes_locatable', (['ax'], {}), '(ax)\n', (678, 682), False, 'from mpl_toolkits.axes_grid1 import make_axes_locatable\n'), ((4380, 4415), 'sstcam_sandbox.get_data', 'get_data', (['"""d190717_alpha/wobble.h5"""'], {}), "('d190717_alpha/wobble.h5')\n", (43... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distrib... | [
"os_testr.regex_builder.construct_regex",
"os_testr.subunit_trace.trace",
"sys.exit",
"oslo_serialization.jsonutils.dumps",
"os.path.isdir",
"tempfile.NamedTemporaryFile",
"io.StringIO",
"testrepository.commands.run_argv",
"os.path.isfile",
"os.path.dirname",
"tempest.common.credentials_factory.... | [((5855, 5900), 'os.path.join', 'os.path.join', (['top_level_path', '"""test_discover"""'], {}), "(top_level_path, 'test_discover')\n", (5867, 5900), False, 'import os\n'), ((8749, 8769), 'sys.exit', 'sys.exit', (['returncode'], {}), '(returncode)\n', (8757, 8769), False, 'import sys\n'), ((8951, 8996), 'tempest.cmd.cl... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import os
import sys
import warnings
import ansible.constants
import ansible.errors
import ansible.utils
import pytest
from pprint import pprint
# The positive path test
def test_zos_tso_command_listuser(ansible_adhoc):
hosts ... | [
"pprint.pprint"
] | [((414, 431), 'pprint.pprint', 'pprint', (['hosts.all'], {}), '(hosts.all)\n', (420, 431), False, 'from pprint import pprint\n'), ((436, 461), 'pprint.pprint', 'pprint', (['hosts.all.options'], {}), '(hosts.all.options)\n', (442, 461), False, 'from pprint import pprint\n'), ((523, 586), 'pprint.pprint', 'pprint', (["ho... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author : <NAME>
# E-mail : <EMAIL>
# Description:
# Date : 15/10/2019: 22:13
# File Name : network
import argparse
import numpy as np
import torch
def worker_init_fn(pid):
np.random.seed(torch.initial_seed() % (2 ** 31 - 1))
def my_collate(batch):... | [
"torch.initial_seed",
"torch.utils.data.dataloader.default_collate",
"argparse.ArgumentParser"
] | [((389, 439), 'torch.utils.data.dataloader.default_collate', 'torch.utils.data.dataloader.default_collate', (['batch'], {}), '(batch)\n', (432, 439), False, 'import torch\n'), ((468, 519), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""audio2height"""'}), "(description='audio2height')\n"... |
import parsetools
from benchDesc import benchsDesc
import matplotlib.pyplot as plt
import matplotlib
import getopt, sys
try:
opts, args = getopt.getopt(sys.argv[1:], "h", ["arch="])
except getopt.GetoptError as err:
print(err)
sys.exit(2)
file_postfix = ""
for o,a in opts:
if o == "--arch":
if... | [
"getopt.getopt",
"parsetools.BoundedEventsCountParser",
"parsetools.UnboundedEventsCountParser",
"benchDesc.benchsDesc.regrouping_parallel_res",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.yticks",
"matplotlib.rc",
"sys.exit",
"matplotlib.pyplot.ylim",
"parsetools.WcetResParser",
"matplotlib.... | [((569, 606), 'parsetools.BoundedEventsCountParser', 'parsetools.BoundedEventsCountParser', ([], {}), '()\n', (604, 606), False, 'import parsetools\n'), ((659, 698), 'benchDesc.benchsDesc.regrouping_parallel_res', 'benchsDesc.regrouping_parallel_res', (['res'], {}), '(res)\n', (693, 698), False, 'from benchDesc import ... |
""" Assemblies List View. """
import logging
from datetime import datetime
from cornice.service import Service
from fabrikApi.models.assembly import DBAssembly
from fabrikApi.models.mixins import arrow
# from fabrikApi.util.cors import CORS_LOCATION, CORS_MAX_AGE
logger = logging.getLogger(__name__)
# SERVICES
as... | [
"logging.getLogger",
"cornice.service.Service",
"fabrikApi.models.mixins.arrow.utcnow"
] | [((277, 304), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (294, 304), False, 'import logging\n'), ((331, 435), 'cornice.service.Service', 'Service', ([], {'cors_origins': "('*',)", 'name': '"""assemblies"""', 'description': '"""List Assemblies."""', 'path': '"""/assemblies"""'}), "(cor... |
import argparse
import numpy as np
import os
import random
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
from datasets import custom_collate_fn, load_data, WebDataset
from models import WebObjExtractionNet
from train import train_model, evaluate_model
from utils... | [
"torch.manual_seed",
"os.path.exists",
"train.train_model",
"argparse.ArgumentParser",
"os.makedirs",
"utils.print_and_log",
"models.WebObjExtractionNet",
"torch.nn.CrossEntropyLoss",
"random.seed",
"numpy.loadtxt",
"torch.cuda.is_available",
"numpy.random.seed",
"torch.utils.data.DataLoader... | [((388, 426), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Train Model"""'], {}), "('Train Model')\n", (411, 426), False, 'import argparse\n'), ((1664, 1681), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1675, 1681), False, 'import random\n'), ((1682, 1702), 'numpy.random.seed', 'np.random.... |
import numpy as np
from typing import Union, Optional, List, Dict, Any
from buffers.chunk_buffer import ChunkReplayBuffer
class IntrospectiveChunkReplayBuffer(ChunkReplayBuffer):
def __init__(self, buffer_size: int, *args, **kwargs):
super().__init__(buffer_size, *args, **kwargs)
self.sam... | [
"numpy.zeros",
"numpy.zeros_like"
] | [((333, 371), 'numpy.zeros', 'np.zeros', (['(buffer_size,)'], {'dtype': 'np.int'}), '((buffer_size,), dtype=np.int)\n', (341, 371), True, 'import numpy as np\n'), ((537, 581), 'numpy.zeros_like', 'np.zeros_like', (['self.first_access'], {'dtype': 'bool'}), '(self.first_access, dtype=bool)\n', (550, 581), True, 'import ... |
# This file is executed on every boot (including wake-boot from deepsleep)
import esp
import gc
import machine
import network
esp.osdebug(None)
# machine.freq(160000000)
def do_connect(wifi_name, wifi_pass):
ssid = 'microsonar'
password = '<PASSWORD>'
ap_if = network.WLAN(network.AP_IF)
ap_if.activ... | [
"machine.Pin",
"network.WLAN",
"esp.osdebug",
"gc.collect"
] | [((127, 144), 'esp.osdebug', 'esp.osdebug', (['None'], {}), '(None)\n', (138, 144), False, 'import esp\n'), ((962, 974), 'gc.collect', 'gc.collect', ([], {}), '()\n', (972, 974), False, 'import gc\n'), ((277, 304), 'network.WLAN', 'network.WLAN', (['network.AP_IF'], {}), '(network.AP_IF)\n', (289, 304), False, 'import ... |
# 02_blink_twice.py
# From the code for the Electronics Starter Kit for the Raspberry Pi by MonkMakes.com
import RPi.GPIO as GPIO
import time
def word_separation(pin):
sleep_time = 7
GPIO.output(pin, False) # True means that LED turns on
time.sleep(sleep_time)
def pulse(pin, length = "dot"):
... | [
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"RPi.GPIO.output",
"time.sleep",
"RPi.GPIO.setmode"
] | [((2520, 2542), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (2532, 2542), True, 'import RPi.GPIO as GPIO\n'), ((2557, 2587), 'RPi.GPIO.setup', 'GPIO.setup', (['red_pin1', 'GPIO.OUT'], {}), '(red_pin1, GPIO.OUT)\n', (2567, 2587), True, 'import RPi.GPIO as GPIO\n'), ((195, 218), 'RPi.GPIO.outp... |
""" Identify low-level jets in wind profile data.
<NAME>
December 2020
"""
import numpy as np
import xarray as xr
def detect_llj(x, axis=None, falloff=0, output='strength', inverse=False):
""" Identify maxima in wind profiles.
args:
- x : ndarray with wind profile data
- axis ... | [
"numpy.ones",
"numpy.minimum",
"numpy.hstack",
"numpy.where",
"numpy.rollaxis",
"numpy.argmax",
"numpy.zeros",
"numpy.apply_along_axis",
"numpy.isnan",
"numpy.ma.masked_invalid"
] | [((1794, 1844), 'numpy.apply_along_axis', 'np.apply_along_axis', (['inner', 'axis', 'x'], {'output': 'output'}), '(inner, axis, x, output=output)\n', (1813, 1844), True, 'import numpy as np\n'), ((2690, 2711), 'numpy.rollaxis', 'np.rollaxis', (['xs', 'axis'], {}), '(xs, axis)\n', (2701, 2711), True, 'import numpy as np... |
"""Sigv4 Signing Support"""
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy
# of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or i... | [
"json.dumps",
"botocore.session.Session"
] | [((1024, 1050), 'botocore.session.Session', 'botocore.session.Session', ([], {}), '()\n', (1048, 1050), False, 'import botocore\n'), ((1215, 1231), 'json.dumps', 'json.dumps', (['body'], {}), '(body)\n', (1225, 1231), False, 'import json\n')] |
r"""
>>> from django.conf import settings
>>> from django.contrib.sessions.backends.db import SessionStore as DatabaseSession
>>> from django.contrib.sessions.backends.cache import SessionStore as CacheSession
>>> from django.contrib.sessions.backends.file import SessionStore as FileSession
>>> from django.contrib.ses... | [
"doctest.testmod"
] | [((2606, 2623), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (2621, 2623), False, 'import doctest\n')] |
import textwrap
from contextlib import ExitStack as does_not_raise # noqa: N813
import pytest
from _pytask.mark import Mark
from _pytask.outcomes import Skipped
from _pytask.outcomes import SkippedAncestorFailed
from _pytask.outcomes import SkippedUnchanged
from _pytask.skipping import pytask_execute_task_setup
from ... | [
"textwrap.dedent",
"_pytask.mark.Mark",
"pytest.mark.parametrize",
"_pytask.skipping.pytask_execute_task_setup",
"pytest.raises",
"contextlib.ExitStack",
"pytask.main"
] | [((2980, 3088), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mark_string"""', '[\'@pytask.mark.skip\', "@pytask.mark.skipif(True, reason=\'bla\')"]'], {}), '(\'mark_string\', [\'@pytask.mark.skip\',\n "@pytask.mark.skipif(True, reason=\'bla\')"])\n', (3003, 3088), False, 'import pytest\n'), ((3559, 36... |
from django.apps import AppConfig
from django.core.checks import Tags, register
from django_version_checks import checks
class DjangoVersionChecksAppConfig(AppConfig):
name = "django_version_checks"
verbose_name = "django-version-checks"
def ready(self) -> None:
register(Tags.compatibility)(chec... | [
"django.core.checks.register"
] | [((287, 315), 'django.core.checks.register', 'register', (['Tags.compatibility'], {}), '(Tags.compatibility)\n', (295, 315), False, 'from django.core.checks import Tags, register\n'), ((345, 373), 'django.core.checks.register', 'register', (['Tags.compatibility'], {}), '(Tags.compatibility)\n', (353, 373), False, 'from... |