code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""Adding control column for feed to fetch
Revision ID: 5f7bef70b57a
Revises: 44<PASSWORD>
Create Date: 2020-05-18 12:27:23.277010
"""
import logging
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '5f7bef70b57a'
down_revision = '4405e<PASSWORD>'
branch_labels = N... | [
"logging.getLogger",
"alembic.op.get_bind",
"sqlalchemy.Boolean",
"alembic.op.alter_column",
"alembic.op.drop_column",
"sqlalchemy.BOOLEAN",
"alembic.op.execute",
"sqlalchemy.dialects.postgresql.ENUM"
] | [((351, 391), 'logging.getLogger', 'logging.getLogger', (["('alembic.' + revision)"], {}), "('alembic.' + revision)\n", (368, 391), False, 'import logging\n'), ((481, 528), 'alembic.op.drop_column', 'op.drop_column', (['"""article"""', '"""readability_parsed"""'], {}), "('article', 'readability_parsed')\n", (495, 528),... |
# setup.py file
from setuptools import find_packages, setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="my-pkg-qianjing2020", # the name that you will install via pip
version="0.0.2",
author="<NAME>",
author_email="<EMAIL>",
description="A small package to te... | [
"setuptools.setup"
] | [((131, 745), 'setuptools.setup', 'setup', ([], {'name': '"""my-pkg-qianjing2020"""', 'version': '"""0.0.2"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""A small package to test distribution via pypi"""', 'long_description': 'long_description', 'long_description_content_type': '"""te... |
import sys
import os
# Root directory of the project
ROOT_DIR = os.getcwd()
print(f"{ROOT_DIR}")
# Import Mask RCNN
sys.path.append(ROOT_DIR) # To find local version of the library
from mrcnn import visualize
from mrcnn import model as modellib
from mrcnn import utils
from mrcnn.config import Config
from mrcnn.model... | [
"mrcnn.model.MaskRCNN",
"os.path.exists",
"random.choice",
"numpy.ones",
"argparse.ArgumentParser",
"mrcnn.utils.download_trained_weights",
"mrcnn.model.load_image_gt",
"os.path.join",
"os.getcwd",
"numpy.stack",
"mrcnn.visualize.display_instances",
"mrcnn.model.log",
"sys.path.append",
"m... | [((65, 76), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (74, 76), False, 'import os\n'), ((117, 142), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (132, 142), False, 'import sys\n'), ((1460, 1503), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""mask_rcnn_coco.h5"""'], {}), "(ROOT_DIR, 'm... |
from rest_framework import serializers
from .models import Post, Category, Tag
from django.contrib.auth.models import User, AnonymousUser
class CategorySerializer(serializers.ModelSerializer):
"""
分类序列化
"""
owner = serializers.ReadOnlyField(source='owner.username')
# article = serializers.ReadOn... | [
"rest_framework.serializers.ReadOnlyField"
] | [((234, 284), 'rest_framework.serializers.ReadOnlyField', 'serializers.ReadOnlyField', ([], {'source': '"""owner.username"""'}), "(source='owner.username')\n", (259, 284), False, 'from rest_framework import serializers\n'), ((559, 609), 'rest_framework.serializers.ReadOnlyField', 'serializers.ReadOnlyField', ([], {'sou... |
from sklearn import datasets
from sklearn.metrics import accuracy_score
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from sklearn.cluster import KMeans
iris = datasets.load_iris()
x = pd.DataFrame(iris.data)
x.columns = ['Sepal_Length','Sepal_Wid... | [
"sklearn.datasets.load_iris",
"sklearn.cluster.KMeans",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.scatter",
"pandas.DataFrame",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"sklearn.metrics.accuracy_score",
"sklearn.metrics.confusion_matrix"
] | [((232, 252), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (250, 252), False, 'from sklearn import datasets\n'), ((258, 281), 'pandas.DataFrame', 'pd.DataFrame', (['iris.data'], {}), '(iris.data)\n', (270, 281), True, 'import pandas as pd\n'), ((359, 384), 'pandas.DataFrame', 'pd.DataFrame', ([... |
import discord
import random
from discord.ext import commands, tasks
from discord import Spotify
import asyncio
from discord import Streaming
import aiohttp
import time
from sys import stdout
import json
import io
import sqlite3
import datetime
from discord.utils import get
class LeaveHelp(commands.Cog, name="Leave")... | [
"discord.ext.commands.Cog.listener",
"discord.ext.commands.has_permissions",
"sqlite3.connect",
"datetime.datetime.utcnow",
"discord.ext.commands.group"
] | [((442, 465), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (463, 465), False, 'from discord.ext import commands, tasks\n'), ((1614, 1657), 'discord.ext.commands.group', 'commands.group', ([], {'invoke_without_command': '(True)'}), '(invoke_without_command=True)\n', (1628, 1657), False... |
# coding=utf-8
import time
from concurrent.futures import ProcessPoolExecutor, as_completed
NUMBERS = range(25, 38)
def fib(n):
if n<= 2:
return 1
return fib(n-1) + fib(n-2)
start = time.time()
with ProcessPoolExecutor(max_workers=3) as executor:
chunksize, extra = divmod(len(NUMBERS), executo... | [
"time.time",
"concurrent.futures.ProcessPoolExecutor"
] | [((203, 214), 'time.time', 'time.time', ([], {}), '()\n', (212, 214), False, 'import time\n'), ((221, 255), 'concurrent.futures.ProcessPoolExecutor', 'ProcessPoolExecutor', ([], {'max_workers': '(3)'}), '(max_workers=3)\n', (240, 255), False, 'from concurrent.futures import ProcessPoolExecutor, as_completed\n'), ((550,... |
from builtins import str
from builtins import object
from adminsortable.models import SortableMixin
from django.db import models
from django.db.models import Sum
from django.utils.functional import lazy
from django.utils.translation import ugettext_lazy as _
from django_extensions.db.fields import CreationDateTimeField... | [
"django.utils.translation.ugettext_lazy",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"builtins.str",
"bluebottle.statistics.statistics.Statistics",
"bluebottle.utils.managers.TranslatablePolymorphicManager",
"django.utils.functional.lazy",
"django.db.models.Sum"
] | [((931, 963), 'bluebottle.utils.managers.TranslatablePolymorphicManager', 'TranslatablePolymorphicManager', ([], {}), '()\n', (961, 963), False, 'from bluebottle.utils.managers import TranslatablePolymorphicManager\n'), ((1746, 1767), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (1765, 1767... |
# -*- coding: utf-8 -*-
import warnings
warnings.filterwarnings("ignore", category=RuntimeWarning)
warnings.resetwarnings()
class Generic(object):
"""Generic class for unit testing :mod:`pydblite.pydblite` and :mod:`pydblite.sqlite`"""
def test_create_index(self):
indices = self.filter_db.get_indice... | [
"warnings.resetwarnings",
"warnings.filterwarnings"
] | [((41, 99), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'RuntimeWarning'}), "('ignore', category=RuntimeWarning)\n", (64, 99), False, 'import warnings\n'), ((100, 124), 'warnings.resetwarnings', 'warnings.resetwarnings', ([], {}), '()\n', (122, 124), False, 'import warnings\n')... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager
class UserProfileManager(BaseUserManager):
def create_user(self, name, email, password):
if not email:
raise ValueError('Email field is required')
email = self.norma... | [
"django.db.models.EmailField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.PositiveIntegerField",
"django.db.models.CharField"
] | [((769, 800), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (785, 800), False, 'from django.db import models\n'), ((813, 858), 'django.db.models.EmailField', 'models.EmailField', ([], {'max_length': '(30)', 'unique': '(True)'}), '(max_length=30, unique=True)\n', (8... |
import numpy as np
from tkinter import filedialog
import sys
import os
import matplotlib.pyplot as plt
import pyproj
import math
import datetime
#------------------------------------------------------------------------------
# READ DELFT GRID FILE
class grd():
"""Orthogonal curvilinear grid file. See A.3.2 in Del... | [
"numpy.abs",
"numpy.ma.masked_equal",
"numpy.reshape",
"numpy.ones",
"math.floor",
"numpy.where",
"tkinter.filedialog.asksaveasfile",
"numpy.size",
"pyproj.transform",
"numpy.array",
"datetime.datetime.now",
"pyproj.Proj",
"tkinter.filedialog.askopenfilename",
"matplotlib.pyplot.axis",
"... | [((1635, 1651), 'numpy.array', 'np.array', (['header'], {}), '(header)\n', (1643, 1651), True, 'import numpy as np\n'), ((4007, 4024), 'math.floor', 'math.floor', (['(m / 5)'], {}), '(m / 5)\n', (4017, 4024), False, 'import math\n'), ((6371, 6413), 'numpy.arange', 'np.arange', (['y0', '(y0 + m * cellsize)', 'cellsize']... |
import datetime
from xml.dom import minidom
import xml.etree.ElementTree as ET
def element_tree_to_file(tree, outfile):
with open(outfile, 'w') as f:
print(minidom.parseString(ET.tostring(tree)).toprettyxml(indent=" "), end='', file=f)
def make_add_submission_xml(outfile, submission_alias, center_name,... | [
"xml.etree.ElementTree.tostring",
"xml.etree.ElementTree.Element",
"datetime.datetime.now",
"datetime.date",
"xml.etree.ElementTree.SubElement"
] | [((671, 707), 'xml.etree.ElementTree.SubElement', 'ET.SubElement', (['submission', '"""ACTIONS"""'], {}), "(submission, 'ACTIONS')\n", (684, 707), True, 'import xml.etree.ElementTree as ET\n'), ((725, 757), 'xml.etree.ElementTree.SubElement', 'ET.SubElement', (['actions', '"""ACTION"""'], {}), "(actions, 'ACTION')\n", ... |
# coding=utf-8
# Copyright 2021 The Uncertainty Baselines Authors.
#
# 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 ap... | [
"jax.tree_util.tree_structure",
"numpy.sqrt",
"io.BytesIO",
"absl.logging.info",
"numpy.argsort",
"tensorflow.io.gfile.rename",
"dataclasses.is_dataclass",
"scipy.ndimage.zoom",
"numpy.savez",
"tensorflow.io.gfile.GFile",
"jax.tree_util.tree_map",
"numpy.concatenate",
"absl.logging.warning",... | [((1831, 1860), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (1854, 1860), False, 'import collections\n'), ((2843, 2904), 'jax.tree_util.tree_map', 'jax.tree_util.tree_map', (['_convert_and_recover_bfloat16', 'values'], {}), '(_convert_and_recover_bfloat16, values)\n', (2865, 2904),... |
"""
Base classes for automl.
"""
import abc
from typing import List
import numpy as np
import pandas as pd
from automatminer.base import DFTransformer
from automatminer.utils.log import AMM_LOG_PREDICT_STR, log_progress
from automatminer.utils.pkg import AutomatminerError, check_fitted
class DFMLAdaptor(DFTransfor... | [
"automatminer.utils.log.log_progress"
] | [((2069, 2102), 'automatminer.utils.log.log_progress', 'log_progress', (['AMM_LOG_PREDICT_STR'], {}), '(AMM_LOG_PREDICT_STR)\n', (2081, 2102), False, 'from automatminer.utils.log import AMM_LOG_PREDICT_STR, log_progress\n')] |
# Copyright 2017-2021 Lawrence Livermore National Security, LLC and other
# CallFlow Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: MIT
# ------------------------------------------------------------------------------
"""
CallFlow's operation to calculate ensemble gradients... | [
"callflow.modules.histogram.Histogram._format_data",
"callflow.utils.utils.histogram",
"numpy.ndenumerate",
"callflow.get_logger",
"numpy.append",
"warnings.simplefilter",
"callflow.utils.df.df_unique"
] | [((681, 710), 'callflow.get_logger', 'callflow.get_logger', (['__name__'], {}), '(__name__)\n', (700, 710), False, 'import callflow\n'), ((711, 788), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'pd.errors.PerformanceWarning'}), "(action='ignore', category=pd.errors.Perf... |
from datetime import date
from random import choice, sample, randint, uniform
from pepper.brain import RdfBuilder
from pepper.framework import UtteranceHypothesis, Context, Face
from pepper.framework.sensor.obj import Object
from pepper.language import Chat, Utterance, UtteranceType
places = ['Office']
friends = ['Pi... | [
"random.sample",
"random.choice",
"pepper.framework.Context",
"pepper.language.Chat",
"random.uniform",
"pepper.framework.Face",
"pepper.framework.UtteranceHypothesis",
"pepper.language.Utterance",
"pepper.brain.RdfBuilder",
"datetime.date",
"pepper.framework.sensor.obj.Object"
] | [((756, 773), 'datetime.date', 'date', (['(2019)', '(1)', '(24)'], {}), '(2019, 1, 24)\n', (760, 773), False, 'from datetime import date\n'), ((1135, 1152), 'datetime.date', 'date', (['(2018)', '(3)', '(19)'], {}), '(2018, 3, 19)\n', (1139, 1152), False, 'from datetime import date\n'), ((1514, 1531), 'datetime.date', '... |
from django.test import TestCase
from rest_framework.test import APIClient
from rest_framework import status
from django.urls import reverse
from .models import Sala
# TESTAR CRIACAO DA SALA
class ModelSalaTestCase(TestCase):
"""Testando o model Sala."""
def setUp(self):
"""Variaveis iniciais para o te... | [
"django.urls.reverse",
"rest_framework.test.APIClient"
] | [((1068, 1079), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (1077, 1079), False, 'from rest_framework.test import APIClient\n'), ((1178, 1200), 'django.urls.reverse', 'reverse', (['"""create_sala"""'], {}), "('create_sala')\n", (1185, 1200), False, 'from django.urls import reverse\n'), ((1633, 1680)... |
#!/usr/bin/env python
#(c)2019-2021, <EMAIL>
"""
This tool provides the resultion of the public IP address to the author.
"""
# Modules
import datetime
import requests
import yaml
# Local modules
import helpers.shared as hs
# Body
if __name__ == "__main__":
# Import configuration file
config = hs.import_con... | [
"datetime.datetime.now",
"requests.get",
"helpers.shared.import_config"
] | [((307, 339), 'helpers.shared.import_config', 'hs.import_config', (['"""./config.yml"""'], {}), "('./config.yml')\n", (323, 339), True, 'import helpers.shared as hs\n'), ((378, 401), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (399, 401), False, 'import datetime\n'), ((411, 453), 'requests.get',... |
#!/usr/bin/env python
import numpy as np
def main():
dt = 10
x0 = np.array([[2.0],[1.0]])
P0 = 2*np.identity(2)
# define model
A = np.matrix([[1, dt], [0, 1]])
C = np.array([[1, 0]])
Q = 0.1*np.identity(2)
R = 0.1
z = 2.25
# predict
x = A*x0 # np.multiply(A, x0)
P = A*P0*np.transpose(A) + Q
# update... | [
"numpy.identity",
"numpy.array",
"numpy.linalg.inv",
"numpy.matrix",
"numpy.transpose"
] | [((71, 95), 'numpy.array', 'np.array', (['[[2.0], [1.0]]'], {}), '([[2.0], [1.0]])\n', (79, 95), True, 'import numpy as np\n'), ((141, 169), 'numpy.matrix', 'np.matrix', (['[[1, dt], [0, 1]]'], {}), '([[1, dt], [0, 1]])\n', (150, 169), True, 'import numpy as np\n'), ((175, 193), 'numpy.array', 'np.array', (['[[1, 0]]']... |
import sys
import os
import torch
import argparse
uer_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.append(uer_dir)
from uer.model_saver import save_model
def average(model_list_path):
for i, model_path in enumerate(model_list_path):
model = torch.load(model_path)
... | [
"argparse.ArgumentParser",
"torch.load",
"os.path.dirname",
"torch.save",
"sys.path.append"
] | [((124, 148), 'sys.path.append', 'sys.path.append', (['uer_dir'], {}), '(uer_dir)\n', (139, 148), False, 'import sys\n'), ((550, 589), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""""""'}), "(description='')\n", (573, 589), False, 'import argparse\n'), ((925, 970), 'torch.save', 'torch.s... |
import flask
import geojson
from flask import render_template, Blueprint, redirect, url_for
from .models import sqlalchemy
tourist_bp = Blueprint('tourist_bp', __name__)
def mapbox_access_token():
return sqlalchemy.db.get_app().config['MAPBOX_ACCESS_TOKEN']
@tourist_bp.route("/")
def home():
world = sqlalch... | [
"flask.render_template",
"geojson.FeatureCollection",
"flask.send_from_directory",
"flask.url_for",
"flask.redirect",
"flask.Blueprint"
] | [((137, 170), 'flask.Blueprint', 'Blueprint', (['"""tourist_bp"""', '__name__'], {}), "('tourist_bp', __name__)\n", (146, 170), False, 'from flask import render_template, Blueprint, redirect, url_for\n'), ((645, 674), 'flask.render_template', 'render_template', (['"""about.html"""'], {}), "('about.html')\n", (660, 674)... |
import nextcord
import logging
import gspread
from oauth2client.service_account import ServiceAccountCredentials
from typing import List, Dict
from enum import IntEnum
from util.decorator import refresh_google_token
WEBHOOK_NAME = "Elden's Bot PNJ Manager"
MAIN_GDOC_KEY = "<KEY>"
class SHEET_COL(IntEnum):
OWNER_I... | [
"logging.getLogger",
"oauth2client.service_account.ServiceAccountCredentials.from_json_keyfile_name",
"gspread.authorize"
] | [((381, 413), 'logging.getLogger', 'logging.getLogger', (['"""PNJ Manager"""'], {}), "('PNJ Manager')\n", (398, 413), False, 'import logging\n'), ((441, 562), 'oauth2client.service_account.ServiceAccountCredentials.from_json_keyfile_name', 'ServiceAccountCredentials.from_json_keyfile_name', (['"""private/googlekey.json... |
# -*- coding: utf-8 -*-
# Copyright 2014 OpenMarket 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 la... | [
"logging.getLogger",
"twisted.internet.defer.returnValue",
"simplejson.dumps",
"synapse.util.caches.descriptors.cachedInlineCallbacks"
] | [((788, 815), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (805, 815), False, 'import logging\n'), ((858, 881), 'synapse.util.caches.descriptors.cachedInlineCallbacks', 'cachedInlineCallbacks', ([], {}), '()\n', (879, 881), False, 'from synapse.util.caches.descriptors import cachedInlin... |
from portality.dao import DomainObject
from datetime import datetime
from copy import deepcopy
class FileUpload(DomainObject):
__type__ = "upload"
@property
def status(self):
return self.data.get("status")
@property
def local_filename(self):
return self.id + ".xml"
@property
... | [
"datetime.datetime.strptime",
"copy.deepcopy"
] | [((1251, 1317), 'datetime.datetime.strptime', 'datetime.strptime', (["self.data['created_date']", '"""%Y-%m-%dT%H:%M:%SZ"""'], {}), "(self.data['created_date'], '%Y-%m-%dT%H:%M:%SZ')\n", (1268, 1317), False, 'from datetime import datetime\n'), ((3640, 3665), 'copy.deepcopy', 'deepcopy', (['self.base_query'], {}), '(sel... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# author: <NAME>
# created at:17/11/2020 8:47 PM
# contact: <EMAIL>
from Dictionary.Dictionary import get_dicts
SUB_DATA_FOLDER = "smart_contracts/comms_4_20"
SBTS_DIC, NODES_DIC, COMMS_DIC = get_dicts(SUB_DATA_FOLDER)
Transformer_args = {
"num_layers": 1,
"d_model": 256,... | [
"Dictionary.Dictionary.get_dicts"
] | [((237, 263), 'Dictionary.Dictionary.get_dicts', 'get_dicts', (['SUB_DATA_FOLDER'], {}), '(SUB_DATA_FOLDER)\n', (246, 263), False, 'from Dictionary.Dictionary import get_dicts\n')] |
# kcauto Copyright (C) 2017 <NAME>
from datetime import datetime
from util.logger import Logger
class Stats(object):
def __init__(self, config):
"""Initializes the Stats module.
Args:
config (Config): azurlane-auto Config instance
"""
self.reset_stats()... | [
"datetime.datetime.now"
] | [((455, 469), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (467, 469), False, 'from datetime import datetime\n'), ((2205, 2219), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (2217, 2219), False, 'from datetime import datetime\n')] |
#!/usr/bin/env python
# coding=utf-8
"""Message Handler.
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# License: BSD 3 clause
Plays the server role in communication_node
Relations
----------
subscribes from /message_server topic,
publishes on corresponding nodes /ns/message_status topic
"""
import os
... | [
"os.path.exists",
"signal.signal",
"rospy.Publisher",
"os.makedirs",
"rospy.is_shutdown",
"rospy.init_node",
"rospy.get_param",
"rospy.Rate",
"rospy.spin",
"sys.exit",
"rospy.Subscriber",
"time.gmtime"
] | [((928, 939), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (936, 939), False, 'import sys\n'), ((5763, 5816), 'rospy.init_node', 'rospy.init_node', (['"""communication_node_message_handler"""'], {}), "('communication_node_message_handler')\n", (5778, 5816), False, 'import rospy\n'), ((5834, 5880), 'rospy.get_param',... |
"""Views for creating, editing and viewing site-specific user profiles."""
from datetime import timedelta
from allauth.account.views import LoginView as AllAuthLoginView
from allauth.account.views import LogoutView as AllAuthLogoutView
from django.conf import settings
from django.contrib import messages
from django.c... | [
"django.utils.translation.ugettext_lazy",
"django.utils.timezone.datetime.strftime",
"rest_framework.authtoken.models.Token.objects.filter",
"readthedocs.projects.utils.get_csv_file",
"readthedocs.core.history.safe_update_change_reason",
"rest_framework.authtoken.models.Token.objects.get_or_create",
"dj... | [((2208, 2255), 'django.utils.translation.ugettext_lazy', '_', (['"""You have successfully deleted your account"""'], {}), "('You have successfully deleted your account')\n", (2209, 2255), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((3504, 3545), 'django.utils.translation.ugettext_lazy', '_', (... |
#!/usr/bin/env python3
import platform
from pathlib import Path
PROFILE_DIRS = {
"Linux": "~/.mozilla/firefox/",
"Darwin": "~/Library/Application Support/Firefox/Profiles/",
"Windows": "~\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\",
}
profile_dir = Path(PROFILE_DIRS[platform.system()]).expanduser().r... | [
"platform.system",
"pathlib.Path"
] | [((618, 632), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (622, 632), False, 'from pathlib import Path\n'), ((286, 303), 'platform.system', 'platform.system', ([], {}), '()\n', (301, 303), False, 'import platform\n')] |
import functools
def FuncDecoratorOne(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
print("Calling: ", func.__name__)
return func(*args, **kwargs)
return wrapper
def FuncDecoratorListProperties(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
print... | [
"functools.wraps"
] | [((51, 72), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (66, 72), False, 'import functools\n'), ((251, 272), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (266, 272), False, 'import functools\n'), ((479, 506), 'functools.wraps', 'functools.wraps', (['c.__init__'], {}), '(c.__in... |
"""
pyGoogleTranslate
--> A Google Translate webpage parser for Python 3
⚠️ Do not forget to set the used browser with browser()\n
⚠️ Do not forget to call browser_kill() after using pyGoogleTranslate (at the end of your script/when you stop your script)\n
Without browser_kill(), your browser will stay opened until y... | [
"selenium.webdriver.chrome.options.Options",
"selenium.webdriver.Chrome",
"selenium.webdriver.Firefox",
"psutil.Process",
"selenium.webdriver.PhantomJS",
"lifeeasy.current_time",
"warnings.filterwarnings",
"lifeeasy.today"
] | [((972, 1005), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (995, 1005), False, 'import warnings\n'), ((2028, 2037), 'selenium.webdriver.chrome.options.Options', 'Options', ([], {}), '()\n', (2035, 2037), False, 'from selenium.webdriver.chrome.options import Options\n'),... |
# Copyright The OpenTelemetry Authors
#
# 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 ... | [
"collections.OrderedDict",
"opentelemetry.sdk.extension.aws.resource.ec2.AwsEc2ResourceDetector",
"unittest.mock.patch"
] | [((1470, 1607), 'unittest.mock.patch', 'patch', (['"""opentelemetry.sdk.extension.aws.resource.ec2._get_host"""'], {'return_value': 'MockEc2ResourceAttributes[ResourceAttributes.HOST_NAME]'}), "('opentelemetry.sdk.extension.aws.resource.ec2._get_host',\n return_value=MockEc2ResourceAttributes[ResourceAttributes.HOST... |
import pandas as pd
from sklearn import cluster
from sklearn import metrics
import matplotlib.pyplot as plt
from sklearn.manifold import TSNE
def k_means(data_set, output_file, png_file, t_labels, score_file, set_name):
model = cluster.KMeans(n_clusters=4, max_iter=100, n_jobs=4, init="k-means++")
model.fit(d... | [
"sklearn.cluster.KMeans",
"pandas.Series",
"matplotlib.pyplot.savefig",
"pandas.read_csv",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"sklearn.metrics.adjusted_rand_score",
"sklearn.manifold.TSNE",
"sklearn.metrics.fowlkes_mallows_score",
"pandas.DataFrame",
"sklearn.cluster.DBSCAN"
] | [((1412, 1451), 'pandas.read_csv', 'pd.read_csv', (['"""../datas/Frogs_MFCCs.csv"""'], {}), "('../datas/Frogs_MFCCs.csv')\n", (1423, 1451), True, 'import pandas as pd\n'), ((2175, 2229), 'sklearn.cluster.DBSCAN', 'cluster.DBSCAN', ([], {'eps': '(0.1011)', 'min_samples': '(115)', 'n_jobs': '(-1)'}), '(eps=0.1011, min_sa... |
# -*- coding: utf-8 -*-
# Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | [
"proto.RepeatedField",
"proto.Field",
"proto.module"
] | [((783, 1172), 'proto.module', 'proto.module', ([], {'package': '"""google.cloud.bigquery.migration.v2alpha"""', 'manifest': "{'CreateMigrationWorkflowRequest', 'GetMigrationWorkflowRequest',\n 'ListMigrationWorkflowsRequest', 'ListMigrationWorkflowsResponse',\n 'DeleteMigrationWorkflowRequest', 'StartMigrationWo... |
"""Install instructions for python libraries not ready for easy_install.
"""
import os
from fabric.api import *
from fabric.contrib.files import *
from shared import _if_not_python_lib, _get_install, _python_make
@_if_not_python_lib("bx")
def install_bx_python(env):
"""Tools for manipulating biological data, par... | [
"shared._get_install",
"shared._if_not_python_lib"
] | [((217, 241), 'shared._if_not_python_lib', '_if_not_python_lib', (['"""bx"""'], {}), "('bx')\n", (235, 241), False, 'from shared import _if_not_python_lib, _get_install, _python_make\n'), ((558, 583), 'shared._if_not_python_lib', '_if_not_python_lib', (['"""rpy"""'], {}), "('rpy')\n", (576, 583), False, 'from shared im... |
import os
from datetime import datetime
from tempfile import NamedTemporaryFile
from bson import json_util
import json
from module_edinet.module_python2 import BeeModule2
from querybuilder import RawQueryBuilder
from datetime_functions import date_n_month
from hive_functions import create_hive_module_input_table, crea... | [
"json.loads",
"querybuilder.RawQueryBuilder",
"hive_functions.create_hive_module_input_table",
"json.dumps",
"hive_functions.create_measures_temp_table_edinet",
"module_edinet.edinet_baseline.align_job.MRJob_align",
"datetime.datetime.now",
"datetime_functions.date_n_month",
"tempfile.NamedTemporary... | [((11067, 11125), 'json.loads', 'json.loads', (['sys.argv[1]'], {'object_hook': 'json_util.object_hook'}), '(sys.argv[1], object_hook=json_util.object_hook)\n', (11077, 11125), False, 'import json\n'), ((1316, 1364), 'tempfile.NamedTemporaryFile', 'NamedTemporaryFile', ([], {'delete': '(False)', 'suffix': '""".json"""'... |
import pytest
import parsl
from parsl.app.app import App
from parsl.tests.configs.local_ipp import config
parsl.clear()
dfk = parsl.load(config)
@App('python')
def slow_double(x, dur=0.1):
import time
time.sleep(dur)
return x * 5
@pytest.mark.local
def test_cleanup_behavior_221():
""" A1 A2 A3 -... | [
"parsl.load",
"time.sleep",
"parsl.clear",
"parsl.app.app.App"
] | [((108, 121), 'parsl.clear', 'parsl.clear', ([], {}), '()\n', (119, 121), False, 'import parsl\n'), ((128, 146), 'parsl.load', 'parsl.load', (['config'], {}), '(config)\n', (138, 146), False, 'import parsl\n'), ((150, 163), 'parsl.app.app.App', 'App', (['"""python"""'], {}), "('python')\n", (153, 163), False, 'from par... |
import json
import sys
from argparse import ArgumentParser
from typing import Any, Dict, List, NoReturn, TextIO
import gnupg
from ._core import get_urls, verify_release
def main(argv: List[str], stream: TextIO = sys.stdout) -> int:
parser = ArgumentParser()
parser.add_argument('packages', nargs='+')
arg... | [
"json.dumps",
"gnupg.GPG",
"argparse.ArgumentParser"
] | [((249, 265), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (263, 265), False, 'from argparse import ArgumentParser\n'), ((359, 370), 'gnupg.GPG', 'gnupg.GPG', ([], {}), '()\n', (368, 370), False, 'import gnupg\n'), ((922, 953), 'json.dumps', 'json.dumps', (['info'], {}), '(info, **json_params)\n', (93... |
# Copyright 2019 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | [
"networkx.algorithms.dag.topological_sort",
"networkx.DiGraph",
"networkx.algorithms.dag.lexicographical_topological_sort"
] | [((7437, 7449), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (7447, 7449), True, 'import networkx as nx\n'), ((8647, 8686), 'networkx.algorithms.dag.topological_sort', 'nx.algorithms.dag.topological_sort', (['dag'], {}), '(dag)\n', (8681, 8686), True, 'import networkx as nx\n'), ((10618, 10682), 'networkx.algori... |
import utils
import argparse
import pathlib
from collections import namedtuple
import itertools
import math
parser = argparse.ArgumentParser(description="Generate run descriptions")
parser.add_argument("base_dir", type=str,
help="Base directory for run descriptions")
args = parser.parse_args()
base... | [
"utils.NavierStokesMeshInitialConditionSource",
"utils.CNN",
"math.ceil",
"utils.NavierStokesDataset",
"argparse.ArgumentParser",
"pathlib.Path",
"utils.KNNPredictorOneshot",
"itertools.product",
"utils.NetworkEvaluation",
"utils.Experiment",
"utils.MLP",
"utils.UNet",
"utils.KNNRegressorOne... | [((117, 181), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate run descriptions"""'}), "(description='Generate run descriptions')\n", (140, 181), False, 'import argparse\n'), ((327, 354), 'pathlib.Path', 'pathlib.Path', (['args.base_dir'], {}), '(args.base_dir)\n', (339, 354), Fal... |
#!/usr/bin/env python
import os
import sys
import capnp
capnp.add_import_hook(
[os.getcwd(), "/usr/local/include/"]
) # change this to be auto-detected?
import test_capnp # noqa: E402
def decode(name):
class_name = name[0].upper() + name[1:]
print(getattr(test_capnp, class_name).from_bytes(sys.stdin.... | [
"sys.stdin.read",
"os.getcwd"
] | [((86, 97), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (95, 97), False, 'import os\n'), ((310, 326), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (324, 326), False, 'import sys\n')] |
# Generated by Django 3.2.7 on 2021-10-05 13:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0002_user_username'),
]
operations = [
migrations.AlterField(
model_name='user',
name='avatar',
... | [
"django.db.models.ImageField"
] | [((326, 439), 'django.db.models.ImageField', 'models.ImageField', ([], {'blank': '(True)', 'default': '"""img/avatar.png"""', 'null': '(True)', 'upload_to': '"""avatar"""', 'verbose_name': '"""Avatar"""'}), "(blank=True, default='img/avatar.png', null=True,\n upload_to='avatar', verbose_name='Avatar')\n", (343, 439)... |
import sys, os, shutil, yaml, subprocess, struct
import elftools.elf.elffile
import addrconv
GCC_PATH = r'C:\devkitPro\devkitPPC\bin/'
OBJ_PATH = r'C:\devkitPro\devkitPPC\powerpc-eabi\bin/'
GHS_PATH = 'C:/ghs/multi5327/'
TEMPLATE = """#!gbuild
primaryTarget=ppc_standalone.tgt
[Project]
\t-bsp generic
\t-cpu=espresso
... | [
"sys.exit",
"addrconv.symbols.items",
"os.path.splitext",
"addrconv.loadAddrFile",
"struct.pack",
"addrconv.convert",
"os.chdir",
"yaml.safe_load",
"os.path.isdir",
"subprocess.call",
"os.path.basename",
"shutil.copy",
"addrconv.convertTable",
"os.mkdir"
] | [((8552, 8566), 'os.chdir', 'os.chdir', (['proj'], {}), '(proj)\n', (8560, 8566), False, 'import sys, os, shutil, yaml, subprocess, struct\n'), ((8673, 8687), 'os.chdir', 'os.chdir', (['""".."""'], {}), "('..')\n", (8681, 8687), False, 'import sys, os, shutil, yaml, subprocess, struct\n'), ((8777, 8844), 'shutil.copy',... |
from urllib.request import urlopen
import json
import math
class API(object):
'''Methods for accessing the API'''
def __init__(self, key=''):
self.key = key
'''Api instance constructor
Parameters
---------
key: Optional argument which adds your API key to all API calls... | [
"math.ceil",
"json.loads",
"doctest.testmod",
"urllib.request.urlopen"
] | [((11574, 11591), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (11589, 11591), False, 'import doctest\n'), ((471, 483), 'urllib.request.urlopen', 'urlopen', (['url'], {}), '(url)\n', (478, 483), False, 'from urllib.request import urlopen\n'), ((551, 567), 'json.loads', 'json.loads', (['data'], {}), '(data)\n... |
from mock import patch
patch.object() | [
"mock.patch.object"
] | [((24, 38), 'mock.patch.object', 'patch.object', ([], {}), '()\n', (36, 38), False, 'from mock import patch\n')] |
# coding: utf-8
from __future__ import unicode_literals
import json
import re
from ..utils import (clean_podcast_url, float_or_none, int_or_none,
strip_or_none, try_get, unified_strdate)
from .common import InfoExtractor
class SpotifyBaseIE(InfoExtractor):
_ACCESS_TOKEN = None
_OPERATIO... | [
"json.dumps",
"re.match"
] | [((2195, 2261), 're.match', 're.match', (['"""([0-9A-Z]{3})_(?:[A-Z]+_)?(\\\\d+)"""', 'audio_preview_format'], {}), "('([0-9A-Z]{3})_(?:[A-Z]+_)?(\\\\d+)', audio_preview_format)\n", (2203, 2261), False, 'import re\n'), ((1139, 1160), 'json.dumps', 'json.dumps', (['variables'], {}), '(variables)\n', (1149, 1160), False,... |
"""Oanda context API."""
import os
from gamestonk_terminal.helper_classes import ModelsNamespace as _models
# flake8: noqa
# pylint: disable=unused-import
# Context menus
from gamestonk_terminal.forex.oanda.oanda_view import get_fx_price as price
from gamestonk_terminal.forex.oanda.oanda_view import get_account_summ... | [
"os.path.dirname"
] | [((1298, 1323), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1313, 1323), False, 'import os\n')] |
import discord
import asyncio
from discord.ext import commands
from discord.utils import get
import time
import random
import os
import qt as qt
import importlib
importlib.import_module('qt')
# |=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= |
# | This is ... | [
"discord.ext.commands.Bot",
"qt.run",
"importlib.import_module"
] | [((173, 202), 'importlib.import_module', 'importlib.import_module', (['"""qt"""'], {}), "('qt')\n", (196, 202), False, 'import importlib\n'), ((819, 851), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': '"""!"""'}), "(command_prefix='!')\n", (831, 851), False, 'from discord.ext import commands\n'), ... |
"""Test extended dicts."""
# pylint: disable=unused-import,redefined-outer-name,unused-argument,unused-wildcard-import,wildcard-import,no-member
import pytest
from aiida.common.extendeddicts import AttributeDict
from aiida.plugins import DataFactory
from aiida_vasp.utils.extended_dicts import update_nested_dict
from... | [
"aiida_vasp.utils.extended_dicts.update_nested_dict",
"aiida_vasp.utils.extended_dicts.delete_keys_from_dict",
"aiida.common.extendeddicts.AttributeDict"
] | [((466, 481), 'aiida.common.extendeddicts.AttributeDict', 'AttributeDict', ([], {}), '()\n', (479, 481), False, 'from aiida.common.extendeddicts import AttributeDict\n'), ((497, 512), 'aiida.common.extendeddicts.AttributeDict', 'AttributeDict', ([], {}), '()\n', (510, 512), False, 'from aiida.common.extendeddicts impor... |
from django.views.generic.base import View, TemplateView
from django.http import HttpResponseRedirect, JsonResponse
from django.core.urlresolvers import reverse
from django.utils import timezone
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from django.core.paginator impor... | [
"barsystem.get_version",
"barsystem.models.Journal.objects.filter",
"barsystem.models.Product.objects.get",
"django.core.urlresolvers.reverse",
"barsystem.models.Person",
"barsystem.models.Token.objects.get",
"json.dumps",
"barsystem.functions.send_overdrawn_mail",
"django.utils.timezone.now",
"co... | [((1565, 1581), 'json.dumps', 'json.dumps', (['self'], {}), '(self)\n', (1575, 1581), False, 'import json\n'), ((1880, 1922), 'barsystem.models.Product.objects.get', 'Product.objects.get', ([], {'id': "self['product_id']"}), "(id=self['product_id'])\n", (1899, 1922), False, 'from barsystem.models import Person, Product... |
# Copyright 2021 ONDEWO GmbH
#
# 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, ... | [
"ondewo.nlu.entity_type_pb2_grpc.EntityTypesStub"
] | [((1585, 1627), 'ondewo.nlu.entity_type_pb2_grpc.EntityTypesStub', 'EntityTypesStub', ([], {'channel': 'self.grpc_channel'}), '(channel=self.grpc_channel)\n', (1600, 1627), False, 'from ondewo.nlu.entity_type_pb2_grpc import EntityTypesStub\n')] |
# encoding: utf8
import os
import sys
import unittest
import datetime
import tkinter as tk
import tkinter.ttk as ttk
pygubu_basedir = os.path.abspath(os.path.dirname(
os.path.dirname(os.path.realpath(sys.argv[0]))))
if pygubu_basedir not in sys.path:
sys.path.insert(0, pygubu_basedir)
import pygubu
import sup... | [
"datetime.datetime",
"sys.path.insert",
"os.path.realpath",
"support.root_deiconify",
"pygubu.Builder",
"support.root_withdraw"
] | [((260, 294), 'sys.path.insert', 'sys.path.insert', (['(0)', 'pygubu_basedir'], {}), '(0, pygubu_basedir)\n', (275, 294), False, 'import sys\n'), ((456, 480), 'support.root_deiconify', 'support.root_deiconify', ([], {}), '()\n', (478, 480), False, 'import support\n'), ((556, 572), 'pygubu.Builder', 'pygubu.Builder', ([... |
"""
The COCO dataset or other datasets for the YOLOv5 model with using NNRT.
"""
import logging
import os
import math
from plato.config import Config
from plato.datasources import base
from nnrt_datasource_yolo_utils import LoadImagesAndLabels
def make_divisible(x, divisor):
# Returns x evenly divisible by divis... | [
"os.path.exists",
"math.ceil",
"os.makedirs",
"plato.config.Config",
"logging.info"
] | [((334, 356), 'math.ceil', 'math.ceil', (['(x / divisor)'], {}), '(x / divisor)\n', (343, 356), False, 'import math\n'), ((883, 904), 'os.path.exists', 'os.path.exists', (['_path'], {}), '(_path)\n', (897, 904), False, 'import os\n'), ((918, 936), 'os.makedirs', 'os.makedirs', (['_path'], {}), '(_path)\n', (929, 936), ... |
import numpy as np
from scipy.sparse import csr_matrix
arr = np.array([
[1,0,0,1,0,0],
[0,0,2,0,0,1],
[0,0,0,2,0,0]
])
print(f"arr is {arr}")
S = csr_matrix(arr)
print(f"CSR matrix is {S}")
B = S.todense()
print(f"dense matrix is {B}")
| [
"numpy.array",
"scipy.sparse.csr_matrix"
] | [((63, 133), 'numpy.array', 'np.array', (['[[1, 0, 0, 1, 0, 0], [0, 0, 2, 0, 0, 1], [0, 0, 0, 2, 0, 0]]'], {}), '([[1, 0, 0, 1, 0, 0], [0, 0, 2, 0, 0, 1], [0, 0, 0, 2, 0, 0]])\n', (71, 133), True, 'import numpy as np\n'), ((166, 181), 'scipy.sparse.csr_matrix', 'csr_matrix', (['arr'], {}), '(arr)\n', (176, 181), False,... |
"""Test for the Dump1090 Aircrafts feed."""
import asyncio
import datetime
import aiohttp
import asynctest
from aioresponses import aioresponses
from flightradar_client.consts import UPDATE_ERROR, UPDATE_OK
from flightradar_client.dump1090_aircrafts import (
Dump1090AircraftsFeed,
Dump1090AircraftsFeedAggrega... | [
"datetime.datetime",
"aiohttp.ClientSession",
"flightradar_client.feed_entry.FeedEntry",
"aiohttp.ClientError",
"flightradar_client.dump1090_aircrafts.Dump1090AircraftsFeed",
"flightradar_client.dump1090_aircrafts.Dump1090AircraftsFeedManager",
"flightradar_client.dump1090_aircrafts.Dump1090AircraftsFee... | [((555, 569), 'aioresponses.aioresponses', 'aioresponses', ([], {}), '()\n', (567, 569), False, 'from aioresponses import aioresponses\n'), ((2171, 2185), 'aioresponses.aioresponses', 'aioresponses', ([], {}), '()\n', (2183, 2185), False, 'from aioresponses import aioresponses\n'), ((3098, 3112), 'aioresponses.aiorespo... |
import numpy as np
def imagem_to_cinza(matrix_colorida: np.array) -> np.array:
linhas = matrix_colorida.shape[0]
colunas = matrix_colorida.shape[1]
matrix_gray = np.zeros((linhas, colunas))
for i in range(linhas):
for j in range(colunas):
r, g, b = matrix_colorida[i, j]
... | [
"numpy.zeros"
] | [((177, 204), 'numpy.zeros', 'np.zeros', (['(linhas, colunas)'], {}), '((linhas, colunas))\n', (185, 204), True, 'import numpy as np\n'), ((557, 584), 'numpy.zeros', 'np.zeros', (['(linhas, colunas)'], {}), '((linhas, colunas))\n', (565, 584), True, 'import numpy as np\n'), ((600, 627), 'numpy.zeros', 'np.zeros', (['(l... |
# Copyright (c) 2015 Rackspace, 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 wr... | [
"re.compile"
] | [((2693, 2736), 're.compile', 're.compile', (['"""^([a-zA-Z0-9_\\\\-\\\\.]{1,256})$"""'], {}), "('^([a-zA-Z0-9_\\\\-\\\\.]{1,256})$')\n", (2703, 2736), False, 'import re\n')] |
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from openstack_dashboard.api import glance
def get_available_images(request, project_id=None, images_cache=None):
"""
Returns a list of images that are public or owned by the given
project_id. If project_id is not spe... | [
"django.utils.translation.ugettext_lazy",
"openstack_dashboard.api.glance.image_list_detailed"
] | [((835, 886), 'openstack_dashboard.api.glance.image_list_detailed', 'glance.image_list_detailed', (['request'], {'filters': 'public'}), '(request, filters=public)\n', (861, 886), False, 'from openstack_dashboard.api import glance\n'), ((1448, 1498), 'openstack_dashboard.api.glance.image_list_detailed', 'glance.image_li... |
import torch.nn as nn
from modules.DGL.transformer.layers import *
from modules.DGL.transformer.functions import *
from modules.DGL.transformer.embedding import *
from modules.DGL.transformer.optims import *
import dgl.function as fn
import torch.nn.init as INIT
class MultiHeadAttention(nn.Module):
... | [
"dgl.function.src_mul_edge",
"dgl.function.sum",
"numpy.sqrt",
"dgl.function.copy_edge",
"torch.sqrt",
"modules.make_model",
"torch.cuda.is_available",
"functools.partial",
"dgl.contrib.transformer.get_dataset",
"torch.nn.Linear",
"torch.set_grad_enabled",
"dgl.contrib.transformer.GraphPool"
] | [((7507, 7518), 'dgl.contrib.transformer.GraphPool', 'GraphPool', ([], {}), '()\n', (7516, 7518), False, 'from dgl.contrib.transformer import get_dataset, GraphPool\n'), ((8739, 8758), 'dgl.contrib.transformer.get_dataset', 'get_dataset', (['"""copy"""'], {}), "('copy')\n", (8750, 8758), False, 'from dgl.contrib.transf... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.tree import DecisionTreeRegressor
base = pd.read_csv('plano-saude2.csv')
X = base.iloc[:, 0:1].values
y = base.iloc[:, 1].values
regressor = DecisionTreeRegressor()
regressor.fit(X, y) # treinamento do regressor de árvore de decisão... | [
"sklearn.tree.DecisionTreeRegressor",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.array",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.title"
] | [((126, 157), 'pandas.read_csv', 'pd.read_csv', (['"""plano-saude2.csv"""'], {}), "('plano-saude2.csv')\n", (137, 157), True, 'import pandas as pd\n'), ((228, 251), 'sklearn.tree.DecisionTreeRegressor', 'DecisionTreeRegressor', ([], {}), '()\n', (249, 251), False, 'from sklearn.tree import DecisionTreeRegressor\n'), ((... |
import unittest
import json
from lax_response_adapter import LaxResponseAdapter
from mock import Mock
from provider.utils import base64_encode_string
FAKE_TOKEN = json.dumps(
{
u"status": u"vor",
u"expanded_folder": u"837411455.1/a8bb05df-2df9-4fce-8f9f-219aca0b0148",
u"version": u"1",
... | [
"mock.Mock",
"json.dumps",
"lax_response_adapter.LaxResponseAdapter",
"unittest.main",
"provider.utils.base64_encode_string"
] | [((164, 360), 'json.dumps', 'json.dumps', (["{u'status': u'vor', u'expanded_folder':\n u'837411455.1/a8bb05df-2df9-4fce-8f9f-219aca0b0148', u'version': u'1',\n u'force': False, u'run': u'a8bb05df-2df9-4fce-8f9f-219aca0b0148'}"], {}), "({u'status': u'vor', u'expanded_folder':\n u'837411455.1/a8bb05df-2df9-4fce-... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def degrees(graph):
result = [sum(r) for r in graph]
return result
if __name__ == "__main__":
import unittest
class DegreesTestCase(unittest.TestCase):
def test_empty_graph(self):
graph = []
self.assertSequenceEqual(degre... | [
"unittest.main"
] | [((1347, 1362), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1360, 1362), False, 'import unittest\n')] |
#!/usr/bin/python
import socket, os, time, re
import urllib2
from aws.route53_dyndns import settings
from boto.route53 import connection, record
import logging
logger = logging.getLogger(__name__)
logger.setLevel(settings.log_level)
def get_connection():
global cfg, logger
#establish a connection to route53
if set... | [
"logging.getLogger",
"urllib2.urlopen",
"re.compile",
"aws.route53_dyndns.settings.Settings",
"boto.route53.connection.Route53Connection",
"boto.route53.record.ResourceRecordSets"
] | [((170, 197), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (187, 197), False, 'import logging\n'), ((463, 570), 'boto.route53.connection.Route53Connection', 'connection.Route53Connection', (['cfg.access_key', 'cfg.secret_key'], {'debug': 'aws_log_level', 'security_token': 'None'}), '(cf... |
#!/usr/bin/python2
# -*- encoding: utf-8 -*-
import time
#KEYPAD:
UP = 'A'
DOWN = 'B'
RIGHT = 'C'
LEFT = 'D'
#BOTONS:
X = 'm'
Y = 'i'
B = 'k'
A = 'j'
R1 = 'p'
R2 = 'z'
R3 = 'l'
L1 = 'q'
L2 = 'x'
L3 = 'o'
SELECT = 'r'
START = 'y'
def getch(): #https://rosettacode.org/wiki/Keyboard_... | [
"termios.tcsetattr",
"termios.tcgetattr",
"sys.stdin.fileno",
"sys.stdin.read"
] | [((412, 430), 'sys.stdin.fileno', 'sys.stdin.fileno', ([], {}), '()\n', (428, 430), False, 'import sys, tty, termios\n'), ((450, 471), 'termios.tcgetattr', 'termios.tcgetattr', (['fd'], {}), '(fd)\n', (467, 471), False, 'import sys, tty, termios\n'), ((533, 550), 'sys.stdin.read', 'sys.stdin.read', (['(1)'], {}), '(1)\... |
"""BOMStation additional feed fields
Revision ID: f04dfaf47b51
Revises: <KEY>
Create Date: 2020-10-08 01:04:58.796972
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "f04dfaf47b51"
down_revision = "<KEY>"
branch_labels = None
depends_on = None
def upgrade():
... | [
"sqlalchemy.Text",
"alembic.op.drop_column",
"sqlalchemy.Boolean",
"sqlalchemy.Integer"
] | [((835, 879), 'alembic.op.drop_column', 'op.drop_column', (['"""bom_station"""', '"""website_url"""'], {}), "('bom_station', 'website_url')\n", (849, 879), False, 'from alembic import op\n'), ((884, 925), 'alembic.op.drop_column', 'op.drop_column', (['"""bom_station"""', '"""priority"""'], {}), "('bom_station', 'priori... |
import logging
from typing import Any, Dict, Callable
_log = logging.getLogger(__name__)
__all__ = ("EventMixin",)
class EventMixin:
events: Dict[str, Callable] = {}
def dispatch(self, event_name: str, *args: Any, **kwargs: Any) -> Any:
event = self.events.get(event_name)
if not event:
... | [
"logging.getLogger"
] | [((62, 89), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (79, 89), False, 'import logging\n')] |
# from django import forms
#
# class PostForm(forms.Form):
# content = forms.CharField(max_length=256)
from django import forms
class InputNumeroForm(forms.Form):
numero = forms.IntegerField()
| [
"django.forms.IntegerField"
] | [((182, 202), 'django.forms.IntegerField', 'forms.IntegerField', ([], {}), '()\n', (200, 202), False, 'from django import forms\n')] |
# -*- coding:utf-8 -*-
import abc
import math
import numbers
import numpy as np
import scipy.sparse as sp
from .physicalmodel import PhysicalModel
class ClassicalIsingModel(PhysicalModel):
@classmethod
def initial_state(cls, shape, state_type):
if state_type == 'qubo':
return cls.initia... | [
"numpy.random.randint",
"numpy.zeros",
"numpy.random.RandomState",
"scipy.sparse.csr_matrix",
"numpy.tri",
"math.exp"
] | [((499, 546), 'numpy.random.randint', 'np.random.randint', (['(2)'], {'size': 'shape', 'dtype': 'np.int8'}), '(2, size=shape, dtype=np.int8)\n', (516, 546), True, 'import numpy as np\n'), ((1083, 1099), 'scipy.sparse.csr_matrix', 'sp.csr_matrix', (['j'], {}), '(j)\n', (1096, 1099), True, 'import scipy.sparse as sp\n'),... |
"""
Copyright (c) 2019 Cisco Systems, Inc. All rights reserved.
License at https://github.com/cisco/mercury/blob/master/LICENSE
"""
import os
import sys
import socket
# SSH helper classes
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.dirname(os.path.abspath(__file__))+'/../')
f... | [
"os.path.abspath"
] | [((224, 249), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (239, 249), False, 'import os\n'), ((284, 309), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (299, 309), False, 'import os\n')] |
import librosa
import torch
import torchaudio
from torchaudio.transforms import Resample, Spectrogram
def load(path, sample_rate=22050):
waveform, source_rate = torchaudio.load(path)
if len(waveform) > 1:
waveform = waveform.mean(dim=0)
if source_rate != sample_rate:
resample = Resample(so... | [
"torchaudio.load",
"torchaudio.transforms.Resample",
"torch.matmul",
"librosa.filters.mel",
"torchaudio.transforms.Spectrogram",
"torch.clamp"
] | [((167, 188), 'torchaudio.load', 'torchaudio.load', (['path'], {}), '(path)\n', (182, 188), False, 'import torchaudio\n'), ((309, 343), 'torchaudio.transforms.Resample', 'Resample', (['source_rate', 'sample_rate'], {}), '(source_rate, sample_rate)\n', (317, 343), False, 'from torchaudio.transforms import Resample, Spec... |
# -*- coding: utf-8 -*-
from scipy import misc
from scipy import ndimage
import numpy as np
import util
import os
oriDir = '../data/'
tgtDir = '../processedData/'
imgLength = 512
compressRatio = 0.2
compressLen = int(imgLength * compressRatio)
def flipImageMatrix(img):
flipped_img = np.ndarray... | [
"os.listdir",
"numpy.fliplr",
"scipy.misc.imsave",
"numpy.zeros",
"numpy.ndarray",
"scipy.misc.imresize",
"util.updateDir",
"scipy.ndimage.rotate",
"util.getImageMatrix",
"numpy.random.permutation"
] | [((310, 346), 'numpy.ndarray', 'np.ndarray', (['img.shape'], {'dtype': '"""uint8"""'}), "(img.shape, dtype='uint8')\n", (320, 346), True, 'import numpy as np\n'), ((375, 398), 'numpy.fliplr', 'np.fliplr', (['img[:, :, 0]'], {}), '(img[:, :, 0])\n', (384, 398), True, 'import numpy as np\n'), ((427, 450), 'numpy.fliplr',... |
import getpass
import glob
import logging
import os
from collections import Counter
import fabric
import paramiko
logger = logging.getLogger(__name__)
def ssh_connect(host, user) -> fabric.Connection:
"""Create ssh connection using fabric and paramiko, supports DUO authentication.
:param host: remote host
... | [
"logging.getLogger",
"os.path.exists",
"os.listdir",
"paramiko.AutoAddPolicy",
"os.path.join",
"os.path.splitext",
"collections.Counter",
"os.rmdir",
"fabric.Connection",
"paramiko.SSHClient",
"glob.glob"
] | [((125, 152), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (142, 152), False, 'import logging\n'), ((531, 551), 'paramiko.SSHClient', 'paramiko.SSHClient', ([], {}), '()\n', (549, 551), False, 'import paramiko\n'), ((677, 700), 'fabric.Connection', 'fabric.Connection', (['host'], {}), '... |
# Lint as: python3
# Copyright 2020 DeepMind Technologies Limited.
#
# 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 appli... | [
"numpy.clip",
"tensorflow.io.FixedLenSequenceFeature",
"tensorflow.shape",
"acme.wrappers.SinglePrecisionWrapper",
"reverb.ReplaySample",
"dm_control.composer.Environment",
"dm_control.composer.variation.distributions.Uniform",
"dm_control.locomotion.arenas.corridors.GapsCorridor",
"tensorflow.io.de... | [((1924, 1988), 'dm_control.locomotion.arenas.bowl.Bowl', 'arenas.bowl.Bowl', ([], {'size': '(20.0, 20.0)', 'aesthetic': '"""outdoor_natural"""'}), "(size=(20.0, 20.0), aesthetic='outdoor_natural')\n", (1940, 1988), False, 'from dm_control.locomotion import arenas\n'), ((2020, 2118), 'dm_control.locomotion.tasks.escape... |
import os
import tensorflow as tf
import numpy as np
import matplotlib
# matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import argparse
from numpy import linalg as LA
from keras.applications.vgg16 import VGG16
from keras.preprocessing import image
from keras.applications.vgg... | [
"keras.applications.vgg16.VGG16",
"matplotlib.pyplot.plot",
"os.path.join",
"numpy.asarray",
"numpy.zeros",
"keras.applications.vgg16.preprocess_input",
"numpy.expand_dims",
"numpy.linalg.norm"
] | [((687, 840), 'keras.applications.vgg16.VGG16', 'VGG16', ([], {'weights': 'self.weight', 'input_shape': '(self.input_shape[0], self.input_shape[1], self.input_shape[2])', 'pooling': 'self.pooling', 'include_top': '(True)'}), '(weights=self.weight, input_shape=(self.input_shape[0], self.\n input_shape[1], self.input_... |
import os
import time
import argparse
from datetime import datetime
import subprocess
import pdb
import math
import numpy as np
import pybullet as p
import pickle
import matplotlib.pyplot as plt
import gym
from gym import error, spaces, utils
from gym.utils import seeding
from gym.spaces import Box, Dict
import torch
i... | [
"ray.rllib.agents.ppo.DEFAULT_CONFIG.copy",
"ray.rllib.models.torch.fcnet.FullyConnectedNetwork",
"gym_pybullet_drones.envs.multi_agent_rl.MeetupAviary.MeetupAviary",
"ray.init",
"torch.nn.Module.__init__",
"os.path.exists",
"argparse.ArgumentParser",
"ray.rllib.models.torch.torch_modelv2.TorchModelV2... | [((5268, 5365), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Multi-agent reinforcement learning experiments script"""'}), "(description=\n 'Multi-agent reinforcement learning experiments script')\n", (5291, 5365), False, 'import argparse\n'), ((7880, 7894), 'ray.shutdown', 'ray.shut... |
import typing
import six as _six
from flyteidl.core import interface_pb2 as _interface_pb2
from flytekit.models import common as _common
from flytekit.models import literals as _literals
from flytekit.models import types as _types
class Variable(_common.FlyteIdlEntity):
def __init__(self, type, description):
... | [
"flytekit.models.literals.Literal.from_flyte_idl",
"six.iteritems",
"flytekit.models.types.LiteralType.from_flyte_idl"
] | [((1598, 1652), 'flytekit.models.types.LiteralType.from_flyte_idl', '_types.LiteralType.from_flyte_idl', (['variable_proto.type'], {}), '(variable_proto.type)\n', (1631, 1652), True, 'from flytekit.models import types as _types\n'), ((6202, 6254), 'flytekit.models.literals.Literal.from_flyte_idl', '_literals.Literal.fr... |
from allauth.socialaccount.providers.oauth2_provider.urls import default_urlpatterns
from .provider import SlackProvider
urlpatterns = default_urlpatterns(SlackProvider)
| [
"allauth.socialaccount.providers.oauth2_provider.urls.default_urlpatterns"
] | [((138, 172), 'allauth.socialaccount.providers.oauth2_provider.urls.default_urlpatterns', 'default_urlpatterns', (['SlackProvider'], {}), '(SlackProvider)\n', (157, 172), False, 'from allauth.socialaccount.providers.oauth2_provider.urls import default_urlpatterns\n')] |
# coding: utf-8
import numpy as np
import torch
from torch.autograd import Variable
import torch.nn as nn
from .pretrainedmodels import inceptionresnetv2
def l2norm(input, p=2.0, dim=1, eps=1e-12):
"""
Compute L2 norm, row-wise
"""
#print("input size(): ", input.size())
l2_inp = input / input.nor... | [
"torch.IntTensor",
"numpy.sqrt",
"torch.nn.Linear",
"torch.nn.GRU"
] | [((481, 493), 'numpy.sqrt', 'np.sqrt', (['(6.0)'], {}), '(6.0)\n', (488, 493), True, 'import numpy as np\n'), ((495, 514), 'numpy.sqrt', 'np.sqrt', (['(nin + nout)'], {}), '(nin + nout)\n', (502, 514), True, 'import numpy as np\n'), ((1290, 1319), 'torch.nn.Linear', 'nn.Linear', (['dim_image', 'hid_dim'], {}), '(dim_im... |
from __future__ import absolute_import
from builtins import str
from builtins import range
from anuga.coordinate_transforms.geo_reference import Geo_reference, DEFAULT_ZONE
from anuga.geometry.polygon import point_in_polygon, populate_polygon
from anuga.utilities.numerical_tools import ensure_numeric
import numpy as n... | [
"anuga.caching.cache",
"anuga.utilities.numerical_tools.ensure_numeric",
"anuga.coordinate_transforms.geo_reference.Geo_reference",
"builtins.str",
"anuga.pmesh.mesh.Mesh",
"exceptions.Exception",
"anuga.geometry.polygon.point_in_polygon",
"builtins.range",
"anuga.utilities.log.resource_usage_timing... | [((7508, 7547), 'anuga.utilities.numerical_tools.ensure_numeric', 'ensure_numeric', (['bounding_polygon', 'float'], {}), '(bounding_polygon, float)\n', (7522, 7547), False, 'from anuga.utilities.numerical_tools import ensure_numeric\n'), ((11197, 11235), 'anuga.pmesh.mesh.Mesh', 'Mesh', ([], {'geo_reference': 'mesh_geo... |
"""
Affine Cipher
"""
from string import ascii_lowercase as low
from textwrap import wrap
from math import gcd
def encode(plain_text, a_value, b_value):
"""
Encode text
"""
if gcd(a_value, 26) != 1:
raise ValueError("a and m must be coprime.")
plain_text = list(filter(lambda x: x.is... | [
"math.gcd",
"string.ascii_lowercase.index"
] | [((201, 217), 'math.gcd', 'gcd', (['a_value', '(26)'], {}), '(a_value, 26)\n', (204, 217), False, 'from math import gcd\n'), ((689, 705), 'math.gcd', 'gcd', (['a_value', '(26)'], {}), '(a_value, 26)\n', (692, 705), False, 'from math import gcd\n'), ((1021, 1036), 'string.ascii_lowercase.index', 'low.index', (['char'], ... |
import json
import os
import sys
import docopt
import pkg_resources
import six
from six.moves import urllib
import dcoscli
from dcos import (cmds, config, emitting, http,
metronome, options, packagemanager, util)
from dcos.cosmos import get_cosmos_url
from dcos.errors import DCOSException, DCOSHTTPE... | [
"dcos.errors.DCOSException",
"dcoscli.tables.job_table",
"dcos.http.delete",
"dcos.http.get",
"pkg_resources.resource_string",
"six.text_type",
"dcos.config.missing_config_exception",
"six.moves.urllib.parse.urljoin",
"dcos.cosmos.get_cosmos_url",
"dcos.cmds.Command",
"dcoscli.subcommand.default... | [((479, 504), 'dcos.util.get_logger', 'util.get_logger', (['__name__'], {}), '(__name__)\n', (494, 504), False, 'from dcos import cmds, config, emitting, http, metronome, options, packagemanager, util\n'), ((515, 537), 'dcos.emitting.FlatEmitter', 'emitting.FlatEmitter', ([], {}), '()\n', (535, 537), False, 'from dcos ... |
# Copyright 2018 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://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | [
"logging.getLogger",
"pytorch_lightning.callbacks.ModelCheckpoint",
"numpy.random.get_state",
"gluonts.itertools.Cached",
"pytorch_lightning.Trainer",
"gluonts.core.component.validated"
] | [((1011, 1038), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1028, 1038), False, 'import logging\n'), ((1555, 1566), 'gluonts.core.component.validated', 'validated', ([], {}), '()\n', (1564, 1566), False, 'from gluonts.core.component import validated\n'), ((4507, 4578), 'pytorch_lightn... |
#!/usr/bin/python
import socket
import struct
rawSocket = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, socket.htons(0x800))
#rawSocket = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.htons(0x0800))
#the 0x0800 means IP protocol
#/usr/include/linux/if_ether.h will show you the defined Ethernet Protocol ID'... | [
"socket.htons",
"struct.pack"
] | [((477, 531), 'struct.pack', 'struct.pack', (['"""!6s6s2s"""', '"""ªªªªªª"""', '"""»»»»»»"""', "'\\x08\\x00'"], {}), "('!6s6s2s', 'ªªªªªª', '»»»»»»', '\\x08\\x00')\n", (488, 531), False, 'import struct\n'), ((109, 127), 'socket.htons', 'socket.htons', (['(2048)'], {}), '(2048)\n', (121, 127), False, 'import socket\n'),... |
import numpy as np
import matplotlib.pyplot as plt
import readFile as r
q50=r.readFile("q_out50.txt")
qt50=r.readFile("qt_out50.txt")
q100=r.readFile("q_out100.txt")
qt100=r.readFile("qt_out100.txt")
q200=r.readFile("q_out200.txt")
qt200=r.readFile("qt_out200.txt")
fig=plt.figure(1)
plt.subplot(211)
plt.grid()
plt.x... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"readFile.readFile",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((77, 102), 'readFile.readFile', 'r.readFile', (['"""q_out50.txt"""'], {}), "('q_out50.txt')\n", (87, 102), True, 'import readFile as r\n'), ((108, 134), 'readFile.readFile', 'r.readFile', (['"""qt_out50.txt"""'], {}), "('qt_out50.txt')\n", (118, 134), True, 'import readFile as r\n'), ((140, 166), 'readFile.readFile',... |
"""Python wrappers around TensorFlow ops.
This file is MACHINE GENERATED! Do not edit.
"""
import collections
from tensorflow.python import pywrap_tfe as pywrap_tfe
from tensorflow.python.eager import context as _context
from tensorflow.python.eager import core as _core
from tensorflow.python.eager import execute as... | [
"tensorflow.python.eager.execute.make_bool",
"tensorflow.python.eager.execute.make_float",
"tensorflow.python.framework.ops.to_raw_op",
"tensorflow.python.eager.execute.make_int",
"tensorflow.python.eager.execute.execute",
"tensorflow.python.pywrap_tfe.TFE_Py_FastPathExecute",
"tensorflow.python.framewo... | [((2768, 2813), 'tensorflow.python.eager.execute.make_str', '_execute.make_str', (['tensor_name', '"""tensor_name"""'], {}), "(tensor_name, 'tensor_name')\n", (2785, 2813), True, 'from tensorflow.python.eager import execute as _execute\n'), ((3155, 3280), 'tensorflow.python.framework.op_def_library._apply_op_helper', '... |
from setuptools import setup, find_packages
with open("requirements.txt") as f:
install_requires = f.read().strip().split("\n")
# get version from __version__ variable in tcm_stunner/__init__.py
from tcm_stunner import __version__ as version
setup(
name="tcm_stunner",
version=version,
description="For Testing",
... | [
"setuptools.find_packages"
] | [((373, 388), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (386, 388), False, 'from setuptools import setup, find_packages\n')] |
""" Command line argument parser """
#pylint: disable=C0326,R0205
from __future__ import unicode_literals
import os
import argparse
from virtusb import log
from virtusb.server import UsbIpServer
from virtusb.controller import VirtualController
LOGGER = log.get_logger()
class Parser(object): #pylint: disable=too-few-p... | [
"virtusb.server.UsbIpServer",
"virtusb.log.set_level",
"argparse.ArgumentParser",
"os.getuid",
"virtusb.controller.VirtualController",
"virtusb.log.get_logger"
] | [((254, 270), 'virtusb.log.get_logger', 'log.get_logger', ([], {}), '()\n', (268, 270), False, 'from virtusb import log\n'), ((1338, 1357), 'virtusb.controller.VirtualController', 'VirtualController', ([], {}), '()\n', (1355, 1357), False, 'from virtusb.controller import VirtualController\n'), ((1429, 1452), 'virtusb.s... |
# Copyright 2014 Mirantis, 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 writing... | [
"fuel_agent.utils.grub_utils.guess_grub2_conf",
"fuel_agent.utils.grub_utils.guess_grub2_mkconfig",
"fuel_agent.utils.grub_utils.grub2_install",
"fuel_agent.utils.grub_utils.guess_grub",
"fuel_agent.utils.grub_utils.grub1_cfg",
"fuel_agent.utils.grub_utils.guess_grub_install",
"StringIO.StringIO",
"fu... | [((935, 970), 'mock.patch.object', 'mock.patch.object', (['os.path', '"""isdir"""'], {}), "(os.path, 'isdir')\n", (952, 970), False, 'import mock\n'), ((1598, 1634), 'mock.patch.object', 'mock.patch.object', (['os.path', '"""isfile"""'], {}), "(os.path, 'isfile')\n", (1615, 1634), False, 'import mock\n'), ((2300, 2336)... |
from sandbox.crazyflie.src.gcg.envs.GibsonEnv.env_modalities import CameraRobotEnv, BaseRobotEnv
from sandbox.crazyflie.src.gcg.envs.GibsonEnv.env_bases import *
from sandbox.crazyflie.src.gcg.envs.GibsonEnv.robot_locomotors import Quadrotor3
from transforms3d import quaternions
import os
import numpy as np
import sys
... | [
"collections.OrderedDict",
"termcolor.colored",
"sandbox.crazyflie.src.gcg.envs.GibsonEnv.robot_locomotors.Quadrotor3",
"numpy.logical_and",
"sandbox.crazyflie.src.gcg.envs.GibsonEnv.env_modalities.CameraRobotEnv._reset",
"gcg.envs.env_spec.EnvSpec",
"sandbox.crazyflie.src.gcg.envs.GibsonEnv.env_modalit... | [((1117, 1230), 'sandbox.crazyflie.src.gcg.envs.GibsonEnv.env_modalities.CameraRobotEnv.__init__', 'CameraRobotEnv.__init__', (['self', 'self.config', 'gpu_count'], {'scene_type': '"""building"""', 'tracking_camera': 'tracking_camera'}), "(self, self.config, gpu_count, scene_type='building',\n tracking_camera=tracki... |
import binascii
import struct
import os
import gevent
import ipaddress
import time
from gevent.lock import RLock
from gevent.event import AsyncResult
from gevent import socket
import collections
import traceback
try:
import color_logging
import logging
logger = logging
except:
import logging
logger... | [
"gevent.socket.create_connection",
"struct.calcsize",
"gevent.event.AsyncResult",
"binascii.hexlify",
"gevent.socket.htonl",
"json.loads",
"collections.namedtuple",
"ipaddress.ip_interface",
"ipaddress.ip_address",
"gevent.sleep",
"os.urandom",
"struct.pack",
"os.path.isfile",
"struct.unpa... | [((384, 448), 'collections.namedtuple', 'collections.namedtuple', (['"""ProtocolHandler"""', '"""permission, handler"""'], {}), "('ProtocolHandler', 'permission, handler')\n", (406, 448), False, 'import collections\n'), ((465, 520), 'collections.namedtuple', 'collections.namedtuple', (['"""NonceCallback"""', '"""id, ca... |
import botocore
import click
from .cli.cliutils import failure
from .functions import get_function
def get_subscription_filters(session, function_name):
"""Returns all the log subscription filters for the function"""
log_group_name = "/aws/lambda/%s" % function_name
try:
res = session.client("log... | [
"click.echo"
] | [((3844, 3919), 'click.echo', 'click.echo', (['("Removing New Relic log subscription from \'%s\'" % function_name)'], {}), '("Removing New Relic log subscription from \'%s\'" % function_name)\n', (3854, 3919), False, 'import click\n'), ((2298, 2771), 'click.echo', 'click.echo', (['"""WARNING: Found a log subscription f... |
from .logger import logger
from . import pretty
import pytest
def _error(e):
error = '{}: {}'.format(type(e).__name__, str(e))
logger.debug(pretty.colorize_text(error, color=pretty.YELLOW))
@pytest.fixture(scope='module')
def timezone():
""" A shortcut to the `django.utils.timezone` module. """
from... | [
"pytest.fixture"
] | [((203, 233), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (217, 233), False, 'import pytest\n'), ((373, 403), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (387, 403), False, 'import pytest\n'), ((496, 526), 'pytest.fixture', 'p... |
#!/usr/bin/env python
from argparse import ArgumentParser, BooleanOptionalAction
from fontTools.ttLib.ttFont import TTFont
parser = ArgumentParser(description='Print the code points of the given font files. More specifically, for each file you provide, the program prints a line with 3 fields (space separated by defau... | [
"fontTools.ttLib.ttFont.TTFont",
"argparse.ArgumentParser"
] | [((134, 612), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Print the code points of the given font files. More specifically, for each file you provide, the program prints a line with 3 fields (space separated by default): the font path, the font name, and the code points. The code points are co... |
#!/usr/bin/env python
import argparse
import datetime
import os
import time
import urlparse
from selenium import webdriver
from har2stix import Har2Stix
def load_driver(extensions, mime_types, output_dir, download_dir):
profile = webdriver.FirefoxProfile()
for extension in extensions:
profile.add_e... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.makedirs",
"datetime.datetime.utcnow",
"selenium.webdriver.Firefox",
"os.path.join",
"os.walk",
"time.sleep",
"os.path.realpath",
"har2stix.Har2Stix",
"selenium.webdriver.FirefoxProfile",
"os.path.expanduser",
"urlparse.urlparse"
] | [((1909, 1957), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'description'}), '(description=description)\n', (1932, 1957), False, 'import argparse\n'), ((2171, 2212), 'os.path.join', 'os.path.join', (['working_dir', 'args.list_file'], {}), '(working_dir, args.list_file)\n', (2183, 2212), F... |
import pytest
import jax.random as jr
import jax.numpy as np
from jax import jit
import numpy as onp
from ssm.factorial_hmm import NormalFactorialHMM
SEED = jr.PRNGKey(0)
@jit
def identity(x):
return x
#### TESTS
def test_normal_factorial_hmm_jit():
fhmm = NormalFactorialHMM(num_states=(3, 4), seed=SEED... | [
"jax.numpy.allclose",
"jax.random.PRNGKey",
"jax.numpy.array_equal",
"ssm.factorial_hmm.NormalFactorialHMM",
"jax.numpy.array",
"jax.numpy.isnan",
"jax.random.split"
] | [((161, 174), 'jax.random.PRNGKey', 'jr.PRNGKey', (['(0)'], {}), '(0)\n', (171, 174), True, 'import jax.random as jr\n'), ((273, 321), 'ssm.factorial_hmm.NormalFactorialHMM', 'NormalFactorialHMM', ([], {'num_states': '(3, 4)', 'seed': 'SEED'}), '(num_states=(3, 4), seed=SEED)\n', (291, 321), False, 'from ssm.factorial_... |
# gpl: authors Liero, Atom
bl_info = {
"name": "Unfold transition",
"author": "Liero, Atom",
"location": "3D View > Toolshelf > Create > Unfold Transition",
"description": "Simple unfold transition / animation, will "
"separate faces and set up an armature",
"category": "Animatio... | [
"bpy.utils.unregister_class",
"random.uniform",
"random.randint",
"bpy.ops.mesh.select_all",
"mathutils.Vector",
"bpy.ops.object.mode_set",
"bpy.data.objects.new",
"bpy.ops.mesh.edge_split",
"bpy.ops.mesh.sort_elements",
"bpy.ops.mesh.remove_doubles",
"bpy.data.objects.remove",
"mathutils.geom... | [((1083, 1108), 'bpy.ops.object.mode_set', 'bpy.ops.object.mode_set', ([], {}), '()\n', (1106, 1108), False, 'import bpy\n'), ((1352, 1388), 'bpy.ops.object.mode_set', 'bpy.ops.object.mode_set', ([], {'mode': '"""EDIT"""'}), "(mode='EDIT')\n", (1375, 1388), False, 'import bpy\n'), ((1397, 1463), 'bpy.ops.mesh.remove_do... |
#! /usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# Copyright 2017 the HERA Collaboration
# Licensed under the 2-clause BSD license.
from __future__ import absolute_import, division, print_function
import argparse
from astropy.time import Time, TimeDelta
import aipy
from hera_mc.observations import Obser... | [
"hera_mc.mc.connect_to_mc_db",
"hera_mc.mc.get_mc_argument_parser",
"astropy.time.Time",
"aipy.miriad.UV"
] | [((355, 382), 'hera_mc.mc.get_mc_argument_parser', 'mc.get_mc_argument_parser', ([], {}), '()\n', (380, 382), False, 'from hera_mc import mc\n'), ((605, 630), 'hera_mc.mc.connect_to_mc_db', 'mc.connect_to_mc_db', (['args'], {}), '(args)\n', (624, 630), False, 'from hera_mc import mc\n'), ((895, 917), 'aipy.miriad.UV', ... |
try:
import cv2
import numpy as np
except ImportError as e:
from pip._internal import main as install
packages = ["numpy", "opencv-python"]
for package in packages:
install(["install", package])
finally:
pass
# read an image and a video
image = cv2.imread("avatar.jpg")
def cannyImage(... | [
"cv2.imshow",
"pip._internal.main",
"cv2.destroyAllWindows",
"cv2.Canny",
"cv2.waitKey",
"cv2.imread"
] | [((279, 303), 'cv2.imread', 'cv2.imread', (['"""avatar.jpg"""'], {}), "('avatar.jpg')\n", (289, 303), False, 'import cv2\n'), ((341, 367), 'cv2.Canny', 'cv2.Canny', (['image', '(100)', '(200)'], {}), '(image, 100, 200)\n', (350, 367), False, 'import cv2\n'), ((372, 410), 'cv2.imshow', 'cv2.imshow', (['"""Image Canny"""... |
import logging
import re
from pprint import pprint, pformat
from datadog import initialize, api
from lib import *
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('main')
def getAll(filters=None):
all = api.Dashboard.get_all()['dashboards']
logger.debug(pformat(all))
if filters:
... | [
"logging.basicConfig",
"logging.getLogger",
"datadog.api.Dashboard.get_all",
"datadog.initialize",
"pprint.pformat",
"datadog.api.Dashboard.get",
"re.search"
] | [((115, 155), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (134, 155), False, 'import logging\n'), ((165, 190), 'logging.getLogger', 'logging.getLogger', (['"""main"""'], {}), "('main')\n", (182, 190), False, 'import logging\n'), ((1027, 1051), 'datadog.init... |
# Copyright 2019 The Cirq Developers
#
# 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 ... | [
"cirq.obj_to_dict_helper",
"cirq._doc.document"
] | [((1612, 2150), 'cirq._doc.document', 'document', (['SYC', '"""The Sycamore gate is a two-qubit gate equivalent to FSimGate(π/2, π/6).\n\n The unitary of this gate is\n\n [[1, 0, 0, 0],\n [0, 0, -1j, 0],\n [0, -1j, 0, 0],\n [0, 0, 0, exp(- 1j * π/6)]]... |