code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import smart_match
from math import sqrt
class MongeElkan:
def __init__(self, method=None):
self.method = smart_match.get_method(method)
def similarity(self, X, Y):
if not X and not Y:
return 1
if not X or not Y:
return 0
retu... | [
"smart_match.get_method"
] | [((124, 154), 'smart_match.get_method', 'smart_match.get_method', (['method'], {}), '(method)\n', (146, 154), False, 'import smart_match\n')] |
import numpy as np
from skimage.measure import label
from lib.utils_lung_segmentation import get_max_rect_in_mask
def getLargestCC(segmentation):
'''find largest connected component
return: binary mask of the largest connected component'''
labels = label(segmentation)
assert(labels.max() != 0 ) # a... | [
"numpy.bincount",
"skimage.measure.label",
"lib.utils_lung_segmentation.get_max_rect_in_mask"
] | [((266, 285), 'skimage.measure.label', 'label', (['segmentation'], {}), '(segmentation)\n', (271, 285), False, 'from skimage.measure import label\n'), ((690, 725), 'lib.utils_lung_segmentation.get_max_rect_in_mask', 'get_max_rect_in_mask', (['blobs_largest'], {}), '(blobs_largest)\n', (710, 725), False, 'from lib.utils... |
import math
from .hive_position import HivePosition
from .bee_movement import BeeMovement
class BeeTrackingObject:
object_id: int
start_frame_id: int
end_frame_id: int
end_age: int
position_estimates: [(int, int)]
angle: int = -1 # 0° is if the bee flies "to the right on the x-axis". Angle turns clockwise
fl... | [
"math.sqrt",
"math.atan2"
] | [((2613, 2661), 'math.sqrt', 'math.sqrt', (['(x_difference ** 2 + y_difference ** 2)'], {}), '(x_difference ** 2 + y_difference ** 2)\n', (2622, 2661), False, 'import math\n'), ((1496, 1534), 'math.atan2', 'math.atan2', (['y_difference', 'x_difference'], {}), '(y_difference, x_difference)\n', (1506, 1534), False, 'impo... |
import importlib
def load_class(cls, *args, **kwargs):
if cls is None:
return None
module_name, class_name = cls.rsplit(".", 1)
return getattr(importlib.import_module(module_name), class_name)(*args, **kwargs)
| [
"importlib.import_module"
] | [((165, 201), 'importlib.import_module', 'importlib.import_module', (['module_name'], {}), '(module_name)\n', (188, 201), False, 'import importlib\n')] |
# coding=utf-8
# Copyright 2020 The Google Research 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 applicab... | [
"tensorflow.tile",
"tensorflow.shape",
"tf3d.utils.box_utils.get_box_corners_3d",
"tensorflow.boolean_mask",
"gin.configurable",
"tensorflow.ones_like",
"tf3d.utils.mask_utils.apply_mask_to_input_voxel_tensors",
"tf3d.utils.batch_utils.get_batch_size_1_input_objects",
"tf3d.utils.mask_utils.apply_ma... | [((11299, 11402), 'gin.configurable', 'gin.configurable', (['"""box_rotation_regression_loss_on_voxel_tensors"""'], {'blacklist': "['inputs', 'outputs']"}), "('box_rotation_regression_loss_on_voxel_tensors', blacklist\n =['inputs', 'outputs'])\n", (11315, 11402), False, 'import gin\n'), ((14921, 15020), 'gin.configu... |
import sys
sys.path.insert(0, "build/lib.linux-x86_64-3.6")
sys.path.insert(0, "build/lib.linux-x86_64-3.8")
import pypet._ext1
class Derived(pypet._ext1.Pet):
def __init__(self, name):
pypet._ext1.Pet.__init__(self)
self.name = name
self.derived = True
def getName(self):
retu... | [
"sys.path.insert"
] | [((11, 59), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""build/lib.linux-x86_64-3.6"""'], {}), "(0, 'build/lib.linux-x86_64-3.6')\n", (26, 59), False, 'import sys\n'), ((60, 108), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""build/lib.linux-x86_64-3.8"""'], {}), "(0, 'build/lib.linux-x86_64-3.8')\n", (75, 1... |
# Copyright 2018 D-Wave Systems 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... | [
"dimod.unembed_response",
"numpy.hstack",
"dimod.Response",
"dimod.BinaryQuadraticModel.empty",
"dwave_networkx.chimera_graph",
"dimod.embed_bqm",
"dwave_networkx.draw_chimera"
] | [((17215, 17318), 'dwave_networkx.chimera_graph', 'dnx.chimera_graph', (['m', 'n', 't'], {'node_list': 'child.structure.nodelist', 'edge_list': 'child.structure.edgelist'}), '(m, n, t, node_list=child.structure.nodelist, edge_list=\n child.structure.edgelist)\n', (17232, 17318), True, 'import dwave_networkx as dnx\n... |
import datetime
import re
import time
from collections import namedtuple
from django.conf import settings
from django.core.management.base import BaseCommand
from trello import ResourceUnavailable, TrelloClient
from core.models import Event
# Create new command
class Command(BaseCommand):
help = 'Syncs event i... | [
"core.models.Event.objects.all",
"collections.namedtuple",
"time.sleep",
"trello.TrelloClient",
"datetime.date",
"datetime.date.today",
"re.search"
] | [((859, 904), 'collections.namedtuple', 'namedtuple', (['"""EventTuple"""', '"""name id city date"""'], {}), "('EventTuple', 'name id city date')\n", (869, 904), False, 'from collections import namedtuple\n'), ((937, 956), 'core.models.Event.objects.all', 'Event.objects.all', ([], {}), '()\n', (954, 956), False, 'from ... |
# this creates a wrapper using ctypes for glfw from the header
# it's not fully automatic, but it does a good deal of work
import re
with open("../glfw/include/GL/glfw3.h") as header_file:
data = header_file.read()
# normalize whitespace
data = re.sub(r"[ \t]+", " ", data)
# delete beginning
data = data[data.in... | [
"re.sub"
] | [((252, 280), 're.sub', 're.sub', (['"""[ \\\\t]+"""', '""" """', 'data'], {}), "('[ \\\\t]+', ' ', data)\n", (258, 280), False, 'import re\n'), ((664, 701), 're.sub', 're.sub', (['""" *\\\\bGLFWAPI\\\\b *"""', '""""""', 'data'], {}), "(' *\\\\bGLFWAPI\\\\b *', '', data)\n", (670, 701), False, 'import re\n'), ((708, 74... |
# Copyright (c) 2021, Parallel Systems Architecture Laboratory (PARSA), EPFL &
# Machine Learning and Optimization Laboratory (MLO), EPFL. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Red... | [
"numpy.random.random_integers",
"torch.LongTensor",
"torch.nn.functional.embedding",
"torch.autograd.Variable",
"torch.nn.Embedding"
] | [((2519, 2649), 'torch.nn.functional.embedding', 'F.embedding', (['words', 'masked_embed_weight', 'padding_idx', 'embed.max_norm', 'embed.norm_type', 'embed.scale_grad_by_freq', 'embed.sparse'], {}), '(words, masked_embed_weight, padding_idx, embed.max_norm, embed.\n norm_type, embed.scale_grad_by_freq, embed.sparse... |
'''
Investigating the offset of CIV emission in the Cloudy models
as a function of ionization, nebular metallicity, stellar metallicity,
stellar population type, age, etc.
'''
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from scipy.optimize import curve_... | [
"scipy.optimize.curve_fit",
"numpy.median",
"matplotlib.pyplot.ylabel",
"numpy.power",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"warnings.simplefilter",
"matplotlib.py... | [((427, 474), 'warnings.simplefilter', 'warnings.simplefilter', (['"""error"""', 'OptimizeWarning'], {}), "('error', OptimizeWarning)\n", (448, 474), False, 'import warnings\n'), ((983, 1009), 'numpy.arange', 'np.arange', (['(-3.5)', '(-1.4)', '(0.2)'], {}), '(-3.5, -1.4, 0.2)\n', (992, 1009), True, 'import numpy as np... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# rtk.hardware.component.resistor.fixed.Wirewound.py is part of the RTK
# Project
#
# All rights reserved.
# Copyright 2007 - 2017 <NAME> andrew.rowland <AT> reliaqual <DOT> com
#
# Redistribution and use in source and binary forms, with or without
# modifica... | [
"locale.setlocale",
"rtk.Utilities.error_handler",
"rtk.hardware.component.resistor.Resistor.Model.set_attributes",
"rtk.hardware.component.resistor.Resistor.Model.get_attributes",
"rtk.hardware.component.resistor.Resistor.Model.calculate_part",
"math.exp"
] | [((2538, 2591), 'locale.setlocale', 'locale.setlocale', (['locale.LC_ALL', 'Configuration.LOCALE'], {}), '(locale.LC_ALL, Configuration.LOCALE)\n', (2554, 2591), False, 'import locale\n'), ((2659, 2694), 'locale.setlocale', 'locale.setlocale', (['locale.LC_ALL', '""""""'], {}), "(locale.LC_ALL, '')\n", (2675, 2694), Fa... |
##############################################################################
#
# Copyright (c) 2007 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | [
"interfaces._",
"zope.security.proxy.removeSecurityProxy",
"interfaces.IZojaxSecurityPolicy.providedBy",
"zope.component.getUtility",
"zope.security.management.queryInteraction"
] | [((1572, 1599), 'zope.component.getUtility', 'getUtility', (['IAuthentication'], {}), '(IAuthentication)\n', (1582, 1599), False, 'from zope.component import getUtility\n'), ((1848, 1866), 'zope.security.management.queryInteraction', 'queryInteraction', ([], {}), '()\n', (1864, 1866), False, 'from zope.security.managem... |
'''
ExperimentClient tests.
'''
import os
import unittest
import pandas as pd
import time
from mljar.client.project import ProjectClient
from mljar.client.dataset import DatasetClient
from mljar.client.experiment import ExperimentClient
from .project_based_test import ProjectBasedTest, get_postfix
class ExperimentCl... | [
"pandas.read_csv",
"mljar.client.experiment.ExperimentClient",
"time.sleep",
"mljar.client.dataset.DatasetClient",
"mljar.client.project.ProjectClient",
"unittest.main"
] | [((7921, 7936), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7934, 7936), False, 'import unittest\n'), ((884, 899), 'mljar.client.project.ProjectClient', 'ProjectClient', ([], {}), '()\n', (897, 899), False, 'from mljar.client.project import ProjectClient\n'), ((1037, 1073), 'pandas.read_csv', 'pd.read_csv', ([... |
import time
import TSL2561
chip = TSL2561.TSL2561()
while True:
chip.power_on()
print("Raw Channel 0 = " + str(chip.read_channel0()))
print("Raw Channel 1 = " + str(chip.read_channel1()))
print("Lux Channel 0 = " + str(chip.calculate_lux(chip.read_channel0())))
print("Lux Channel 1 = " + str(chip.calculate_lux(ch... | [
"TSL2561.TSL2561",
"time.sleep"
] | [((34, 51), 'TSL2561.TSL2561', 'TSL2561.TSL2561', ([], {}), '()\n', (49, 51), False, 'import TSL2561\n'), ((539, 552), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (549, 552), False, 'import time\n')] |
# import modules
import subprocess
import io
def afplay(filepath):
params = io.getInfo(filepath)
time = params[3] / params[2]
cmd = 'afplay -q 1 %s'%(filepath)
subprocess.Popen(cmd, shell=True)
time.sleep()
return
| [
"io.getInfo",
"subprocess.Popen"
] | [((84, 104), 'io.getInfo', 'io.getInfo', (['filepath'], {}), '(filepath)\n', (94, 104), False, 'import io\n'), ((180, 213), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'shell': '(True)'}), '(cmd, shell=True)\n', (196, 213), False, 'import subprocess\n')] |
from setuptools import setup, find_packages
try:
import s3stat
doc = s3stat.__doc__
except ImportError:
doc = "The docs are only available when the package is already installed. Sorry for this."
setup(
name="s3stat",
version="2.3.1",
description='An extensible Amazon S3 and Cloudfront log ... | [
"setuptools.setup"
] | [((213, 615), 'setuptools.setup', 'setup', ([], {'name': '"""s3stat"""', 'version': '"""2.3.1"""', 'description': '"""An extensible Amazon S3 and Cloudfront log parser."""', 'long_description': 'doc', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/nagyv/s3stat"""', 'include_pac... |
from collections import Sequence
from alphatwirl_interface.cut_flows import cut_flow, cut_flow_with_counter, cut_flow_with_weighted_counter
import six
def Selection(steps={}, cutflow_file=None, weight_attr=None):
'''
This class ties together several modules from alphatwirl to
bring a simplified Se... | [
"alphatwirl_interface.cut_flows.cut_flow_with_counter",
"alphatwirl_interface.cut_flows.cut_flow_with_weighted_counter",
"alphatwirl_interface.cut_flows.cut_flow"
] | [((1307, 1322), 'alphatwirl_interface.cut_flows.cut_flow', 'cut_flow', (['steps'], {}), '(steps)\n', (1315, 1322), False, 'from alphatwirl_interface.cut_flows import cut_flow, cut_flow_with_counter, cut_flow_with_weighted_counter\n'), ((1135, 1199), 'alphatwirl_interface.cut_flows.cut_flow_with_weighted_counter', 'cut_... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
import psoap
from psoap.data import lkca14, redshift, Chunk
from psoap import matrix_functions
from psoap import covariance
from psoap import orbit
# from matplotlib.ticker import FormatStrFormatter as FSF
# from matplotlib.tick... | [
"numpy.sqrt",
"scipy.interpolate.interp1d",
"numpy.array",
"psoap.orbit.SB2",
"numpy.save",
"numpy.searchsorted",
"numpy.max",
"numpy.linspace",
"numpy.empty",
"numpy.min",
"numpy.random.normal",
"numpy.ones",
"psoap.data.Chunk",
"numpy.std",
"numpy.ones_like",
"psoap.data.redshift",
... | [((577, 643), 'numpy.array', 'np.array', (['[2.1, 4.9, 8.0, 9.9, 12.2, 16.0, 16.9, 19.1, 22.3, 26.1]'], {}), '([2.1, 4.9, 8.0, 9.9, 12.2, 16.0, 16.9, 19.1, 22.3, 26.1])\n', (585, 643), True, 'import numpy as np\n'), ((700, 750), 'psoap.orbit.SB2', 'orbit.SB2', (['q', 'K', 'e', 'omega', 'P', 'T0', 'gamma', 'obs_dates'],... |
from __future__ import absolute_import
import logging
import os
import json
from dxlbootstrap.app import Application
from dxlclient.service import ServiceRegistrationInfo
from dxlclient.callbacks import RequestCallback
from dxlclient.message import ErrorResponse, Response
from ._epo import _Epo
# Configure local log... | [
"logging.getLogger",
"dxlclient.service.ServiceRegistrationInfo",
"dxlclient.message.Response",
"os.path.isabs",
"os.access",
"os.path.join",
"os.path.isfile"
] | [((333, 360), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (350, 360), False, 'import logging\n'), ((7824, 7883), 'dxlclient.service.ServiceRegistrationInfo', 'ServiceRegistrationInfo', (['self.client', 'self.DXL_SERVICE_TYPE'], {}), '(self.client, self.DXL_SERVICE_TYPE)\n', (7847, 7883... |
# Copyright (c) 2008-2018 VMware, Inc. 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 applicabl... | [
"alembic.op.get_bind",
"alembic.op.drop_constraint",
"alembic.op.alter_column",
"alembic.op.execute",
"alembic.op.drop_index",
"alembic.op.create_index",
"alembic.op.create_unique_constraint"
] | [((960, 973), 'alembic.op.get_bind', 'op.get_bind', ([], {}), '()\n', (971, 973), False, 'from alembic import op\n'), ((1257, 1343), 'alembic.op.drop_constraint', 'op.drop_constraint', (['"""project_member_ibfk_1"""', '"""project_member"""'], {'type_': '"""foreignkey"""'}), "('project_member_ibfk_1', 'project_member', ... |
from __future__ import print_function
import pandas
import matplotlib; matplotlib.use('Agg')
import sys, os, copy, math, numpy as np, matplotlib.pyplot as plt
from tabulate import tabulate
from munkres import Munkres
from collections import defaultdict
try:
from ordereddict import OrderedDict # can be installed u... | [
"os.path.exists",
"pandas.read_csv",
"mailpy.Mail",
"matplotlib.use",
"sys.exit",
"pandas.DataFrame"
] | [((73, 94), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (87, 94), False, 'import matplotlib\n'), ((1706, 1721), 'mailpy.Mail', 'mailpy.Mail', (['""""""'], {}), "('')\n", (1717, 1721), False, 'import mailpy\n'), ((2308, 2334), 'os.path.exists', 'os.path.exists', (['table_name'], {}), '(table_na... |
import time
from datetime import datetime
from serial import Serial # Library needed to open serial connection
PIN = 'a5'
PORT = 'COM11'
PORT = Serial(port=PORT, baudrate=9600, timeout=0) # Open the Serial port
def encode_command(command):
return bytearray(command, encoding='utf-8')
print('-' * 50)
print('... | [
"datetime.datetime.now",
"serial.Serial",
"time.sleep"
] | [((148, 191), 'serial.Serial', 'Serial', ([], {'port': 'PORT', 'baudrate': '(9600)', 'timeout': '(0)'}), '(port=PORT, baudrate=9600, timeout=0)\n', (154, 191), False, 'from serial import Serial\n'), ((521, 536), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (531, 536), False, 'import time\n'), ((899, 913), 'd... |
#!/usr/bin/env python
#encoding=utf-8
# Copyright (c) 2012 Baidu, Inc. 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
#... | [
"logging.getLogger",
"logging.NullHandler",
"curses.setupterm",
"logging.StreamHandler",
"curses.tigetnum",
"logging.handlers.RotatingFileHandler",
"os.environ.get",
"curses.tparm",
"sys.stderr.isatty",
"logging.Formatter.__init__",
"curses.tigetstr",
"os.path.abspath"
] | [((1443, 1481), 'logging.getLogger', 'logging.getLogger', (['"""com.baidu.bigflow"""'], {}), "('com.baidu.bigflow')\n", (1460, 1481), False, 'import logging\n'), ((9228, 9266), 'os.environ.get', 'os.environ.get', (['"""BIGFLOW_LOG_FILE"""', '""""""'], {}), "('BIGFLOW_LOG_FILE', '')\n", (9242, 9266), False, 'import os\n... |
import json
import yaml
import os
import requests
from git import Repo
### convert device config in json to ansible playbook and run the playbook
PATH_TO_REPO = os.path.expanduser('~') + "/awx-playbooks/"
URL = 'http://10.4.19.251:32121/api/v2/'
USER = 'admin'
PWD = '<PASSWORD>'
### Set proper headers
headers = {"Con... | [
"json.loads",
"requests.post",
"yaml.safe_dump",
"requests.get",
"yaml.safe_load",
"git.Repo",
"os.path.expanduser"
] | [((163, 186), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (181, 186), False, 'import os\n'), ((413, 507), 'requests.post', 'requests.post', (["(URL + 'projects/9/update/')"], {'auth': '(USER, PWD)', 'headers': 'headers', 'verify': '(False)'}), "(URL + 'projects/9/update/', auth=(USER, PWD)... |
import cv2
import sys
import json
from image_encoder.image_encoder import decode
import numpy
import requests
# Get user supplied values
def get_image(fpath):
with open(fpath) as f:
record = [json.loads(line) for line in f]
img = decode(record[0]["image"])
return img
def n_faces(fpath):
cascP... | [
"image_encoder.image_encoder.decode",
"json.loads",
"requests.post",
"numpy.array",
"cv2.cvtColor",
"cv2.CascadeClassifier",
"pika_listener.QueueListener"
] | [((247, 273), 'image_encoder.image_encoder.decode', 'decode', (["record[0]['image']"], {}), "(record[0]['image'])\n", (253, 273), False, 'from image_encoder.image_encoder import decode\n'), ((413, 444), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['cascPath'], {}), '(cascPath)\n', (434, 444), False, 'import cv2\... |
import argparse
from datetime import datetime
import glob
import html
import json
import os
import pytz
import shutil
import sys
import time
from yattag import Doc
# Constants
__SYSTEM__ = "GroupMe"
FONT_URL = "https://fonts.googleapis.com/css?family=Open+Sans"
def css_file():
return """
.message_container ... | [
"pytz.timezone",
"datetime.datetime.fromtimestamp",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.join",
"os.path.realpath",
"os.path.dirname",
"sys.exit",
"json.load",
"yattag.Doc",
"glob.glob"
] | [((3252, 3307), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (["message['created_at']", 'timezone'], {}), "(message['created_at'], timezone)\n", (3274, 3307), False, 'from datetime import datetime\n'), ((3752, 3807), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (["message['created_at']",... |
from slack_sdk import WebClient
from slack_bolt.app.app import SlackAppDevelopmentServer, App
from tests.mock_web_api_server import (
setup_mock_web_api_server,
cleanup_mock_web_api_server,
)
from tests.utils import remove_os_env_temporarily, restore_os_env
class TestDevServer:
signing_secret = "secret"
... | [
"tests.utils.remove_os_env_temporarily",
"tests.mock_web_api_server.cleanup_mock_web_api_server",
"slack_sdk.WebClient",
"tests.mock_web_api_server.setup_mock_web_api_server",
"tests.utils.restore_os_env",
"slack_bolt.app.app.App"
] | [((423, 486), 'slack_sdk.WebClient', 'WebClient', ([], {'token': 'valid_token', 'base_url': 'mock_api_server_base_url'}), '(token=valid_token, base_url=mock_api_server_base_url)\n', (432, 486), False, 'from slack_sdk import WebClient\n'), ((565, 592), 'tests.utils.remove_os_env_temporarily', 'remove_os_env_temporarily'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import optparse
import os
import re
import sys
import vtk
from multiprocessing import Process
import parse_imx
RADIUS = 3 # For Open and Gauss
SCALE = 50.0 # For Rasterization
class RepairMeshParser(optparse.OptionParser):
def __init__(self):
... | [
"vtk.vtkPolyDataToImageStencil",
"multiprocessing.Process",
"vtk.vtkOBJExporter",
"vtk.vtkImageStencil",
"vtk.vtkDecimatePro",
"vtk.vtkVRMLExporter",
"os.remove",
"vtk.vtkVRMLImporter",
"vtk.vtkImageDilateErode3D",
"os.path.isdir",
"vtk.vtkRenderer",
"vtk.vtkMetaImageWriter",
"sys.stdout.flu... | [((1355, 1379), 'vtk.vtkMetaImageWriter', 'vtk.vtkMetaImageWriter', ([], {}), '()\n', (1377, 1379), False, 'import vtk\n'), ((2470, 2501), 'vtk.vtkPolyDataToImageStencil', 'vtk.vtkPolyDataToImageStencil', ([], {}), '()\n', (2499, 2501), False, 'import vtk\n'), ((2841, 2859), 'vtk.vtkImageData', 'vtk.vtkImageData', ([],... |
'''
service.py
ancilla
Created by <NAME> (<EMAIL>) on 01/08/20
Copyright 2019 FrenzyLabs, LLC.
'''
import json
from .base import BaseHandler
import importlib
import socket
from ...data.models import Service
import asyncio
import functools
import requests
class WifiResource(BaseHandler):
def initializ... | [
"asyncio.get_event_loop",
"functools.partial",
"requests.Session",
"requests.Request"
] | [((375, 393), 'requests.Session', 'requests.Session', ([], {}), '()\n', (391, 393), False, 'import requests\n'), ((1304, 1328), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (1326, 1328), False, 'import asyncio\n'), ((1349, 1405), 'functools.partial', 'functools.partial', (['self.session.send', ... |
#!/usr/bin/env python
from holtztools import plots,html
from astropy.io import fits,ascii
import numpy as np
import math
import pdb
import argparse
import os
import matplotlib.pyplot as plt
def throughplot(instrument='apogee-s',outfile=None,inter=False) :
'''
Routine to make zeropoint/throughput plots from ap... | [
"numpy.log10",
"argparse.ArgumentParser",
"numpy.where",
"holtztools.html.htmltab",
"numpy.exp",
"holtztools.plots.multi",
"holtztools.plots.plotc",
"numpy.isfinite",
"os.path.basename",
"pdb.set_trace",
"astropy.io.fits.open",
"astropy.io.ascii.read",
"numpy.arange"
] | [((2788, 2822), 'holtztools.plots.multi', 'plots.multi', (['(2)', '(3)'], {'figsize': '(8, 12)'}), '(2, 3, figsize=(8, 12))\n', (2799, 2822), False, 'from holtztools import plots, html\n'), ((5967, 5984), 'holtztools.plots.multi', 'plots.multi', (['(1)', '(1)'], {}), '(1, 1)\n', (5978, 5984), False, 'from holtztools im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import matplotlib.pyplot as plt
from lorawan_toa import *
def get_line(list_size, n_sf, bw=125):
return [ get_toa(i, n_sf, n_bw=bw)["t_packet"] for i in list_size ]
#########
#
fig = plt.figure(num=None, figsize=(16, ... | [
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show"
] | [((286, 353), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'num': 'None', 'figsize': '(16, 8)', 'facecolor': '"""w"""', 'edgecolor': '"""k"""'}), "(num=None, figsize=(16, 8), facecolor='w', edgecolor='k')\n", (296, 353), True, 'import matplotlib.pyplot as plt\n'), ((1062, 1072), 'matplotlib.pyplot.show', 'plt.show',... |
import tensorflow as tf
if __name__ == "__main__":
with tf.Session() as sess:
game_dir = "Gobang"
model_dir = "model2_10_10_5"
batch = "11000"
# 初始化变量
sess.run(tf.global_variables_initializer())
# 获取最新的checkpoint,其实就是解析了checkpoint文件
latest_ckpt = tf.train.... | [
"tensorflow.graph_util.convert_variables_to_constants",
"tensorflow.Session",
"tensorflow.global_variables_initializer",
"tensorflow.train.import_meta_graph",
"tensorflow.train.write_graph",
"tensorflow.train.latest_checkpoint"
] | [((61, 73), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (71, 73), True, 'import tensorflow as tf\n'), ((311, 387), 'tensorflow.train.latest_checkpoint', 'tf.train.latest_checkpoint', (["('../' + game_dir + '/' + model_dir + '/' + batch)"], {}), "('../' + game_dir + '/' + model_dir + '/' + batch)\n", (337, 387... |
from django.db import connection
from rest_framework.decorators import api_view
from rest_framework.response import Response
@api_view()
def root(request):
return Response({"message": "Hello, from Yappa!",
"next step": "go to the next example: "
"connect you ... | [
"rest_framework.response.Response",
"rest_framework.decorators.api_view"
] | [((128, 138), 'rest_framework.decorators.api_view', 'api_view', ([], {}), '()\n', (136, 138), False, 'from rest_framework.decorators import api_view\n'), ((169, 288), 'rest_framework.response.Response', 'Response', (["{'message': 'Hello, from Yappa!', 'next step':\n 'go to the next example: connect you managed Postg... |
from PyQt4.QtCore import (QAbstractTableModel, QModelIndex, QVariant, Qt,
SIGNAL)
import operator
import logging
from globalvalues.constants.plottingconstants import PlottingConstants
from PyQt4 import QtGui, QtCore
from globalvalues.appsettings import AppSettings
logger = logging.getLogger('console')
class LogL... | [
"logging.getLogger",
"PyQt4.QtCore.QAbstractTableModel.headerData",
"PyQt4.QtGui.QTableWidgetItem",
"PyQt4.QtCore.SIGNAL",
"PyQt4.QtCore.QAbstractTableModel.__init__",
"operator.itemgetter"
] | [((280, 308), 'logging.getLogger', 'logging.getLogger', (['"""console"""'], {}), "('console')\n", (297, 308), False, 'import logging\n'), ((734, 783), 'PyQt4.QtCore.QAbstractTableModel.__init__', 'QAbstractTableModel.__init__', (['self', 'parent', '*args'], {}), '(self, parent, *args)\n', (762, 783), False, 'from PyQt4... |
#
# Copyright SAS Institute
#
# 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... | [
"metakernel.IPythonKernel"
] | [((1563, 1578), 'metakernel.IPythonKernel', 'IPythonKernel', ([], {}), '()\n', (1576, 1578), False, 'from metakernel import IPythonKernel\n')] |
from datetime import date
from models import gtfs, config, util, nextbus, routeconfig
import argparse
import shapely
import partridge as ptg
import numpy as np
from pathlib import Path
import requests
import json
import boto3
import gzip
import hashlib
import math
import zipfile
# Downloads and parses the GTFS specifi... | [
"zipfile.ZipFile",
"models.nextbus.get_route_list",
"shapely.geometry.Point",
"numpy.argsort",
"numpy.array",
"partridge.load_geo_feed",
"argparse.ArgumentParser",
"pathlib.Path",
"json.dumps",
"boto3.resource",
"models.nextbus.get_route_config",
"models.config.get_agency",
"shapely.ops.tran... | [((2964, 2990), 'numpy.argsort', 'np.argsort', (['terminal_dists'], {}), '(terminal_dists)\n', (2974, 2990), True, 'import numpy as np\n'), ((4156, 4216), 'shapely.geometry.Point', 'shapely.geometry.Point', (['shape_lines_xy[best_index].coords[0]'], {}), '(shape_lines_xy[best_index].coords[0])\n', (4178, 4216), False, ... |
"""AVLetters lip dataset.
The original dataset is available from
http://www.ee.surrey.ac.uk/Projects/LILiR/datasets/avletters1/index.html
This dataset consists of three repetitions by each of 10 talkers,
five male (two with moustaches) and five female,
of the isolated letters A-Z, a total of 780 utterances
Refe... | [
"os.path.exists",
"os.listdir",
"scipy.io.loadmat",
"os.path.join",
"os.path.dirname",
"numpy.zeros",
"numpy.empty"
] | [((736, 753), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (743, 753), False, 'from os.path import dirname, exists, isfile, join\n'), ((1790, 1809), 'os.listdir', 'listdir', (['folderpath'], {}), '(folderpath)\n', (1797, 1809), False, 'from os import listdir\n'), ((2113, 2182), 'numpy.empty', 'np.e... |
#
# Copyright 2021 Rovio Entertainment Corporation
#
# 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... | [
"datetime.datetime",
"datetime.datetime.strptime",
"pyspark.sql.types.DoubleType",
"rovio_ingest.extensions.dataframe_extension.add_dataframe_druid_extension",
"test_helper.get_df",
"pyspark.sql.types.IntegerType",
"pyspark.sql.types.StringType",
"pyspark.sql.types.TimestampType",
"pyspark.sql.types... | [((898, 937), 'datetime.datetime.strptime', 'datetime.strptime', (['date_str', '"""%Y-%m-%d"""'], {}), "(date_str, '%Y-%m-%d')\n", (915, 937), False, 'from datetime import datetime\n'), ((995, 1026), 'rovio_ingest.extensions.dataframe_extension.add_dataframe_druid_extension', 'add_dataframe_druid_extension', ([], {}), ... |
#!/usr/bin/env python
#
# Copyright 2021 Espressif Systems (Shanghai) CO LTD
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | [
"os.path.getsize",
"hashlib.md5",
"re.compile",
"tiny_test_fw.Utility.console_log",
"os.path.join",
"ttfw_idf.idf_example_test",
"idf_http_server_test.adder.start_session",
"idf_http_server_test.adder.getreq"
] | [((800, 859), 'ttfw_idf.idf_example_test', 'ttfw_idf.idf_example_test', ([], {'env_tag': '"""Example_WIFI_Protocols"""'}), "(env_tag='Example_WIFI_Protocols')\n", (825, 859), False, 'import ttfw_idf\n'), ((1189, 1242), 'os.path.join', 'os.path.join', (['dut1.app.binary_path', '"""file_server.bin"""'], {}), "(dut1.app.b... |
from flask import Blueprint
needs = Blueprint('needs', __name__)
from . import views
from ..models import Permission
@needs.app_context_processor
def inject_permissions():
return dict(Permission=Permission)
| [
"flask.Blueprint"
] | [((37, 65), 'flask.Blueprint', 'Blueprint', (['"""needs"""', '__name__'], {}), "('needs', __name__)\n", (46, 65), False, 'from flask import Blueprint\n')] |
# -*- coding: utf-8 -*-
from setuptools import setup
try:
with open('requirements.txt') as f:
required = f.read().splitlines()
except:
required = ['requests>=2.7.0', 'pyrestcli>=0.6.4']
try:
with open('test_requirements.txt') as f:
test_required = f.read().splitlines()
except:
pass
se... | [
"setuptools.setup"
] | [((318, 542), 'setuptools.setup', 'setup', ([], {'name': '"""carto"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""SDK around CARTO\'s APIs"""', 'version': '"""1.8.1"""', 'url': '"""https://github.com/CartoDB/carto-python"""', 'install_requires': 'required', 'packages': "['carto']"}),... |
import machine
from machine import Pin, I2C
import googlyscreen, functions
i2c_builtin = I2C(scl=Pin(5), sda=Pin(4), freq=400000) # 5 = D1, 4 = D2
screen = googlyscreen.GooglyScreen(i2c_builtin)
def push_data():
data = screen.environment_data
functions.push_data(data)
def main_loop():
count = 0
... | [
"machine.Pin",
"machine.lightsleep",
"functions.push_data",
"googlyscreen.GooglyScreen"
] | [((159, 197), 'googlyscreen.GooglyScreen', 'googlyscreen.GooglyScreen', (['i2c_builtin'], {}), '(i2c_builtin)\n', (184, 197), False, 'import googlyscreen, functions\n'), ((256, 281), 'functions.push_data', 'functions.push_data', (['data'], {}), '(data)\n', (275, 281), False, 'import googlyscreen, functions\n'), ((99, 1... |
import csv
from collections import deque
from dataclasses import dataclass
from decimal import Decimal
from datetime import date
import io
import itertools
from typing import List, Optional
from dateutil.parser import parse as dateparse
from dateutil.relativedelta import relativedelta
from casparser.exceptions import... | [
"dateutil.parser.parse",
"casparser.exceptions.GainsError",
"collections.deque",
"itertools.groupby",
"dateutil.relativedelta.relativedelta",
"csv.writer",
"datetime.date",
"casparser.exceptions.IncompleteCASError",
"io.StringIO",
"decimal.Decimal"
] | [((2008, 2020), 'decimal.Decimal', 'Decimal', (['(0.0)'], {}), '(0.0)\n', (2015, 2020), False, 'from decimal import Decimal\n'), ((2045, 2057), 'decimal.Decimal', 'Decimal', (['(0.0)'], {}), '(0.0)\n', (2052, 2057), False, 'from decimal import Decimal\n'), ((2088, 2100), 'decimal.Decimal', 'Decimal', (['(0.0)'], {}), '... |
from controller.user import User
from view.console import Console
from model.registry import Registry
def main():
user = User()
registry = Registry()
view = Console(registry)
user.start_app(view)
if __name__ == '__main__':
main()
| [
"view.console.Console",
"controller.user.User",
"model.registry.Registry"
] | [((127, 133), 'controller.user.User', 'User', ([], {}), '()\n', (131, 133), False, 'from controller.user import User\n'), ((149, 159), 'model.registry.Registry', 'Registry', ([], {}), '()\n', (157, 159), False, 'from model.registry import Registry\n'), ((171, 188), 'view.console.Console', 'Console', (['registry'], {}),... |
import requests
import json
from datetime import datetime, timedelta
import pytz
import re
import dateutil.parser
from pprint import pprint
from django.conf import settings
class TwitterPostScraper:
def __init__(self, post_link, resp):
self.resp = resp
self.data = {"link": post_link}
def get... | [
"pytz.timezone"
] | [((786, 815), 'pytz.timezone', 'pytz.timezone', (['"""Asia/Kolkata"""'], {}), "('Asia/Kolkata')\n", (799, 815), False, 'import pytz\n')] |
import yadisk
import sys
import os
def auth():
y = yadisk.YaDisk("7d9ca04e4fe848bbb1d1c6ba4916a5b4", "b7400bc636e144d988e749333afa388b")
url = y.get_code_url()
print("Go to the following url: %s" % url)
code = input("Enter the confirmation code: ")
try:
response = y.get_token(code)
ex... | [
"os.path.dirname",
"yadisk.YaDisk",
"sys.exit"
] | [((57, 146), 'yadisk.YaDisk', 'yadisk.YaDisk', (['"""7d9ca04e4fe848bbb1d1c6ba4916a5b4"""', '"""b7400bc636e144d988e749333afa388b"""'], {}), "('7d9ca04e4fe848bbb1d1c6ba4916a5b4',\n 'b7400bc636e144d988e749333afa388b')\n", (70, 146), False, 'import yadisk\n'), ((557, 582), 'os.path.dirname', 'os.path.dirname', (['__file... |
"""
Created on Sat Oct 30 19:29:30 2021
@author: siddharthvenkatesh
This is a command line interface for scraper1830.
"""
import click
from .scraper1830 import Scraper1830
@click.group()
def cli_entry():
pass
@cli_entry.command()
@click.option(
"--id", prompt="Enter Game ID", help="The id for the 1830 ga... | [
"click.group",
"click.option"
] | [((178, 191), 'click.group', 'click.group', ([], {}), '()\n', (189, 191), False, 'import click\n'), ((242, 338), 'click.option', 'click.option', (['"""--id"""'], {'prompt': '"""Enter Game ID"""', 'help': '"""The id for the 1830 game on 18xx.games"""'}), "('--id', prompt='Enter Game ID', help=\n 'The id for the 1830 ... |
import re, sys, time;
from mWindowsAPI import *;
from mWindowsSDK import *;
from mConsole import oConsole;
def fDumpThreadInfo(oThread, sISA, bDumpContext):
oConsole.fOutput(" * Thread: %s" % (repr(oThread),));
o0TEB = oThread.fo0GetTEB();
if o0TEB:
oConsole.fOutput(" * TEB:");
for sLine in oThread.o... | [
"mConsole.oConsole.fOutput",
"mConsole.oConsole.fStatus",
"time.sleep",
"re.compile"
] | [((2195, 2287), 'mConsole.oConsole.fStatus', 'oConsole.fStatus', (["(' * Calling <cProcess #%X>.faoGetThreads()...' % (oTestProcess.uId,))"], {}), "(' * Calling <cProcess #%X>.faoGetThreads()...' % (\n oTestProcess.uId,))\n", (2211, 2287), False, 'from mConsole import oConsole\n'), ((2572, 2643), 'mConsole.oConsol... |
# Snafu: Snake Functions - OpenShift Executor
import requests
import os
import configparser
import subprocess
container = "jszhaw/snafu"
endpoints = {}
def executecontrol(flaskrequest, tenant):
if not tenant in endpoints:
username = os.getenv("OPENSHIFT_USERNAME")
password = os.getenv("OPENSHIFT_PASSWORD")
p... | [
"requests.post",
"os.getenv"
] | [((1097, 1168), 'requests.post', 'requests.post', (['(endpoint + flaskrequest.path)'], {'data': 'data', 'headers': 'headers'}), '(endpoint + flaskrequest.path, data=data, headers=headers)\n', (1110, 1168), False, 'import requests\n'), ((240, 271), 'os.getenv', 'os.getenv', (['"""OPENSHIFT_USERNAME"""'], {}), "('OPENSHI... |
# Copyright 2019 The Sonnet Authors. 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 applicable l... | [
"tensorflow.unique",
"tensorflow.shape"
] | [((2180, 2198), 'tensorflow.unique', 'tf.unique', (['indices'], {}), '(indices)\n', (2189, 2198), True, 'import tensorflow as tf\n'), ((2322, 2346), 'tensorflow.shape', 'tf.shape', (['unique_indices'], {}), '(unique_indices)\n', (2330, 2346), True, 'import tensorflow as tf\n')] |
from flask_restplus import fields
from apis.v1.v1_api import api
movie_ns = api.namespace('movies', description='Movie Module')
movie = movie_ns.model('Movie', {
'id': fields.Integer(required=True, description='Movie id'),
'99popularity': fields.Float(attribute='ninety_nine_popularity', required=True),
... | [
"flask_restplus.fields.Nested",
"flask_restplus.fields.Integer",
"flask_restplus.fields.String",
"flask_restplus.fields.Float",
"flask_restplus.fields.Boolean",
"apis.v1.v1_api.api.namespace"
] | [((78, 129), 'apis.v1.v1_api.api.namespace', 'api.namespace', (['"""movies"""'], {'description': '"""Movie Module"""'}), "('movies', description='Movie Module')\n", (91, 129), False, 'from apis.v1.v1_api import api\n'), ((176, 229), 'flask_restplus.fields.Integer', 'fields.Integer', ([], {'required': '(True)', 'descrip... |
import logging
from .base import BaseTransaction
logger = logging.getLogger(__name__)
class VoteTransaction(BaseTransaction):
def can_be_applied_to_wallet(self, wallet, wallet_manager, block_height):
vote = self.asset["votes"][0]
if vote.startswith("+"):
if wallet.vote:
... | [
"logging.getLogger"
] | [((60, 87), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (77, 87), False, 'import logging\n')] |
# Copyright 2021 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 agreed to in writing, ... | [
"dataclasses.dataclass"
] | [((707, 741), 'dataclasses.dataclass', 'dataclasses.dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (728, 741), False, 'import dataclasses\n')] |
'''
Create format report from json to html using jinja2
'''
import json
import sys
import argparse
from jinja2 import Template
def get_template(argument: str):
'''
get template content
'''
if argument == '-':
return Template(sys.stdin.read())
return Template(open(argument).read())
def ge... | [
"sys.stdin.read",
"argparse.ArgumentParser"
] | [((549, 574), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (572, 574), False, 'import argparse\n'), ((251, 267), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (265, 267), False, 'import sys\n')] |
# Copyright 2015-2017 FUJITSU 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | [
"networking_fujitsu.ml2.common.utils.get_physical_connectivity",
"networking_fujitsu.ml2.common.utils.get_physical_network",
"networking_fujitsu.ml2.common.utils.is_lag",
"networking_fujitsu.ml2.common.utils.get_segmentation_id",
"networking_fujitsu._i18n._",
"oslo_utils.importutils.import_object",
"neu... | [((1115, 1142), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1132, 1142), True, 'from oslo_log import log as logging\n'), ((2324, 2378), 'oslo_config.cfg.CONF.register_opts', 'cfg.CONF.register_opts', (['ML2_FUJITSU', 'ML2_FUJITSU_GROUP'], {}), '(ML2_FUJITSU, ML2_FUJITSU_GROUP)\n'... |
from __future__ import print_function
from math import log10
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
from dataset import DataSetFromFolder
import torch.cuda
from torch.autograd import Variable
import torch.backends.cudnn as cudnn
import torchvision.utils as... | [
"torchvision.transforms.CenterCrop",
"models.dicriminator_model",
"torchvision.transforms.Scale",
"models.generator_model",
"torchvision.transforms.Normalize",
"torch.cuda.manual_seed",
"torchvision.transforms.ToTensor",
"torch.FloatTensor"
] | [((596, 623), 'torch.cuda.manual_seed', 'torch.cuda.manual_seed', (['(619)'], {}), '(619)\n', (618, 623), False, 'import torch\n'), ((683, 709), 'torchvision.transforms.CenterCrop', 'transforms.CenterCrop', (['(160)'], {}), '(160)\n', (704, 709), False, 'from torchvision import transforms\n'), ((732, 757), 'torchvision... |
import cv2
import numpy as np
img = cv2.imread('../Resources/Photos/park.jpg')
b,g,r = cv2.split(img)
# cv2.imshow('Blue',b)
# cv2.imshow('Green',g)
# cv2.imshow('Red',r)
blank = np.zeros(img.shape[:2],dtype='uint8')
blue = cv2.merge([b,blank,blank])
green = cv2.merge([blank,g,blank])
red = cv2.merge([blank,blank,r]... | [
"cv2.merge",
"cv2.imshow",
"numpy.zeros",
"cv2.waitKey",
"cv2.split",
"cv2.imread"
] | [((37, 79), 'cv2.imread', 'cv2.imread', (['"""../Resources/Photos/park.jpg"""'], {}), "('../Resources/Photos/park.jpg')\n", (47, 79), False, 'import cv2\n'), ((89, 103), 'cv2.split', 'cv2.split', (['img'], {}), '(img)\n', (98, 103), False, 'import cv2\n'), ((182, 220), 'numpy.zeros', 'np.zeros', (['img.shape[:2]'], {'d... |
# encoding: utf-8
"""
@author: ccj
@contact:
"""
import numpy as np
from typing import List, Dict, Tuple, Any
import torch
import torch.nn.functional as F
def crop_white(image: np.ndarray, value: int = 255) -> np.ndarray:
"""
Crop white border from image
:param image: Type: np.ndarray, image to be ... | [
"torch.utils.data.dataloader.default_collate",
"numpy.sqrt",
"torch.stack",
"numpy.zeros",
"torch.nn.functional.one_hot",
"numpy.random.uniform",
"numpy.pad",
"torch.cat"
] | [((1593, 1709), 'numpy.pad', 'np.pad', (['image', '[[pad_h // 2, pad_h - pad_h // 2], [pad_w // 2, pad_w - pad_w // 2], [0, 0]]'], {'constant_values': '(255)'}), '(image, [[pad_h // 2, pad_h - pad_h // 2], [pad_w // 2, pad_w - pad_w //\n 2], [0, 0]], constant_values=255)\n', (1599, 1709), True, 'import numpy as np\n... |
"""
compare_neigh_overlap.py
Plots distributions of Jaccard distances for overlapping ipsilateral
neighborhoods (blue) and homologous contralateral neighborhoods (red)
in the adult and L4.
crated: <NAME>
data: 01 November 2018
"""
import os
from configparser import ConfigParser,ExtendedInterpolation
import argpars... | [
"networks.stats.get_neighborhood_similarity",
"connectome.load.from_db",
"networks.stats.get_neighborhood_overlap_similarity",
"pandas.DataFrame",
"ioaux.read.into_list",
"argparse.ArgumentParser",
"ioaux.read.into_lr_dict",
"configparser.ExtendedInterpolation"
] | [((813, 860), 'networks.stats.get_neighborhood_similarity', 'get_neighborhood_similarity', (['A', 'reflected', 'left'], {}), '(A, reflected, left)\n', (840, 860), False, 'from networks.stats import get_neighborhood_similarity, get_neighborhood_overlap_similarity\n'), ((1015, 1063), 'networks.stats.get_neighborhood_over... |
#%%
import ast
from preprocess import to_n_gram
from grammar_checker import Checker
import pickle
LANGUAGES = ast.literal_eval(open("language_short_names.txt", "r").read())
class Autocorrect:
def __init__(self, language = 'en-US') -> None:
self.language = language
self.tool = self.load_dictionary... | [
"preprocess.to_n_gram",
"grammar_checker.Checker"
] | [((1150, 1172), 'grammar_checker.Checker', 'Checker', (['self.language'], {}), '(self.language)\n', (1157, 1172), False, 'from grammar_checker import Checker\n'), ((687, 715), 'preprocess.to_n_gram', 'to_n_gram', (['self.input_string'], {}), '(self.input_string)\n', (696, 715), False, 'from preprocess import to_n_gram\... |
from struct import pack, unpack, calcsize
from enum import Enum
import logging
START_DELIMITER = 0x7E
class XBeeOutFrame(object):
def __bytes__(self):
raise NotImplementedError("Subclass should implement this method")
@staticmethod
def calc_checksum(partial_frame):
'''
partial_fr... | [
"struct.calcsize",
"binascii.unhexlify",
"struct.pack"
] | [((3644, 3671), 'struct.calcsize', 'calcsize', (['TX_REQ_HEADER_FMT'], {}), '(TX_REQ_HEADER_FMT)\n', (3652, 3671), False, 'from struct import pack, unpack, calcsize\n'), ((4748, 4771), 'struct.calcsize', 'calcsize', (['AT_HEADER_FMT'], {}), '(AT_HEADER_FMT)\n', (4756, 4771), False, 'from struct import pack, unpack, cal... |
#IMPORTACIÓN DE LIBRERIAS
import tensorflow as tf
import os
#QUITAR LOS MENSAJES DE AVISO
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
#CREAR EL MODELO
#Entradas
A = tf.constant([4], tf.int32, name='A')
B = tf.constant([5], tf.int32, name='B')
C = tf.constant([6], tf.int32, name='C')
x = tf.placeholder(tf.int... | [
"tensorflow.pow",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.multiply",
"tensorflow.add_n",
"tensorflow.name_scope",
"tensorflow.constant",
"tensorflow.summary.FileWriter"
] | [((173, 209), 'tensorflow.constant', 'tf.constant', (['[4]', 'tf.int32'], {'name': '"""A"""'}), "([4], tf.int32, name='A')\n", (184, 209), True, 'import tensorflow as tf\n'), ((215, 251), 'tensorflow.constant', 'tf.constant', (['[5]', 'tf.int32'], {'name': '"""B"""'}), "([5], tf.int32, name='B')\n", (226, 251), True, '... |
from ui.config import SITE_CONFIG
from django.contrib.sites.models import Site
def basics(req):
result = SITE_CONFIG
result['domain'] = Site.objects.get_current().domain
return result | [
"django.contrib.sites.models.Site.objects.get_current"
] | [((149, 175), 'django.contrib.sites.models.Site.objects.get_current', 'Site.objects.get_current', ([], {}), '()\n', (173, 175), False, 'from django.contrib.sites.models import Site\n')] |
"""An echo server that has a server thread and a client thread. ONLY 5 CONNECTIONS."""
import threading
import socket
def server() -> None:
"""A server thread that has a server thread"""
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
port = 8007
host = 'localhost'
server_socket... | [
"threading.Thread",
"socket.socket"
] | [((1054, 1085), 'threading.Thread', 'threading.Thread', ([], {'target': 'server'}), '(target=server)\n', (1070, 1085), False, 'import threading\n'), ((1102, 1133), 'threading.Thread', 'threading.Thread', ([], {'target': 'client'}), '(target=client)\n', (1118, 1133), False, 'import threading\n'), ((214, 263), 'socket.so... |
import json
import urllib
import requests
import types
class MovesAPIError(Exception):
"""Raised if the Moves API returns an error."""
pass
class MovesAPINotModifed(Exception):
"""Raised if the document requested is unmodified. Need the use of etag header"""
pass
class MovesClient(object):
"""OA... | [
"json.loads",
"requests.post",
"requests.request",
"requests.get",
"urllib.urlencode",
"types.FunctionType"
] | [((1128, 1153), 'json.loads', 'json.loads', (['response.text'], {}), '(response.text)\n', (1138, 1153), False, 'import json\n'), ((2035, 2079), 'requests.post', 'requests.post', (['self.token_url'], {'params': 'params'}), '(self.token_url, params=params)\n', (2048, 2079), False, 'import requests\n'), ((2099, 2127), 'js... |
# Generated by Django 2.2.10 on 2020-04-09 02:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0007_auto_20200409_0223'),
]
operations = [
migrations.RenameField(
model_name='game',
old_name='active_gue... | [
"django.db.migrations.RemoveField",
"django.db.migrations.RenameField",
"django.db.models.IntegerField"
] | [((233, 332), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""game"""', 'old_name': '"""active_guessing"""', 'new_name': '"""is_live_round"""'}), "(model_name='game', old_name='active_guessing',\n new_name='is_live_round')\n", (255, 332), False, 'from django.db import migrations... |
import pickle
import numpy as np
import scipy.linalg as sci
from scipy import signal
# Rotations
def wrap2Pi(x):
xm = np.mod(x+np.pi,(2.0*np.pi))
return xm-np.pi
def Rot(x):
return np.array([[np.cos(x),-np.sin(x)],[np.sin(x),np.cos(x)]])
def RotVec(x_vec, rot_vec):
rvec = np.array([np.dot(x_vec[i,:-1],Rot(rot_ve... | [
"numpy.hstack",
"scipy.signal.filtfilt",
"numpy.log",
"numpy.sin",
"numpy.cov",
"numpy.mod",
"numpy.arange",
"numpy.divide",
"numpy.mean",
"numpy.vstack",
"numpy.abs",
"numpy.ones",
"pickle.load",
"numpy.cos",
"numpy.shape",
"numpy.copy",
"pickle.dump",
"scipy.signal.butter",
"nu... | [((120, 150), 'numpy.mod', 'np.mod', (['(x + np.pi)', '(2.0 * np.pi)'], {}), '(x + np.pi, 2.0 * np.pi)\n', (126, 150), True, 'import numpy as np\n'), ((545, 571), 'numpy.divide', 'np.divide', (['(x - x[0])', 't_vec'], {}), '(x - x[0], t_vec)\n', (554, 571), True, 'import numpy as np\n'), ((730, 743), 'numpy.cov', 'np.c... |
import pytest
from time_manager.schemas.user import (
UserBase,
UserCredentials,
UserDB,
UserDBBase,
validate_username,
)
@pytest.mark.parametrize(
"username,should_raise",
[
("", True),
(" ", True),
(" -", True),
("- ", True),
("-a", True),
... | [
"time_manager.schemas.user.UserCredentials",
"time_manager.schemas.user.UserBase",
"time_manager.schemas.user.UserDB",
"pytest.mark.parametrize",
"pytest.raises",
"time_manager.schemas.user.UserDBBase",
"time_manager.schemas.user.validate_username"
] | [((146, 358), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""username,should_raise"""', "[('', True), (' ', True), (' -', True), ('- ', True), ('-a', True), ('a ', \n True), ('a', False), ('a!@#$%^&*()_12qw', False), ('a !@#$%^&*()_12qw',\n True)]"], {}), "('username,should_raise', [('', True), (' ',... |
"""
Make a learning curve for the full neural net trained on all 30 output
measures. The point of this graph is to investigate how much training data
is needed to achieve various MSE values.
"""
import matplotlib.pyplot as plt
import numpy as np
import cPickle as pickle
import lasagne
from lasagne import layers
from ... | [
"numpy.mean",
"cPickle.dump",
"lignet_utils.gen_train_test",
"lasagne.nonlinearities.ScaledTanH",
"numpy.std",
"nolearn.lasagne.TrainSplit"
] | [((593, 609), 'lignet_utils.gen_train_test', 'gen_train_test', ([], {}), '()\n', (607, 609), False, 'from lignet_utils import gen_train_test\n'), ((764, 810), 'lasagne.nonlinearities.ScaledTanH', 'ScaledTanH', ([], {'scale_in': '(2.0 / 3)', 'scale_out': '(1.7159)'}), '(scale_in=2.0 / 3, scale_out=1.7159)\n', (774, 810)... |
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import re
import sys
def _GetTelemetryPath(input_api):
return os.path.join(
os.path.dirname(os.path.dirname(os.path.dirname(os.path.di... | [
"telemetry.util.cloud_storage.ReadHash",
"os.path.splitext",
"telemetry.util.cloud_storage.List"
] | [((1429, 1476), 'telemetry.util.cloud_storage.List', 'cloud_storage.List', (['cloud_storage.PUBLIC_BUCKET'], {}), '(cloud_storage.PUBLIC_BUCKET)\n', (1447, 1476), False, 'from telemetry.util import cloud_storage\n'), ((1160, 1187), 'os.path.splitext', 'os.path.splitext', (['hash_path'], {}), '(hash_path)\n', (1176, 118... |
from flask import render_template, flash, redirect, url_for
from app import flask_app
from app.forms import LoginForm
from flask_login import current_user, login_user
from app.models import User
from flask_login import logout_user
from flask_login import login_required
from flask import request
from werkzeug.urls impor... | [
"app.flask_app.route",
"flask.render_template",
"app.forms.RegistrationForm",
"flask.request.args.get",
"app.forms.LoginForm",
"app.db.session.commit",
"flask.flash",
"werkzeug.urls.url_parse",
"flask_login.login_user",
"flask_login.logout_user",
"app.models.User",
"flask.url_for",
"flask.re... | [((392, 412), 'app.flask_app.route', 'flask_app.route', (['"""/"""'], {}), "('/')\n", (407, 412), False, 'from app import flask_app\n'), ((414, 439), 'app.flask_app.route', 'flask_app.route', (['"""/index"""'], {}), "('/index')\n", (429, 439), False, 'from app import flask_app\n'), ((833, 883), 'app.flask_app.route', '... |
from pysmt.shortcuts import Symbol
from pysmt.typing import INT
h = Symbol("H", INT)
domain = (1 <= h) & (10 >= h)
| [
"pysmt.shortcuts.Symbol"
] | [((69, 85), 'pysmt.shortcuts.Symbol', 'Symbol', (['"""H"""', 'INT'], {}), "('H', INT)\n", (75, 85), False, 'from pysmt.shortcuts import Symbol\n')] |
# vim: sw=4:ts=4:et
from flask import Blueprint
main = Blueprint('main', __name__)
from . import views, errors
| [
"flask.Blueprint"
] | [((55, 82), 'flask.Blueprint', 'Blueprint', (['"""main"""', '__name__'], {}), "('main', __name__)\n", (64, 82), False, 'from flask import Blueprint\n')] |
from PyQt5.QtWidgets import QMainWindow
from Controller.venda import VendaTemp
from Funcoes.utils import data_hora_atual
from Model.Compra_Itens import Compra_Itens
from Model.Compra_Fin import Compra_Fin
from Model.Compra_Header import Compras_Header
from Model.Compra_Tmp import Compra_Tmp
from Model.Fornecedor import... | [
"Funcoes.utils.exec_app",
"Model.Compra_Itens.Compra_Itens.inserir_compra",
"PyQt5.QtGui.QIcon",
"Model.Venda_Fin.Venda_Fin",
"Model.Venda_Tmp.Venda_Tmp.qtd_itens",
"Model.Venda_Tmp.Venda_Tmp.retorna_total",
"Model.Compra_Tmp.Compra_Tmp.delete_compra",
"PyQt5.QtWidgets.QMessageBox.question",
"PyQt5.... | [((645, 682), 'PyQt5.QtCore.QObject.__init__', 'QtCore.QObject.__init__', (['self', 'parent'], {}), '(self, parent)\n', (668, 682), False, 'from PyQt5 import QtGui, QtCore\n'), ((926, 970), 'PyQt5.QtCore.QObject.eventFilter', 'QtCore.QObject.eventFilter', (['self', 'obj', 'event'], {}), '(self, obj, event)\n', (952, 97... |
from django.urls import reverse
from rest_framework import status
from rest_framework.test import force_authenticate
from core.models import UserModel
from recycle import garbage
from recycle.models import CommercialRequest, Location
from recycle.views.commercial_order import EditCommercialOrderAPIView
from tests.unit... | [
"recycle.views.commercial_order.EditCommercialOrderAPIView.as_view",
"recycle.models.CommercialRequest.objects.get",
"core.models.UserModel.objects.get",
"recycle.models.Location.objects.get",
"django.urls.reverse",
"rest_framework.test.force_authenticate"
] | [((534, 572), 'core.models.UserModel.objects.get', 'UserModel.objects.get', ([], {'username': '"""User"""'}), "(username='User')\n", (555, 572), False, 'from core.models import UserModel\n'), ((593, 636), 'core.models.UserModel.objects.get', 'UserModel.objects.get', ([], {'username': '"""SuperUser"""'}), "(username='Su... |
import numpy, copy
from numpy import nan
from PyQt5.QtGui import QPalette, QColor, QFont
from PyQt5.QtWidgets import QMessageBox
from orangewidget import gui
from orangewidget import widget
from orangewidget.settings import Setting
from oasys.widgets import gui as oasysgui
from oasys.widgets import congruence
from oa... | [
"oasys.widgets.gui.widgetBox",
"oasys.widgets.gui.createTabPage",
"PyQt5.QtGui.QColor",
"oasys.util.oasys_util.read_surface_file",
"oasys.widgets.gui.tabWidget",
"copy.deepcopy",
"orangewidget.settings.Setting",
"wofrysrw.propagator.wavefront2D.srw_wavefront.SRWWavefront.fromGenericWavefront",
"oasy... | [((2028, 2039), 'orangewidget.settings.Setting', 'Setting', (['[]'], {}), '([])\n', (2035, 2039), False, 'from orangewidget.settings import Setting\n'), ((2065, 2077), 'orangewidget.settings.Setting', 'Setting', (['(1.0)'], {}), '(1.0)\n', (2072, 2077), False, 'from orangewidget.settings import Setting\n'), ((2213, 225... |
# Pi_ReportHumidity.py
#
# Created: Jan 10, 2016 by <NAME>
#
# Simple script to read humidity on RPi
import time
from sense_hat import SenseHat
sense = SenseHat()
#humidity = sense.get_humidity()
#print("Humidity: %s %%rH" % humidity)
# alternatives
#print(sense.humidity)
# continue to print humidity reading every ... | [
"sense_hat.SenseHat",
"time.sleep"
] | [((154, 164), 'sense_hat.SenseHat', 'SenseHat', ([], {}), '()\n', (162, 164), False, 'from sense_hat import SenseHat\n'), ((449, 462), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (459, 462), False, 'import time\n')] |
from django import template
from django.template.defaultfilters import stringfilter
from django.conf import settings
from urlparse import urlparse
register = template.Library()
@register.filter(is_safe=True)
@stringfilter
def xml_escape(string):
"""Replaces all unescaped xml characters"""
return string.repla... | [
"django.template.Library",
"urlparse.urlparse"
] | [((160, 178), 'django.template.Library', 'template.Library', ([], {}), '()\n', (176, 178), False, 'from django import template\n'), ((564, 577), 'urlparse.urlparse', 'urlparse', (['url'], {}), '(url)\n', (572, 577), False, 'from urlparse import urlparse\n')] |
import numpy as np
import torch
from matplotlib import pyplot as plt
from scipy.spatial.distance import directed_hausdorff
from numpy import linalg as LA
from sklearn import metrics
def get_roc_auc(target, prediction):
y_true = target.view(-1).numpy()
y_score = prediction.view(-1).cpu().detach().numpy()
... | [
"scipy.spatial.distance.directed_hausdorff",
"numpy.arange",
"numpy.where",
"sklearn.metrics.auc",
"sklearn.metrics.precision_recall_curve",
"sklearn.metrics.roc_auc_score",
"numpy.array",
"matplotlib.pyplot.figure",
"torch.sum",
"numpy.linalg.norm",
"numpy.save"
] | [((336, 374), 'sklearn.metrics.roc_auc_score', 'metrics.roc_auc_score', (['y_true', 'y_score'], {}), '(y_true, y_score)\n', (357, 374), False, 'from sklearn import metrics\n'), ((574, 621), 'sklearn.metrics.precision_recall_curve', 'metrics.precision_recall_curve', (['y_true', 'y_score'], {}), '(y_true, y_score)\n', (6... |
from server import Server
import os
def file_exists(server, name):
out, _ = server.run("ls")
print(out)
files = out.strip().split("\n")
print(files)
return name in files
if __name__ == "__main__":
server = Server(host = "192.168.3.11", user="ubuntu", key_filename="/Users/greg/.ssh/lightsail-oh... | [
"server.Server"
] | [((232, 335), 'server.Server', 'Server', ([], {'host': '"""192.168.3.11"""', 'user': '"""ubuntu"""', 'key_filename': '"""/Users/greg/.ssh/lightsail-ohio-gsd.pem"""'}), "(host='192.168.3.11', user='ubuntu', key_filename=\n '/Users/greg/.ssh/lightsail-ohio-gsd.pem')\n", (238, 335), False, 'from server import Server\n'... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from textw... | [
"pants.build_graph.build_file_address_mapper.BuildFileAddressMapper.EmptyBuildFileError",
"textwrap.dedent",
"pants.build_graph.build_file_address_mapper.BuildFileAddressMapper.InvalidBuildFileReference",
"pants.build_graph.build_file_address_mapper.BuildFileAddressMapper.BuildFileScanError",
"pants.build_g... | [((3114, 3153), 'os.path.join', 'os.path.join', (['self.build_root', '"""subdir"""'], {}), "(self.build_root, 'subdir')\n", (3126, 3153), False, 'import os\n'), ((4162, 4183), 'pants.build_graph.address.Address.parse', 'Address.parse', (['""":bar"""'], {}), "(':bar')\n", (4175, 4183), False, 'from pants.build_graph.add... |
from __future__ import absolute_import
__author__ = '<NAME>'
import time
import struct
try:
from pebble import pulse2
except ImportError:
pass
from . import BaseTransport, MessageTargetWatch
from libpebble2.exceptions import ConnectionError, PebbleError
class PULSETransport(BaseTransport):
"""
Repr... | [
"struct.unpack",
"time.time",
"libpebble2.exceptions.ConnectionError"
] | [((1298, 1309), 'time.time', 'time.time', ([], {}), '()\n', (1307, 1309), False, 'import time\n'), ((1168, 1217), 'libpebble2.exceptions.ConnectionError', 'ConnectionError', (['"""Failed to open PPoPULSE socket"""'], {}), "('Failed to open PPoPULSE socket')\n", (1183, 1217), False, 'from libpebble2.exceptions import Co... |
# -*- coding: utf-8 -*-
import cx_Oracle
import re
from collections import namedtuple
from .base import (SynDataDriver)
import logging
log = logging.getLogger(__name__)
# RE_CONN_TEMPLATE = re.compile(r"(?:(?P<user>[^/]*)/(?P<password>[^@]*)@//)?(?P<host>[^:^/]*)(?::(?P<port>[^/|^?]*))?(?:/(?P<path>.*))?")
RE_CONN_... | [
"logging.getLogger",
"cx_Oracle.connect",
"collections.namedtuple",
"re.compile"
] | [((144, 171), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (161, 171), False, 'import logging\n'), ((331, 399), 're.compile', 're.compile', (['"""(?:(?P<user>[^/]*)/(?P<password>[^@]*)@//)?(?P<dsn>.*)"""'], {}), "('(?:(?P<user>[^/]*)/(?P<password>[^@]*)@//)?(?P<dsn>.*)')\n", (341, 399),... |
from logging.handlers import SysLogHandler
from logging import LogRecord
import json
class SyslogLoggerMsgOnlyFormatter(object):
def format(self, record):
return record.msg['event']
class SyslogLoggerJSONFormatter(object):
def format(self, record):
return json.dumps(record.msg)
class Sys... | [
"json.dumps",
"logging.handlers.SysLogHandler"
] | [((286, 308), 'json.dumps', 'json.dumps', (['record.msg'], {}), '(record.msg)\n', (296, 308), False, 'import json\n'), ((445, 467), 'logging.handlers.SysLogHandler', 'SysLogHandler', (['address'], {}), '(address)\n', (458, 467), False, 'from logging.handlers import SysLogHandler\n')] |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"azure.cli.core.azclierror.ArgumentUsageError",
"azure.cli.core.azclierror.InvalidArgumentValueError",
"azure.graphrbac.models.GetObjectsParameters",
"uuid.uuid4",
"azure.cli.core.util.is_guid",
"knack.util.CLIError"
] | [((9531, 9544), 'azure.cli.core.util.is_guid', 'is_guid', (['role'], {}), '(role)\n', (9538, 9544), False, 'from azure.cli.core.util import is_guid\n'), ((10037, 10049), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (10047, 10049), False, 'import uuid\n'), ((1025, 1110), 'azure.cli.core.azclierror.ArgumentUsageError', ... |
# -*- encoding: utf-8 -*-
"""
@Author : zYx.Tom
@Contact : <EMAIL>
@site : https://zhuyuanxiang.github.io
---------------------------
@Software : PyCharm
@Project : tensorflow_cookbook
@File : C0707_Doc2Vec.py
@Version : v0.1
@Time : 2019-12-06 17:12
@License : ... | [
"numpy.sqrt",
"tensorflow.python.framework.ops.reset_default_graph",
"matplotlib.pyplot.ylabel",
"text_tools.generate_batch_data",
"text_tools.text_to_numbers",
"numpy.array",
"tensorflow.reduce_mean",
"text_tools.build_dictionary",
"tensorflow.set_random_seed",
"tensorflow.cast",
"tensorflow.sl... | [((1086, 1171), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(8)', 'suppress': '(True)', 'threshold': 'np.inf', 'linewidth': '(200)'}), '(precision=8, suppress=True, threshold=np.inf, linewidth=200\n )\n', (1105, 1171), True, 'import numpy as np\n'), ((1219, 1239), 'numpy.random.seed', 'np.ra... |
# Copyright 2020 The TensorFlow Authors. 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 applica... | [
"tensorflow.python.framework.ops.RegisterGradient",
"tensorflow.python.ops.nn_grad._DepthwiseConv2dNativeGrad",
"tensorflow.python.ops.nn_grad._DepthwiseConv2dNativeBackpropFilterGrad",
"tensorflow.python.ops.nn_grad._Conv2DBackpropFilterGrad",
"tensorflow.python.ops.nn_grad._Conv2DBackpropInputGrad",
"te... | [((2170, 2206), 'tensorflow.python.framework.ops.RegisterGradient', 'ops.RegisterGradient', (['"""CustomConv2D"""'], {}), "('CustomConv2D')\n", (2190, 2206), False, 'from tensorflow.python.framework import ops\n'), ((2421, 2470), 'tensorflow.python.framework.ops.RegisterGradient', 'ops.RegisterGradient', (['"""CustomCo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import torch
import numpy as np
from utils import Generator
import matplotlib.pyplot as plt
from IPython.display import HTML
import torchvision.utils as vutils
import matplotlib.animation as animation
from IPython import embed
if __name__ == "__main__":
... | [
"utils.Generator",
"matplotlib.pyplot.title",
"IPython.embed",
"torch.nn.DataParallel",
"os.path.join",
"matplotlib.animation.ArtistAnimation",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.axis",
"numpy.transpose",
"matplotlib.pyplot.subplot",
"torch.randn",
"matplotlib.pyplot.show"
] | [((495, 546), 'torch.nn.DataParallel', 'torch.nn.DataParallel', (['generator'], {'device_ids': '[0, 1]'}), '(generator, device_ids=[0, 1])\n', (516, 546), False, 'import torch\n'), ((968, 994), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 8)'}), '(figsize=(8, 8))\n', (978, 994), True, 'import matplot... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib.colors import ListedColormap
from . import common
def v_loc(x):
return 40*np.log10(x + 1)
def x_loc(x):
return 40*(np.log10(x) + 1)
def main(debug=False):
name = ['I', 'SCA', 'tfp']
suffi... | [
"matplotlib.pyplot.setp",
"numpy.log10",
"pandas.read_csv",
"seaborn.heatmap",
"matplotlib.colors.ListedColormap",
"seaborn.boxenplot",
"pandas.concat"
] | [((744, 765), 'pandas.concat', 'pd.concat', (['df'], {'axis': '(1)'}), '(df, axis=1)\n', (753, 765), True, 'import pandas as pd\n'), ((1477, 1520), 'matplotlib.colors.ListedColormap', 'ListedColormap', (["['silver', 'grey', 'black']"], {}), "(['silver', 'grey', 'black'])\n", (1491, 1520), False, 'from matplotlib.colors... |
import pytest
from asynctb._registry import HANDLING_FOR_CODE
from asynctb._glue import ensure_installed
@pytest.fixture
def local_registry():
ensure_installed()
prev_contents = list(HANDLING_FOR_CODE.items())
yield
HANDLING_FOR_CODE.clear()
HANDLING_FOR_CODE.update(prev_contents)
@pytest.fixtur... | [
"asynctb._registry.HANDLING_FOR_CODE.update",
"asynctb._registry.HANDLING_FOR_CODE.clear",
"asynctb._glue.ensure_installed",
"asynctb._registry.HANDLING_FOR_CODE.items"
] | [((149, 167), 'asynctb._glue.ensure_installed', 'ensure_installed', ([], {}), '()\n', (165, 167), False, 'from asynctb._glue import ensure_installed\n'), ((234, 259), 'asynctb._registry.HANDLING_FOR_CODE.clear', 'HANDLING_FOR_CODE.clear', ([], {}), '()\n', (257, 259), False, 'from asynctb._registry import HANDLING_FOR_... |
import os
from pathlib import Path
import sys
from subprocess import run, PIPE
from typing import Optional, Sequence, Iterable, List
import importlib
import traceback
from . import LazyLogger
log = LazyLogger("HPI cli")
import functools
@functools.lru_cache()
def mypy_cmd() -> Optional[Sequence[str]]:
try:
... | [
"tempfile.TemporaryDirectory",
"importlib.import_module",
"argparse.ArgumentParser",
"pathlib.Path",
"shutil.which",
"subprocess.run",
"traceback.format_exception",
"sys.exit",
"functools.lru_cache"
] | [((244, 265), 'functools.lru_cache', 'functools.lru_cache', ([], {}), '()\n', (263, 265), False, 'import functools\n'), ((525, 545), 'shutil.which', 'shutil.which', (['"""mypy"""'], {}), "('mypy')\n", (537, 545), False, 'import shutil\n'), ((1219, 1417), 'subprocess.run', 'run', (["[*cmd, '--namespace-packages', '--col... |
import symjax
import symjax.tensor as T
import matplotlib.pyplot as plt
import numpy as np
J = 5
Q = 4
scales = T.power(2, T.linspace(0.1, J - 1, J * Q))
scales = scales[:, None]
print(scales.get())
wavelet = symjax.tensor.signal.complex_morlet(5 * scales, np.pi / scales)
waveletw = symjax.tensor.signal.fourier_comp... | [
"numpy.abs",
"matplotlib.pyplot.savefig",
"symjax.tensor.linspace",
"symjax.tensor.signal.littewood_paley_normalization",
"symjax.tensor.signal.complex_morlet",
"matplotlib.pyplot.plot",
"numpy.fft.ifft",
"numpy.fft.ifftshift",
"matplotlib.pyplot.subplot",
"symjax.tensor.signal.fourier_complex_mor... | [((212, 275), 'symjax.tensor.signal.complex_morlet', 'symjax.tensor.signal.complex_morlet', (['(5 * scales)', '(np.pi / scales)'], {}), '(5 * scales, np.pi / scales)\n', (247, 275), False, 'import symjax\n'), ((287, 381), 'symjax.tensor.signal.fourier_complex_morlet', 'symjax.tensor.signal.fourier_complex_morlet', (['(... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
class MatplotlibWidget(FigureC... | [
"matplotlib.pyplot.close"
] | [((619, 638), 'matplotlib.pyplot.close', 'plt.close', (['self.fig'], {}), '(self.fig)\n', (628, 638), True, 'import matplotlib.pyplot as plt\n')] |
# -*- coding: utf-8 -*-
from cms.utils.i18n import get_default_language
from django.conf import settings
from django.core.urlresolvers import reverse
from django.middleware.locale import LocaleMiddleware
from django.utils import translation
import re
import urllib
class DummyMultilingualURLMiddleware(object):... | [
"django.utils.translation.activate"
] | [((512, 542), 'django.utils.translation.activate', 'translation.activate', (['language'], {}), '(language)\n', (532, 542), False, 'from django.utils import translation\n')] |
"""Publication model."""
# Django
from django.db import models
# Utilities
from apartacho.utils.models import ApartachoModel
from apartacho.properties.models import Property
from apartacho.users.models import User
class Publication(ApartachoModel):
"""Publication model."""
is_published = models.BooleanFiel... | [
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((302, 426), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'verbose_name': '"""published"""', 'default': '(False)', 'help_text': '"""Set to true when the publication is published"""'}), "(verbose_name='published', default=False, help_text=\n 'Set to true when the publication is published')\n", (321,... |
from sqlalchemy import Column, String
from app.api.database.models import Base
def make_subscriber_table(name: str) -> type:
"""
Return a new SQLAlchemy Table object representing the lichess - twitch pairs for a certain user.
"""
class Pair(Base):
__tablename__ = name
__table_args__ = ... | [
"sqlalchemy.String"
] | [((371, 381), 'sqlalchemy.String', 'String', (['(25)'], {}), '(25)\n', (377, 381), False, 'from sqlalchemy import Column, String\n'), ((426, 436), 'sqlalchemy.String', 'String', (['(20)'], {}), '(20)\n', (432, 436), False, 'from sqlalchemy import Column, String\n')] |
# coding: utf-8
import asyncio
from concurrent.futures._base import CancelledError
import json
import typing
import aiohttp
from aiohttp import web
from aiohttp.web_request import Request
from rolling.exception import DisconnectClient
from rolling.exception import UnableToProcessEvent
from rolling.exception import Un... | [
"json.loads",
"rolling.log.server_logger.warning",
"rolling.model.event.ZoneEventType",
"rolling.model.serializer.ZoneEventSerializerFactory",
"rolling.log.server_logger.debug",
"rolling.server.zone.event.EventProcessorFactory",
"rolling.log.server_logger.info",
"asyncio.get_event_loop",
"rolling.mo... | [((937, 972), 'rolling.server.zone.event.EventProcessorFactory', 'EventProcessorFactory', (['kernel', 'self'], {}), '(kernel, self)\n', (958, 972), False, 'from rolling.server.zone.event import EventProcessorFactory\n'), ((1014, 1042), 'rolling.model.serializer.ZoneEventSerializerFactory', 'ZoneEventSerializerFactory',... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from contentos_sdk.key_store import KeyStore
def test_key_store():
key_store = KeyStore()
key_store.add_key("account1", "key1")
key_store.add_key("account2", "key2")
assert key_store.get_key("account1") == "key1"
assert key_store.get_accounts() == ["... | [
"contentos_sdk.key_store.KeyStore"
] | [((133, 143), 'contentos_sdk.key_store.KeyStore', 'KeyStore', ([], {}), '()\n', (141, 143), False, 'from contentos_sdk.key_store import KeyStore\n'), ((451, 461), 'contentos_sdk.key_store.KeyStore', 'KeyStore', ([], {}), '()\n', (459, 461), False, 'from contentos_sdk.key_store import KeyStore\n')] |
'''
Authors: <NAME>, <NAME>, <NAME>
'''
# FIXME Behebe möglichen fehler mit Flask:
# https://github.com/flask-restful/flask-restful/pull/913
# import flask.scaffold
# flask.helpers._endpoint_from_view_func = flask.scaffold._endpoint_from_view_funcfrom flask import Flask, request, make_response
from flask import Flask,... | [
"flask_cors.CORS",
"flask.Flask",
"flask.request.get_data",
"os.environ.get",
"dotenv.load_dotenv",
"flask.request.get_json"
] | [((469, 484), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (474, 484), False, 'from flask import Flask, request, make_response\n'), ((485, 521), 'flask_cors.CORS', 'CORS', (['app'], {'supports_credentials': '(True)'}), '(app, supports_credentials=True)\n', (489, 521), False, 'from flask_cors import CORS\... |