code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from sqlalchemy import create_engine, Sequence
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm.exc import MultipleResultsFound, NoResultFound
from sqlalchemy.pool import StaticPool
from ocd_backend import settings
from ocd_backend.models.definitions import Ori
from ocd_backend.models.misc import Uri
from o... | [
"sqlalchemy.orm.sessionmaker",
"ocd_backend.models.misc.Uri",
"ocd_backend.models.postgres_models.Property.predicate.in_",
"ocd_backend.models.postgres_models.Property",
"sqlalchemy.create_engine",
"sqlalchemy.orm.exc.MultipleResultsFound",
"ocd_backend.models.postgres_models.Source",
"sqlalchemy.orm.... | [((1015, 1074), 'sqlalchemy.create_engine', 'create_engine', (['self.connection_string'], {'poolclass': 'StaticPool'}), '(self.connection_string, poolclass=StaticPool)\n', (1028, 1074), False, 'from sqlalchemy import create_engine, Sequence\n'), ((1098, 1128), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', ([], {'bind'... |
from dataclasses import dataclass, field
from itertools import chain
from typing import List
from ivory.core.base import Base
from ivory.core.parameter import Input, Loss, Output, Parameter, State, Weight
from ivory.core.variable import Data, Shape, Variable
@dataclass(repr=False, eq=False)
class Layer(Base):
sh... | [
"itertools.chain",
"dataclasses.dataclass",
"dataclasses.field"
] | [((263, 294), 'dataclasses.dataclass', 'dataclass', ([], {'repr': '(False)', 'eq': '(False)'}), '(repr=False, eq=False)\n', (272, 294), False, 'from dataclasses import dataclass, field\n'), ((410, 449), 'dataclasses.field', 'field', ([], {'default_factory': 'list', 'init': '(False)'}), '(default_factory=list, init=Fals... |
"""
Line Chart with datum
---------------------------------
An example of using ``datum`` to highlight certain values, including a ``DateTime`` value.
This is adapted from two corresponding Vega-Lite Examples:
`Highlight a Specific Value <https://vega.github.io/vega-lite/docs/datum.html#highlight-a-specific-data-value>... | [
"altair.datum",
"altair.Chart",
"vega_datasets.data.stocks",
"altair.DateTime"
] | [((415, 428), 'vega_datasets.data.stocks', 'data.stocks', ([], {}), '()\n', (426, 428), False, 'from vega_datasets import data\n'), ((745, 759), 'altair.datum', 'alt.datum', (['(350)'], {}), '(350)\n', (754, 759), True, 'import altair as alt\n'), ((625, 666), 'altair.DateTime', 'alt.DateTime', ([], {'year': '(2006)', '... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 14 16:26:11 2022
@author: sergio
"""
# 2 - Crear una Criptomoneda
# Para Instalar:
# Flask==1.1.2: pip install Flask==1.1.2
# Cliente HTTP Postman: https://www.getpostman.com/
# requests==2.25.1: pip install requests==2.25.1
# Importar las librerí... | [
"hashlib.sha256",
"urllib.parse.urlparse",
"flask.Flask",
"json.dumps",
"requests.get",
"uuid.uuid4",
"json.get",
"datetime.datetime.now",
"flask.request.get_json",
"flask.jsonify"
] | [((3477, 3492), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (3482, 3492), False, 'from flask import Flask, jsonify, request\n'), ((5355, 5373), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (5371, 5373), False, 'from flask import Flask, jsonify, request\n'), ((5905, 5923), 'flask.reque... |
from pommerman.constants import Action
import numpy as np
class DataAugmentor():
"""
A class that creates new valid state transitions based on the input
transition.
"""
def __init__(self) -> None:
pass
def augment(self, obs: dict, action: Action, reward: float, nobs: dict, d... | [
"numpy.flip",
"numpy.rot90"
] | [((4511, 4533), 'numpy.rot90', 'np.rot90', (["obs['board']"], {}), "(obs['board'])\n", (4519, 4533), True, 'import numpy as np\n'), ((4580, 4616), 'numpy.rot90', 'np.rot90', (["obs['bomb_blast_strength']"], {}), "(obs['bomb_blast_strength'])\n", (4588, 4616), True, 'import numpy as np\n'), ((4654, 4680), 'numpy.rot90',... |
# -*- coding: utf-8 -*-
# !/usr/bin/env python
"""Ploting data."""
import numpy as np
import matplotlib.pyplot as plt
import datetime
import math
from scipy.interpolate import spline
def get_sec():
"""Get second."""
return int(datetime.datetime.now().strftime("%S"))
def setup(graph, kind):
"""Setup pypl... | [
"numpy.abs",
"numpy.fft.fft",
"numpy.array",
"datetime.datetime.now",
"scipy.interpolate.spline",
"matplotlib.pyplot.ion",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.subplots"
] | [((1449, 1464), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)'], {}), '(2)\n', (1461, 1464), True, 'import matplotlib.pyplot as plt\n'), ((1557, 1566), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (1564, 1566), True, 'import matplotlib.pyplot as plt\n'), ((1743, 1759), 'matplotlib.pyplot.pause', 'plt.pa... |
from awacs.aws import (
Allow,
Policy,
Statement,
)
import awacs.sns
from stacker.blueprints.base import Blueprint
from troposphere import (
iam,
sns,
Output,
Ref,
)
SLACK_NOTIFICATION_TOPIC = 'SlackNotificationTopic'
NEW_TEAM_TOPIC = 'NewTeamTopic'
NEW_USER_TOPIC = 'NewUserTopic'
ROLE_TOPI... | [
"awacs.aws.Policy",
"troposphere.Ref",
"troposphere.sns.Topic"
] | [((850, 878), 'awacs.aws.Policy', 'Policy', ([], {'Statement': 'statements'}), '(Statement=statements)\n', (856, 878), False, 'from awacs.aws import Allow, Policy, Statement\n'), ((958, 983), 'troposphere.sns.Topic', 'sns.Topic', (['NEW_USER_TOPIC'], {}), '(NEW_USER_TOPIC)\n', (967, 983), False, 'from troposphere impor... |
#!/usr/bin/env python3
import os
import sys
import yaml
from collections import OrderedDict
CONFIG_FILE = os.environ.get("CONFIG_FILE", "./inventory/mycluster/hosts.yaml")
# to remove 'null' when dumping file
def represent_none(self, _):
return self.represent_scalar('tag:yaml.org,2002:null', '')
yaml.add_repres... | [
"os.environ.get",
"yaml.load",
"yaml.dump"
] | [((108, 173), 'os.environ.get', 'os.environ.get', (['"""CONFIG_FILE"""', '"""./inventory/mycluster/hosts.yaml"""'], {}), "('CONFIG_FILE', './inventory/mycluster/hosts.yaml')\n", (122, 173), False, 'import os\n'), ((2470, 2517), 'yaml.dump', 'yaml.dump', (['self.yaml_config', 'f'], {'sort_keys': '(False)'}), '(self.yaml... |
from click import Path, argument, command, option, secho
from . import VERSION
from .clean_ipynb import clean_ipynb
@command()
@argument("ipynb-file-paths", nargs=-1, type=Path(exists=True))
@option("--back-up", is_flag=True, help="Flag to back up .ipynb.")
@option("--keep-output", is_flag=True, help="Flag to keep .... | [
"click.option",
"click.command",
"click.Path",
"click.secho"
] | [((120, 129), 'click.command', 'command', ([], {}), '()\n', (127, 129), False, 'from click import Path, argument, command, option, secho\n'), ((195, 260), 'click.option', 'option', (['"""--back-up"""'], {'is_flag': '(True)', 'help': '"""Flag to back up .ipynb."""'}), "('--back-up', is_flag=True, help='Flag to back up .... |
import responses
from urllib.parse import urlencode
from tests.util import random_str
from tests.util import mock_http_response
from binance.spot import Spot as Client
from binance.error import ParameterRequiredError
mock_item = {"key_1": "value_1", "key_2": "value_2"}
mock_exception = {"code": -1, "msg": "error messa... | [
"urllib.parse.urlencode",
"tests.util.random_str",
"binance.spot.Spot"
] | [((332, 344), 'tests.util.random_str', 'random_str', ([], {}), '()\n', (342, 344), False, 'from tests.util import random_str\n'), ((354, 366), 'tests.util.random_str', 'random_str', ([], {}), '()\n', (364, 366), False, 'from tests.util import random_str\n'), ((440, 459), 'binance.spot.Spot', 'Client', (['key', 'secret'... |
import numpy as np
from typing import Tuple
from typing import List
from typing import Any
import matplotlib.pyplot as plt
import cv2
from GroundedScan.gym_minigrid.minigrid import DIR_TO_VEC
# TODO faster
def topo_sort(items, constraints):
if not constraints:
return items
items = list(items)
con... | [
"numpy.flip",
"matplotlib.pyplot.savefig",
"numpy.ones",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"numpy.random.random",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.imsave",
"matplotlib.pyplot.close",
"numpy.zeros",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.title",
"cv2.imre... | [((865, 878), 'numpy.ones', 'np.ones', (['size'], {}), '(size)\n', (872, 878), True, 'import numpy as np\n'), ((1364, 1389), 'numpy.zeros', 'np.zeros', (['size'], {'dtype': 'int'}), '(size, dtype=int)\n', (1372, 1389), True, 'import numpy as np\n'), ((2402, 2481), 'matplotlib.pyplot.bar', 'plt.bar', (['y_pos', 'values_... |
import logging
from elasticsearch_async.connection import AIOHttpConnection
logger = logging.getLogger("elasticsearch")
tracer = logging.getLogger("elasticsearch.trace")
class BiothingsAIOHttpConnection(AIOHttpConnection):
def _log_trace(self, method, path, body, status_code, response, duration):
if not... | [
"logging.getLogger"
] | [((87, 121), 'logging.getLogger', 'logging.getLogger', (['"""elasticsearch"""'], {}), "('elasticsearch')\n", (104, 121), False, 'import logging\n'), ((131, 171), 'logging.getLogger', 'logging.getLogger', (['"""elasticsearch.trace"""'], {}), "('elasticsearch.trace')\n", (148, 171), False, 'import logging\n')] |
# coding: utf-8
u"""Этот модуль содержит главный класс библиотеки и набор actions для него."""
from __future__ import absolute_import
import copy
import datetime
import json
import warnings
import six
from django.core import exceptions as dj_exceptions
from django.db.models import fields as dj_fields
from django.uti... | [
"m3.db.safe_delete",
"m3.actions.context.ActionContext",
"m3.actions.results.PreJsonResult",
"six.text_type",
"m3.ApplicationLogicException",
"m3_django_compat.get_request_params",
"m3_django_compat.ModelOptions",
"m3_ext.ui.results.ExtUIScriptResult",
"django.utils.encoding.force_text",
"m3.actio... | [((4306, 4409), 'warnings.warn', 'warnings.warn', (['"""Please, replace "set_windowS_params"->"set_window_params"!"""'], {'category': 'FutureWarning'}), '(\'Please, replace "set_windowS_params"->"set_window_params"!\',\n category=FutureWarning)\n', (4319, 4409), False, 'import warnings\n'), ((4594, 4708), 'warnings.... |
import configparser
import json
import unittest
from io import BytesIO
from pdfminer.pdfparser import PDFSyntaxError
from flaskapp.core.extract_pdf_data import (
extract_data_from_pdf_uri,
get_file_object_from_uri,
)
config = configparser.ConfigParser()
TESTS_DIRECTORY = "./tests"
config.read(TESTS_DIRECTORY... | [
"flaskapp.core.extract_pdf_data.get_file_object_from_uri",
"configparser.ConfigParser",
"io.BytesIO",
"flaskapp.core.extract_pdf_data.extract_data_from_pdf_uri",
"json.load"
] | [((237, 264), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (262, 264), False, 'import configparser\n'), ((938, 971), 'flaskapp.core.extract_pdf_data.get_file_object_from_uri', 'get_file_object_from_uri', (['PDF_URI'], {}), '(PDF_URI)\n', (962, 971), False, 'from flaskapp.core.extract_pdf_... |
import os
from glob import glob
from logging import getLogger
from b2py import utils as b2_utils
logger = getLogger('cache')
class Cache:
"""Cache files to the local disk to save bandwidth."""
def __init__(self, cache_dir: str, cache_size: int):
"""Initialize a local object cache.
Args:
cache_di... | [
"logging.getLogger",
"os.path.getsize",
"os.makedirs",
"b2py.utils.write_file",
"os.path.join",
"os.path.basename",
"os.remove"
] | [((108, 126), 'logging.getLogger', 'getLogger', (['"""cache"""'], {}), "('cache')\n", (117, 126), False, 'from logging import getLogger\n'), ((676, 718), 'os.makedirs', 'os.makedirs', (['self.cache_dir'], {'exist_ok': '(True)'}), '(self.cache_dir, exist_ok=True)\n', (687, 718), False, 'import os\n'), ((1763, 1800), 'os... |
from sklearn.base import BaseEstimator, RegressorMixin, MultiOutputMixin
from sklearn.utils.validation import check_is_fitted
from sklearn.model_selection import check_cv
from ._group_lasso import solve_sparse_group_lasso_cv
from ..validation import check_array
from ..validation import _get_string_dtype
from ..backen... | [
"sklearn.utils.validation.check_is_fitted",
"sklearn.model_selection.check_cv"
] | [((3305, 3322), 'sklearn.model_selection.check_cv', 'check_cv', (['self.cv'], {}), '(self.cv)\n', (3313, 3322), False, 'from sklearn.model_selection import check_cv\n'), ((4899, 4920), 'sklearn.utils.validation.check_is_fitted', 'check_is_fitted', (['self'], {}), '(self)\n', (4914, 4920), False, 'from sklearn.utils.val... |
# Copyright (C) 2020 Hewlett Packard Enterprise Development LP
# All Rights Reserved.
#
# The contents of this software are proprietary and confidential
# to the Hewlett Packard Enterprise Development LP. No part of this
# program may be photocopied, reproduced, or translated into another
# programming language without... | [
"json.loads",
"requests.post",
"eventlet.sleep",
"tornado.platform.asyncio.AnyThreadEventLoopPolicy",
"tornado.httpclient.HTTPRequest",
"json.dumps",
"uuid.uuid4",
"tornado.ioloop.IOLoop.instance",
"sys.exit",
"tornado.websocket.websocket_connect"
] | [((1626, 1643), 'tornado.ioloop.IOLoop.instance', 'IOLoop.instance', ([], {}), '()\n', (1641, 1643), False, 'from tornado.ioloop import IOLoop\n'), ((8214, 8287), 'requests.post', 'post', (['logout_url'], {'verify': '(False)', 'headers': 'logout_header', 'proxies': 'self.proxy'}), '(logout_url, verify=False, headers=lo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 21 09:34:07 2020
kinematics and kinetics diagrams for multi-index dataframes in human gait
@author: nikorose
"""
# import seaborn as sns; sns.set()
import matplotlib.pyplot as plt
import math
from itertools import combinations
from matplotlib.font_m... | [
"numpy.hstack",
"numpy.array",
"shapely.geometry.Polygon",
"os.path.exists",
"pandas.MultiIndex.from_product",
"numpy.mean",
"matplotlib.pyplot.style.use",
"numpy.ndenumerate",
"matplotlib.pyplot.close",
"matplotlib.pyplot.yticks",
"pandas.DataFrame",
"matplotlib.pyplot.ylim",
"matplotlib.py... | [((1656, 1680), 'matplotlib.pyplot.style.use', 'plt.style.use', (['plt_style'], {}), '(plt_style)\n', (1669, 1680), True, 'import matplotlib.pyplot as plt\n'), ((6671, 6747), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': 'nrows', 'ncols': 'ncols', 'squeeze': '(False)', 'figsize': 'self.fig_size'}), '(nro... |
#-------by HYH -------#
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
##
world=np.array([['red','green','green','red', 'red'],
['red','red', 'green','red', 'red'],
['red','red', 'green','green','red'],
['red','red', 'red',... | [
"matplotlib.pyplot.title",
"numpy.ones",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"numpy.log2",
"matplotlib.pyplot.ioff",
"numpy.argsort",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.zeros",
"matplotlib.pyplot.ion",
"numpy.meshgrid",
"numpy.... | [((124, 300), 'numpy.array', 'np.array', (["[['red', 'green', 'green', 'red', 'red'], ['red', 'red', 'green', 'red',\n 'red'], ['red', 'red', 'green', 'green', 'red'], ['red', 'red', 'red',\n 'red', 'red']]"], {}), "([['red', 'green', 'green', 'red', 'red'], ['red', 'red', 'green',\n 'red', 'red'], ['red', 're... |
import math
import random
from dataclasses import dataclass
from transformers.models.bart.modeling_bart import (
BartLearnedPositionalEmbedding,
BartEncoderLayer,
BartPretrainedModel,
BartConfig,
ACT2FN,
shift_tokens_right, _make_causal_mask, _expand_mask
)
from my_transformers.modeling_bart ... | [
"transformers.models.bart.modeling_bart.shift_tokens_right",
"torch.nn.Tanh",
"torch.nn.CrossEntropyLoss",
"transformers.AutoTokenizer.from_pretrained",
"transformers.utils.logging.get_logger",
"torch.arange",
"my_transformers.modeling_bart.BartDecoder",
"transformers.modeling_outputs.Seq2SeqModelOutp... | [((1016, 1044), 'transformers.utils.logging.get_logger', 'logging.get_logger', (['__name__'], {}), '(__name__)\n', (1034, 1044), False, 'from transformers.utils import logging\n'), ((21969, 22030), 'transformers.AutoConfig.from_pretrained', 'transformers.AutoConfig.from_pretrained', (['"""facebook/bart-base"""'], {}), ... |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2019 Nortxort
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use,... | [
"logging.getLogger",
"websocket.create_connection",
"time.time",
"json.loads"
] | [((1173, 1200), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1190, 1200), False, 'import logging\n'), ((5136, 5258), 'websocket.create_connection', 'websocket.create_connection', (['"""wss://lb-stat.tinychat.com/leaderboard"""'], {'header': 'tc_header', 'origin': '"""https://tinychat.c... |
import MySQLdb as db
from xalanih.utils.parameters import Parameters
from xalanih.core.dbconnector import DBConnector
from xalanih.core.logger import Logger
from xalanih.core.xalanihexception import XalanihException
class MysqlConnector(DBConnector):
def __init__(self, params, logger):
"""
Constru... | [
"xalanih.core.xalanihexception.XalanihException"
] | [((873, 959), 'xalanih.core.xalanihexception.XalanihException', 'XalanihException', (['"""You are already connected"""', 'XalanihException.ALREADY_CONNECTED'], {}), "('You are already connected', XalanihException.\n ALREADY_CONNECTED)\n", (889, 959), False, 'from xalanih.core.xalanihexception import XalanihException... |
from __future__ import absolute_import, division, print_function, unicode_literals
import tensorflow as tf
import logging
logger = tf.get_logger()
logger.setLevel(logging.ERROR)
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import tensorflow.compat.v2.feature_column as fc
import os
os.envir... | [
"pandas.read_csv",
"tensorflow.estimator.LinearClassifier",
"tensorflow.feature_column.numeric_column",
"tensorflow.get_logger",
"tensorflow.feature_column.categorical_column_with_vocabulary_list"
] | [((132, 147), 'tensorflow.get_logger', 'tf.get_logger', ([], {}), '()\n', (145, 147), True, 'import tensorflow as tf\n'), ((375, 450), 'pandas.read_csv', 'pd.read_csv', (['"""https://storage.googleapis.com/tf-datasets/titanic/train.csv"""'], {}), "('https://storage.googleapis.com/tf-datasets/titanic/train.csv')\n", (38... |
"""
Name: inherent
Coder: <NAME> (BGI-Research)[V1]
Current Version: 1
Function(s):
(1) Some inherent concepts.
"""
import numpy
# mapping of integer and char
A = 65 # ord('A')
B = 66 # ord('B')
C = 67 # ord('C')
D = 68 # ord('D')
E = 69 # ord('E')
F = 70 # ord('F')
G = 71 # ord('G')
H = ... | [
"numpy.array"
] | [((681, 739), 'numpy.array', 'numpy.array', (['[A, C, G, T, M, R, W, S, Y, K, V, H, D, B, N]'], {}), '([A, C, G, T, M, R, W, S, Y, K, V, H, D, B, N])\n', (692, 739), False, 'import numpy\n'), ((783, 926), 'numpy.array', 'numpy.array', (['[[A], [C], [G], [T], [A, C], [A, G], [A, T], [C, G], [C, T], [G, T], [A, C,\n G... |
from django import forms
from My_music_app.music_app.helpers import BootstrapFormMixin
from My_music_app.music_app.models import Profile, Album
class CreateProfileForm(forms.ModelForm):
class Meta:
model = Profile
fields = ('username', 'email', 'age')
labels = {
'username': 'U... | [
"django.forms.Textarea",
"My_music_app.music_app.models.Album.objects.all",
"django.forms.TextInput"
] | [((440, 490), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'placeholder': 'Username'}"}), "(attrs={'placeholder': 'Username'})\n", (455, 490), False, 'from django import forms\n'), ((584, 631), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'placeholder': 'Email'}"}), "(attrs={'placehold... |
#!/usr/bin/env python3
"""
This executable builds takes RST files comprising the SE manual and outputs final PHP files for publication to the SE website.
"""
import os
import argparse
from html import escape
from pathlib import Path
import subprocess
import sys
import tempfile
from bs4 import BeautifulSoup, NavigableS... | [
"tempfile.TemporaryDirectory",
"os.listdir",
"argparse.ArgumentParser",
"pathlib.Path",
"regex.match",
"bs4.BeautifulSoup",
"os.path.isdir",
"natsort.natsorted",
"regex.sub",
"html.escape",
"regex.findall",
"regex.compile"
] | [((2250, 2270), 'pathlib.Path', 'Path', (['dest_directory'], {}), '(dest_directory)\n', (2254, 2270), False, 'from pathlib import Path\n'), ((2848, 2907), 'regex.sub', 'regex.sub', (['"""(?<=href\\\\=\\\\")([/a-z0-9\\\\.-]+?)(?=#)"""', '""""""', 'toc'], {}), '(\'(?<=href\\\\=\\\\")([/a-z0-9\\\\.-]+?)(?=#)\', \'\', toc)... |
import bpy
import os
bl_info = {
"name" : "plantFEM_export", # プラグイン名
"author" : "<NAME>", # 作者
"version" : (0,1), # プラグインのバージョン
"blender" : (2, 80, 0), # プラグインが動作するBlenderのバージョン
"location" : "File > Export > plantFEM_export", # Blender内... | [
"bpy.utils.unregister_class",
"bpy.props.BoolProperty",
"bpy.props.StringProperty",
"bpy.context.scene.world.items",
"bpy.types.TOPBAR_MT_file_export.remove",
"bpy.props.EnumProperty",
"bpy.types.TOPBAR_MT_file_export.append",
"bpy.utils.register_class",
"bpy.ops.export_test.some_data"
] | [((14798, 14861), 'bpy.props.StringProperty', 'StringProperty', ([], {'default': '"""*.f90"""', 'options': "{'HIDDEN'}", 'maxlen': '(255)'}), "(default='*.f90', options={'HIDDEN'}, maxlen=255)\n", (14812, 14861), False, 'from bpy.props import StringProperty, BoolProperty, EnumProperty\n'), ((15105, 15191), 'bpy.props.B... |
from PIL import Image
import numpy as np
import tensorflow as tf
# colour map
label_colours = [(0,0,0)
# 0=background
,(128,0,0),(0,128,0),(128,128,0),(0,0,128),(128,0,128)
# 1=aeroplane, 2=bicycle, 3=bird, 4=boat, 5=bottle
,(0,128,128),(128,128,128),(64,... | [
"tensorflow.one_hot",
"tensorflow.image.resize_nearest_neighbor",
"tensorflow.reduce_sum",
"numpy.array",
"numpy.zeros",
"tensorflow.name_scope",
"tensorflow.reduce_mean",
"tensorflow.squeeze"
] | [((1402, 1449), 'numpy.zeros', 'np.zeros', (['(num_images, h, w, 3)'], {'dtype': 'np.uint8'}), '((num_images, h, w, 3), dtype=np.uint8)\n', (1410, 1449), True, 'import numpy as np\n'), ((3385, 3432), 'numpy.zeros', 'np.zeros', (['(num_images, h, w, c)'], {'dtype': 'np.uint8'}), '((num_images, h, w, c), dtype=np.uint8)\... |
from abc import ABC, abstractmethod
import logging
import selectors
import multiprocessing
from defusedxml import ElementTree as etree
from FreeTAKServer.controllers.DatabaseControllers.DatabaseController import DatabaseController
from FreeTAKServer.controllers.services.service_abstracts import ServerServiceInterface... | [
"traceback.format_exc",
"FreeTAKServer.controllers.serializers.xml_serializer.XmlSerializer",
"defusedxml.ElementTree.tostring",
"defusedxml.ElementTree.fromstring",
"FreeTAKServer.controllers.serializers.protobuf_serializer.ProtobufSerializer",
"FreeTAKServer.controllers.XMLCoTController.XMLCoTController... | [((1839, 1865), 'defusedxml.ElementTree.tostring', 'etree.tostring', (['xml_object'], {}), '(xml_object)\n', (1853, 1865), True, 'from defusedxml import ElementTree as etree\n'), ((7205, 7221), 'FreeTAKServer.model.protobufModel.fig_pb2.FederatedEvent', 'FederatedEvent', ([], {}), '()\n', (7219, 7221), False, 'from Fre... |
""" Classes used to represent assignment statements. """
# Standard library imports.
import ast
# Enthought library imports.
from traits.api import Any, Bool, HasTraits, Instance, Int, List, Str
# Local imports.
from envisage._compat import STRING_BASE_CLASS
class Assign(HasTraits):
""" An assignment statemen... | [
"traits.api.Instance",
"traits.api.Bool",
"ast.walk",
"traits.api.List"
] | [((482, 545), 'traits.api.Instance', 'Instance', (['"""envisage.developer.code_browser.namespace.Namespace"""'], {}), "('envisage.developer.code_browser.namespace.Namespace')\n", (490, 545), False, 'from traits.api import Any, Bool, HasTraits, Instance, Int, List, Str\n'), ((756, 765), 'traits.api.List', 'List', (['Str... |
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
from django.contrib.auth.models import User
from numpy import argsort
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
from submodules.url_strip import url_strip
from ... | [
"datetime.timedelta",
"apiapp.models.Cluster.objects.all",
"apiapp.models.Article.objects.get",
"sklearn.metrics.pairwise.cosine_similarity",
"submodules.get_media.save_media",
"django.http.HttpResponse",
"json.dumps",
"apiapp.models.Article.objects.filter",
"submodules.cluster.cluster",
"apiapp.m... | [((636, 662), 'django.http.HttpResponse', 'HttpResponse', (['"""test works"""'], {}), "('test works')\n", (648, 662), False, 'from django.http import HttpResponse, JsonResponse\n'), ((813, 827), 'submodules.url_strip.url_strip', 'url_strip', (['url'], {}), '(url)\n', (822, 827), False, 'from submodules.url_strip import... |
from typing import *
from code_checker import find_functions, find_imports, clean
from load_files import get_source_code
class SourceParser:
def __init__(self, path: str):
self.source_code = get_source_code(path)
def scan(self) -> Dict[str, Dict[str, Set[str]]]:
relations_dict = dict()
... | [
"load_files.get_source_code",
"code_checker.find_functions",
"code_checker.find_imports",
"code_checker.clean"
] | [((207, 228), 'load_files.get_source_code', 'get_source_code', (['path'], {}), '(path)\n', (222, 228), False, 'from load_files import get_source_code\n'), ((695, 716), 'code_checker.clean', 'clean', (['relations_dict'], {}), '(relations_dict)\n', (700, 716), False, 'from code_checker import find_functions, find_imports... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from astropy.time import Time
def open_avro(fname):
with open(fname,'rb') as f:
freader = fastavro.reader(f)
schema = freader.writer_schema
for packet in freader:
return packet
def make_dataframe(packet):
... | [
"numpy.log10",
"astropy.time.Time.now",
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"numpy.sum",
"matplotlib.pyplot.figure",
"numpy.isnan",
"numpy.isfinite",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.errorbar",
"pandas.DataFrame",
"p... | [((328, 372), 'pandas.DataFrame', 'pd.DataFrame', (["packet['candidate']"], {'index': '[0]'}), "(packet['candidate'], index=[0])\n", (340, 372), True, 'import pandas as pd\n'), ((386, 424), 'pandas.DataFrame', 'pd.DataFrame', (["packet['prv_candidates']"], {}), "(packet['prv_candidates'])\n", (398, 424), True, 'import ... |
import time
import ssl
import google.protobuf.text_format
import google.protobuf.json_format
from . import abi
from . import casper_pb2 as casper
from . import consensus_pb2 as consensus
from . import crypto
def _read_binary(file_name: str):
with open(file_name, "rb") as f:
return f.read()
def hexify(o)... | [
"time.time",
"ssl._ssl._test_decode_cert"
] | [((638, 682), 'ssl._ssl._test_decode_cert', 'ssl._ssl._test_decode_cert', (['certificate_file'], {}), '(certificate_file)\n', (664, 682), False, 'import ssl\n'), ((4073, 4084), 'time.time', 'time.time', ([], {}), '()\n', (4082, 4084), False, 'import time\n')] |
# -*- coding: utf-8 -*-
"""
Spyder Editor
Este é um arquivo de script temporário.
"""
def consulta_cep(cep):
import requests
url = 'https://viacep.com.br/ws/%s/json/'%cep
response = requests.get(url)
print (response.content)
type('response.content')
if __name__ == '__main__' :
consulta_c... | [
"requests.get"
] | [((196, 213), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (208, 213), False, 'import requests\n')] |
"""
It contains the functions to compute the cases that presents an analytical
solutions.
All functions output the analytical solution in kcal/mol
"""
import numpy
from numpy import pi
from scipy import special, linalg
from scipy.misc import factorial
from math import gamma
def an_spherical(q, xq, E_1, E_2, E_0, R, N... | [
"numpy.arccos",
"scipy.misc.factorial",
"numpy.sqrt",
"scipy.special.kv",
"numpy.sinh",
"numpy.arctan2",
"scipy.special.sph_harm",
"numpy.arange",
"math.gamma",
"numpy.tanh",
"numpy.exp",
"numpy.real",
"scipy.special.iv",
"numpy.abs",
"numpy.cos",
"scipy.linalg.solve",
"numpy.sum",
... | [((2216, 2228), 'scipy.misc.factorial', 'factorial', (['n'], {}), '(n)\n', (2225, 2228), False, 'from scipy.misc import factorial\n'), ((2243, 2259), 'scipy.misc.factorial', 'factorial', (['(2 * n)'], {}), '(2 * n)\n', (2252, 2259), False, 'from scipy.misc import factorial\n'), ((6216, 6245), 'scipy.special.kv', 'speci... |
from django.db import models
class Users(models.Model):
id_user = models.FloatField(primary_key=True)
name = models.CharField(max_length=50, blank=True, null=True)
username = models.CharField(max_length=100, blank=True, null=True)
password = models.CharField(max_length=60, blank=True, null=True)
s... | [
"django.db.models.FloatField",
"django.db.models.DateField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.AutoField",
"django.db.models.BigIntegerField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((72, 107), 'django.db.models.FloatField', 'models.FloatField', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (89, 107), False, 'from django.db import models\n'), ((119, 173), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', 'blank': '(True)', 'null': '(True)'}), '(max_length=50... |
"""empty message
Revision ID: 508b5d9e042a
Revises: 35665e680f24
Create Date: 2020-02-10 19:28:47.818594
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '508b5d9e042a'
down_revision = '35665e680f24'
branch_labels = None... | [
"sqlalchemy.ForeignKeyConstraint",
"alembic.op.drop_table",
"sqlalchemy.Text",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Integer"
] | [((905, 951), 'alembic.op.drop_table', 'op.drop_table', (['"""session_learner_form_response"""'], {}), "('session_learner_form_response')\n", (918, 951), False, 'from alembic import op\n'), ((673, 737), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['session_id']", "['tutoring_session.id']"], {}), "(... |
"""
Filename: ifp.py
Authors: <NAME>, <NAME>
Tools for solving the standard optimal savings / income fluctuation
problem for an infinitely lived consumer facing an exogenous income
process that evolves according to a Markov chain.
References
----------
http://quant-econ.net/ifp.html
"""
import numpy as np
from sc... | [
"scipy.interp",
"numpy.array",
"numpy.linspace",
"numpy.empty",
"numpy.min"
] | [((2661, 2697), 'numpy.linspace', 'np.linspace', (['(-b)', 'grid_max', 'grid_size'], {}), '(-b, grid_max, grid_size)\n', (2672, 2697), True, 'import numpy as np\n'), ((3619, 3636), 'numpy.empty', 'np.empty', (['V.shape'], {}), '(V.shape)\n', (3627, 3636), True, 'import numpy as np\n'), ((3653, 3670), 'numpy.empty', 'np... |
from torch import nn
class SCSEModule(nn.Module):
def __init__(self, ch, re=16):
super().__init__()
self.cSE = nn.Sequential(nn.AdaptiveAvgPool2d(1),
nn.Conv2d(ch, ch // re, 1),
nn.ReLU(inplace=True),
... | [
"torch.nn.Sigmoid",
"torch.nn.ReLU",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.Conv2d"
] | [((147, 170), 'torch.nn.AdaptiveAvgPool2d', 'nn.AdaptiveAvgPool2d', (['(1)'], {}), '(1)\n', (167, 170), False, 'from torch import nn\n'), ((205, 231), 'torch.nn.Conv2d', 'nn.Conv2d', (['ch', '(ch // re)', '(1)'], {}), '(ch, ch // re, 1)\n', (214, 231), False, 'from torch import nn\n'), ((266, 287), 'torch.nn.ReLU', 'nn... |
import time
from serial_weighing_scale import connect_serial_scale
def wait():
time.sleep(0.1)
port = "/dev/tty.usbmodem14201"
scale = connect_serial_scale(test_ports=[port])
while not scale.scale_is_ready():
wait()
def do_run():
known_mass = 59.52 # for ThorLabs BA1L/M bar
port = "/dev/tty.usbm... | [
"serial_weighing_scale.connect_serial_scale",
"time.sleep"
] | [((144, 183), 'serial_weighing_scale.connect_serial_scale', 'connect_serial_scale', ([], {'test_ports': '[port]'}), '(test_ports=[port])\n', (164, 183), False, 'from serial_weighing_scale import connect_serial_scale\n'), ((86, 101), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (96, 101), False, 'import time\... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"pgsqltoolsservice.edit_data.update_management.CellUpdate",
"pgsqltoolsservice.edit_data.contracts.EditCellResponse",
"pgsqltoolsservice.edit_data.contracts.EditCell",
"pgsqltoolsservice.edit_data.contracts.EditRow",
"pgsqltoolsservice.edit_data.update_management.EditScript"
] | [((1223, 1288), 'pgsqltoolsservice.edit_data.update_management.CellUpdate', 'CellUpdate', (['self.result_set.columns_info[column_index]', 'new_value'], {}), '(self.result_set.columns_info[column_index], new_value)\n', (1233, 1288), False, 'from pgsqltoolsservice.edit_data.update_management import RowEdit, CellUpdate, E... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Shortest path using Google's ortools TSP solver
"""
import os
import sys
import argparse
import pandas as pd
import numpy as np
from random import randint
from ortools.constraint_solver import pywrapcp
# You need to import routing_enums_pb2 after pywrapcp!
from ort... | [
"pandas.read_csv",
"argparse.ArgumentParser",
"ortools.constraint_solver.pywrapcp.RoutingModel",
"folium.Map",
"matplotlib.pyplot.close",
"allocator.distance_matrix.osrm_distance_matrix",
"pandas.DataFrame",
"random.randint",
"ortools.constraint_solver.pywrapcp.RoutingModel.DefaultSearchParameters",... | [((1944, 1981), 'ortools.constraint_solver.pywrapcp.RoutingModel', 'pywrapcp.RoutingModel', (['tsp_size', '(1)', '(0)'], {}), '(tsp_size, 1, 0)\n', (1965, 1981), False, 'from ortools.constraint_solver import pywrapcp\n'), ((2007, 2054), 'ortools.constraint_solver.pywrapcp.RoutingModel.DefaultSearchParameters', 'pywrapc... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 <NAME> <<EMAIL>>
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Distribution License v1.0
# which accompanies this distribution.
#
# The Eclipse Distribution License is available at
... | [
"paho.mqtt.client.Client"
] | [((1181, 1232), 'paho.mqtt.client.Client', 'mqtt.Client', ([], {'client_id': '"""asdfj"""', 'clean_session': '(False)'}), "(client_id='asdfj', clean_session=False)\n", (1192, 1232), True, 'import paho.mqtt.client as mqtt\n'), ((1481, 1531), 'paho.mqtt.client.Client', 'mqtt.Client', ([], {'client_id': '"""asdfj"""', 'cl... |
from django.core.management.base import BaseCommand, CommandError
from qfieldcloud.core.models import Project
from qfieldcloud.core.utils2 import storage
class Command(BaseCommand):
"""Runs purge_old_file_versions as a management command"""
help = storage.purge_old_file_versions.__doc__
PROMPT_TXT = "Th... | [
"qfieldcloud.core.utils2.storage.purge_old_file_versions",
"qfieldcloud.core.models.Project.objects.all",
"django.core.management.base.CommandError"
] | [((1208, 1229), 'qfieldcloud.core.models.Project.objects.all', 'Project.objects.all', ([], {}), '()\n', (1227, 1229), False, 'from qfieldcloud.core.models import Project\n'), ((1496, 1542), 'qfieldcloud.core.utils2.storage.purge_old_file_versions', 'storage.purge_old_file_versions', (['proj_instance'], {}), '(proj_inst... |
from server.models.issue import Issue, IssueStatus
from server.service.access.issues import get_issues, open_issue, update_issue, get_broken_bikes
class TestIssues:
async def test_get_issues(self, random_user):
issue = await Issue.create(user=random_user, description="I don't like it!")
assert is... | [
"server.models.issue.Issue.create",
"server.service.access.issues.get_issues",
"server.service.access.issues.open_issue",
"server.models.issue.Issue.first",
"server.service.access.issues.update_issue",
"server.models.issue.Issue.filter",
"server.service.access.issues.get_broken_bikes"
] | [((240, 302), 'server.models.issue.Issue.create', 'Issue.create', ([], {'user': 'random_user', 'description': '"""I don\'t like it!"""'}), '(user=random_user, description="I don\'t like it!")\n', (252, 302), False, 'from server.models.issue import Issue, IssueStatus\n'), ((442, 502), 'server.models.issue.Issue.create',... |
from .compression import encodeLZ78, decodeLZ78
from argparse import ArgumentParser
main_command = ArgumentParser(
prog="pylz78",
description="""A program for compressing and decompressing files using lz78 encoding.
The number of bytes in both the character and index representations must be the same ... | [
"argparse.ArgumentParser"
] | [((100, 483), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'prog': '"""pylz78"""', 'description': '"""A program for compressing and decompressing files using lz78 encoding.\n \n\n The number of bytes in both the character and index representations must be the same when\n encoding and decoding.\n \n\n ... |
# Test if graph with 15 closest settlements is connected
from utils import loadFile
D = loadFile("data/distances15.pkl.gz")
# G = [sorted(i[1] for i in d) for d in D]
G = [{i[1] for i in d} for d in D]
for u in range(len(G)):
for v in G[u]:
G[v].add(u)
print(sum(len(i) for i in G))
for u in range(len(G... | [
"utils.loadFile"
] | [((89, 124), 'utils.loadFile', 'loadFile', (['"""data/distances15.pkl.gz"""'], {}), "('data/distances15.pkl.gz')\n", (97, 124), False, 'from utils import loadFile\n')] |
# coding: utf-8
from nose.tools import eq_
from .utils import check_status_code, create_user, refresh
from allmychanges import chat
from allmychanges.models import EmailVerificationCode
from django.core import mail
from django.test import Client
from django.core.urlresolvers import reverse
def test_user_creation_le... | [
"allmychanges.models.EmailVerificationCode.objects.count",
"nose.tools.eq_",
"django.core.urlresolvers.reverse",
"allmychanges.models.EmailVerificationCode.new_code_for",
"allmychanges.chat.clear_messages",
"django.test.Client"
] | [((351, 372), 'allmychanges.chat.clear_messages', 'chat.clear_messages', ([], {}), '()\n', (370, 372), False, 'from allmychanges import chat\n'), ((500, 508), 'django.test.Client', 'Client', ([], {}), '()\n', (506, 508), False, 'from django.test import Client\n'), ((1090, 1098), 'django.test.Client', 'Client', ([], {})... |
import pytest
from challenges.queue_with_stacks.queue_with_stacks import PseudoQueue, Stack, Node, InvalidOperationError
def test_dequeue_from_example():
pq = PseudoQueue()
pq.enqueue(5)
pq.enqueue(3)
pq.enqueue(1)
actual = pq.dequeue()
expected = 5
assert actual == expected
| [
"challenges.queue_with_stacks.queue_with_stacks.PseudoQueue"
] | [((164, 177), 'challenges.queue_with_stacks.queue_with_stacks.PseudoQueue', 'PseudoQueue', ([], {}), '()\n', (175, 177), False, 'from challenges.queue_with_stacks.queue_with_stacks import PseudoQueue, Stack, Node, InvalidOperationError\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from tqdm import tqdm
from collections import deque
from plasticity.utils import _check_activation
from plasticity.utils.activations import Linear
from plasticity.model.optimizer import Optimizer
from plasticity.model.weights import BaseWeights
from sk... | [
"numpy.fromfile",
"plasticity.model.weights.BaseWeights",
"numpy.arange",
"collections.deque",
"numpy.full_like",
"plasticity.utils._check_activation",
"numpy.random.seed",
"numpy.concatenate",
"sklearn.utils.validation.check_is_fitted",
"plasticity.utils.activations.Linear",
"numpy.allclose",
... | [((2051, 2062), 'plasticity.model.optimizer.Optimizer', 'Optimizer', ([], {}), '()\n', (2060, 2062), False, 'from plasticity.model.optimizer import Optimizer\n'), ((2134, 2147), 'plasticity.model.weights.BaseWeights', 'BaseWeights', ([], {}), '()\n', (2145, 2147), False, 'from plasticity.model.weights import BaseWeight... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app_manager', '0002_auto_20171001_1057'),
]
operations = [
migrations.AlterField(
model_name='app',
n... | [
"django.db.models.ManyToManyField"
] | [((350, 420), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'to': '"""app_manager.AppTag"""', 'null': '(True)', 'blank': '(True)'}), "(to='app_manager.AppTag', null=True, blank=True)\n", (372, 420), False, 'from django.db import migrations, models\n')] |
#!/usr/bin/env python
import os
import sgmake
from common import Status
from common import Support
from common import Settings
from common.Plugin import Plugin
import subprocess
from common import call
def make(project):
cmd = [ 'haxe', 'compile.hxml' ]
try:
call(cmd)
except subprocess.Called... | [
"os.path.isfile",
"common.call"
] | [((507, 537), 'os.path.isfile', 'os.path.isfile', (['"""compile.hxml"""'], {}), "('compile.hxml')\n", (521, 537), False, 'import os\n'), ((282, 291), 'common.call', 'call', (['cmd'], {}), '(cmd)\n', (286, 291), False, 'from common import call\n')] |
# Standard Library
from datetime import datetime
# 3rd Party
import croniter
import pkg_resources
from flask import Blueprint, current_app, jsonify, url_for
# Fastlane
from fastlane.models import Job, Task
from fastlane.models.categories import QueueNames
from fastlane.queue import Queue
from fastlane.utils import fr... | [
"flask.current_app.redis.llen",
"datetime.datetime.utcnow",
"fastlane.models.Task.objects.count",
"fastlane.utils.from_unix",
"flask.current_app.redis.zcard",
"flask.url_for",
"fastlane.models.Job.objects.count",
"flask.current_app.redis.zrange",
"fastlane.models.Job.objects",
"flask.Blueprint",
... | [((334, 385), 'flask.Blueprint', 'Blueprint', (['"""status"""', '__name__'], {'url_prefix': '"""/status"""'}), "('status', __name__, url_prefix='/status')\n", (343, 385), False, 'from flask import Blueprint, current_app, jsonify, url_for\n'), ((1328, 1403), 'flask.current_app.redis.zrange', 'current_app.redis.zrange', ... |
# Copyright 2021, The TensorFlow Federated 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 o... | [
"tensorflow_federated.python.learning.optimizers.sgdm.build_sgdm",
"tensorflow_federated.python.learning.templates.composers.build_basic_fedavg_process",
"tensorflow_federated.python.aggregators.mean.MeanFactory",
"tensorflow_federated.python.common_libs.structure.has_field",
"tensorflow_federated.python.co... | [((1923, 1963), 'tensorflow_federated.python.core.impl.types.computation_types.TensorType', 'computation_types.TensorType', (['tf.float32'], {}), '(tf.float32)\n', (1951, 1963), False, 'from tensorflow_federated.python.core.impl.types import computation_types\n'), ((2253, 2289), 'tensorflow_federated.python.core.api.co... |
# python imports
import os
import time
import argparse
from tqdm import tqdm
# torch imports
import torch
import torch.nn as nn
import torch.optim as optim
# helper functions for computer vision
import torchvision
import torchvision.transforms as transforms
from dataloader import MiniPlaces
from student_code import ... | [
"torch.manual_seed",
"dataloader.MiniPlaces",
"student_code.LeNet",
"argparse.ArgumentParser",
"torch.load",
"os.path.isfile",
"torchvision.transforms.Normalize",
"torch.utils.data.DataLoader",
"torchvision.transforms.ToTensor",
"time.time",
"os.path.expanduser",
"student_code.test_model"
] | [((426, 446), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (443, 446), False, 'import torch\n'), ((580, 587), 'student_code.LeNet', 'LeNet', ([], {}), '()\n', (585, 587), False, 'from student_code import LeNet, test_model\n'), ((1061, 1148), 'dataloader.MiniPlaces', 'MiniPlaces', ([], {'root': 'dat... |
#
# This file is part of GEO Knowledge Hub Package Loader.
# Copyright (C) 2021 GEO Secretariat.
#
# GEO Knowledge Hub Package Loader is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#
"""Command-Line Interface for GEO Knowledge Hub Pac... | [
"os.path.exists",
"requests.post",
"requests.packages.urllib3.disable_warnings",
"click.secho",
"click.group",
"click.option",
"json.dumps",
"os.path.join",
"click.File",
"time.sleep",
"click.version_option",
"os.path.basename",
"json.load"
] | [((573, 648), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings', ([], {'category': 'InsecureRequestWarning'}), '(category=InsecureRequestWarning)\n', (615, 648), False, 'import requests\n'), ((7070, 7083), 'click.group', 'click.group', ([], {}), '()\n', (7081, 7083), False, 'imp... |
import models
from sqlalchemy.orm import sessionmaker
import location
import wingo_fiber
import requests
engine = models.db_connect()
Session = sessionmaker(bind=engine)
def update_avaliability():
session = Session()
exists = session.query(models.ApartmentModel).filter_by(available=None)
for model i... | [
"sqlalchemy.orm.sessionmaker",
"argparse.ArgumentParser",
"location.get_distance",
"requests.get",
"models.db_connect",
"wingo_fiber.get_address",
"location.get_gps",
"wingo_fiber.check_address"
] | [((118, 137), 'models.db_connect', 'models.db_connect', ([], {}), '()\n', (135, 137), False, 'import models\n'), ((148, 173), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', ([], {'bind': 'engine'}), '(bind=engine)\n', (160, 173), False, 'from sqlalchemy.orm import sessionmaker\n'), ((1140, 1166), 'location.get_distance... |
import subprocess
from datetime import datetime
from io import BytesIO
from os import path
import shutil
from typing import Callable, Iterable, Optional, TypeVar
def coords(lon, lat):
t = "%2.4f" % lat
if (lat>0):
t += "N"
else:
t += "S"
t += " %2.4f" % lon
if (lon>0):
t +=... | [
"shutil.copyfileobj",
"os.path.join",
"os.path.realpath",
"os.path.dirname",
"os.path.getmtime",
"typing.TypeVar"
] | [((517, 529), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (524, 529), False, 'from typing import Callable, Iterable, Optional, TypeVar\n'), ((1146, 1168), 'os.path.dirname', 'path.dirname', (['root_dir'], {}), '(root_dir)\n', (1158, 1168), False, 'from os import path\n'), ((1191, 1223), 'os.path.join', '... |
""" Testing Local Notes Module
"""
import unittest
import datetime
from mock import MagicMock, mock_open, patch, call
from ddt import ddt, data, unpack
from ashaw_notes.connectors import local_notes
from ashaw_notes.utils.search import get_search_request
@ddt
class LocalNotesTests(unittest.TestCase):
"""Unit Tes... | [
"ashaw_notes.connectors.local_notes.save_note",
"ashaw_notes.connectors.local_notes.parse_note_line",
"ashaw_notes.utils.search.get_search_request.assert_called_once_with",
"datetime.datetime",
"mock.patch",
"ashaw_notes.connectors.local_notes.write_line",
"ashaw_notes.connectors.local_notes.is_header_f... | [((358, 450), 'ddt.data', 'data', (["('local_notes', True)", "('redis_notes, local_notes', True)", "('redis_notes', False)"], {}), "(('local_notes', True), ('redis_notes, local_notes', True), (\n 'redis_notes', False))\n", (362, 450), False, 'from ddt import ddt, data, unpack\n'), ((482, 534), 'mock.patch', 'patch',... |
import numpy as np
from py_diff_stokes_flow.env.env_base import EnvBase
from py_diff_stokes_flow.common.common import ndarray
from py_diff_stokes_flow.core.py_diff_stokes_flow_core import ShapeComposition2d, StdIntArray2d
class FluidicTwisterEnv3d(EnvBase):
def __init__(self, seed, folder):
np.random.seed... | [
"py_diff_stokes_flow.common.common.ndarray",
"numpy.zeros",
"py_diff_stokes_flow.env.env_base.EnvBase.__init__",
"numpy.random.seed",
"py_diff_stokes_flow.core.py_diff_stokes_flow_core.ShapeComposition2d",
"numpy.linalg.norm",
"numpy.full"
] | [((306, 326), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (320, 326), True, 'import numpy as np\n'), ((455, 529), 'py_diff_stokes_flow.env.env_base.EnvBase.__init__', 'EnvBase.__init__', (['self', 'cell_nums', 'E', 'nu', 'vol_tol', 'edge_sample_num', 'folder'], {}), '(self, cell_nums, E, nu, vol_... |
import time
from azureml.core import (
Workspace, Datastore, Dataset,
ComputeTarget, Environment,
Experiment
)
from azureml.pipeline.steps import PythonScriptStep
from azureml.pipeline.core import Pipeline, PipelineData
from azureml.data import OutputFileDatasetConfig
from azureml.core.runconfig import Run... | [
"azureml.core.Workspace.from_config",
"azureml.core.Experiment",
"azureml.core.Dataset.File.from_files",
"azureml.core.authentication.InteractiveLoginAuthentication",
"azureml.pipeline.steps.PythonScriptStep",
"azureml.pipeline.core.Pipeline",
"azureml.data.OutputFileDatasetConfig",
"azureml.core.Envi... | [((613, 654), 'azureml.core.authentication.InteractiveLoginAuthentication', 'InteractiveLoginAuthentication', (['tenant_id'], {}), '(tenant_id)\n', (643, 654), False, 'from azureml.core.authentication import InteractiveLoginAuthentication\n'), ((679, 723), 'azureml.core.Workspace.from_config', 'Workspace.from_config', ... |
# -*-coding:utf-8 -*-
import numpy as np
from bs4 import BeautifulSoup
import random
def scrapePage(retX, retY, inFile, yr, numPce, origPrc):
"""
函数说明:从页面读取数据,生成retX和retY列表
Parameters:
retX - 数据X
retY - 数据Y
inFile - HTML文件
yr - 年份
numPce - 乐高部件数目
origPrc - 原价
Returns:
无
Website:
http://www.cuijiah... | [
"numpy.mean",
"numpy.mat",
"numpy.multiply",
"random.shuffle",
"numpy.ones",
"sklearn.linear_model.Ridge",
"numpy.linalg.det",
"bs4.BeautifulSoup",
"numpy.exp",
"numpy.zeros",
"numpy.array",
"numpy.nonzero",
"numpy.shape",
"numpy.var"
] | [((439, 458), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html'], {}), '(html)\n', (452, 458), False, 'from bs4 import BeautifulSoup\n'), ((2962, 2978), 'numpy.mean', 'np.mean', (['yMat', '(0)'], {}), '(yMat, 0)\n', (2969, 2978), True, 'import numpy as np\n'), ((3057, 3075), 'numpy.mean', 'np.mean', (['inxMat', '(0)'], {}... |
from functools import partial
from heap import Heap
from itertools import chain, groupby
from math import prod
from sys import argv
import re
def extract(rule):
regex = re.compile(r'([\w ]+): (\d+)-(\d+) or (\d+)-(\d+)')
match = regex.match(rule).groups()
name, (a, b, c, d) = match[0], map(int, match[1:])... | [
"itertools.chain",
"functools.partial",
"itertools.groupby",
"re.compile"
] | [((175, 230), 're.compile', 're.compile', (['"""([\\\\w ]+): (\\\\d+)-(\\\\d+) or (\\\\d+)-(\\\\d+)"""'], {}), "('([\\\\w ]+): (\\\\d+)-(\\\\d+) or (\\\\d+)-(\\\\d+)')\n", (185, 230), False, 'import re\n'), ((438, 453), 'itertools.chain', 'chain', (['*tickets'], {}), '(*tickets)\n', (443, 453), False, 'from itertools i... |
# plotting.py
#
# This file is part of scqubits.
#
# Copyright (c) 2019, <NAME> and <NAME>
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
##############################################################... | [
"matplotlib.colorbar.ColorbarBase",
"scqubits.utils.plot_defaults.wavefunction2d",
"matplotlib.pyplot.IndexLocator",
"matplotlib.colorbar.make_axes",
"scqubits.utils.plot_defaults.contours",
"numpy.arange",
"scqubits.utils.misc.process_which",
"scqubits.utils.plot_defaults.evals_vs_paramvals",
"nump... | [((5669, 5694), 'mpl_toolkits.axes_grid1.make_axes_locatable', 'make_axes_locatable', (['axes'], {}), '(axes)\n', (5688, 5694), False, 'from mpl_toolkits.axes_grid1 import make_axes_locatable\n'), ((6660, 6687), 'numpy.meshgrid', 'np.meshgrid', (['x_vals', 'y_vals'], {}), '(x_vals, y_vals)\n', (6671, 6687), True, 'impo... |
import time
from bynge import app
class AudioFileProcessor:
def __init__(self, uuid):
self.uuid = uuid
app.logger.info('processing task started')
def process(self):
app.logger.info(self.uuid)
time.sleep(10)
def store(self):
print(self.uuid)
def normalize(sel... | [
"time.sleep",
"bynge.app.logger.info"
] | [((126, 168), 'bynge.app.logger.info', 'app.logger.info', (['"""processing task started"""'], {}), "('processing task started')\n", (141, 168), False, 'from bynge import app\n'), ((201, 227), 'bynge.app.logger.info', 'app.logger.info', (['self.uuid'], {}), '(self.uuid)\n', (216, 227), False, 'from bynge import app\n'),... |
from typing import Optional, Dict, List, Callable
from Crypto.Cipher import DES, AES
from Crypto.Util.Padding import pad
from datetime import datetime
from httpx import AsyncClient
from copy import deepcopy
import base64, json, uuid
import hashlib
from loguru import logger
from .base import AsyncBaseTask
from ..cpdail... | [
"uuid.UUID",
"loguru.logger.info",
"loguru.logger.debug",
"base64.b64encode",
"loguru.logger.warning",
"Crypto.Cipher.DES.new",
"json.dumps",
"Crypto.Cipher.AES.new",
"httpx.AsyncClient",
"copy.deepcopy"
] | [((487, 529), 'Crypto.Cipher.DES.new', 'DES.new', ([], {'key': 'key', 'mode': 'DES.MODE_CBC', 'iv': 'iv'}), '(key=key, mode=DES.MODE_CBC, iv=iv)\n', (494, 529), False, 'from Crypto.Cipher import DES, AES\n'), ((863, 905), 'Crypto.Cipher.AES.new', 'AES.new', ([], {'key': 'key', 'mode': 'AES.MODE_CBC', 'iv': 'iv'}), '(ke... |
import torch
from torch import nn
from .utils import EarlyStopping, appendabledict, \
calculate_multiclass_accuracy, calculate_multiclass_f1_score,\
append_suffix, compute_dict_average
from copy import deepcopy
import numpy as np
from torch.utils.data import RandomSampler, BatchSampler
from .categorization imp... | [
"numpy.mean",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"torch.nn.CrossEntropyLoss",
"torch.stack",
"numpy.argmax",
"torch.tensor",
"torch.cuda.is_available",
"torch.nn.Linear",
"copy.deepcopy",
"torch.no_grad",
"torch.cat"
] | [((473, 531), 'torch.nn.Linear', 'nn.Linear', ([], {'in_features': 'input_dim', 'out_features': 'num_classes'}), '(in_features=input_dim, out_features=num_classes)\n', (482, 531), False, 'from torch import nn\n'), ((763, 780), 'copy.deepcopy', 'deepcopy', (['encoder'], {}), '(encoder)\n', (771, 780), False, 'from copy ... |
"""
This app aims to create a nested sidebar structure similar to VSCode layout.
V1 will be a sidebar only with 3 main page links with icons and a settings link at the bottom
V2 will aim to expand on this with a nested sidebar section for each icon"""
import dash
import dash_bootstrap_components as dbc
import dash_cor... | [
"dash_bootstrap_components.Button",
"dash_bootstrap_components.NavLink",
"dash_html_components.I",
"dash_core_components.Location",
"dash_bootstrap_components.ButtonGroup",
"dash_bootstrap_components.Nav",
"dash_html_components.P",
"frontend.server.app.run_server",
"dash_bootstrap_components.Col"
] | [((2390, 2427), 'frontend.server.app.run_server', 'app.run_server', ([], {'port': '(8888)', 'debug': '(True)'}), '(port=8888, debug=True)\n', (2404, 2427), False, 'from frontend.server import app\n'), ((490, 512), 'dash_core_components.Location', 'dcc.Location', ([], {'id': '"""url"""'}), "(id='url')\n", (502, 512), Tr... |
import pathlib
import random
import tensorflow as tf
data_root = pathlib.Path(r'C:\Users\<NAME>\Documents\data')
all_images_paths = list(data_root.glob('*/*'))
all_images_paths = [str(path) for path in all_images_paths]
random.shuffle(all_images_paths)
label_names = sorted(item.name for item in data_root.glob('*/') ... | [
"tensorflow.data.Dataset.zip",
"random.shuffle",
"tensorflow.keras.layers.Conv2D",
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow.keras.Sequential",
"pathlib.Path",
"tensorflow.image.resize",
"tensorflow.io.read_file",
"tensorflow.keras.layers.MaxPooling2D",
"tensorflow.keras.layers.Dro... | [((66, 116), 'pathlib.Path', 'pathlib.Path', (['"""C:\\\\Users\\\\<NAME>\\\\Documents\\\\data"""'], {}), "('C:\\\\Users\\\\<NAME>\\\\Documents\\\\data')\n", (78, 116), False, 'import pathlib\n'), ((222, 254), 'random.shuffle', 'random.shuffle', (['all_images_paths'], {}), '(all_images_paths)\n', (236, 254), False, 'imp... |
# Copyright 2014 Aeris Communications Inc
#
# AerCloud sample code for using the Paho MQTT Library
#
# Dependencies
# Paho Library https://pypi.python.org/pypi/paho-mqtt
#
# To get the sample running, you'll need to fill in the following parameters below
#
# AerCloud API Key:
# AerCloud Account ID:... | [
"paho.mqtt.client.Client",
"json.dumps",
"paho.mqtt.client.connack_string",
"time.sleep"
] | [((2266, 2323), 'paho.mqtt.client.Client', 'mqtt.Client', ([], {'client_id': 'client_uniq', 'protocol': 'mqtt.MQTTv31'}), '(client_id=client_uniq, protocol=mqtt.MQTTv31)\n', (2277, 2323), True, 'import paho.mqtt.client as mqtt\n'), ((2631, 2752), 'json.dumps', 'json.dumps', (["{'Accuracy': '11', 'Latitude': '37.61', 'L... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License... | [
"httmock.response",
"os.path.dirname",
"os.path.join",
"httmock.urlmatch"
] | [((1028, 1068), 'os.path.join', 'os.path.join', (['_TESTS_PATH', '"""../fixtures"""'], {}), "(_TESTS_PATH, '../fixtures')\n", (1040, 1068), False, 'import os\n'), ((985, 1010), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1000, 1010), False, 'import os\n'), ((1101, 1136), 'httmock.urlmatch... |
from PIL import Image, ImageDraw
from io import BytesIO
from math import hypot
from multiprocessing import Pool
import ginit as g
import math
from enums import *
from util import *
def imageOutput(pixels,output,maskfile=None):
iSize = (len(pixels),len(pixels))
picture = Image.new("RGB",iSize)
for x in range(len(pi... | [
"PIL.Image.open",
"PIL.Image.new",
"math.asin",
"io.BytesIO",
"math.cos",
"multiprocessing.Pool",
"math.hypot",
"math.sin"
] | [((275, 298), 'PIL.Image.new', 'Image.new', (['"""RGB"""', 'iSize'], {}), "('RGB', iSize)\n", (284, 298), False, 'from PIL import Image, ImageDraw\n'), ((2873, 2891), 'math.hypot', 'math.hypot', (['x0', 'y0'], {}), '(x0, y0)\n', (2883, 2891), False, 'import math\n'), ((3752, 3761), 'io.BytesIO', 'BytesIO', ([], {}), '(... |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from collections import defaultdict
from past.builtins import basestring
from pycolocstats.core.config import REF_COLL_GSUITES_PATH
__metaclass__ = type
class RefTrackCollectionRegistry(object):
PREBUILT = '__prebuilt_... | [
"os.path.join",
"os.path.exists",
"collections.defaultdict",
"os.walk"
] | [((385, 401), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (396, 401), False, 'from collections import defaultdict\n'), ((443, 459), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (454, 459), False, 'from collections import defaultdict\n'), ((605, 635), 'os.walk', 'os.walk', ... |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
#
import click
import six
from certifiable import CertifierTypeError, certify_int
from certifiable.cli_impl.utils import execute_cli_command, load_json_pickle
@click.command(
'int', help='certify an integer')
@click.option(
'--min-value', type=int,
help='m... | [
"certifiable.cli_impl.utils.load_json_pickle",
"click.argument",
"click.option",
"certifiable.cli_impl.utils.execute_cli_command",
"click.command"
] | [((212, 259), 'click.command', 'click.command', (['"""int"""'], {'help': '"""certify an integer"""'}), "('int', help='certify an integer')\n", (225, 259), False, 'import click\n'), ((266, 335), 'click.option', 'click.option', (['"""--min-value"""'], {'type': 'int', 'help': '"""minimum allowable value"""'}), "('--min-va... |
import argparse
import json
import os
from os import listdir
from os.path import isfile
import shutil
from genson import SchemaBuilder
from enum import Enum
import copy
import flatdict
import pandas as pd
import numpy as np
from collections import OrderedDict
from functools import reduce # forward compatibility for Py... | [
"copy.deepcopy",
"numpy.arange",
"os.listdir",
"genson.SchemaBuilder",
"argparse.ArgumentParser",
"sys.getsizeof",
"flatdict.FlatterDict",
"numpy.concatenate",
"pandas.DataFrame",
"collections.OrderedDict",
"functools.reduce",
"rich.console.Console",
"pandas.get_dummies",
"numpy.bincount",... | [((550, 561), 'echr.utils.logger.getlogger', 'getlogger', ([], {}), '()\n', (559, 561), False, 'from echr.utils.logger import getlogger\n'), ((575, 595), 'rich.console.Console', 'Console', ([], {'record': '(True)'}), '(record=True)\n', (582, 595), False, 'from rich.console import Console\n'), ((630, 697), 'collections.... |
import logging
import abstracthandler
import datetime
class DefaultHandler(abstracthandler.AbstractHandler):
def __init__(self, conf, bot):
abstracthandler.AbstractHandler.__init__(self, 'default', conf, bot)
self.log = logging.getLogger(__name__)
self.commands={}
self.commands['ti... | [
"abstracthandler.AbstractHandler.__init__",
"datetime.datetime.now",
"logging.getLogger"
] | [((154, 222), 'abstracthandler.AbstractHandler.__init__', 'abstracthandler.AbstractHandler.__init__', (['self', '"""default"""', 'conf', 'bot'], {}), "(self, 'default', conf, bot)\n", (194, 222), False, 'import abstracthandler\n'), ((242, 269), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n... |
#!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
import itertools
import copy
class Node:
def __init__(self, index, chars, pos=None, head_index=-1, relation=None, lefts=None, rights=None):
self.index = index
self.chars = chars if chars else []
self.pos = pos
self.head_index = head_... | [
"itertools.chain.from_iterable",
"copy.copy",
"argparse.ArgumentParser",
"copy.deepcopy"
] | [((5239, 5264), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (5262, 5264), False, 'import argparse\n'), ((807, 828), 'copy.copy', 'copy.copy', (['self.index'], {}), '(self.index)\n', (816, 828), False, 'import copy\n'), ((845, 866), 'copy.copy', 'copy.copy', (['self.chars'], {}), '(self.chars... |
import glob
import os
import pandas as pd
from app.proto import MpsProtoAircraft
from .trans import epsg4326_to_3857
def find_simudata_in_directory(directory: str):
matchings = glob.glob1(directory, 'simudata_*')
if matchings:
return os.path.join(directory, matchings[0])
else:
raise File... | [
"os.path.exists",
"glob.glob1",
"os.path.join",
"pandas.DataFrame",
"app.proto.MpsProtoAircraft"
] | [((185, 220), 'glob.glob1', 'glob.glob1', (['directory', '"""simudata_*"""'], {}), "(directory, 'simudata_*')\n", (195, 220), False, 'import glob\n'), ((451, 490), 'os.path.join', 'os.path.join', (['directory', '"""simudata.csv"""'], {}), "(directory, 'simudata.csv')\n", (463, 490), False, 'import os\n'), ((778, 796), ... |
#!/usr/bin/env python3
"""
Crawls all links on a webpage for pcaps.
"""
import argparse
import logging
from multiprocessing.pool import ThreadPool
from urllib.parse import urljoin
import os
import requests
from bs4 import BeautifulSoup
from functools import partial
from helpers import utils
from seed_crawlers import ... | [
"logging.basicConfig",
"logging.getLogger",
"os.makedirs",
"argparse.ArgumentParser",
"os.path.join",
"requests.get",
"multiprocessing.pool.ThreadPool",
"functools.partial",
"os.unlink",
"urllib.parse.urljoin",
"seed_crawlers.pcap_parser.FileBackend"
] | [((333, 354), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (352, 354), False, 'import logging\n'), ((364, 391), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (381, 391), False, 'import logging\n'), ((1353, 1382), 'multiprocessing.pool.ThreadPool', 'ThreadPool', (['POOL... |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"collections.Counter",
"re.sub"
] | [((848, 874), 'collections.Counter', 'Counter', (['prediction_tokens'], {}), '(prediction_tokens)\n', (855, 874), False, 'from collections import Counter\n'), ((877, 905), 'collections.Counter', 'Counter', (['ground_truth_tokens'], {}), '(ground_truth_tokens)\n', (884, 905), False, 'from collections import Counter\n'),... |
import os
#
# Add module to Nuvla server.
#
# The following environmental variables can/must be defined:
#
# NUVLA_ENDPOINT: endpoint of Nuvla server, defaults to localhost
# NUVLA_USERNAME: username to access Nuvla
# NUVLA_PASSWORD: <PASSWORD> access Nuvla
#
from nuvla.api import Api as nuvla_Api
nuvla_api = nuvla_... | [
"nuvla.api.Api"
] | [((314, 368), 'nuvla.api.Api', 'nuvla_Api', (["os.environ['NUVLA_ENDPOINT']"], {'insecure': '(True)'}), "(os.environ['NUVLA_ENDPOINT'], insecure=True)\n", (323, 368), True, 'from nuvla.api import Api as nuvla_Api\n')] |
from typing import Optional
from fastapi import APIRouter, Depends, Response, status
from schemas.tasks import TaskSchema, TaskCreationSchema, TaskUpdateSchema
from services.tasks import TaskService
from models.users import User
from services.auth import get_current_user
router = APIRouter(prefix='/task', tags=['ta... | [
"fastapi.APIRouter",
"fastapi.Response",
"fastapi.Depends"
] | [((285, 326), 'fastapi.APIRouter', 'APIRouter', ([], {'prefix': '"""/task"""', 'tags': "['tasks']"}), "(prefix='/task', tags=['tasks'])\n", (294, 326), False, 'from fastapi import APIRouter, Depends, Response, status\n'), ((415, 440), 'fastapi.Depends', 'Depends', (['get_current_user'], {}), '(get_current_user)\n', (42... |
#!/usr/bin/python3
__author__ = "<NAME>"
__copyright__ = "Copyright 2016, Interface Innovations"
__credits__ = ["<NAME>"]
__license__ = "Apache 2.0"
__version__ = "1.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
import os
import sys
import inspect
try:
import simplejson as json
exc... | [
"iiutilities.dblib.sqlitequery",
"sys.path.insert",
"iiutilities.dblib.dbvntovalue",
"cupid.pilib.dbs.control.read_table",
"cupid.pilib.dbs.motes.insert",
"iiutilities.datalib.gettimestring",
"json.dumps",
"iiutilities.utility.log",
"iiutilities.dblib.setsinglevalue",
"cupid.pilib.dbs.motes.read_t... | [((507, 537), 'sys.path.insert', 'sys.path.insert', (['(0)', 'top_folder'], {}), '(0, top_folder)\n', (522, 537), False, 'import sys\n'), ((25374, 25413), 'cupid.pilib.dbs.control.read_table', 'pilib.dbs.control.read_table', (['"""actions"""'], {}), "('actions')\n", (25402, 25413), False, 'from cupid import pilib\n'), ... |
import math
T = int(input())
for i in range(T):
conv = input()
r, g, b = map(int, input().split(' '))
if conv == 'min':
print("Caso #{}: {}".format(i + 1, min(r, g, b)))
elif conv == 'mean':
print("Caso #{}: {}".format(i + 1, math.floor((r + g + b) / 3)))
elif conv == 'max':
... | [
"math.floor"
] | [((261, 288), 'math.floor', 'math.floor', (['((r + g + b) / 3)'], {}), '((r + g + b) / 3)\n', (271, 288), False, 'import math\n'), ((426, 467), 'math.floor', 'math.floor', (['(r * 0.3 + g * 0.59 + b * 0.11)'], {}), '(r * 0.3 + g * 0.59 + b * 0.11)\n', (436, 467), False, 'import math\n')] |
from math import pi, cos, sin
from numpy.random.mtrand import uniform
from pydesim import Model
from pycsmaca.simulations.modules import RandomSource, Queue, Transmitter, \
Receiver, Radio, ConnectionManager, WirelessInterface, SaturatedQueue
from pycsmaca.simulations.modules.app_layer import ControlledSource
fro... | [
"pycsmaca.simulations.modules.Transmitter",
"pycsmaca.simulations.modules.SaturatedQueue",
"collections.namedtuple",
"pycsmaca.simulations.modules.station.Station",
"pycsmaca.simulations.modules.RandomSource",
"pycsmaca.simulations.modules.ConnectionManager",
"math.cos",
"pycsmaca.simulations.modules.... | [((658, 680), 'pycsmaca.simulations.modules.ConnectionManager', 'ConnectionManager', (['sim'], {}), '(sim)\n', (675, 680), False, 'from pycsmaca.simulations.modules import RandomSource, Queue, Transmitter, Receiver, Radio, ConnectionManager, WirelessInterface, SaturatedQueue\n'), ((2015, 2030), 'pycsmaca.simulations.mo... |
# Copyright 2015 <NAME> (<EMAIL>)
# 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/LICENSE-2.0
#
# Unless required by... | [
"logging.getLogger",
"mercury_agent.procedures.lib.download_file",
"mercury_agent.capabilities.capability",
"mercury.common.helpers.cli.run"
] | [((820, 847), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (837, 847), False, 'import logging\n'), ((851, 914), 'mercury_agent.capabilities.capability', 'capability', (['"""echo"""', '"""Echo something to the console"""'], {'num_args': '(1)'}), "('echo', 'Echo something to the console',... |
"""Test structure and contents of site Atom feeds."""
from urllib.parse import urlparse
from pathlib import Path
from typing import Any, Dict
import feedparser
import pytest
import rich
import toml
SITE_BUILD_DIR = "public"
@pytest.fixture(scope="session")
def site_config() -> Dict[str, Any]:
"""Return the sit... | [
"urllib.parse.urlparse",
"pathlib.Path",
"pytest.mark.parametrize",
"rich.print",
"toml.load",
"pytest.fixture"
] | [((230, 261), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (244, 261), False, 'import pytest\n'), ((386, 417), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (400, 417), False, 'import pytest\n'), ((658, 689), 'pytest.fixture'... |
try:
from celery import Celery
app = Celery("billing_test")
app.config_from_object("django.conf:settings", namespace="CELERY")
app.autodiscover_tasks()
except ImportError:
pass
| [
"celery.Celery"
] | [((46, 68), 'celery.Celery', 'Celery', (['"""billing_test"""'], {}), "('billing_test')\n", (52, 68), False, 'from celery import Celery\n')] |
##
# File: NEFImportTests.py
# Date: 06-Oct-2018 <NAME>
#
# Updates:
##
"""Test cases for NEFTranslator - simply import everything to ensure imports work"""
import unittest
import sys
if __package__ is None or __package__ == "":
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__f... | [
"wwpdb.utils.nmr.NEFTranslator.NEFTranslator.NEFTranslator",
"wwpdb.utils.nmr.NmrStarToCif.NmrStarToCif",
"wwpdb.utils.nmr.NmrDpUtility.NmrDpUtility",
"wwpdb.utils.nmr.BMRBChemShiftStat.BMRBChemShiftStat",
"wwpdb.utils.nmr.NmrDpReport.NmrDpReport",
"unittest.main",
"wwpdb.utils.nmr.rci.RCI.RCI",
"os.p... | [((1228, 1243), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1241, 1243), False, 'import unittest\n'), ((948, 963), 'wwpdb.utils.nmr.NEFTranslator.NEFTranslator.NEFTranslator', 'NEFTranslator', ([], {}), '()\n', (961, 963), False, 'from wwpdb.utils.nmr.NEFTranslator.NEFTranslator import NEFTranslator\n'), ((993... |
from django.shortcuts import render, redirect, get_object_or_404
from django.core.paginator import Paginator
from django.db.models.functions import Lower
# imported our models
from App.models.playlist import Playlist
from App.models.user import User
def show_playlists(user, owner_only=False):
# assume there ... | [
"django.shortcuts.render",
"App.models.playlist.Playlist.objects.filter",
"django.db.models.functions.Lower",
"django.shortcuts.redirect",
"App.models.playlist.Playlist.objects.count"
] | [((441, 465), 'App.models.playlist.Playlist.objects.count', 'Playlist.objects.count', ([], {}), '()\n', (463, 465), False, 'from App.models.playlist import Playlist\n'), ((1913, 1930), 'django.shortcuts.redirect', 'redirect', (['"""login"""'], {}), "('login')\n", (1921, 1930), False, 'from django.shortcuts import rende... |
from sympy import Eq, symbols
import pyexlatex as pl
STR_EQ = r'a = b^{2} + \frac{c}{d}'
a, b, c, d = symbols('a b c d')
SYMPY_EQ = Eq(a, b ** 2 + c/d)
def test_eq_inline():
eq_from_str = pl.Equation(str_eq=STR_EQ)
eq_from_sympy = pl.Equation(eq=SYMPY_EQ)
assert str(eq_from_str) == str(eq_from_sympy) ==... | [
"sympy.symbols",
"sympy.Eq",
"pyexlatex.Equation"
] | [((103, 121), 'sympy.symbols', 'symbols', (['"""a b c d"""'], {}), "('a b c d')\n", (110, 121), False, 'from sympy import Eq, symbols\n'), ((133, 154), 'sympy.Eq', 'Eq', (['a', '(b ** 2 + c / d)'], {}), '(a, b ** 2 + c / d)\n', (135, 154), False, 'from sympy import Eq, symbols\n'), ((195, 221), 'pyexlatex.Equation', 'p... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from glob import glob
from os.path import basename, dirname, join, splitext
import io
import re
from setuptools import find_packages, setup
def read(*names, **kwargs):
with io.open(
join(dirname(__file__), *names),
encoding=kwargs.get("encoding", "... | [
"re.compile",
"setuptools.find_packages",
"os.path.dirname",
"os.path.basename",
"glob.glob"
] | [((251, 268), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (258, 268), False, 'from os.path import basename, dirname, join, splitext\n'), ((404, 463), 're.compile', 're.compile', (['"""^.. start-badges.*^.. end-badges"""', '(re.M | re.S)'], {}), "('^.. start-badges.*^.. end-badges', re.M | re.S)\n"... |
# -*- coding: utf-8 -*-
# Copyright 2014, Digital Reasoning
#
# 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 applica... | [
"south.db.db.send_create_signal",
"south.db.db.delete_table"
] | [((2294, 2341), 'south.db.db.send_create_signal', 'db.send_create_signal', (['u"""formulas"""', "['Formula']"], {}), "(u'formulas', ['Formula'])\n", (2315, 2341), False, 'from south.db import db\n'), ((3134, 3190), 'south.db.db.send_create_signal', 'db.send_create_signal', (['u"""formulas"""', "['FormulaComponent']"], ... |
import traceback
import tensorflow as tf
import keras.backend as K
from hyperopt import STATUS_FAIL
from neural_net import build_and_train
from utils import save_json_result, is_gpu_available, export_model
def optimize_cnn(hype_space):
"""Build a convolutional neural network and train it."""
if not is_gpu_a... | [
"traceback.format_exc",
"tensorflow.logging.error",
"tensorflow.logging.warning",
"utils.is_gpu_available",
"tensorflow.logging.info",
"utils.save_json_result",
"tensorflow.logging.debug",
"neural_net.build_and_train",
"utils.export_model",
"keras.backend.clear_session"
] | [((390, 434), 'tensorflow.logging.debug', 'tf.logging.debug', (['"""Hyperspace: """', 'hype_space'], {}), "('Hyperspace: ', hype_space)\n", (406, 434), True, 'import tensorflow as tf\n'), ((439, 461), 'tensorflow.logging.debug', 'tf.logging.debug', (['"""\n"""'], {}), "('\\n')\n", (455, 461), True, 'import tensorflow a... |
# Copyright 2016, 2017 IBM Corp.
#
# 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 writin... | [
"logging.getLogger",
"sqlalchemy.orm.aliased",
"flask_potion.exceptions.BackendConflict",
"re.match"
] | [((1554, 1581), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1571, 1581), False, 'import logging\n'), ((2113, 2171), 're.match', 're.match', (['"""^.*»(.*)«.*$"""', 'sa_exc.orig.diag.message_primary'], {}), "('^.*»(.*)«.*$', sa_exc.orig.diag.message_primary)\n", (2121, 2171), False, 'i... |
# Generated by Django 2.2.2 on 2019-09-28 14:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('schools', '0003_auto_20190928_1320'),
]
operations = [
migrations.CreateModel(
name='Perspectiv... | [
"django.db.migrations.DeleteModel",
"django.db.models.FloatField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.AutoField"
] | [((814, 851), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""Badges"""'}), "(name='Badges')\n", (836, 851), False, 'from django.db import migrations, models\n'), ((373, 466), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'seri... |
import os
from testglobals import config
import subprocess
import re
# Feature names generally follow the naming used by Linux's /proc/cpuinfo.
SUPPORTED_CPU_FEATURES = {
# These aren't comprehensive; they are only CPU features that we care about
# x86:
'sse', 'sse2', 'sse3', 'ssse3', 'sse4_1', 'sse4_2',
... | [
"subprocess.check_output",
"os.path.exists",
"re.search"
] | [((467, 498), 'os.path.exists', 'os.path.exists', (['"""/proc/cpuinfo"""'], {}), "('/proc/cpuinfo')\n", (481, 498), False, 'import os\n'), ((557, 596), 're.search', 're.search', (['"""flags\\\\s*:\\\\s*.*$"""', 'f', 're.M'], {}), "('flags\\\\s*:\\\\s*.*$', f, re.M)\n", (566, 596), False, 'import re\n'), ((912, 953), 's... |
from django.db import models
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
class SensitivePhraseAbstract(models.Model):
phrase = models.CharField(max_length=200)
replace_phrase = models.CharField(max_length=200, blank=True, null=Tru... | [
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.PositiveIntegerField",
"django.contrib.contenttypes.fields.GenericForeignKey",
"django.db.models.CharField"
] | [((213, 245), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (229, 245), False, 'from django.db import models\n'), ((267, 322), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'blank': '(True)', 'null': '(True)'}), '(max_length=200, ... |
"""
MIT License
Copyright (c) 2020-present shay (shayypy)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge,... | [
"logging.getLogger",
"threading.Thread.__init__",
"json.loads",
"asyncio.run_coroutine_threadsafe",
"traceback.format_stack",
"datetime.datetime.utcnow",
"json.dumps",
"threading.Event",
"sys._current_frames",
"asyncio.get_event_loop"
] | [((2799, 2826), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2816, 2826), False, 'import logging\n'), ((5828, 5847), 'json.loads', 'json.loads', (['payload'], {}), '(payload)\n', (5838, 5847), False, 'import json\n'), ((35719, 35738), 'json.dumps', 'json.dumps', (['payload'], {}), '(pa... |