code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import magma as m
from magma.testing.utils import has_warning, has_error
def _check_foo_interface(Foo):
assert list(Foo.interface.ports.keys()) == ["I", "O"]
assert isinstance(Foo.interface.ports["I"], m.Bit)
assert Foo.interface.ports["I"].is_output()
assert isinstance(Foo.interface.ports["O"], m.Bit... | [
"magma.testing.utils.has_warning",
"magma.In",
"magma.testing.utils.has_error",
"magma.Out",
"magma.isdefinition",
"magma.wire"
] | [((545, 565), 'magma.isdefinition', 'm.isdefinition', (['_Foo'], {}), '(_Foo)\n', (559, 565), True, 'import magma as m\n'), ((1533, 1562), 'magma.testing.utils.has_warning', 'has_warning', (['caplog', 'expected'], {}), '(caplog, expected)\n', (1544, 1562), False, 'from magma.testing.utils import has_warning, has_error\... |
import os
import sys
from plistlib import Plist
from . import __version__ as bdist_mpkg_version
from . import tools
from .py3k import unicode, u, any_str_type
def _major_minor(v):
rval = [0, 0]
try:
for i, rev in enumerate(v.version):
rval[i] = int(rev)
except (TypeError, ValueError, I... | [
"os.path.realpath",
"os.path.dirname",
"plistlib.Plist"
] | [((2643, 2667), 'os.path.realpath', 'os.path.realpath', (['prefix'], {}), '(prefix)\n', (2659, 2667), False, 'import os\n'), ((4385, 4392), 'plistlib.Plist', 'Plist', ([], {}), '()\n', (4390, 4392), False, 'from plistlib import Plist\n'), ((2701, 2724), 'os.path.dirname', 'os.path.dirname', (['prefix'], {}), '(prefix)\... |
__author__ = '<NAME>'
__website__ = 'https://www.iabdullahmughal.com'
__twitter__ = '@iabdullahmughal'
from flask import Flask
from view.ui import index_page
from view.ui import analysis_report
from view.ui import project_settings
from view.ajax.upload_samples import ajax_sample_upload
from view.ajax.load_reports im... | [
"flask.Flask"
] | [((400, 415), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (405, 415), False, 'from flask import Flask\n')] |
import torch
import pdb
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import pdb
class LinearNorm(torch.nn.Module):
def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'):
super(LinearNorm, self).__init__()
self.linear_layer = torch.nn.Linear(in_dim, out_dim... | [
"torch.nn.ModuleList",
"torch.nn.LSTM",
"torch.nn.BatchNorm1d",
"torch.nn.Linear",
"torch.nn.init.calculate_gain",
"torch.nn.Conv1d",
"torch.cat"
] | [((289, 332), 'torch.nn.Linear', 'torch.nn.Linear', (['in_dim', 'out_dim'], {'bias': 'bias'}), '(in_dim, out_dim, bias=bias)\n', (304, 332), False, 'import torch\n'), ((911, 1045), 'torch.nn.Conv1d', 'torch.nn.Conv1d', (['in_channels', 'out_channels'], {'kernel_size': 'kernel_size', 'stride': 'stride', 'padding': 'padd... |
from lib import InputTransport
from lib import Parser
from lib import Interpolator
class Program:
def __init__(self):
self.transport = InputTransport()
self.parser = Parser()
self.interpolator = Interpolator()
def run(self):
try:
input = self.transport.read()
... | [
"lib.InputTransport",
"lib.Parser",
"lib.Interpolator"
] | [((148, 164), 'lib.InputTransport', 'InputTransport', ([], {}), '()\n', (162, 164), False, 'from lib import InputTransport\n'), ((187, 195), 'lib.Parser', 'Parser', ([], {}), '()\n', (193, 195), False, 'from lib import Parser\n'), ((224, 238), 'lib.Interpolator', 'Interpolator', ([], {}), '()\n', (236, 238), False, 'fr... |
from helpers import render_frames
from graphs.ForwardRendering import ForwardRendering as g
from falcor import *
g.unmarkOutput("ForwardLightingPass.motionVecs")
m.addGraph(g)
m.loadScene("grey_and_white_room/grey_and_white_room.fbx")
ctx = locals()
# default
render_frames(ctx, 'default', frames=[1,16,64,128,256])
e... | [
"graphs.ForwardRendering.ForwardRendering.unmarkOutput",
"helpers.render_frames"
] | [((114, 162), 'graphs.ForwardRendering.ForwardRendering.unmarkOutput', 'g.unmarkOutput', (['"""ForwardLightingPass.motionVecs"""'], {}), "('ForwardLightingPass.motionVecs')\n", (128, 162), True, 'from graphs.ForwardRendering import ForwardRendering as g\n'), ((262, 321), 'helpers.render_frames', 'render_frames', (['ctx... |
import pygame
import constants
import re, random
from game.bullet import Bullet
frame_regex = re.compile(r'^\d*[0-4]$')
class Plane(pygame.sprite.Sprite):
# 飞机的绘制图片列表
plane_imgs = []
# 飞机毁灭时用来绘制的图片
destory_imgs = []
# 飞机毁灭时的音乐
destory_sound = None
# 飞机当前的状态
active = True
# 飞机的子弹组
... | [
"pygame.sprite.spritecollide",
"re.compile",
"pygame.sprite.Group",
"pygame.mixer.Sound",
"game.bullet.Bullet",
"pygame.image.load",
"random.randint"
] | [((95, 120), 're.compile', 're.compile', (['"""^\\\\d*[0-4]$"""'], {}), "('^\\\\d*[0-4]$')\n", (105, 120), False, 'import re, random\n'), ((333, 354), 'pygame.sprite.Group', 'pygame.sprite.Group', ([], {}), '()\n', (352, 354), False, 'import pygame\n'), ((1870, 1895), 'game.bullet.Bullet', 'Bullet', (['self.screen', 's... |
# look for arcpy access, otherwise use open source version
from __future__ import print_function
import sqlite3
import base64
import shutil
import contextlib
import urlparse
from rest_utils import *
from .decorator import decorator
import sys
if sys.version_info[0] > 2:
basestring = str
try:
import arcpy
... | [
"arcpy.management.CopyFeatures",
"arcpy.management.SetValueForRangeDomain",
"arcpy.ListFields",
"arcpy.da.UpdateCursor",
"urlparse.urlparse",
"arcpy.management.AddField",
"arcpy.management.CreateDomain",
"arcpy.geoprocessing._base.Geoprocessor",
"arcpy.management.Delete",
"arcpy.management.AddAtta... | [((30983, 31010), 'urlparse.urlparse', 'urlparse.urlparse', (['self.url'], {}), '(self.url)\n', (31000, 31010), False, 'import urlparse\n'), ((4916, 4956), 'arcpy.geoprocessing._base.Geoprocessor', 'arcpy.geoprocessing._base.Geoprocessor', ([], {}), '()\n', (4954, 4956), False, 'import arcpy\n'), ((9406, 9453), 'arcpy.... |
import pytest
from application import create_app
@pytest.fixture()
def testapp(request):
app = create_app()
client = app.test_client()
def teardown():
pass
request.addfinalizer(teardown)
return client
| [
"pytest.fixture",
"application.create_app"
] | [((53, 69), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (67, 69), False, 'import pytest\n'), ((102, 114), 'application.create_app', 'create_app', ([], {}), '()\n', (112, 114), False, 'from application import create_app\n')] |
import numpy as np
def measure_curvature_pixels(y_eval, left_fit, right_fit):
'''
Calculates the curvature of polynomial functions in pixels.
PARAMETERS
* y_eval : where we want radius of curvature to be evaluated (We'll choose the maximum y-value, bottom of image)
'''
# Calculation of R_curve ... | [
"numpy.absolute",
"numpy.polyfit"
] | [((1317, 1374), 'numpy.polyfit', 'np.polyfit', (['(ploty * ym_per_pix)', '(left_fitx * xm_per_pix)', '(2)'], {}), '(ploty * ym_per_pix, left_fitx * xm_per_pix, 2)\n', (1327, 1374), True, 'import numpy as np\n'), ((1390, 1448), 'numpy.polyfit', 'np.polyfit', (['(ploty * ym_per_pix)', '(right_fitx * xm_per_pix)', '(2)'],... |
from collections import namedtuple
import re
import glob
import os.path
import numpy as np
import scipy.io.wavfile as wavfile
import scipy.signal as signal
import math
import paths
from minimum_phase import minimum_phase
files = glob.glob(os.path.join(paths.data_path, "elev*", "L*.wav"), recursive=True)
def to_coords... | [
"collections.namedtuple",
"numpy.sqrt",
"numpy.minimum",
"numpy.fft.fft",
"re.match",
"scipy.signal.blackmanharris",
"scipy.io.wavfile.read",
"minimum_phase.minimum_phase"
] | [((2678, 2795), 'collections.namedtuple', 'namedtuple', (['"""HrtfData"""', "['num_elevs', 'elev_increment', 'elev_min', 'num_azimuths', 'azimuths',\n 'impulse_length']"], {}), "('HrtfData', ['num_elevs', 'elev_increment', 'elev_min',\n 'num_azimuths', 'azimuths', 'impulse_length'])\n", (2688, 2795), False, 'from... |
"""
# Copyright 2022 Red Hat
#
# 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 agr... | [
"cibyl.utils.sorting.nsort",
"cibyl.utils.sorting.BubbleSortAlgorithm",
"cibyl.utils.sorting.sort",
"cibyl.utils.sorting.NativeComparator"
] | [((1412, 1430), 'cibyl.utils.sorting.NativeComparator', 'NativeComparator', ([], {}), '()\n', (1428, 1430), False, 'from cibyl.utils.sorting import BubbleSortAlgorithm, NativeComparator, nsort, sort\n'), ((1757, 1775), 'cibyl.utils.sorting.NativeComparator', 'NativeComparator', ([], {}), '()\n', (1773, 1775), False, 'f... |
import logging
import time
logging.basicConfig(filename="test_{}.log".format(time.ctime()),
format='%(asctime)s - %(levelname)s: %(message)s',
datefmt='%I:%M:%S.%f',
level=logging.DEBUG)
class test(object):
def __init__(self):
logging.info("New ... | [
"time.ctime",
"logging.warning",
"logging.info"
] | [((302, 341), 'logging.info', 'logging.info', (['"""New object was created."""'], {}), "('New object was created.')\n", (314, 341), False, 'import logging\n'), ((79, 91), 'time.ctime', 'time.ctime', ([], {}), '()\n', (89, 91), False, 'import time\n'), ((508, 560), 'logging.warning', 'logging.warning', (['"""Arguments a... |
"""Permission storage model."""
import logging
from enum import IntEnum
from functools import reduce
from typing import List, Optional, Union
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, User
from django.db import models, transaction
log... | [
"logging.getLogger",
"django.contrib.auth.get_user_model",
"resolwe.permissions.utils.get_identity",
"django.db.models.ForeignKey",
"resolwe.permissions.utils.get_user",
"resolwe.test.utils.is_testing",
"django.db.models.Q",
"django.db.models.PositiveSmallIntegerField"
] | [((326, 353), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (343, 353), False, 'import logging\n'), ((5112, 5146), 'django.db.models.PositiveSmallIntegerField', 'models.PositiveSmallIntegerField', ([], {}), '()\n', (5144, 5146), False, 'from django.db import models, transaction\n'), ((53... |
### Author: <NAME>
### Date: Aug,15 2017
import sys
import os.path
import encrypt
import decrypt
def main():
print("---------------------------------------------------")
print("Music Encrypt - Music Based Encryption")
print("Author: <NAME>")
print("---------------------------------------------------"... | [
"decrypt.decrypt",
"encrypt.encrypt"
] | [((1347, 1383), 'encrypt.encrypt', 'encrypt.encrypt', (['fpath', 'key', 'outfile'], {}), '(fpath, key, outfile)\n', (1362, 1383), False, 'import encrypt\n'), ((1719, 1746), 'decrypt.decrypt', 'decrypt.decrypt', (['fpath', 'key'], {}), '(fpath, key)\n', (1734, 1746), False, 'import decrypt\n')] |
#!/usr/bin/env python
"""
This module provides Block.UpdateStatus data access object.
"""
from WMCore.Database.DBFormatter import DBFormatter
from dbs.utils.dbsExceptionHandler import dbsExceptionHandler
from dbs.utils.dbsUtils import dbsUtils
class UpdateStatus(DBFormatter):
"""
Block Update Status DAO class... | [
"dbs.utils.dbsExceptionHandler.dbsExceptionHandler",
"WMCore.Database.DBFormatter.DBFormatter.__init__",
"dbs.utils.dbsUtils.dbsUtils"
] | [((441, 480), 'WMCore.Database.DBFormatter.DBFormatter.__init__', 'DBFormatter.__init__', (['self', 'logger', 'dbi'], {}), '(self, logger, dbi)\n', (461, 480), False, 'from WMCore.Database.DBFormatter import DBFormatter\n'), ((954, 1110), 'dbs.utils.dbsExceptionHandler.dbsExceptionHandler', 'dbsExceptionHandler', (['""... |
"""Dimmable Lighting Control Devices (CATEGORY 0x01)."""
from functools import partial
from typing import Iterable
from ..constants import FanSpeed
from ..extended_property import (
LED_DIMMING,
ON_LEVEL,
RAMP_RATE,
X10_HOUSE,
X10_UNIT,
ON_MASK,
OFF_MASK,
NON_TOGGLE_MASK,
TRIGGER_GRO... | [
"functools.partial"
] | [((21838, 21882), 'functools.partial', 'partial', (['self._led_follow_check'], {'group': 'group'}), '(self._led_follow_check, group=group)\n', (21845, 21882), False, 'from functools import partial\n')] |
import os
import os.path
import yaml
class Configuration:
def __init__(self):
self.path = os.path.dirname(__file__)
def get_liq_bands(self):
return self.__load_config(os.path.join(self.path,'liq_bands.yml'))
def get_trades_bands(self):
return self.__load_config(os.path.join(self.p... | [
"os.path.dirname",
"os.path.exists",
"os.path.join",
"yaml.load"
] | [((103, 128), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (118, 128), False, 'import os\n'), ((193, 233), 'os.path.join', 'os.path.join', (['self.path', '"""liq_bands.yml"""'], {}), "(self.path, 'liq_bands.yml')\n", (205, 233), False, 'import os\n'), ((301, 344), 'os.path.join', 'os.path.j... |
from rest_framework import serializers
from ..models.orders import Order, OrderMenuEntry, OrderProductEntry
from ..models.models import Customer, Restaurant, Product
from ..models.menu import Menu
class OrderProductSerializer(serializers.ModelSerializer):
class Meta:
model = OrderProductEntry
fie... | [
"rest_framework.serializers.ValidationError",
"rest_framework.serializers.SerializerMethodField"
] | [((633, 668), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {}), '()\n', (666, 668), False, 'from rest_framework import serializers\n'), ((684, 719), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {}), '()\n', (717, 719), Fal... |
import requests
from exceptions import RequestError
from log import Log
from .ladder import Ladder
from .player import Player
class API:
@staticmethod
def get_current_season_id(params: dict) -> int:
r = requests.get("https://us.api.battle.net/data/sc2/season/current", params)
if r.status_code... | [
"requests.get"
] | [((222, 295), 'requests.get', 'requests.get', (['"""https://us.api.battle.net/data/sc2/season/current"""', 'params'], {}), "('https://us.api.battle.net/data/sc2/season/current', params)\n", (234, 295), False, 'import requests\n')] |
import itertools as it
import math
from . import base_objs
import gen_basis_helpers.shared.misc_utils as misc
import numpy as np
class BroadenFunctCompositeStandard(base_objs.BroadenFunctionStandard):
leafObjs = misc.StandardComponentDescriptor("leafObjs")
def __init__(self, objs:iter):
""" Initializer for comp... | [
"itertools.zip_longest",
"gen_basis_helpers.shared.misc_utils.StandardComponentDescriptor",
"math.sqrt",
"math.log",
"numpy.exp",
"numpy.array"
] | [((217, 261), 'gen_basis_helpers.shared.misc_utils.StandardComponentDescriptor', 'misc.StandardComponentDescriptor', (['"""leafObjs"""'], {}), "('leafObjs')\n", (249, 261), True, 'import gen_basis_helpers.shared.misc_utils as misc\n'), ((1318, 1347), 'itertools.zip_longest', 'it.zip_longest', (['vals', 'allObjs'], {}),... |
import ctypes
import functools
from .exceptions import Aborted, NeedHelp, NeedExtra
from .native import FUNCTIONS
Any = object()
def native_bridge(name: str, bases: tuple, dct: dict):
dct2 = {}
while dct:
k, v = dct.popitem()
if k.startswith('_') or (not isinstance(v, type) and v is not Any)... | [
"ctypes.POINTER",
"functools.wraps"
] | [((7865, 7884), 'functools.wraps', 'functools.wraps', (['fn'], {}), '(fn)\n', (7880, 7884), False, 'import functools\n'), ((6691, 6710), 'ctypes.POINTER', 'ctypes.POINTER', (['typ'], {}), '(typ)\n', (6705, 6710), False, 'import ctypes\n')] |
# import numpy as np
from neon.optimizers.optimizer import Optimizer, get_param_list
class RMSPropNesterov(Optimizer):
"""
RMSProp with Nesterov Momentum
"""
# TODO: max norm constraint
def __init__(self, stochastic_round=False, momentum=0.5, decay_rate=0.90, learning_rate=1e-4, epsilon=1e-6,
... | [
"neon.optimizers.optimizer.get_param_list"
] | [((912, 938), 'neon.optimizers.optimizer.get_param_list', 'get_param_list', (['layer_list'], {}), '(layer_list)\n', (926, 938), False, 'from neon.optimizers.optimizer import Optimizer, get_param_list\n'), ((2527, 2553), 'neon.optimizers.optimizer.get_param_list', 'get_param_list', (['layer_list'], {}), '(layer_list)\n'... |
import imp
API_KEY = '<KEY>'
write = imp.load_source('writeFile', '../writeFiles/writeFile.py')
coordinate = (52.517671, 13.377802)
#1000 trajectories without any waypoints
waypoints = write.generate_Random_Waypoints(25, coordinate, 0.05, .5)
# for i in range(len(waypoints)):
# print(waypoints[i])
# 52.517671, 1... | [
"imp.load_source"
] | [((39, 97), 'imp.load_source', 'imp.load_source', (['"""writeFile"""', '"""../writeFiles/writeFile.py"""'], {}), "('writeFile', '../writeFiles/writeFile.py')\n", (54, 97), False, 'import imp\n')] |
import mobileEntity as me
import mixZone as mz
import datetime as dt
import dtmzUtils as utils
import pandas as pd
import graphOperations as graphOp
import os
def simulation(G, n_mixzones, k_anonymity, mobile_entities_path,sim_file,mixzones_path, days, intervals, radius_mixzone, metric):
print("Simulation begins a... | [
"os.path.exists",
"datetime.datetime.fromtimestamp",
"pandas.read_csv",
"graphOperations.selectMixZonesByMetricAndRegion",
"dtmzUtils.generateMixZonesObjects",
"datetime.datetime.now",
"os.mkdir"
] | [((380, 434), 'pandas.read_csv', 'pd.read_csv', (['mixzones_path'], {'delimiter': '""","""', 'header': 'None'}), "(mixzones_path, delimiter=',', header=None)\n", (391, 434), True, 'import pandas as pd\n'), ((1014, 1109), 'graphOperations.selectMixZonesByMetricAndRegion', 'graphOp.selectMixZonesByMetricAndRegion', (['n_... |
from abc import ABC
from dataclasses import asdict, dataclass
from typing import Any, Dict, List, Optional, Sequence, Union
import numpy as np
import torch
from lhotse.features.base import FeatureExtractor, register_extractor
from lhotse.utils import EPSILON, Seconds, is_module_available
@dataclass
class KaldifeatF... | [
"dataclasses.asdict",
"torch.stack",
"torch.from_numpy",
"numpy.exp",
"lhotse.utils.is_module_available"
] | [((770, 782), 'dataclasses.asdict', 'asdict', (['self'], {}), '(self)\n', (776, 782), False, 'from dataclasses import asdict, dataclass\n'), ((1712, 1724), 'dataclasses.asdict', 'asdict', (['self'], {}), '(self)\n', (1718, 1724), False, 'from dataclasses import asdict, dataclass\n'), ((2194, 2226), 'lhotse.utils.is_mod... |
import os
import json
import csv
from pprint import pprint
from collections import defaultdict
with open("f2g_library_dump.json", "r") as f2g_lib:
syndromes = json.load(f2g_lib)
ps_dict = {}
mim_to_ps = {}
with open("data/phenotypicSeries.txt", "r") as ps_data:
for raw_entry in csv.DictReader(
(r ... | [
"json.load",
"os.listdir"
] | [((164, 182), 'json.load', 'json.load', (['f2g_lib'], {}), '(f2g_lib)\n', (173, 182), False, 'import json\n'), ((1456, 1491), 'os.listdir', 'os.listdir', (['"""process/aws_dir/cases"""'], {}), "('process/aws_dir/cases')\n", (1466, 1491), False, 'import os\n'), ((3205, 3219), 'json.load', 'json.load', (['jfp'], {}), '(j... |
import pytest
from super_mario.base_pipeline import BasePipeline
from super_mario.decorators import process_pipe
from super_mario.exceptions import GlobalContextUpdateException
@pytest.fixture
def simple_pipeline():
class SimplePipeline(BasePipeline):
pipeline = [
'sum_numbers',
'... | [
"pytest.raises"
] | [((625, 668), 'pytest.raises', 'pytest.raises', (['GlobalContextUpdateException'], {}), '(GlobalContextUpdateException)\n', (638, 668), False, 'import pytest\n')] |
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... | [
"setuptools.Extension",
"platform.mac_ver",
"distutils.sysconfig.get_config_var"
] | [((1442, 1569), 'setuptools.Extension', 'Extension', (['"""sasl.saslwrapper"""'], {'sources': "['sasl/saslwrapper.cpp']", 'include_dirs': "['sasl']", 'libraries': "['sasl2']", 'language': '"""c++"""'}), "('sasl.saslwrapper', sources=['sasl/saslwrapper.cpp'],\n include_dirs=['sasl'], libraries=['sasl2'], language='c+... |
from unittest.mock import patch, MagicMock
import pytest
from pycbc.aws import ses
@pytest.fixture
def mock_ses():
ses_mock = MagicMock()
with patch('pycbc.aws.ses.boto3.client') as mock:
mock.return_value = ses_mock
yield ses_mock
def test_send_email(email, mock_ses):
ses.send_email(e... | [
"pycbc.aws.ses.send_email",
"unittest.mock.MagicMock",
"unittest.mock.patch"
] | [((134, 145), 'unittest.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (143, 145), False, 'from unittest.mock import patch, MagicMock\n'), ((304, 372), 'pycbc.aws.ses.send_email', 'ses.send_email', (['email', 'email', '"""test"""', '"""test"""'], {'bcc_recipients': '[email]'}), "(email, email, 'test', 'test', bcc_reci... |
# coding: utf-8
"""
Lightly API
Lightly.ai enables you to do self-supervised learning in an easy and intuitive way. The lightly.ai OpenAPI spec defines how one can interact with our REST API to unleash the full potential of lightly.ai # noqa: E501
OpenAPI spec version: 1.0.0
Contact: <EMAIL>
Gen... | [
"six.iteritems",
"lightly.openapi_generated.swagger_client.api_client.ApiClient"
] | [((3449, 3480), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (3462, 3480), False, 'import six\n'), ((894, 905), 'lightly.openapi_generated.swagger_client.api_client.ApiClient', 'ApiClient', ([], {}), '()\n', (903, 905), False, 'from lightly.openapi_generated.swagger_client.api_c... |
import shutil
import subprocess
from snake import error
from snake import scale
class Commands(scale.Commands):
def check(self):
exiftool = shutil.which("exiftool")
if not exiftool:
raise error.CommandError("binary 'exiftool' not found")
@scale.command({
'info': 'parse ex... | [
"subprocess.check_output",
"snake.error.CommandError",
"shutil.which",
"snake.scale.command"
] | [((279, 340), 'snake.scale.command', 'scale.command', (["{'info': 'parse exif data of the file passed'}"], {}), "({'info': 'parse exif data of the file passed'})\n", (292, 340), False, 'from snake import scale\n'), ((155, 179), 'shutil.which', 'shutil.which', (['"""exiftool"""'], {}), "('exiftool')\n", (167, 179), Fals... |
"""
Classes for writing and filtering of processed reads.
A Filter is a callable that has the read as its only argument. If it is called,
it returns True if the read should be filtered (discarded), and False if not.
To be used, a filter needs to be wrapped in one of the redirector classes.
They are called so because ... | [
"dnaio.open"
] | [((7823, 7870), 'dnaio.open', 'dnaio.open', (['path'], {'mode': '"""w"""', 'qualities': 'qualities'}), "(path, mode='w', qualities=qualities)\n", (7833, 7870), False, 'import dnaio\n'), ((8009, 8056), 'dnaio.open', 'dnaio.open', (['path'], {'mode': '"""w"""', 'qualities': 'qualities'}), "(path, mode='w', qualities=qual... |
import time
class GenericEvent(object):
def __init__(self, client, original):
self.name = self.__class__.__name__.lower()
self.timestamp = time.time()
self.client = client
self.original_event = original
class PublicMessage(GenericEvent):
def __init__(self, client, original, t... | [
"time.time"
] | [((161, 172), 'time.time', 'time.time', ([], {}), '()\n', (170, 172), False, 'import time\n')] |
# PIPELINE PHASES
import re
import miscellaneous as misc
import calculator as calc
instructionMemory = []
# Search phase
# @param program counter
# @return a instruction such as "dadd","daddi","dsub" ...
def search(pc):
# Retrieve next instruction in memory
instruction = misc.readInstructions("inputfile.txt")
... | [
"calculator.bnez",
"calculator.beqz",
"miscellaneous.readInstructions",
"miscellaneous.readRegisters",
"calculator.sum",
"calculator.sub",
"calculator.daddi",
"calculator.bne",
"calculator.beq",
"miscellaneous.writeRegisters"
] | [((279, 317), 'miscellaneous.readInstructions', 'misc.readInstructions', (['"""inputfile.txt"""'], {}), "('inputfile.txt')\n", (300, 317), True, 'import miscellaneous as misc\n'), ((613, 651), 'miscellaneous.readInstructions', 'misc.readInstructions', (['"""inputfile.txt"""'], {}), "('inputfile.txt')\n", (634, 651), Tr... |
import abc
import re
from typing import Optional
from aiohttp import ClientSession as Sess
from newspaper.configuration import Configuration as NConf
from functools import partial
from dirtyfunc import Either, Left
from evenflow import utreq
from evenflow.streams.messages.article_extended import ArticleExtended
from ev... | [
"evenflow.utreq.get_html",
"dirtyfunc.Left",
"functools.partial",
"evenflow.urlman.functions.maintain_path"
] | [((840, 927), 'functools.partial', 'partial', (['ArticleExtended'], {'url_to_visit': 'article_link', 'scraped_from': 'source', 'fake': 'fake'}), '(ArticleExtended, url_to_visit=article_link, scraped_from=source,\n fake=fake)\n', (847, 927), False, 'from functools import partial\n'), ((2596, 2638), 'evenflow.urlman.f... |
#!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name='armagetron.py',
version='0.0.1',
description='a scripting library for Armagetron Advanced',
license='MIT',
url='https://github.com/fkmclane/armagetron.py',
author='<NAME>',
author_email='<EMAIL>',
packages=... | [
"setuptools.find_packages"
] | [((320, 335), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (333, 335), False, 'from setuptools import setup, find_packages\n')] |
#NASA API Consumption
import requests
from urllib.request import urlretrieve
from pprint import PrettyPrinter
pp = PrettyPrinter()
api_key = "YOUR_NASA_API_KEY"
def fetchAPOD():
URL_APOD = "https://api.nasa.gov/planetary/apod"
date = '2020-01-23'
params = {
'api_key':api_key,
'date':date,
'hd... | [
"pprint.PrettyPrinter",
"requests.get",
"urllib.request.urlretrieve"
] | [((115, 130), 'pprint.PrettyPrinter', 'PrettyPrinter', ([], {}), '()\n', (128, 130), False, 'from pprint import PrettyPrinter\n'), ((1789, 1829), 'urllib.request.urlretrieve', 'urlretrieve', (['URL_EPIC', "(IMAGE_ID + '.png')"], {}), "(URL_EPIC, IMAGE_ID + '.png')\n", (1800, 1829), False, 'from urllib.request import ur... |
from exo2_starter_template import Cyborg
from robot import Robot
from human import Human
h = Human('femme')
h.eat(['banane', 'chocolaaat', 'petit ecolier'])
print(h.estomac)
h.eat(['pizza', 'pizza']) | [
"human.Human"
] | [((96, 110), 'human.Human', 'Human', (['"""femme"""'], {}), "('femme')\n", (101, 110), False, 'from human import Human\n')] |
import argparse
import getopt
import sys
import datetime
import time
import subprocess
from time import sleep
from threading import Thread
from getmac import get_mac_address
from netaddr import *
import yaml
import serial
import re
def is_csi_supported():
global csi_type
global debug
global serial_port
... | [
"argparse.ArgumentParser",
"subprocess.Popen",
"time.sleep",
"datetime.datetime.now",
"serial.Serial",
"time.time",
"threading.Thread",
"getmac.get_mac_address",
"re.search"
] | [((1966, 2034), 'subprocess.Popen', 'subprocess.Popen', (['csi_filter_cmd'], {'stdout': 'subprocess.PIPE', 'shell': '(True)'}), '(csi_filter_cmd, stdout=subprocess.PIPE, shell=True)\n', (1982, 2034), False, 'import subprocess\n'), ((2272, 2337), 'subprocess.Popen', 'subprocess.Popen', (['csi_ext_cmd'], {'stdout': 'subp... |
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Any, Callable, Dict, Tuple
import numpy as np
from dppy.finite_dpps import FiniteDPP
from scipydirect import minimize
from .acquisition import (
AcquisitionFunction,
OneShotBatchAcquisitionFunction,
SequentialBatchAcq... | [
"numpy.array",
"numpy.concatenate",
"dppy.finite_dpps.FiniteDPP"
] | [((6859, 6896), 'dppy.finite_dpps.FiniteDPP', 'FiniteDPP', (['"""likelihood"""'], {'L': 'likelihood'}), "('likelihood', L=likelihood)\n", (6868, 6896), False, 'from dppy.finite_dpps import FiniteDPP\n'), ((2845, 2862), 'numpy.array', 'np.array', (['[x_min]'], {}), '([x_min])\n', (2853, 2862), True, 'import numpy as np\... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-01-13 19:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0011_auto_20180113_1248'),
]
operations = [
migrations.AlterField(
... | [
"django.db.models.CharField"
] | [((397, 441), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(100)'}), '(blank=True, max_length=100)\n', (413, 441), False, 'from django.db import migrations, models\n')] |
"""main server script
will sit onboard host and operate as Nebula --- its dynamic soul"""
# --------------------------------------------------
#
# Embodied AI Engine Prototype v0.10
# 2021/01/25
#
# © <NAME> 2020
# <EMAIL>
#
# Dedicated to <NAME>
#
# --------------------------------------------------
from random impo... | [
"numpy.abs",
"numpy.reshape",
"random.randrange",
"pydub.playback.play",
"pydub.AudioSegment.from_mp3",
"robot.rerobot.Robot",
"time.sleep",
"tensorflow.keras.models.load_model",
"time.time",
"random.random",
"pyaudio.PyAudio",
"arm.arm.Arm",
"pydub.AudioSegment.from_wav"
] | [((899, 954), 'tensorflow.keras.models.load_model', 'load_model', (['"""models/EMR-v4_RNN_skeleton_data.nose.x.h5"""'], {}), "('models/EMR-v4_RNN_skeleton_data.nose.x.h5')\n", (909, 954), False, 'from tensorflow.keras.models import load_model\n'), ((1218, 1261), 'tensorflow.keras.models.load_model', 'load_model', (['""... |
import unittest
from oeqa.sdk.case import OESDKTestCase
class PerlTest(OESDKTestCase):
@classmethod
def setUpClass(self):
if not (self.tc.hasHostPackage("nativesdk-perl") or
self.tc.hasHostPackage("perl-native")):
raise unittest.SkipTest("No perl package in the SDK")
de... | [
"unittest.SkipTest"
] | [((265, 312), 'unittest.SkipTest', 'unittest.SkipTest', (['"""No perl package in the SDK"""'], {}), "('No perl package in the SDK')\n", (282, 312), False, 'import unittest\n')] |
from django.contrib import admin
from .models import Biodata, UserProfile
# Register your models here.
@admin.register(Biodata)
@admin.register(UserProfile)
# admin.site.register(UserProfile)
class BiodataAdmin(admin.ModelAdmin):
pass | [
"django.contrib.admin.register"
] | [((106, 129), 'django.contrib.admin.register', 'admin.register', (['Biodata'], {}), '(Biodata)\n', (120, 129), False, 'from django.contrib import admin\n'), ((131, 158), 'django.contrib.admin.register', 'admin.register', (['UserProfile'], {}), '(UserProfile)\n', (145, 158), False, 'from django.contrib import admin\n')] |
from expungeservice.record_creator import RecordCreator
from expungeservice.models.record import Record
from tests.factories.case_factory import CaseFactory
def test_sort_by_case_date():
case1 = CaseFactory.create(case_number="1", date_location=["1/1/2018", "Multnomah"])
case2 = CaseFactory.create(case_number... | [
"expungeservice.record_creator.RecordCreator.sort_record_by_case_date",
"tests.factories.case_factory.CaseFactory.create"
] | [((201, 277), 'tests.factories.case_factory.CaseFactory.create', 'CaseFactory.create', ([], {'case_number': '"""1"""', 'date_location': "['1/1/2018', 'Multnomah']"}), "(case_number='1', date_location=['1/1/2018', 'Multnomah'])\n", (219, 277), False, 'from tests.factories.case_factory import CaseFactory\n'), ((290, 366)... |
import json
from onadata.apps.api.models import Team
from onadata.apps.api.tests.viewsets.test_abstract_viewset import\
TestAbstractViewSet
from onadata.apps.api.viewsets.team_viewset import TeamViewSet
class TestTeamViewSet(TestAbstractViewSet):
def setUp(self):
super(self.__class__, self).setUp()
... | [
"onadata.apps.api.viewsets.team_viewset.TeamViewSet.as_view",
"json.dumps",
"onadata.apps.api.models.Team.objects.get"
] | [((340, 394), 'onadata.apps.api.viewsets.team_viewset.TeamViewSet.as_view', 'TeamViewSet.as_view', (["{'get': 'list', 'post': 'create'}"], {}), "({'get': 'list', 'post': 'create'})\n", (359, 394), False, 'from onadata.apps.api.viewsets.team_viewset import TeamViewSet\n'), ((1433, 1473), 'onadata.apps.api.viewsets.team_... |
# telegram api
from telegram.ext import Updater
# utils
from Utils.logging import get_logger as log
# controllers
from Controllers.main_menu import MainMenu
from Controllers.about import About
from Controllers.add_watchlist_button import UpdateWatchlist
from Controllers.dividend_summary import DividendSummary
# jobs
fr... | [
"Controllers.add_watchlist_button.UpdateWatchlist",
"datetime.time",
"Controllers.dividend_summary.DividendSummary",
"Controllers.main_menu.MainMenu",
"Model.db.DBEngine",
"Bot.config.BotConfig",
"Controllers.about.About",
"telegram.ext.Updater",
"Utils.logging.get_logger"
] | [((529, 549), 'Bot.config.BotConfig', 'BotConfig', ([], {'dev': '(False)'}), '(dev=False)\n', (538, 549), False, 'from Bot.config import BotConfig\n'), ((650, 660), 'Model.db.DBEngine', 'DBEngine', ([], {}), '()\n', (658, 660), False, 'from Model.db import DBEngine\n'), ((775, 812), 'telegram.ext.Updater', 'Updater', (... |
import os
import time
import requests
import datetime
from alive_progress import alive_bar
from instascrape import *
from database import DB
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options
IG_URL = 'http://instagram.com/p/' # IG_URL + shortocde = post url
IG_PROFILE = 'h... | [
"requests.Session",
"datetime.datetime.utcnow",
"selenium.webdriver.Firefox",
"os.getcwd",
"selenium.webdriver.firefox.options.Options",
"alive_progress.alive_bar",
"database.DB"
] | [((693, 702), 'selenium.webdriver.firefox.options.Options', 'Options', ([], {}), '()\n', (700, 702), False, 'from selenium.webdriver.firefox.options import Options\n'), ((793, 846), 'selenium.webdriver.Firefox', 'Firefox', ([], {'options': 'options', 'executable_path': 'geckodriver'}), '(options=options, executable_pat... |
from typing import Tuple, List
import matplotlib.pyplot as plt
import tensorflow as tf
from histomics_detect.boxes.transforms import filter_edge_boxes
from histomics_detect.anchors.create import create_anchors
from histomics_detect.metrics import greedy_iou_mapping
from histomics_detect.metrics.iou import iou
from hi... | [
"tensorflow.shape",
"tensorflow.split",
"tensorflow.cast",
"histomics_detect.anchors.create.create_anchors",
"tensorflow.greater",
"tensorflow.size",
"histomics_detect.models.compression_network.CompressionNetwork",
"histomics_detect.models.lnms_model.LearningNMS",
"tensorflow.where",
"tensorflow.... | [((2446, 2472), 'tensorflow.reshape', 'tf.reshape', (['nms_output', '(-1)'], {}), '(nms_output, -1)\n', (2456, 2472), True, 'import tensorflow as tf\n'), ((2489, 2518), 'tensorflow.greater', 'tf.greater', (['scores', 'threshold'], {}), '(scores, threshold)\n', (2499, 2518), True, 'import tensorflow as tf\n'), ((5481, 5... |
#-*- coding:utf-8 -*-
import random
import time
import json
import requests
import re
class TiebaSpider:
def __init__(self,name):
self.Encoding = 'gbk'
self.name =name
self.url_temp='https://search.51job.com/list/170200%252C170300,000000,0000,00,9,99,'+name+',2,{}.html?lang=c&postchannel=000... | [
"json.loads",
"re.compile",
"json.dumps",
"requests.get",
"random.randint"
] | [((1023, 1061), 'requests.get', 'requests.get', (['url'], {'headers': 'self.heards'}), '(url, headers=self.heards)\n', (1035, 1061), False, 'import requests\n'), ((1332, 1385), 're.compile', 're.compile', (['"""^(window.__SEARCH_RESULT__) = .*$"""', 're.M'], {}), "('^(window.__SEARCH_RESULT__) = .*$', re.M)\n", (1342, ... |
from typing import Optional, List
from fastapi import HTTPException, Query
from maggma.api.query_operator import QueryOperator
from maggma.api.utils import STORE_PARAMS
class SortQuery(QueryOperator):
"""
Method to generate the sorting portion of a query
"""
def query(
self,
_sort_f... | [
"fastapi.Query"
] | [((343, 480), 'fastapi.Query', 'Query', (['None'], {'description': '"""Comma delimited fields to sort with. Prefixing \'-\' to a field will force a sort in descending order."""'}), '(None, description=\n "Comma delimited fields to sort with. Prefixing \'-\' to a field will force a sort in descending order."\n )\n... |
import factory
from django.contrib.auth.models import Group
class GroupFactory(factory.django.DjangoModelFactory):
name = factory.Sequence(lambda n: "group-%d" % n)
class Meta:
model = Group
django_get_or_create = ("name",)
| [
"factory.Sequence"
] | [((128, 170), 'factory.Sequence', 'factory.Sequence', (["(lambda n: 'group-%d' % n)"], {}), "(lambda n: 'group-%d' % n)\n", (144, 170), False, 'import factory\n')] |
import random
board = []
second_board = []
board_height = 0
board_width = 0
mines = 0
mine_location = []
def _print_welcome():
print('BUSCAMINAS')
print('*' * 50)
print('Elije una dificultad:')
print('[P]incipiante')
print('[I]ntermedio')
print('[M]aestro')
def locate_mines():
located_mines = 0
while(lo... | [
"random.randint"
] | [((362, 397), 'random.randint', 'random.randint', (['(0)', '(board_height - 1)'], {}), '(0, board_height - 1)\n', (376, 397), False, 'import random\n'), ((397, 431), 'random.randint', 'random.randint', (['(0)', '(board_width - 1)'], {}), '(0, board_width - 1)\n', (411, 431), False, 'import random\n')] |
#!/usr/bin/python
#coding:utf-8
import mylog
import mythreadpool as tp
import logging
if __name__ == '__main__':
logger = logging.getLogger(__name__)
def process(args):
logger.info('task %d is finished!', args['taskid'])
threadpool = tp.MyThreadPool(2)
for i in range(1,10):
threadpool.DispatchTa... | [
"logging.getLogger",
"mythreadpool.MyThreadPool"
] | [((126, 153), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (143, 153), False, 'import logging\n'), ((252, 270), 'mythreadpool.MyThreadPool', 'tp.MyThreadPool', (['(2)'], {}), '(2)\n', (267, 270), True, 'import mythreadpool as tp\n')] |
# encoding: utf-8
"""
定时运行爬取器
"""
import time
import os
import django
import importlib
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ProxyPool.settings")
django.setup()
from proxy_api.models import Fetcher, StatusRecode
from fetchers.BaseFetcher import BaseFetcher
def main():
while True:
for fetcher_... | [
"os.environ.setdefault",
"django.setup",
"os.listdir",
"importlib.import_module",
"proxy_api.models.Fetcher",
"proxy_api.models.StatusRecode.make_recode",
"time.sleep",
"proxy_api.models.Fetcher.objects.filter",
"time.time"
] | [((88, 157), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""ProxyPool.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'ProxyPool.settings')\n", (109, 157), False, 'import os\n'), ((158, 172), 'django.setup', 'django.setup', ([], {}), '()\n', (170, 172), False, 'import django\n')... |
import numpy as np
import matplotlib.pyplot as plt
from astropy.wcs import WCS
from kidsdata import KissData
from kidsdata.db import list_scan, get_scan
plt.ion()
# Open the scan 431
kd = KissData(get_scan(431))
# Read All the valid data from array B
list_data = kd.names.DataSc + kd.names.DataUc + ["I", "Q"]
kd.re... | [
"matplotlib.pyplot.imshow",
"numpy.abs",
"numpy.sqrt",
"numpy.nanmedian",
"numpy.array",
"kidsdata.db.get_scan",
"matplotlib.pyplot.ion",
"astropy.wcs.WCS"
] | [((156, 165), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (163, 165), True, 'import matplotlib.pyplot as plt\n'), ((1226, 1263), 'matplotlib.pyplot.imshow', 'plt.imshow', (['data.data'], {'origin': '"""lower"""'}), "(data.data, origin='lower')\n", (1236, 1263), True, 'import matplotlib.pyplot as plt\n'), ((20... |
import matplotlib.pyplot as plt
import numpy as np
from dataclass.signal import Signal
from dataclass.spectrogram import Spectrogram
from matplotlib import gridspec
from matplotlib.collections import PatchCollection
from matplotlib.patches import Rectangle
def plot_spectrogram(spectrogram, **kwargs):
ax = kwargs... | [
"matplotlib.patches.Rectangle",
"dataclass.spectrogram.Spectrogram",
"matplotlib.pyplot.xticks",
"dataclass.signal.Signal",
"matplotlib.collections.PatchCollection",
"matplotlib.pyplot.figure",
"matplotlib.gridspec.GridSpec",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.tight_layout",
"matplotli... | [((971, 1069), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'constrained_layout': '(True)', 'figsize': '(20, 4)', 'subplot_kw': "{'projection': 'luscinia'}"}), "(constrained_layout=True, figsize=(20, 4), subplot_kw={\n 'projection': 'luscinia'})\n", (983, 1069), True, 'import matplotlib.pyplot as plt\n'), ((1... |
from django.db import models
from phone_field import PhoneField
# Create your models here.
class Person(models.Model):
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
email = models.EmailField(max_length=254)
phone = PhoneField(help_text='Contact phone number')
created ... | [
"phone_field.PhoneField",
"django.db.models.EmailField",
"django.db.models.CharField",
"django.db.models.DateTimeField"
] | [((135, 167), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (151, 167), False, 'from django.db import models\n'), ((181, 213), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (197, 213), False, 'from django.d... |
import Qt.QtCore as QtCore
import Qt.QtWidgets as QtWidgets
import nomenclate.core.tools as tools
import nomenclateUI.utils as utils
import nomenclateUI.components.input_widgets as input_widgets
class FormatLabel(QtWidgets.QLabel):
doubleClick = QtCore.Signal(QtCore.QEvent)
rightClick = QtCore.Signal(QtCore.Q... | [
"nomenclateUI.components.input_widgets.CompleterTextEntry",
"Qt.QtCore.Signal",
"nomenclate.core.tools.get_string_difference"
] | [((252, 280), 'Qt.QtCore.Signal', 'QtCore.Signal', (['QtCore.QEvent'], {}), '(QtCore.QEvent)\n', (265, 280), True, 'import Qt.QtCore as QtCore\n'), ((298, 326), 'Qt.QtCore.Signal', 'QtCore.Signal', (['QtCore.QEvent'], {}), '(QtCore.QEvent)\n', (311, 326), True, 'import Qt.QtCore as QtCore\n'), ((825, 840), 'Qt.QtCore.S... |
# -*- coding: utf-8 -*-
# Copyright 2021 UuuNyaa <<EMAIL>>
# This file is part of x7zipfile.
import glob
import os
import shutil
import stat
import tempfile
import unittest
from tests import x7zipfile
from .archives import ARCHIVES, ARCHIVES_PATH
class TestCase(unittest.TestCase):
def test_archive_list(self):
... | [
"stat.S_ISDIR",
"os.path.join",
"tempfile.mkdtemp",
"os.lstat",
"shutil.rmtree",
"stat.S_ISLNK",
"os.walk",
"os.path.relpath"
] | [((943, 961), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (959, 961), False, 'import tempfile\n'), ((3050, 3073), 'shutil.rmtree', 'shutil.rmtree', (['temp_dir'], {}), '(temp_dir)\n', (3063, 3073), False, 'import shutil\n'), ((464, 505), 'os.path.join', 'os.path.join', (['ARCHIVES_PATH', 'archive_name'], ... |
"""
This code explores Different Models of Convolutional Neural Networks
for the San Salvador Gang Project
@author: falba and ftop
"""
import os
import google_streetview.api
import pandas as pd
import numpy as np
import sys
import matplotlib.image as mp_img
from matplotlib import pyplot as plot
from skima... | [
"keras.layers.Conv2D",
"pandas.read_csv",
"keras.layers.Dense",
"numpy.reshape",
"matplotlib.pyplot.plot",
"keras.regularizers.l1",
"skimage.color.rgb2gray",
"keras.layers.Flatten",
"keras.layers.MaxPooling2D",
"sklearn.model_selection.train_test_split",
"keras.models.Sequential",
"skimage.io.... | [((1094, 1170), 'os.chdir', 'os.chdir', (['"""C:/Users/falba/Dropbox/ImageAnalysis/San Salvador/GangBoundaries"""'], {}), "('C:/Users/falba/Dropbox/ImageAnalysis/San Salvador/GangBoundaries')\n", (1102, 1170), False, 'import os\n'), ((1177, 1287), 'pandas.read_csv', 'pd.read_csv', (['"""C:/Users/falba/Dropbox/ImageAnal... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Version 1.6
import argparse
import json
import os
import re
import sys
import yaml
import colorama
from queries import custom_search
from utilities import escape_ldap
from ldap_connector import LDAP3Connector
from ldap_connector import ImpacketLDAPConn... | [
"os.isatty",
"json.dumps",
"re.match",
"logging.exception",
"sys.stderr.write",
"sys.exit",
"sys.stdin.read",
"utilities.escape_ldap",
"colorama.init"
] | [((458, 473), 'colorama.init', 'colorama.init', ([], {}), '()\n', (471, 473), False, 'import colorama\n'), ((6522, 6559), 're.match', 're.match', (['"""[0-9.]*[0-9]"""', 'args.search'], {}), "('[0-9.]*[0-9]', args.search)\n", (6530, 6559), False, 'import re\n'), ((1271, 1310), 're.match', 're.match', (['"""^[0-9.]*[0-9... |
import turtle as t
tim = t.Turtle()
scr = t.Screen()
def move_forward():
tim.forward(10)
def move_backward():
tim.backward(10)
def clockwise():
tim.setheading(tim.heading() - 10)
def anticlockwise():
tim.setheading(tim.heading() + 10)
def clear():
tim.clear()
tim.penup()
tim.home(... | [
"turtle.Screen",
"turtle.Turtle"
] | [((26, 36), 'turtle.Turtle', 't.Turtle', ([], {}), '()\n', (34, 36), True, 'import turtle as t\n'), ((43, 53), 'turtle.Screen', 't.Screen', ([], {}), '()\n', (51, 53), True, 'import turtle as t\n')] |
# Code based on https://github.com/yaringal/ConcreteDropout
# License:
# MIT License
#
# Copyright (c) 2017
#
# 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 wi... | [
"torch.mul",
"torch.nn.ReLU",
"torch.log",
"torch.rand_like",
"torch.nn.Sequential",
"torch.sigmoid",
"numpy.log",
"torch.pow",
"torch.nn.Linear",
"torch.nn.Identity",
"torch.empty"
] | [((1816, 1843), 'torch.sigmoid', 'torch.sigmoid', (['self.p_logit'], {}), '(self.p_logit)\n', (1829, 1843), False, 'import torch\n'), ((2585, 2603), 'torch.rand_like', 'torch.rand_like', (['x'], {}), '(x)\n', (2600, 2603), False, 'import torch\n'), ((2819, 2850), 'torch.sigmoid', 'torch.sigmoid', (['(drop_prob / temp)'... |
#!/usr/bin/python3
from urllib.parse import urlencode
import requests
url_base = 'https://v1.hitokoto.cn/?'
params = {
'c': 'a',
'charset': 'utf-8',
'encode': 'json'
}
url = url_base + urlencode(params)
def get_content(url):
results = requests.get(url)
text = results.json()
... | [
"urllib.parse.urlencode",
"requests.get"
] | [((210, 227), 'urllib.parse.urlencode', 'urlencode', (['params'], {}), '(params)\n', (219, 227), False, 'from urllib.parse import urlencode\n'), ((270, 287), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (282, 287), False, 'import requests\n')] |
import os.path, sys
from ctypes import *
from modules.windows_thumbnailcache.lib.olefile import olefile
from modules.windows_thumbnailcache.lib.yjSysUtils import *
#from lib.yjSQLite3 import TSQLite3
import base64, hashlib
def exit(exit_code, msg=None):
if debug_mode: exit_code = 0
if msg: print(msg)
sys.... | [
"modules.windows_thumbnailcache.lib.olefile.olefile.isOleFile",
"hashlib.sha1",
"modules.windows_thumbnailcache.lib.olefile.olefile.OleFileIO",
"sys.exit"
] | [((316, 335), 'sys.exit', 'sys.exit', (['exit_code'], {}), '(exit_code)\n', (324, 335), False, 'import os.path, sys\n'), ((1860, 1887), 'modules.windows_thumbnailcache.lib.olefile.olefile.isOleFile', 'olefile.isOleFile', (['fileName'], {}), '(fileName)\n', (1877, 1887), False, 'from modules.windows_thumbnailcache.lib.o... |
#!/usr/bin/env python3
#This sample demonstrates digital port read and write.
#Install IoT HAT 3 library with "pip3 install turta-iothat3"
from time import sleep
from turta_iothat3 import Turta_Digital
#Initialize
#Set left digital port as output, right digital port as input
digital = Turta_Digital.DigitalPort(False... | [
"turta_iothat3.Turta_Digital.DigitalPort",
"time.sleep"
] | [((289, 340), 'turta_iothat3.Turta_Digital.DigitalPort', 'Turta_Digital.DigitalPort', (['(False)', '(False)', '(True)', '(True)'], {}), '(False, False, True, True)\n', (314, 340), False, 'from turta_iothat3 import Turta_Digital\n'), ((479, 489), 'time.sleep', 'sleep', (['(1.0)'], {}), '(1.0)\n', (484, 489), False, 'fro... |
""" FMI 2.0 interface """
import pathlib
from ctypes import *
from . import free, calloc
from .fmi1 import _FMU, FMICallException, printLogMessage
fmi2Component = c_void_p
fmi2ComponentEnvironment = c_void_p
fmi2FMUstate = c_void_p
fmi2ValueReference = c_uint
fmi2Real ... | [
"pathlib.Path"
] | [((9734, 9780), 'pathlib.Path', 'pathlib.Path', (['self.unzipDirectory', '"""resources"""'], {}), "(self.unzipDirectory, 'resources')\n", (9746, 9780), False, 'import pathlib\n')] |
'''
A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.
Copyright (c) 2016-2020 <NAME>
'''
from __future__ import absolute_import
from .._cffi_api_util import Base
import numpy as np
class IYMatrix(Base):
__slots__ = []
def GetCompressedYMatrix(self, factor=True):
'''R... | [
"numpy.array"
] | [((2540, 2555), 'numpy.array', 'np.array', (['NodeV'], {}), '(NodeV)\n', (2548, 2555), True, 'import numpy as np\n')] |
import webbrowser
import time
# Take a break every hours
num = 0
while num < 3:
print('Begin at: ' + time.ctime())
time.sleep(2*60*60)
webbrowser.open("https://www.youtube.com/watch?v=dlFA0Zq1k2A&list=RDdlFA0Zq1k2A")
num += 1
print('End at: ' + time.ctime())
| [
"time.ctime",
"webbrowser.open",
"time.sleep"
] | [((126, 149), 'time.sleep', 'time.sleep', (['(2 * 60 * 60)'], {}), '(2 * 60 * 60)\n', (136, 149), False, 'import time\n'), ((150, 236), 'webbrowser.open', 'webbrowser.open', (['"""https://www.youtube.com/watch?v=dlFA0Zq1k2A&list=RDdlFA0Zq1k2A"""'], {}), "(\n 'https://www.youtube.com/watch?v=dlFA0Zq1k2A&list=RDdlFA0Z... |
import yaml
import galsim
from galsim.config import WCSBuilder, RegisterWCSType
class DictWCS(WCSBuilder):
def __init__(self):
self.d = {} # Empty dict means we haven't read the file yet.
def buildWCS(self, config, base, logger):
"""Build the TanWCS based on the specifications in the config ... | [
"galsim.utilities.math_eval",
"galsim.config.GetAllParams"
] | [((759, 817), 'galsim.config.GetAllParams', 'galsim.config.GetAllParams', (['config', 'base'], {'req': 'req', 'opt': 'opt'}), '(config, base, req=req, opt=opt)\n', (785, 817), False, 'import galsim\n'), ((1323, 1362), 'galsim.utilities.math_eval', 'galsim.utilities.math_eval', (['self.d[key]'], {}), '(self.d[key])\n', ... |
#!/usr/bin/python3
"""Sorts input lines by order of decreasing line length.
Read std input, then emit output lines in decreasing/increasing order
of line length.
"""
from collections import defaultdict
import getopt
import os
import sys
import script_utils as u
flag_reverse = True
def usage(msgarg):
"""Print ... | [
"getopt.getopt",
"script_utils.increment_verbosity",
"sys.stdin.readlines",
"sys.stderr.write",
"script_utils.setdeflanglocale",
"collections.defaultdict",
"os.path.basename",
"sys.exit",
"sys.stdout.write"
] | [((958, 978), 'script_utils.setdeflanglocale', 'u.setdeflanglocale', ([], {}), '()\n', (976, 978), True, 'import script_utils as u\n'), ((1004, 1021), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1015, 1021), False, 'from collections import defaultdict\n'), ((1030, 1051), 'sys.stdin.readlines'... |
import pytest
from rest_framework.test import APIClient
from channels_ws_auth.models import WSAuthTicket
@pytest.fixture
@pytest.mark.django_db
def user(django_user_model):
return django_user_model.objects.create_user(username="user")
@pytest.fixture
@pytest.mark.django_db
def ticket(user):
return WSAuthTic... | [
"channels_ws_auth.models.WSAuthTicket.objects.create",
"rest_framework.test.APIClient"
] | [((311, 349), 'channels_ws_auth.models.WSAuthTicket.objects.create', 'WSAuthTicket.objects.create', ([], {'user': 'user'}), '(user=user)\n', (338, 349), False, 'from channels_ws_auth.models import WSAuthTicket\n'), ((397, 408), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (406, 408), False, 'from res... |
import unittest
import pytest
from tfsnippet.utils import BaseRegistry, ClassRegistry
class RegistryTestCase(unittest.TestCase):
def test_base_registry(self):
a = object()
b = object()
# test not ignore case
r = BaseRegistry(ignore_case=False)
self.assertFalse(r.ignore_... | [
"tfsnippet.utils.ClassRegistry",
"tfsnippet.utils.BaseRegistry",
"pytest.raises"
] | [((254, 285), 'tfsnippet.utils.BaseRegistry', 'BaseRegistry', ([], {'ignore_case': '(False)'}), '(ignore_case=False)\n', (266, 285), False, 'from tfsnippet.utils import BaseRegistry, ClassRegistry\n'), ((913, 943), 'tfsnippet.utils.BaseRegistry', 'BaseRegistry', ([], {'ignore_case': '(True)'}), '(ignore_case=True)\n', ... |
import argparse
import torch.nn.functional as F
from .. import load_graph_data
from ..train import train_and_eval
from ..train import register_general_args
from .gat import GAT
def gat_model_fn(args, data):
heads = ([args.n_heads] * args.n_layers) + [args.n_out_heads]
return GAT(data.graph,
a... | [
"argparse.ArgumentParser"
] | [((1664, 1706), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""GAT"""'}), "(description='GAT')\n", (1687, 1706), False, 'import argparse\n')] |
####
#
# The MIT License (MIT)
#
# Copyright 2021, 2022 <NAME> <<EMAIL>>
#
# 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 us... | [
"pandas.read_csv",
"os.extsep.join",
"re.compile",
"pandas.api.types.is_float",
"os.path.basename",
"pandas.api.types.is_bool",
"pandas.DataFrame",
"pandas.api.types.is_integer",
"pandas.concat"
] | [((2755, 2789), 're.compile', 're.compile', (['"""(?:[a-zA-Z0-9]+_?)+="""'], {}), "('(?:[a-zA-Z0-9]+_?)+=')\n", (2765, 2789), False, 'import re\n'), ((6901, 6933), 'pandas.concat', 'pd.concat', (['df'], {'ignore_index': '(True)'}), '(df, ignore_index=True)\n', (6910, 6933), True, 'import pandas as pd\n'), ((8155, 8181)... |
#!/usr/bin/env python3
import os
import sys
from argparse import ArgumentParser
from datetime import datetime, timedelta
from subprocess import check_output, run
from typing import List, Tuple
def get_backup_time(backup_path: str) -> datetime:
return datetime.strptime(os.path.basename(backup_path), "%Y-%m-%d-%H%M... | [
"subprocess.check_output",
"argparse.ArgumentParser",
"subprocess.run",
"os.geteuid",
"datetime.datetime.now",
"os.path.basename",
"sys.exit",
"datetime.timedelta"
] | [((381, 395), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (393, 395), False, 'from datetime import datetime, timedelta\n'), ((400, 438), 'subprocess.run', 'run', (["['tmutil', 'delete', backup_path]"], {}), "(['tmutil', 'delete', backup_path])\n", (403, 438), False, 'from subprocess import check_output, ... |
import argparse
import csv
import sys
from stringcase import constcase
"""
Workflow:
1. execute sql
2. export results to .csv
3. feed csv to this and optionally redirect results
4. complete formatting manually
(impossible to avoid without adding
a formatting dictionary by the user).
... | [
"stringcase.constcase",
"csv.reader",
"argparse.ArgumentParser"
] | [((1231, 1256), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1254, 1256), False, 'import argparse\n'), ((1513, 1547), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': '""";"""'}), "(csvfile, delimiter=';')\n", (1523, 1547), False, 'import csv\n'), ((579, 591), 'stringcase.constcase', ... |
import os
import random
import numpy as np
from PIL import Image
def get_loss_train_data():
if not os.path.exists('.data/DIV2K'):
# DIV2K Home Page: https://data.vision.ee.ethz.ch/cvl/DIV2K/
# DIV2K Training Set: http://data.vision.ee.ethz.ch/cvl/DIV2K/DIV2K_train_HR.zip
raise os.error('No... | [
"os.path.exists",
"os.listdir",
"PIL.Image.open",
"numpy.reshape",
"numpy.asarray",
"os.error",
"numpy.transpose"
] | [((1319, 1344), 'os.listdir', 'os.listdir', (['""".data/DIV2K"""'], {}), "('.data/DIV2K')\n", (1329, 1344), False, 'import os\n'), ((105, 134), 'os.path.exists', 'os.path.exists', (['""".data/DIV2K"""'], {}), "('.data/DIV2K')\n", (119, 134), False, 'import os\n'), ((308, 451), 'os.error', 'os.error', (['"""No DIV2K Tra... |
#!/usr/bin/env python3
# pylint:disable=line-too-long
"""
The tool to check the availability or syntax of domains, IPv4 or URL.
::
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
███... | [
"PyFunceble.lookup.Lookup",
"PyFunceble.check.Check",
"PyFunceble.generate.Generate",
"PyFunceble.helpers.Regex",
"PyFunceble.expiration_date.ExpirationDate",
"PyFunceble.requests.get"
] | [((9162, 9208), 'PyFunceble.requests.get', 'requests.get', (['url_to_get'], {'headers': 'self.headers'}), '(url_to_get, headers=self.headers)\n', (9174, 9208), False, 'from PyFunceble import requests\n'), ((10559, 10645), 'PyFunceble.requests.get', 'requests.get', (["('http://%s:80' % PyFunceble.INTERN['to_test'])"], {... |
# -*- coding:utf-8 -*-
'''
For full text searching.
'''
from config import CMS_CFG
from torcms.core.base_handler import BaseHandler
from torcms.core.tool.whoosh_tool import YunSearch
from torcms.model.category_model import MCategory
from torcms.core.tools import logger
def gen_pager_bootstrap_url(cat_slug, page_num... | [
"torcms.core.tool.whoosh_tool.YunSearch",
"torcms.core.tools.logger.info",
"torcms.model.category_model.MCategory.query_pcat"
] | [((2314, 2325), 'torcms.core.tool.whoosh_tool.YunSearch', 'YunSearch', ([], {}), '()\n', (2323, 2325), False, 'from torcms.core.tool.whoosh_tool import YunSearch\n'), ((2913, 2935), 'torcms.model.category_model.MCategory.query_pcat', 'MCategory.query_pcat', ([], {}), '()\n', (2933, 2935), False, 'from torcms.model.cate... |
import itertools as it
def check_sys_sols(sols, mat, lim = 1e-3, verbose = False):
"""
Checks if a set of solutions for a matrix is correct.
"""
permutations = it.permutations(sols)
minmaxerr = 1/lim if ((lim < 1) & (lim != 0)) else lim**2
for permutation in permutations:
maxerr = 0
... | [
"itertools.permutations"
] | [((177, 198), 'itertools.permutations', 'it.permutations', (['sols'], {}), '(sols)\n', (192, 198), True, 'import itertools as it\n')] |
# ##### BEGIN MIT LICENSE BLOCK #####
#
# MIT License
#
# Copyright (c) 2022 <NAME>
#
# 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 rig... | [
"mathutils.Euler",
"mathutils.Vector"
] | [((15617, 15625), 'mathutils.Vector', 'Vector', ([], {}), '()\n', (15623, 15625), False, 'from mathutils import Vector, Euler\n'), ((15636, 15643), 'mathutils.Euler', 'Euler', ([], {}), '()\n', (15641, 15643), False, 'from mathutils import Vector, Euler\n'), ((21673, 21681), 'mathutils.Vector', 'Vector', ([], {}), '()\... |
from django.core.management.base import BaseCommand, CommandError
from django.db.utils import IntegrityError
from oi_ghostwriter.models import Backup
import json
class Command(BaseCommand):
help = 'Deletes all computers from database'
def handle(self, *args, **options):
Backup.objects.all().delete()
| [
"oi_ghostwriter.models.Backup.objects.all"
] | [((289, 309), 'oi_ghostwriter.models.Backup.objects.all', 'Backup.objects.all', ([], {}), '()\n', (307, 309), False, 'from oi_ghostwriter.models import Backup\n')] |
import os.path
from absl import app
from absl import flags
from absl import logging
from typing import Any, Dict
import tensorflow as tf
import tensorflow.keras as keras
import uncertainty_baselines as ub
import uncertainty_metrics as um
import numpy as np
# import sklearn.isotonic
# import sklearn.neural_network
... | [
"tensorflow.keras.losses.MSE",
"tensorflow.tile",
"tensorflow.shape",
"numpy.random.rand",
"tensorflow.math.log",
"tensorflow.reduce_sum",
"uncertainty_baselines.optimizers.get",
"tensorflow.math.divide",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.GradientTape",
"numpy.array",
"... | [((6352, 6376), 'tensorflow.math.log', 'tf.math.log', (['(certs + eps)'], {}), '(certs + eps)\n', (6363, 6376), True, 'import tensorflow as tf\n'), ((25718, 25733), 'numpy.array', 'np.array', (['probs'], {}), '(probs)\n', (25726, 25733), True, 'import numpy as np\n'), ((25747, 25763), 'numpy.array', 'np.array', (['labe... |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 17 19:39:45 2019
@author: aimldl
"""
import numpy as np
print( np.random.choice(5, 3, replace=False ) )
a = ['pooh', 'rabbit', 'piglet', 'Christopher']
print( np.random.choice(a, 3, replace=False ) )
print( np.random.choice(8, 32, replace=False ) )
| [
"numpy.random.choice"
] | [((122, 159), 'numpy.random.choice', 'np.random.choice', (['(5)', '(3)'], {'replace': '(False)'}), '(5, 3, replace=False)\n', (138, 159), True, 'import numpy as np\n'), ((222, 259), 'numpy.random.choice', 'np.random.choice', (['a', '(3)'], {'replace': '(False)'}), '(a, 3, replace=False)\n', (238, 259), True, 'import nu... |
"""implementation of argmin step"""
from scipy import optimize
import numpy as np
from BanditPricing import randUnitVector
def argmin(eta, s_radius, barrier, g_bar_aggr_t, g_tilde, d, max_iter = 1e4):
#implement argmin_ball(eta * (g_bar_1:t + g_tilde_t+1)^T x + barrier(x)
#argmin is over ball with radius r
... | [
"BanditPricing.randUnitVector",
"numpy.real",
"numpy.dot",
"numpy.zeros",
"numpy.linalg.norm",
"numpy.imag"
] | [((1067, 1100), 'numpy.dot', 'np.dot', (['(g_bar_aggr_t + g_tilde)', 'x'], {}), '(g_bar_aggr_t + g_tilde, x)\n', (1073, 1100), True, 'import numpy as np\n'), ((1347, 1357), 'numpy.real', 'np.real', (['z'], {}), '(z)\n', (1354, 1357), True, 'import numpy as np\n'), ((1359, 1369), 'numpy.imag', 'np.imag', (['z'], {}), '(... |
def make_clust(net, dist_type='cosine', run_clustering=True,
dendro=True, requested_views=['pct_row_sum', 'N_row_sum'],
linkage_type='average', sim_mat=False):
''' This will calculate multiple views of a clustergram by filtering the
data and clustering after each... | [
"run_filter.df_filter_col",
"make_views.N_rows",
"calc_clust.cluster_row_and_col",
"run_filter.df_filter_row",
"copy.deepcopy",
"make_views.pct_rows"
] | [((584, 623), 'run_filter.df_filter_row', 'run_filter.df_filter_row', (['df', 'threshold'], {}), '(df, threshold)\n', (608, 623), False, 'import run_filter\n'), ((631, 670), 'run_filter.df_filter_col', 'run_filter.df_filter_col', (['df', 'threshold'], {}), '(df, threshold)\n', (655, 670), False, 'import run_filter\n'),... |
# -*- coding: utf-8 -*-
# (c) 2017 <NAME> <<EMAIL>>
import logging
from uspto.util.document import GenericDocument
logger = logging.getLogger(__name__)
class UsptoPairBulkDataDocument(GenericDocument):
XML_NAMESPACES = {
'pat': 'http://www.wipo.int/standards/XMLSchema/ST96/Patent',
'uscom': 'urn:... | [
"logging.getLogger"
] | [((125, 152), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (142, 152), False, 'import logging\n')] |
import sys
import pandas as pd
from sqlalchemy import create_engine
def load_data(messages_filepath, categories_filepath):
"""
Load data from two .csv file and then merge them by "id" column
Args:
messages_filepath: str. the file path of id and messages .csv file
categories_filepath: str. the ... | [
"pandas.merge",
"pandas.concat",
"pandas.read_csv"
] | [((533, 563), 'pandas.read_csv', 'pd.read_csv', (['messages_filepath'], {}), '(messages_filepath)\n', (544, 563), True, 'import pandas as pd\n'), ((581, 613), 'pandas.read_csv', 'pd.read_csv', (['categories_filepath'], {}), '(categories_filepath)\n', (592, 613), True, 'import pandas as pd\n'), ((670, 709), 'pandas.merg... |
import random
import structlog
from shapely.geometry import Point
import matplotlib.pyplot as plt
from matplotlib import cm
from deepcomp.env.util.utility import log_utility, step_utility, linear_clipped_utility
from deepcomp.util.constants import MIN_UTILITY, MAX_UTILITY, SUPPORTED_UTILITIES
class User:
"""
... | [
"deepcomp.env.util.utility.log_utility",
"random.Random",
"matplotlib.pyplot.Normalize",
"shapely.geometry.Point",
"deepcomp.env.util.utility.step_utility",
"deepcomp.env.util.utility.linear_clipped_utility",
"matplotlib.cm.get_cmap"
] | [((1576, 1591), 'random.Random', 'random.Random', ([], {}), '()\n', (1589, 1591), False, 'import random\n'), ((4099, 4118), 'shapely.geometry.Point', 'Point', (['pos_x', 'pos_y'], {}), '(pos_x, pos_y)\n', (4104, 4118), False, 'from shapely.geometry import Point\n'), ((4832, 4853), 'matplotlib.cm.get_cmap', 'cm.get_cmap... |
import os
from urllib.parse import urlparse
import cv2
from PIL import Image
import numpy
import multiprocessing
import boto3
from botocore import UNSIGNED
from botocore.client import Config
from loguru import logger
class FileHandler:
def __init__(self, local_path, s3_path, download_if_required=True):
se... | [
"PIL.Image.open",
"urllib.parse.urlparse",
"loguru.logger.info",
"os.path.join",
"multiprocessing.cpu_count",
"os.path.isfile",
"multiprocessing.Pool",
"botocore.client.Config",
"cv2.imread"
] | [((733, 773), 'urllib.parse.urlparse', 'urlparse', (['s3_path'], {'allow_fragments': '(False)'}), '(s3_path, allow_fragments=False)\n', (741, 773), False, 'from urllib.parse import urlparse\n'), ((2034, 2069), 'os.path.join', 'os.path.join', (['self.local_path', 'path'], {}), '(self.local_path, path)\n', (2046, 2069), ... |
from typing import TypeVar
import torch
from torch import Tensor
from torch.nn import Module
T = TypeVar("T")
class FactorModel(Module):
"""Factor model.
Attributes:
beta (Tensor): Created after `fit`.
Shape:
- input: :math:`(*, A, T)`
:math:`A` is the number of assets.
... | [
"torch.set_grad_enabled",
"torch.linalg.pinv",
"typing.TypeVar"
] | [((99, 111), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (106, 111), False, 'from typing import TypeVar\n'), ((2579, 2619), 'torch.set_grad_enabled', 'torch.set_grad_enabled', ([], {'mode': 'enable_grad'}), '(mode=enable_grad)\n', (2601, 2619), False, 'import torch\n'), ((2826, 2853), 'torch.linalg.pinv'... |
# coding=utf-8
# Copyright (C) 2020 NumS Development Team.
#
# 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, modif... | [
"os.path.join",
"os.environ.get",
"multiprocessing.cpu_count",
"pathlib.Path"
] | [((1291, 1334), 'os.environ.get', 'os.environ.get', (['"""NUMS_SYSTEM"""', '"""ray-cyclic"""'], {}), "('NUMS_SYSTEM', 'ray-cyclic')\n", (1305, 1334), False, 'import os\n'), ((1478, 1517), 'os.environ.get', 'os.environ.get', (['"""NUMS_COMPUTE"""', '"""numpy"""'], {}), "('NUMS_COMPUTE', 'numpy')\n", (1492, 1517), False,... |
import torch.nn as nn
import torch.nn.functional as F
from fcdd.models.bases import FCDDNet
class FCDD_CNN224_VARK(FCDDNet):
def __init__(self, in_shape, k=3, **kwargs):
assert k % 2 == 1, 'kernel size needs to be uneven'
p = (k - 1) // 2
super().__init__(in_shape, **kwargs)
self.c... | [
"torch.nn.BatchNorm2d"
] | [((415, 463), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', (['(32)'], {'eps': '(0.0001)', 'affine': 'self.bias'}), '(32, eps=0.0001, affine=self.bias)\n', (429, 463), True, 'import torch.nn as nn\n'), ((636, 685), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', (['(128)'], {'eps': '(0.0001)', 'affine': 'self.bias'}), '(128, eps... |
import sched, time
import os
import datetime
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
from sqlConn import con
import asyncio
import pymysql
email_template = []
def send_report(filename=""):
... | [
"smtplib.SMTP",
"email.mime.base.MIMEBase",
"email.mime.text.MIMEText",
"traceback.print_exc",
"sqlConn.con.cursor",
"email.mime.multipart.MIMEMultipart",
"email.encoders.encode_base64",
"sched.scheduler",
"datetime.date.today",
"asyncio.get_event_loop",
"sqlConn.con.commit"
] | [((3773, 3811), 'sched.scheduler', 'sched.scheduler', (['time.time', 'time.sleep'], {}), '(time.time, time.sleep)\n', (3788, 3811), False, 'import sched, time\n'), ((2866, 2878), 'sqlConn.con.cursor', 'con.cursor', ([], {}), '()\n', (2876, 2878), False, 'from sqlConn import con\n'), ((3202, 3214), 'sqlConn.con.commit',... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2022/3/7 23:26
# @Author : 张大鹏
# @Site :
# @File : practice01.py
# @Software: PyCharm
from zdppy_mysql import Mysql
import json
m = Mysql(db="test")
# 查询所有同学的学生编号、学生姓名、选课总数、所有课程的总成绩(没成绩的显示为null)
sql = """
select student.SId,student.Sname,t1.sumscore,t... | [
"zdppy_mysql.Mysql"
] | [((200, 216), 'zdppy_mysql.Mysql', 'Mysql', ([], {'db': '"""test"""'}), "(db='test')\n", (205, 216), False, 'from zdppy_mysql import Mysql\n')] |
"""
Author: michealowen
Last edited: 2019.11.1,Friday
LASSO回归算法,使用波士顿房价数据集
在损失函数中加入L1正则项,后验概率的符合拉普拉斯分布
"""
#encoding=UTF-8
import numpy as np
import pandas as pd
from sklearn import datasets
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
class ridgeRegression:
'''
... | [
"numpy.mean",
"numpy.abs",
"sklearn.model_selection.train_test_split",
"sklearn.datasets.load_boston",
"numpy.dot",
"numpy.std"
] | [((4743, 4756), 'sklearn.datasets.load_boston', 'load_boston', ([], {}), '()\n', (4754, 4756), False, 'from sklearn.datasets import load_boston\n'), ((4817, 4892), 'sklearn.model_selection.train_test_split', 'train_test_split', (['boston.data', 'boston.target'], {'test_size': '(0.1)', 'random_state': '(0)'}), '(boston.... |
from app.create_app import limiter, shortlink
from app.repositories import db
def test_should_return_200(client):
rv = client.get('/')
assert rv.status_code == 200
assert rv.headers['Content-type'] == 'text/html; charset=utf-8'
def test_should_return_redirect_to_home(client):
rv = client.post('/')
... | [
"app.create_app.shortlink.encode",
"app.repositories.db.engine.execute"
] | [((1073, 1111), 'app.repositories.db.engine.execute', 'db.engine.execute', (['"""DROP TABLE pastes"""'], {}), "('DROP TABLE pastes')\n", (1090, 1111), False, 'from app.repositories import db\n'), ((1174, 1221), 'app.repositories.db.engine.execute', 'db.engine.execute', (['"""DROP TABLE alembic_version"""'], {}), "('DRO... |