code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import unittest
import pandas as pd
import supervise
import data
class test_supervise(unittest.TestCase):
# Read in test Datafile
def setUp(self):
self.dataset = 'iris.data'
self.headers = None
self.classcolumn = 4
self.folds = 2
self.data, self.class_data, self.class_c... | [
"unittest.main",
"supervise.multiclass",
"data.create_column_class"
] | [((917, 932), 'unittest.main', 'unittest.main', ([], {}), '()\n', (930, 932), False, 'import unittest\n'), ((328, 398), 'data.create_column_class', 'data.create_column_class', (['self.dataset', 'self.classcolumn', 'self.headers'], {}), '(self.dataset, self.classcolumn, self.headers)\n', (352, 398), False, 'import data\... |
import sqlite3
import os
import logging
log = logging.getLogger(__name__)
def do_migration(db_dir):
log.info("Doing the migration")
migrate_blobs_db(db_dir)
log.info("Migration succeeded")
def migrate_blobs_db(db_dir):
"""
We migrate the blobs.db used in BlobManager to have a "should_announce" ... | [
"os.path.isfile",
"sqlite3.connect",
"os.path.join",
"logging.getLogger"
] | [((47, 74), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (64, 74), False, 'import logging\n'), ((443, 475), 'os.path.join', 'os.path.join', (['db_dir', '"""blobs.db"""'], {}), "(db_dir, 'blobs.db')\n", (455, 475), False, 'import os\n'), ((499, 539), 'os.path.join', 'os.path.join', (['db... |
# -*-: coding utf-8 -*-
""" Helper methods for OS related tasks. """
from getpass import getpass
import os
import platform
import re
import shlex
import subprocess
import urllib2
from snipsmanagercore import pretty_printer as pp
email_regex = r"[^@]+@[^@]+\.[^@]+"
github_url_regex = re.compile(
r... | [
"subprocess.Popen",
"os.remove",
"os.makedirs",
"getpass.getpass",
"snipsmanagercore.pretty_printer.generate_user_input_string",
"subprocess.check_output",
"os.path.exists",
"re.match",
"os.uname",
"subprocess.call",
"platform.system",
"urllib2.urlopen",
"re.compile"
] | [((288, 511), 're.compile', 're.compile', (['"""^(?:http|ftp|git)s?://(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\\\.)+(?:[A-Z]{2,6}\\\\.?|[A-Z0-9-]{2,}\\\\.?)|localhost|\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3})(?::\\\\d+)?(?:/?|[/?]\\\\S+)$"""', 're.IGNORECASE'], {}), "(\n '^(?:http|ftp|git)s?://(?:(... |
'''Physarum simulation example.
See https://sagejenson.com/physarum for the details.'''
import numpy as np
import taichi as ti
ti.init(arch=ti.gpu)
PARTICLE_N = 1024
GRID_SIZE = 512
SENSE_ANGLE = 0.20 * np.pi
SENSE_DIST = 4.0
EVAPORATION = 0.95
MOVE_ANGLE = 0.1 * np.pi
MOVE_STEP = 2.0
grid = ti.field(dtype=ti.f32, ... | [
"taichi.field",
"taichi.GUI",
"taichi.Vector.field",
"taichi.sin",
"taichi.grouped",
"taichi.cos",
"taichi.init",
"taichi.ndrange",
"taichi.random"
] | [((129, 149), 'taichi.init', 'ti.init', ([], {'arch': 'ti.gpu'}), '(arch=ti.gpu)\n', (136, 149), True, 'import taichi as ti\n'), ((297, 352), 'taichi.field', 'ti.field', ([], {'dtype': 'ti.f32', 'shape': '[2, GRID_SIZE, GRID_SIZE]'}), '(dtype=ti.f32, shape=[2, GRID_SIZE, GRID_SIZE])\n', (305, 352), True, 'import taichi... |
from django.shortcuts import render
from rest_framework.decorators import api_view, permission_classes
from rest_framework.permissions import IsAuthenticated, IsAdminUser
from rest_framework.response import Response
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from loans.models import Prod... | [
"core.utils.randomstr",
"loans.models.ProductConfig.objects.filter",
"loans.models.InterestConfig.objects.filter",
"rest_framework.response.Response",
"django.core.paginator.Paginator",
"loans.models.Product.objects.filter",
"rest_framework.decorators.permission_classes",
"rest_framework.decorators.ap... | [((554, 572), 'rest_framework.decorators.api_view', 'api_view', (["['POST']"], {}), "(['POST'])\n", (562, 572), False, 'from rest_framework.decorators import api_view, permission_classes\n'), ((574, 611), 'rest_framework.decorators.permission_classes', 'permission_classes', (['[IsAuthenticated]'], {}), '([IsAuthenticat... |
import os
from drivers import IPHONE_UA
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
def get(driver_path):
if not os.path.exists(driver_path):
raise FileNotFoundError("Could not find phantomjs executable at %s. Download it for your platform ... | [
"selenium.webdriver.PhantomJS",
"os.path.exists"
] | [((493, 568), 'selenium.webdriver.PhantomJS', 'webdriver.PhantomJS', ([], {'desired_capabilities': 'dcap', 'executable_path': 'driver_path'}), '(desired_capabilities=dcap, executable_path=driver_path)\n', (512, 568), False, 'from selenium import webdriver\n'), ((185, 212), 'os.path.exists', 'os.path.exists', (['driver_... |
from aws_cdk import aws_s3 as s3
def base_bucket(construct, **kwargs):
"""
Function that generates an S3 Bucket.
:param construct: Custom construct that will use this function. From the external construct is usually 'self'.
:param kwargs:
:return: S3 Bucket Construct.
"""
bucket_name = con... | [
"aws_cdk.aws_s3.CorsRule",
"aws_cdk.aws_s3.Bucket"
] | [((1053, 1272), 'aws_cdk.aws_s3.Bucket', 's3.Bucket', (['construct'], {'id': 'parsed_bucket_name', 'bucket_name': 'parsed_bucket_name', 'cors': 'cors_settings', 'versioned': 'versioned', 'website_error_document': 'website_error_document', 'website_index_document': 'website_index_document'}), '(construct, id=parsed_buck... |
"""This code generates interactive HTML file with MCTS Tree Visualized"""
import os
from monte_carlo_tree_search.trees.abstract_tree import TreeNode
DATA_DIR = os.path.dirname(os.path.abspath(__file__))
PREAMBLE_FILE = os.path.join(DATA_DIR, 'preamble')
POSTAMBLE_FILE = os.path.join(DATA_DIR, 'postamble')
class Tree... | [
"os.path.abspath",
"os.path.join"
] | [((221, 255), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""preamble"""'], {}), "(DATA_DIR, 'preamble')\n", (233, 255), False, 'import os\n'), ((273, 308), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""postamble"""'], {}), "(DATA_DIR, 'postamble')\n", (285, 308), False, 'import os\n'), ((178, 203), 'os.path.abs... |
import asyncio
from telethon import events
from telethon.errors.rpcerrorlist import MessageDeleteForbiddenError
from telethon.tl.types import ChannelParticipantsAdmins
from YorForger import client, DEV_USERS
# Check if user has admin rights
async def is_administrator(user_id: int, message):
admin = False
a... | [
"YorForger.client.iter_participants",
"telethon.events.NewMessage",
"asyncio.sleep"
] | [((337, 412), 'YorForger.client.iter_participants', 'client.iter_participants', (['message.chat_id'], {'filter': 'ChannelParticipantsAdmins'}), '(message.chat_id, filter=ChannelParticipantsAdmins)\n', (361, 412), False, 'from YorForger import client, DEV_USERS\n'), ((556, 592), 'telethon.events.NewMessage', 'events.New... |
'''
Convert finance statistics: From JSON to CSV.
Update log: (date / version / author : comments)
2018-02-19 / 1.0.0 / <NAME> : Creation
Support Yahoo Finance stock
'''
from collections import OrderedDict
import csv
import getopt
import json
import sys
from time import lo... | [
"json.load",
"getopt.getopt",
"time.time",
"collections.OrderedDict",
"sys.exit",
"csv.DictWriter"
] | [((8474, 8495), 'sys.exit', 'sys.exit', (['__exit_code'], {}), '(__exit_code)\n', (8482, 8495), False, 'import sys\n'), ((1869, 1875), 'time.time', 'time', ([], {}), '()\n', (1873, 1875), False, 'from time import localtime, strftime, time\n'), ((2124, 2176), 'json.load', 'json.load', (['input_file'], {'object_pairs_hoo... |
'''
Script originally for doing dp grads using parameter expansions
'''
import numpy as np
import torch
from torch.autograd import Variable
import sys
from utils import generate_proj_matrix_piece
# clip and accumulate clipped gradients
def acc_scaled_grads(model, C, cum_grads, use_cuda=False):
batch_size = model... | [
"torch.sqrt",
"torch.zeros_like",
"torch.zeros"
] | [((620, 638), 'torch.sqrt', 'torch.sqrt', (['g_norm'], {}), '(g_norm)\n', (630, 638), False, 'import torch\n'), ((358, 381), 'torch.zeros', 'torch.zeros', (['batch_size'], {}), '(batch_size)\n', (369, 381), False, 'import torch\n'), ((1368, 1395), 'torch.zeros_like', 'torch.zeros_like', (['p.grad[0]'], {}), '(p.grad[0]... |
import logging
logger = logging.getLogger(__name__)
class Result:
def __init__(self):
self.ok = True
def ok(self):
return self.ok
class BadResult(Result):
def __init__(self):
super().__init__()
self.ok = False
class Bus:
def __init__(self):
self.handlers =... | [
"logging.getLogger"
] | [((25, 52), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (42, 52), False, 'import logging\n')] |
import currency_converter
def main():
currency_converter.main()
| [
"currency_converter.main"
] | [((44, 69), 'currency_converter.main', 'currency_converter.main', ([], {}), '()\n', (67, 69), False, 'import currency_converter\n')] |
from django.db import models
from django.contrib.auth.models import User
import datetime
# Create your models here.
class Profile(models.Model):
user = models.OneToOneField(User, on_delete = models.CASCADE, default='')
profile_pic = models.ImageField(upload_to = 'media/', default='default.jpg',blank=True)
... | [
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.ImageField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField"
] | [((158, 222), 'django.db.models.OneToOneField', 'models.OneToOneField', (['User'], {'on_delete': 'models.CASCADE', 'default': '""""""'}), "(User, on_delete=models.CASCADE, default='')\n", (178, 222), False, 'from django.db import models\n'), ((243, 315), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload... |
# Generated by Django 2.0 on 2018-04-08 08:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('make_queue', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='reservation3d',
options={'permissio... | [
"django.db.models.TextField",
"django.db.migrations.AlterModelOptions"
] | [((225, 367), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""reservation3d"""', 'options': "{'permissions': (('can_view_reservation_user', 'Can view reservation user'),)}"}), "(name='reservation3d', options={'permissions':\n (('can_view_reservation_user', 'Can view reserv... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import astropy.units as u
from numpy.testing import assert_allclose
from astropy.tests.helper import pytest, assert_quantity_allclose
from ...datasets imp... | [
"numpy.nonzero",
"numpy.testing.assert_allclose",
"astropy.units.Unit"
] | [((1759, 1813), 'numpy.testing.assert_allclose', 'assert_allclose', (['npred_stacked.data', 'npred_summed.data'], {}), '(npred_stacked.data, npred_summed.data)\n', (1774, 1813), False, 'from numpy.testing import assert_allclose\n'), ((1622, 1656), 'numpy.nonzero', 'np.nonzero', (['obs1.on_vector.quality'], {}), '(obs1.... |
import torch
import pyro.ops.jit
from tests.common import assert_equal
def test_varying_len_args():
def fn(*args):
return sum(args)
jit_fn = pyro.ops.jit.trace(fn)
examples = [
[torch.tensor(1.)],
[torch.tensor(2.), torch.tensor(3.)],
[torch.tensor(4.), torch.tensor(5.),... | [
"torch.tensor"
] | [((544, 561), 'torch.tensor', 'torch.tensor', (['(1.0)'], {}), '(1.0)\n', (556, 561), False, 'import torch\n'), ((816, 833), 'torch.tensor', 'torch.tensor', (['(1.0)'], {}), '(1.0)\n', (828, 833), False, 'import torch\n'), ((211, 228), 'torch.tensor', 'torch.tensor', (['(1.0)'], {}), '(1.0)\n', (223, 228), False, 'impo... |
# Generated by Django 3.0.2 on 2020-03-29 18:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hitchhikeapp', '0009_user_ride'),
]
operations = [
migrations.AddField(
model_name='userdata',
name='userId',
... | [
"django.db.models.IntegerField"
] | [((332, 362), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'null': '(True)'}), '(null=True)\n', (351, 362), False, 'from django.db import migrations, models\n')] |
import socket
seeders = [
'satoshi.BitWin24.io',
'satoshi.litemint.com',
'172.16.17.32',
'172.16.31.10',
'192.168.127.12'
]
for seeder in seeders:
try:
ais = socket.getaddrinfo(seeder, 0)
except socket.gaierror:
ais = []
# Prevent duplicates, need to update to che... | [
"socket.getaddrinfo"
] | [((193, 222), 'socket.getaddrinfo', 'socket.getaddrinfo', (['seeder', '(0)'], {}), '(seeder, 0)\n', (211, 222), False, 'import socket\n')] |
#!/usr/bin/python3
from getpass import getpass
import json
import traceback
from uuid import UUID, uuid4
from gmusicapi.clients import Mobileclient
class Song:
def __init__(self, song_id, artist, title, album, in_library = True):
self.id = song_id
self.artist = artist
self.title = title
... | [
"json.dump",
"traceback.print_exc",
"uuid.uuid4",
"getpass.getpass",
"uuid.UUID",
"gmusicapi.clients.Mobileclient"
] | [((789, 803), 'gmusicapi.clients.Mobileclient', 'Mobileclient', ([], {}), '()\n', (801, 803), False, 'from gmusicapi.clients import Mobileclient\n'), ((5457, 5497), 'json.dump', 'json.dump', (['serial', 'json_output'], {'indent': '(2)'}), '(serial, json_output, indent=2)\n', (5466, 5497), False, 'import json\n'), ((562... |
import math
import numpy as np
from parameter import *
if using_salome:
from parameter_salome import *
else:
from parameter_gmsh import *
if workpiece_type_id == 1:
disc_H = 0.01; #same with cutter now
length_scale = disc_R;
#if is_straight_chip:
# mesh_file = meshfolder + "/metal_cut_st... | [
"math.tan",
"math.sin",
"numpy.array",
"math.cos",
"numpy.dot"
] | [((921, 961), 'math.sin', 'math.sin', (['(cutter_angle_v * math.pi / 180)'], {}), '(cutter_angle_v * math.pi / 180)\n', (929, 961), False, 'import math\n'), ((990, 1030), 'math.cos', 'math.cos', (['(cutter_angle_v * math.pi / 180)'], {}), '(cutter_angle_v * math.pi / 180)\n', (998, 1030), False, 'import math\n'), ((129... |
# 16-TaterBot main.py
'''
Created on Mar 13, 2016
@author: Dead Robot Society
'''
import actions as act
import constants as c
from sensors import DEBUG
from servos import moveClaw
def main():
act.init()
#act.disposeOfDirt()
act.goToWestPile()
act.grabWestPile()
act.wiggle()
... | [
"actions.grabWestPile",
"actions.recollectNorthPile",
"servos.moveClaw",
"actions.goToTaterBin",
"sensors.DEBUG",
"actions.grabBin",
"actions.depositWestPile",
"actions.grabNorthPile",
"actions.grabMiddlePile",
"actions.turnToSouth",
"sys.stdout.fileno",
"actions.backUpFromBin",
"actions.wig... | [((216, 226), 'actions.init', 'act.init', ([], {}), '()\n', (224, 226), True, 'import actions as act\n'), ((258, 276), 'actions.goToWestPile', 'act.goToWestPile', ([], {}), '()\n', (274, 276), True, 'import actions as act\n'), ((282, 300), 'actions.grabWestPile', 'act.grabWestPile', ([], {}), '()\n', (298, 300), True, ... |
import torch
import torch.nn.functional as F
from torch import nn
from torch import sigmoid, tanh, relu_
class LockedDropout(nn.Module):
def __init__(self, dropout):
self.dropout = dropout
super().__init__()
def forward(self, x):
if not self.training or not self.dropout:
... | [
"torch.nn.Parameter",
"torch.zeros_like",
"torch.relu_",
"torch.add",
"torch.split",
"torch.nn.functional.dropout",
"torch.mm",
"torch.randn",
"torch.sigmoid",
"torch.nn.Linear",
"torch.nn.LSTM",
"torch.tanh"
] | [((3292, 3325), 'torch.mm', 'torch.mm', (['m_prev', 'self.concat_w_m'], {}), '(m_prev, self.concat_w_m)\n', (3300, 3325), False, 'import torch\n'), ((3350, 3387), 'torch.mm', 'torch.mm', (['input', 'self.concat_w_inputs'], {}), '(input, self.concat_w_inputs)\n', (3358, 3387), False, 'import torch\n'), ((3499, 3544), 't... |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | [
"unittest.main",
"tornado.escape.json_decode"
] | [((7791, 7797), 'unittest.main', 'main', ([], {}), '()\n', (7795, 7797), False, 'from unittest import main\n'), ((2225, 2251), 'tornado.escape.json_decode', 'json_decode', (['response.body'], {}), '(response.body)\n', (2236, 2251), False, 'from tornado.escape import json_decode\n'), ((4223, 4249), 'tornado.escape.json_... |
"""
Example script to show how to use Engine Node health
-get virtual engine or Layer3 firewall
-get health data for each node
-retrieve master engine from virtual engine health
"""
# Python Base Import
from smc import session
from smc.core.engines import Layer3VirtualEngine, Layer3Firewall
from smc.core.waiters impor... | [
"smc.session.login",
"smc.core.waiters.NodeStatusWaiter",
"smc.core.engines.Layer3VirtualEngine",
"smc.session.logout",
"smc.core.engines.Layer3Firewall"
] | [((395, 494), 'smc.session.login', 'session.login', ([], {'url': 'SMC_URL', 'api_key': 'API_KEY', 'verify': '(False)', 'timeout': '(120)', 'api_version': 'API_VERSION'}), '(url=SMC_URL, api_key=API_KEY, verify=False, timeout=120,\n api_version=API_VERSION)\n', (408, 494), False, 'from smc import session\n'), ((543, ... |
import requests
import json
class Client:
def __init__(self, key):
self.key = key
self.base = "https://api.aletheiaapi.com/"
def StockData(self, symbol, summary = False, statistics = False):
url = self.base + f"StockData?key={self.key}&symbol={symbol}"
if summary: url =... | [
"requests.get"
] | [((5129, 5146), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (5141, 5146), False, 'import requests\n'), ((5416, 5451), 'requests.get', 'requests.get', (["(self.base + 'version')"], {}), "(self.base + 'version')\n", (5428, 5451), False, 'import requests\n'), ((5724, 5767), 'requests.get', 'requests.get', ([... |
import pandas as pd
import urllib.parse
import requests
SERVER_URL = "https://npclassifier.ucsd.edu/"
#SERVER_URL = "http://mingwangbeta.ucsd.edu:6541"
def test_heartbeat():
request_url = "{}/model/metadata".format(SERVER_URL)
r = requests.get(request_url)
r.raise_for_status()
def test():
df = ... | [
"pandas.read_csv",
"requests.get"
] | [((242, 267), 'requests.get', 'requests.get', (['request_url'], {}), '(request_url)\n', (254, 267), False, 'import requests\n'), ((320, 352), 'pandas.read_csv', 'pd.read_csv', (['"""test.tsv"""'], {'sep': '""","""'}), "('test.tsv', sep=',')\n", (331, 352), True, 'import pandas as pd\n'), ((580, 605), 'requests.get', 'r... |
import sys
import argparse
import os
import math
import pandas as pd
from matplotlib import pyplot as plt
# Sample command line execution:
# python3.6 Azure-functions-cdf-builder.py --datadir "/home/ubuntu/data/Azure" --figuresdir "/home/ubuntu" --n 12
parser = argparse.ArgumentParser(description = 'Building CDF of A... | [
"pandas.DataFrame",
"matplotlib.pyplot.xlim",
"argparse.ArgumentParser",
"matplotlib.pyplot.ylim",
"pandas.read_csv",
"matplotlib.pyplot.close",
"matplotlib.pyplot.subplots",
"pandas.Series",
"pandas.melt",
"os.path.join",
"sys.exit"
] | [((264, 351), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Building CDF of Azure functions invocations"""'}), "(description=\n 'Building CDF of Azure functions invocations')\n", (287, 351), False, 'import argparse\n'), ((1254, 1324), 'os.path.join', 'os.path.join', (['args.datadir',... |
#!/usr/bin/python3
from pathlib import Path
import sys
import re
pattern = re.compile(r'takenCorrect: (\d+) takenIncorrect: (\d+) notTakenCorrect: (\d+) notTakenIncorrect: (\d+)')
def read_results_file(result_file):
with open(result_file) as f:
result_text = f.read()
m = pattern.match(result_text)
if not m:
... | [
"pathlib.Path",
"sys.exit",
"re.compile"
] | [((76, 194), 're.compile', 're.compile', (['"""takenCorrect: (\\\\d+) takenIncorrect: (\\\\d+) notTakenCorrect: (\\\\d+) notTakenIncorrect: (\\\\d+)"""'], {}), "(\n 'takenCorrect: (\\\\d+) takenIncorrect: (\\\\d+) notTakenCorrect: (\\\\d+) notTakenIncorrect: (\\\\d+)'\n )\n", (86, 194), False, 'import re\n'), (... |
import torch
from acquisition.acquisition_functions import expected_improvement
from acquisition.acquisition_marginalization import acquisition_expectation
import numpy as np
import cma
import time
import scipy.optimize as spo
from functools import partial
def continuous_acquisition_expectation(x_continuous, discre... | [
"numpy.concatenate",
"cma.CMAEvolutionStrategy",
"torch.cat",
"time.time",
"numpy.array",
"acquisition.acquisition_marginalization.acquisition_expectation",
"torch.tensor",
"torch.from_numpy"
] | [((1589, 1600), 'time.time', 'time.time', ([], {}), '()\n', (1598, 1600), False, 'import time\n'), ((1610, 1733), 'cma.CMAEvolutionStrategy', 'cma.CMAEvolutionStrategy', ([], {'x0': 'x_init[objective.num_discrete:]', 'sigma0': '(0.1)', 'inopts': "{'bounds': cont_bounds, 'popsize': 50}"}), "(x0=x_init[objective.num_disc... |
from helpers import *
from collection_api import info, add_game, remove_game, lend_game
from cs50 import SQL
from flask import Flask, jsonify, render_template, request, url_for
from flask_jsglue import JSGlue
from flask_session import Session
from passlib.apps import custom_app_context as pwd_context
from tempfile impo... | [
"flask_jsglue.JSGlue",
"flask.request.form.get",
"json.dumps",
"flask.url_for",
"passlib.apps.custom_app_context.hash",
"collection_api.info",
"flask.request.args.get",
"tempfile.mkdtemp",
"flask.render_template",
"collection_api.lend_game",
"bgg_api.info_games",
"flask_session.Session",
"re... | [((426, 441), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (431, 441), False, 'from flask import Flask, jsonify, render_template, request, url_for\n'), ((442, 453), 'flask_jsglue.JSGlue', 'JSGlue', (['app'], {}), '(app)\n', (448, 453), False, 'from flask_jsglue import JSGlue\n'), ((822, 831), 'tempfile.m... |
import torch.nn as nn
import torch.nn.functional as F
import torch
from transformer.Attention import Attention
class TransformerEncoderLayer(nn.Module):
r"""
Encoder Layer
"""
def __init__(self, d_model, n_heads, dim_feedforward=2048, attention_dropout_rate=0.1, projection_dropout_rate=0.1):
... | [
"torch.nn.Dropout",
"torch.nn.LayerNorm",
"transformer.Attention.Attention",
"torch.nn.Linear"
] | [((393, 414), 'torch.nn.LayerNorm', 'nn.LayerNorm', (['d_model'], {}), '(d_model)\n', (405, 414), True, 'import torch.nn as nn\n'), ((440, 577), 'transformer.Attention.Attention', 'Attention', ([], {'dim': 'd_model', 'num_heads': 'n_heads', 'attn_dropout_rate': 'attention_dropout_rate', 'projection_dropout_rate': 'proj... |
""""
This is the main module for the CKAN-WIT.
It first imports the necessary packages from within python and its environs.
"""
import logging
import aiohttp
import asyncio
import requests
from urllib.error import URLError
from ckan_wit.src import uris
from ckan_wit.src import proxies
logger = logging.getLogg... | [
"asyncio.gather",
"ckan_wit.src.proxies.ProxySetting",
"logging.FileHandler",
"asyncio.sleep",
"asyncio.set_event_loop",
"logging.getLogger",
"logging.Formatter",
"aiohttp.ClientSession",
"requests.get",
"asyncio.new_event_loop"
] | [((305, 332), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (322, 332), False, 'import logging\n'), ((375, 504), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s: %(levelname)-5s: \n\t\t\t%(message)s: \n\t\t\t%(pathname)s: \n\t\t\t%(module)s: %(funcName)s\n"""'], {}), '(\n ... |
import collections
import logging
from pathlib import Path
import re
from unidecode import unidecode
from itertools import groupby
__all__ = [
"flatten",
"PROJECT_ROOT",
"FILE_NAME_CLEANER",
"DUPE_SPECIAL_CHARS",
"sanitize_name",
"all_equal"
]
logger = logging.getLogger(__name__)
PROJECT_ROOT ... | [
"unidecode.unidecode",
"pathlib.Path",
"itertools.groupby",
"logging.getLogger",
"re.compile"
] | [((278, 305), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (295, 305), False, 'import logging\n'), ((391, 411), 're.compile', 're.compile', (['"""[^\\\\w]"""'], {}), "('[^\\\\w]')\n", (401, 411), False, 'import re\n'), ((433, 468), 're.compile', 're.compile', (['"""([_\\\\.\\\\-])[_\\\\... |
# -*- coding: utf-8 -*-
#
# Copyright 2015 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
"tempfile.NamedTemporaryFile",
"invoice.invoice_main.invoice_main",
"tempfile.TemporaryDirectory",
"os.makedirs",
"invoice.log.get_null_logger",
"os.path.dirname",
"invoice.string_printer.StringPrinter",
"os.path.join"
] | [((1546, 1563), 'invoice.log.get_null_logger', 'get_null_logger', ([], {}), '()\n', (1561, 1563), False, 'from invoice.log import get_null_logger\n'), ((1659, 1688), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {}), '()\n', (1686, 1688), False, 'import tempfile\n'), ((1721, 1751), 'os.path.join', ... |
#!/usr/bin/python3
import logging
import sys
from pathlib import Path
from logging.handlers import RotatingFileHandler
from minerwatch import (
DictConfig, Manager, ManagerConfig,
Dispatcher, DispatcherConfig,
EtherMineAPIProber, ProberConfig
)
class Defaults:
config_path = Path.home().joinpath('.co... | [
"logging.error",
"minerwatch.ManagerConfig",
"argparse.ArgumentParser",
"logging.basicConfig",
"pathlib.Path.home",
"minerwatch.ProberConfig",
"logging.StreamHandler",
"pathlib.Path",
"minerwatch.DispatcherConfig",
"logging.handlers.RotatingFileHandler"
] | [((1211, 1239), 'argparse.ArgumentParser', 'ArgumentParser', (['"""MinerWatch"""'], {}), "('MinerWatch')\n", (1225, 1239), False, 'from argparse import ArgumentParser\n'), ((3933, 4093), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""', 'datefmt'... |
from tuprolog import logger
# noinspection PyUnresolvedReferences
import jpype.imports
# noinspection PyUnresolvedReferences
import it.unibo.tuprolog.solve.library.exception as _exception
AlreadyLoadedLibraryException = _exception.AlreadyLoadedLibraryException
LibraryException = _exception.LibraryException
NoSuchAL... | [
"tuprolog.logger.debug"
] | [((375, 463), 'tuprolog.logger.debug', 'logger.debug', (['"""Loaded JVM classes from it.unibo.tuprolog.solve.library.exception.*"""'], {}), "(\n 'Loaded JVM classes from it.unibo.tuprolog.solve.library.exception.*')\n", (387, 463), False, 'from tuprolog import logger\n')] |
import os
import math
import numpy as np
from PIL import Image
import skimage.transform as trans
import cv2
import torch
from data import dataset_info
from data.base_dataset import BaseDataset
import util.util as util
dataset_info = dataset_info()
class AllFaceDataset(BaseDataset):
@staticmethod
def modify_co... | [
"data.dataset_info",
"os.path.basename",
"cv2.cvtColor",
"numpy.frombuffer",
"math.ceil",
"cv2.imdecode",
"skimage.transform.SimilarityTransform",
"data.dataset_info.get_dataset",
"cv2.warpAffine",
"numpy.random.randint",
"numpy.array",
"cv2.imread",
"os.path.splitext",
"os.path.join",
"... | [((234, 248), 'data.dataset_info', 'dataset_info', ([], {}), '()\n', (246, 248), False, 'from data import dataset_info\n'), ((610, 648), 'numpy.frombuffer', 'np.frombuffer', (['img_str'], {'dtype': 'np.uint8'}), '(img_str, dtype=np.uint8)\n', (623, 648), True, 'import numpy as np\n'), ((664, 705), 'cv2.imdecode', 'cv2.... |
'''
Created on 25 Jan 2018
@author: Slaporter
'''
import platform
def get_platform_info():
return (platform.platform())
if __name__ == '__main__':
get_platform_info() | [
"platform.platform"
] | [((105, 124), 'platform.platform', 'platform.platform', ([], {}), '()\n', (122, 124), False, 'import platform\n')] |
from bs4 import BeautifulSoup as bs
import os
import pandas as pd
import re
import csv
import io
result = {}
new = {}
id = 0
'''
result = {id:{'title':' ', 'abstract':' ', 'key_wordsZ':{'a','b','c'}, 'key_wordsE':{'a','b','c'},'authors': {'author1'} }}
'''
p = os.walk('知网html') # html文件夹路径
output_route = '../outpu... | [
"bs4.BeautifulSoup",
"os.walk",
"csv.writer",
"io.open"
] | [((265, 282), 'os.walk', 'os.walk', (['"""知网html"""'], {}), "('知网html')\n", (272, 282), False, 'import os\n'), ((417, 436), 'csv.writer', 'csv.writer', (['csvfile'], {}), '(csvfile)\n', (427, 436), False, 'import csv\n'), ((574, 593), 'csv.writer', 'csv.writer', (['csvfile'], {}), '(csvfile)\n', (584, 593), False, 'imp... |
from django.conf.urls import url
from djexperience.core.views import home, about
urlpatterns = [
url(r'^$', home, name='home'),
url(r'^about/$', about, name='about'),
]
| [
"django.conf.urls.url"
] | [((103, 131), 'django.conf.urls.url', 'url', (['"""^$"""', 'home'], {'name': '"""home"""'}), "('^$', home, name='home')\n", (106, 131), False, 'from django.conf.urls import url\n'), ((138, 174), 'django.conf.urls.url', 'url', (['"""^about/$"""', 'about'], {'name': '"""about"""'}), "('^about/$', about, name='about')\n",... |
# _*_ coding: utf-8 _*_
"""
Created by Allen7D on 2020/4/13.
"""
from app import create_app
from tests.utils import get_authorization
__author__ = 'Allen7D'
app = create_app()
def test_create_auth_list():
with app.test_client() as client:
rv = client.post('/cms/auth/append', headers={
'Aut... | [
"app.create_app",
"tests.utils.get_authorization"
] | [((167, 179), 'app.create_app', 'create_app', ([], {}), '()\n', (177, 179), False, 'from app import create_app\n'), ((333, 352), 'tests.utils.get_authorization', 'get_authorization', ([], {}), '()\n', (350, 352), False, 'from tests.utils import get_authorization\n'), ((655, 674), 'tests.utils.get_authorization', 'get_a... |
"""
Demonstrates title normalization and parsing.
"""
import sys
import os
sys.path.insert(0, os.path.abspath(os.getcwd()))
from mw.api import Session
from mw.lib import title
# Normalize titles
title.normalize("foo bar")
# > "Foo_bar"
# Construct a title parser from the API
api_session = Session("https://en.wikipe... | [
"os.getcwd",
"mw.lib.title.normalize",
"mw.api.Session",
"mw.lib.title.Parser.from_api"
] | [((198, 224), 'mw.lib.title.normalize', 'title.normalize', (['"""foo bar"""'], {}), "('foo bar')\n", (213, 224), False, 'from mw.lib import title\n'), ((294, 339), 'mw.api.Session', 'Session', (['"""https://en.wikipedia.org/w/api.php"""'], {}), "('https://en.wikipedia.org/w/api.php')\n", (301, 339), False, 'from mw.api... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | [
"airflow.operators.bash_operator.BashOperator",
"datetime.timedelta",
"datetime.datetime.today",
"datetime.datetime.min.time"
] | [((827, 855), 'datetime.datetime.min.time', 'datetime.datetime.min.time', ([], {}), '()\n', (853, 855), False, 'import datetime\n'), ((1231, 1350), 'airflow.operators.bash_operator.BashOperator', 'bash_operator.BashOperator', ([], {'task_id': '"""run_python2"""', 'bash_command': '"""python2 /home/airflow/gcs/data/pytho... |
import logging
from .field_parser import parse_field_row
from .parse_exception import ExcelParseException
LOGGER = logging.getLogger(__name__)
def is_empty_row(row):
if row[0].value == "":
return True
return False
def is_field_row(row):
"""
row: xlrd row object.
"""
if row[2].... | [
"logging.getLogger"
] | [((118, 145), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (135, 145), False, 'import logging\n')] |
#
# Copyright (C) 2019 Authlete, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"authlete.django.web.response_utility.ResponseUtility.location",
"authlete.django.web.response_utility.ResponseUtility.badRequest",
"authlete.django.web.response_utility.ResponseUtility.internalServerError",
"authlete.django.web.response_utility.ResponseUtility.okHtml"
] | [((2413, 2457), 'authlete.django.web.response_utility.ResponseUtility.internalServerError', 'ResponseUtility.internalServerError', (['content'], {}), '(content)\n', (2448, 2457), False, 'from authlete.django.web.response_utility import ResponseUtility\n'), ((2563, 2598), 'authlete.django.web.response_utility.ResponseUt... |
# MIT License
#
# Copyright (c) 2020 - Present nxtlo
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, mer... | [
"typing.TypeVar"
] | [((1200, 1236), 'typing.TypeVar', 'typing.TypeVar', (['"""_T"""'], {'covariant': '(True)'}), "('_T', covariant=True)\n", (1214, 1236), False, 'import typing\n')] |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
from torch.autograd import Variable
from .lazy_variable import LazyVariable
from .non_lazy_variable import NonLazyVariable
def _inner_repeat(tensor, amt):
... | [
"torch.arange"
] | [((2150, 2201), 'torch.arange', 'torch.arange', (['(0)', 'inner_size'], {'out': 'inner_indices.data'}), '(0, inner_size, out=inner_indices.data)\n', (2162, 2201), False, 'import torch\n'), ((2974, 3025), 'torch.arange', 'torch.arange', (['(0)', 'inner_size'], {'out': 'inner_indices.data'}), '(0, inner_size, out=inner_i... |
"""
We are given two sentences A and B. (A sentence is a string of space separated words.
Each word consists only of lowercase letters.) A word is uncommon if it appears exactly
once in one of the sentences, and does not appear in the other sentence. Return a list
of all uncommon words. You may return the list in any... | [
"collections.Counter"
] | [((538, 550), 'collections.Counter', 'Counter', (['tmp'], {}), '(tmp)\n', (545, 550), False, 'from collections import Counter\n')] |
#!/bin/python3
import os
import sys
from collections import deque
LOCAL_INPUT = "ON"
class CitiesAndRoads:
def __init__(self):
self.nodesToEdges = {}
def addNode(self, nodeId):
self.nodesToEdges[nodeId] = set()
def addEdge(self, startNodeId, endNodeId):
self.nodesToEdges[start... | [
"collections.deque"
] | [((417, 424), 'collections.deque', 'deque', ([], {}), '()\n', (422, 424), False, 'from collections import deque\n')] |
# coding: utf-8
# @Author: oliver
# @Date: 2019-07-29 19:14:22
import re
import math
import torch
import logging
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
from copy import deepcopy
from adaptive_avgmax_pool import SelectAdaptivePool2d
from mixed_conv2d import se... | [
"torch.nn.init.constant_",
"torch.nn.init.kaiming_normal_",
"torch.utils.model_zoo.load_url",
"logging.warning",
"mixed_conv2d.select_conv2d",
"copy.deepcopy",
"re.split",
"math.sqrt",
"math.ceil",
"torch.nn.Conv2d",
"torch.nn.BatchNorm2d",
"torch.nn.init.kaiming_uniform_",
"torch.nn.ReLU",
... | [((30192, 30230), 'torch.utils.model_zoo.load_url', 'model_zoo.load_url', (["default_cfg['url']"], {}), "(default_cfg['url'])\n", (30210, 30230), True, 'import torch.utils.model_zoo as model_zoo\n'), ((6521, 6561), 'math.ceil', 'math.ceil', (['(num_repeat * depth_multiplier)'], {}), '(num_repeat * depth_multiplier)\n',... |
# -*- coding: utf-8 -*-
"""
Read gslib file format
Created on Wen Sep 5th 2018
"""
from __future__ import absolute_import, division, print_function
__author__ = "yuhao"
import numpy as np
import pandas as pd
from scipy.spatial.distance import pdist
from mpl_toolkits.mplot3d import Axes3D
class SpatialData(object):... | [
"pandas.read_csv",
"numpy.sort",
"numpy.histogram",
"numpy.median"
] | [((955, 1046), 'pandas.read_csv', 'pd.read_csv', (['self.datafl'], {'sep': '"""\t"""', 'header': 'None', 'names': 'column_name', 'skiprows': '(ncols + 2)'}), "(self.datafl, sep='\\t', header=None, names=column_name, skiprows\n =ncols + 2)\n", (966, 1046), True, 'import pandas as pd\n'), ((1542, 1597), 'numpy.histogr... |
import urllib3
import json
def ETRI_POS_Tagging(text) :
openApiURL = "http://aiopen.etri.re.kr:8000/WiseNLU"
accessKey = "14af2341-2fde-40f3-a0b9-b724fa029380"
analysisCode = "morp"
requestJson = {
"access_key": accessKey,
"argument": {
"text": text,
"analysis_co... | [
"urllib3.PoolManager",
"json.dumps"
] | [((365, 386), 'urllib3.PoolManager', 'urllib3.PoolManager', ([], {}), '()\n', (384, 386), False, 'import urllib3\n'), ((534, 557), 'json.dumps', 'json.dumps', (['requestJson'], {}), '(requestJson)\n', (544, 557), False, 'import json\n')] |
import random
from tqdm import tqdm
from Crypto.Util.number import *
for seed in tqdm(range(10000000)):
random.seed(seed)
toBreak = False
for i in range(19):
random.seed(random.random())
seedtosave = random.random()
for add in range(0, 1000):
random.seed(seedtosave+add)
... | [
"random.random",
"random.seed"
] | [((110, 127), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (121, 127), False, 'import random\n'), ((228, 243), 'random.random', 'random.random', ([], {}), '()\n', (241, 243), False, 'import random\n'), ((706, 729), 'random.seed', 'random.seed', (['seedtosave'], {}), '(seedtosave)\n', (717, 729), False, 'im... |
#twitterclient
import twitter
from configuration import configuration
class twitterclient:
def __init__(self):
config = configuration("config.ini")
self.api = twitter.Api(consumer_key=config.getTwitterConsumerKey(),
consumer_secret=config.getTwitterConsumerSecret(),
... | [
"configuration.configuration"
] | [((135, 162), 'configuration.configuration', 'configuration', (['"""config.ini"""'], {}), "('config.ini')\n", (148, 162), False, 'from configuration import configuration\n')] |
from enrichmentmanager.models import EnrichmentSignup, EnrichmentOption
from enrichmentmanager.lib import canEditSignup
from io import StringIO
from datetime import date
from django import template
register = template.Library()
@register.assignment_tag(takes_context=True)
def select_for(context, slot, student):
... | [
"django.template.Library",
"io.StringIO",
"enrichmentmanager.models.EnrichmentSignup.objects.get",
"enrichmentmanager.lib.canEditSignup",
"enrichmentmanager.models.EnrichmentOption.objects.get"
] | [((212, 230), 'django.template.Library', 'template.Library', ([], {}), '()\n', (228, 230), False, 'from django import template\n'), ((454, 504), 'enrichmentmanager.lib.canEditSignup', 'canEditSignup', (['context.request.user', 'slot', 'student'], {}), '(context.request.user, slot, student)\n', (467, 504), False, 'from ... |
"""
testing module knmi_rain from acequia
"""
import acequia as aq
def hdr(msg):
print()
print('#','-'*50)
print(msg)
print('#','-'*50)
print()
if __name__ == '__main__':
hdr('# read valid file')
srcpath = r'.\testdata\knmi\neerslaggeg_EENRUM_154.txt'
prc = aq.KnmiRain(srcpath)
... | [
"acequia.KnmiRain"
] | [((297, 317), 'acequia.KnmiRain', 'aq.KnmiRain', (['srcpath'], {}), '(srcpath)\n', (308, 317), True, 'import acequia as aq\n'), ((438, 458), 'acequia.KnmiRain', 'aq.KnmiRain', (['"""dummy"""'], {}), "('dummy')\n", (449, 458), True, 'import acequia as aq\n')] |
from django.conf.urls import url, include
from rest_framework_jwt.views import obtain_jwt_token
from accounts.views import (
UserCreateView,
)
app_name = 'accounts'
urlpatterns = [
url(r'^register/$',UserCreateView.as_view(),name='accounts'),
url(r'^home/login/token/$',obtain_jwt_token),
]
| [
"accounts.views.UserCreateView.as_view",
"django.conf.urls.url"
] | [((249, 293), 'django.conf.urls.url', 'url', (['"""^home/login/token/$"""', 'obtain_jwt_token'], {}), "('^home/login/token/$', obtain_jwt_token)\n", (252, 293), False, 'from django.conf.urls import url, include\n'), ((205, 229), 'accounts.views.UserCreateView.as_view', 'UserCreateView.as_view', ([], {}), '()\n', (227, ... |
import os
import shutil
import send2trash
import tkinter
import tkinter.filedialog
definitions=['.zip','.tar','.rar']
cur_dir='C:\\Users\\Zombie\\Downloads'
#processedobjects
compressedlist=list()
extractedfolders=list()
cur_dir = tkinter.filedialog.askdirectory(initialdir="/",title='Please select a dir... | [
"os.path.basename",
"os.path.isdir",
"tkinter.filedialog.askdirectory",
"send2trash.send2trash",
"os.path.splitext",
"os.listdir"
] | [((247, 334), 'tkinter.filedialog.askdirectory', 'tkinter.filedialog.askdirectory', ([], {'initialdir': '"""/"""', 'title': '"""Please select a directory"""'}), "(initialdir='/', title=\n 'Please select a directory')\n", (278, 334), False, 'import tkinter\n'), ((721, 739), 'os.listdir', 'os.listdir', (['folder'], {}... |
import logging
import traceback
from collections import namedtuple
from copy import deepcopy
from datetime import datetime, timedelta
from functools import lru_cache, partial
import pytz
import requests
from django.db import transaction
from django.utils.dateparse import parse_time
from django.utils.timezone import no... | [
"datetime.datetime.utcnow",
"events.models.DataSource.objects.get",
"django.utils.timezone.now",
"events.models.DataSource.objects.get_or_create",
"datetime.datetime.utcfromtimestamp",
"datetime.timedelta",
"traceback.format_exc",
"requests.get",
"events.importer.util.clean_text",
"functools.parti... | [((705, 732), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (722, 732), False, 'import logging\n'), ((813, 845), 'pytz.timezone', 'pytz.timezone', (['"""Europe/Helsinki"""'], {}), "('Europe/Helsinki')\n", (826, 845), False, 'import pytz\n'), ((1329, 1378), 'collections.namedtuple', 'name... |
import tweepy
from textblob import TextBlob
# Twitter API variables
con_key = ""
con_secret = ""
access_token = ""
access_token_secret = ""
auth = tweepy.OAuthHandler(con_key, con_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
search_term = input("Enter term to analyse:\n")... | [
"tweepy.OAuthHandler",
"tweepy.API",
"textblob.TextBlob"
] | [((149, 189), 'tweepy.OAuthHandler', 'tweepy.OAuthHandler', (['con_key', 'con_secret'], {}), '(con_key, con_secret)\n', (168, 189), False, 'import tweepy\n'), ((254, 270), 'tweepy.API', 'tweepy.API', (['auth'], {}), '(auth)\n', (264, 270), False, 'import tweepy\n'), ((425, 445), 'textblob.TextBlob', 'TextBlob', (['twee... |
from flask import render_template
from urllib import error
# @app.errorhandler(404)
from app.main import main
@main.app_errorhandler(404)
def page_not_found(error):
return render_template('404_page.html'), 404
@main.app_errorhandler(error.HTTPError)
def http_error(error):
return render_template('404_page.... | [
"flask.render_template",
"app.main.main.app_errorhandler"
] | [((115, 141), 'app.main.main.app_errorhandler', 'main.app_errorhandler', (['(404)'], {}), '(404)\n', (136, 141), False, 'from app.main import main\n'), ((221, 259), 'app.main.main.app_errorhandler', 'main.app_errorhandler', (['error.HTTPError'], {}), '(error.HTTPError)\n', (242, 259), False, 'from app.main import main\... |
from UdonPie import GameObject
from UdonPie import Transform
this_trans = Transform()
this_gameObj = GameObject()
Void = None
def instantiate(arg1):
'''
:param arg1: GameObject
:type arg1: GameObject
'''
pass
| [
"UdonPie.Transform",
"UdonPie.GameObject"
] | [((75, 86), 'UdonPie.Transform', 'Transform', ([], {}), '()\n', (84, 86), False, 'from UdonPie import Transform\n'), ((102, 114), 'UdonPie.GameObject', 'GameObject', ([], {}), '()\n', (112, 114), False, 'from UdonPie import GameObject\n')] |
# 数据处理
# pickle是一个将任意复杂的对象转成对象的文本或二进制表示的过程
# 也可以将这些字符串、文件或任何类似于文件的对象 unpickle 成原来的对象
import pickle
import os
import random
import numpy as np
# 标签字典
tag2label = {"O": 0,
"B-PER": 1, "I-PER": 2,
"B-LOC": 3, "I-LOC": 4,
"B-ORG": 5, "I-ORG": 6
}
def read_corpus(corpu... | [
"pickle.dump",
"random.shuffle",
"numpy.float32",
"pickle.load",
"os.path.join"
] | [((2661, 2685), 'os.path.join', 'os.path.join', (['vocab_path'], {}), '(vocab_path)\n', (2673, 2685), False, 'import os\n'), ((3015, 3040), 'numpy.float32', 'np.float32', (['embedding_mat'], {}), '(embedding_mat)\n', (3025, 3040), True, 'import numpy as np\n'), ((2085, 2109), 'pickle.dump', 'pickle.dump', (['word2id', ... |
import pytorch_lightning as pl
import torch
from torch.utils.data import random_split
from torch_geometric import datasets
from torch_geometric.data import DataLoader
from src.settings.paths import CLEANED_DATA_PATH, NOT_CLEANED_DATA_PATH
class MUTANGDataModule(pl.LightningDataModule):
def __init__(
self... | [
"torch_geometric.datasets.TUDataset",
"torch.manual_seed",
"torch_geometric.data.DataLoader"
] | [((940, 1089), 'torch_geometric.datasets.TUDataset', 'datasets.TUDataset', ([], {'root': '(CLEANED_DATA_PATH if self.cleaned else NOT_CLEANED_DATA_PATH)', 'name': '"""MUTAG"""', 'cleaned': 'self.cleaned', 'pre_transform': 'None'}), "(root=CLEANED_DATA_PATH if self.cleaned else\n NOT_CLEANED_DATA_PATH, name='MUTAG', ... |
from os import getcwd
from typing import Tuple
from prompt_toolkit import prompt
from figcli.commands.config_context import ConfigContext
from figcli.commands.types.config import ConfigCommand
from figcli.io.input import Input
from figcli.svcs.observability.anonymous_usage_tracker import AnonymousUsageTracker
from fi... | [
"os.getcwd",
"prompt_toolkit.prompt",
"figcli.io.input.Input.input"
] | [((1804, 1920), 'figcli.io.input.Input.input', 'Input.input', (['f"""Please select a new service name, it CANNOT be: {service_name}: """'], {'default': 'new_service_name'}), "(\n f'Please select a new service name, it CANNOT be: {service_name}: ',\n default=new_service_name)\n", (1815, 1920), False, 'from figcl... |
""" Used for training hyperparameters and running multiple simulations """
import time
from threading import Thread
from ai import simulate, show
# # Tuning parameters and weights
# MAX_DEPTH = 4
# EMPTY_TILE_POINTS = 12
# SMOOTHNESS_WEIGHT = 30
# EDGE_WEIGHT = 30
# LOSS_PENALTY = -200000
# MONOTONICITY_POWER = 3.0
#... | [
"threading.Thread",
"ai.simulate",
"ai.show",
"time.clock"
] | [((823, 833), 'ai.simulate', 'simulate', ([], {}), '()\n', (831, 833), False, 'from ai import simulate, show\n'), ((1100, 1112), 'time.clock', 'time.clock', ([], {}), '()\n', (1110, 1112), False, 'import time\n'), ((1424, 1461), 'ai.show', 'show', (['best_board'], {'show_best_tile': '(True)'}), '(best_board, show_best_... |
"""
Custom metric for mxnet
"""
__author__ = 'bshang'
from sklearn.metrics import f1_score
from sklearn import preprocessing
def f1(label, pred):
""" Custom evaluation metric on F1.
"""
pred_bin = preprocessing.binarize(pred, threshold=0.5)
score = f1_score(label, pred_bin, average='micro')
retur... | [
"sklearn.metrics.f1_score",
"sklearn.preprocessing.binarize"
] | [((212, 255), 'sklearn.preprocessing.binarize', 'preprocessing.binarize', (['pred'], {'threshold': '(0.5)'}), '(pred, threshold=0.5)\n', (234, 255), False, 'from sklearn import preprocessing\n'), ((268, 310), 'sklearn.metrics.f1_score', 'f1_score', (['label', 'pred_bin'], {'average': '"""micro"""'}), "(label, pred_bin,... |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test mandatory coinbase feature"""
from binascii import b2a_hex
from test_framework.blocktools import... | [
"test_framework.messages.CBlock",
"binascii.b2a_hex",
"test_framework.script.CScript",
"test_framework.messages.CTxOut",
"test_framework.messages.CTxOutValue",
"test_framework.util.assert_equal"
] | [((1064, 1089), 'test_framework.util.assert_equal', 'assert_equal', (['rsp', 'expect'], {}), '(rsp, expect)\n', (1076, 1089), False, 'from test_framework.util import assert_equal, assert_raises_rpc_error\n'), ((2534, 2542), 'test_framework.messages.CBlock', 'CBlock', ([], {}), '()\n', (2540, 2542), False, 'from test_fr... |
# Copyright 2019 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.
"""Sanity checking for grd_helper.py. Run manually before uploading a CL."""
import io
import os
import subprocess
import sys
# Add the parent dir so that w... | [
"sys.platform.startswith",
"os.path.abspath",
"os.path.join",
"os.path.realpath",
"helper.grd_helper.GetGrdpMessagesFromString",
"subprocess.check_output",
"os.path.dirname",
"io.open",
"helper.translation_helper.get_translatable_grds"
] | [((500, 530), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (523, 530), False, 'import sys\n'), ((648, 674), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (664, 674), False, 'import os\n'), ((705, 741), 'os.path.join', 'os.path.join', (['here', '""... |
# Author: <NAME> <<EMAIL>>
# License: MIT
from copy import deepcopy
from collections import defaultdict
import numpy as np
import pandas as pd
from wittgenstein.base_functions import truncstr
from wittgenstein.utils import rnd
class BinTransformer:
def __init__(self, n_discretize_bins=10, names_precision=2, ver... | [
"copy.deepcopy",
"pandas.Interval",
"collections.defaultdict",
"pandas.cut",
"pandas.IntervalIndex",
"pandas.qcut"
] | [((5448, 5472), 'pandas.Interval', 'pd.Interval', (['floor', 'ceil'], {}), '(floor, ceil)\n', (5459, 5472), True, 'import pandas as pd\n'), ((8422, 8439), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (8433, 8439), False, 'from collections import defaultdict\n'), ((2136, 2234), 'pandas.qcut', 'p... |
from collections import defaultdict
from aoc.util import load_example, load_input
def prepare_map(lines):
result = defaultdict(lambda: ".")
for y, line in enumerate(lines):
for x, c in enumerate(line):
if c == "#":
result[x, y] = "#"
return result, (len(lines) - 1) // ... | [
"collections.defaultdict",
"aoc.util.load_input"
] | [((122, 147), 'collections.defaultdict', 'defaultdict', (["(lambda : '.')"], {}), "(lambda : '.')\n", (133, 147), False, 'from collections import defaultdict\n'), ((2038, 2070), 'aoc.util.load_input', 'load_input', (['__file__', '(2017)', '"""22"""'], {}), "(__file__, 2017, '22')\n", (2048, 2070), False, 'from aoc.util... |
#!/usr/bin/env python3
from aws_cdk import App
from lambda_sqs_cdk.lambda_sqs_cdk_stack import LambdaSqsCdkStack
app = App()
LambdaSqsCdkStack(app, "LambdaSqsCdkStack")
app.synth()
| [
"aws_cdk.App",
"lambda_sqs_cdk.lambda_sqs_cdk_stack.LambdaSqsCdkStack"
] | [((122, 127), 'aws_cdk.App', 'App', ([], {}), '()\n', (125, 127), False, 'from aws_cdk import App\n'), ((128, 171), 'lambda_sqs_cdk.lambda_sqs_cdk_stack.LambdaSqsCdkStack', 'LambdaSqsCdkStack', (['app', '"""LambdaSqsCdkStack"""'], {}), "(app, 'LambdaSqsCdkStack')\n", (145, 171), False, 'from lambda_sqs_cdk.lambda_sqs_c... |
# Generated by Django 3.2 on 2021-04-22 17:14
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('info', '0015_attendancerange'),
]
operations = [
migrations.AlterModelOptions(
name='attendanceclass',
options={'verbose_name'... | [
"django.db.migrations.AlterModelOptions"
] | [((219, 353), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""attendanceclass"""', 'options': "{'verbose_name': 'Attendance', 'verbose_name_plural': 'Attendance'}"}), "(name='attendanceclass', options={\n 'verbose_name': 'Attendance', 'verbose_name_plural': 'Attendance'})\... |
import cv2
import numpy as np
import argparse
# we are not going to bother with objects less than 30% probability
THRESHOLD = 0.3
# the lower the value: the fewer bounding boxes will remain
SUPPRESSION_THRESHOLD = 0.3
YOLO_IMAGE_SIZE = 320
DATA_FOLDER = './data/'
CFG_FOLDER = './cfg/'
MODEL_FOLDER = './mo... | [
"cv2.putText",
"cv2.dnn.NMSBoxes",
"argparse.ArgumentParser",
"numpy.argmax",
"cv2.waitKey",
"cv2.dnn.blobFromImage",
"cv2.imshow",
"cv2.dnn.readNetFromDarknet",
"cv2.VideoCapture",
"cv2.rectangle",
"cv2.destroyAllWindows"
] | [((2191, 2288), 'cv2.dnn.NMSBoxes', 'cv2.dnn.NMSBoxes', (['bounding_box_locations', 'confidence_values', 'THRESHOLD', 'SUPPRESSION_THRESHOLD'], {}), '(bounding_box_locations, confidence_values, THRESHOLD,\n SUPPRESSION_THRESHOLD)\n', (2207, 2288), False, 'import cv2\n'), ((4244, 4269), 'argparse.ArgumentParser', 'ar... |
import torch
import pykitti
from torch.utils.data import Dataset
from torchvision.utils import make_grid
import torchvision.transforms.functional as TF
import matplotlib.pyplot as plt
def transform_stereo_lidar(samples):
for k in samples:
samples[k] = TF.to_tensor(samples[k])
return samples
class Ki... | [
"torch.is_tensor",
"torchvision.transforms.functional.to_tensor",
"pykitti.raw"
] | [((266, 290), 'torchvision.transforms.functional.to_tensor', 'TF.to_tensor', (['samples[k]'], {}), '(samples[k])\n', (278, 290), True, 'import torchvision.transforms.functional as TF\n'), ((610, 643), 'pykitti.raw', 'pykitti.raw', (['basedir', 'date', 'drive'], {}), '(basedir, date, drive)\n', (621, 643), False, 'impor... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | [
"pydot.Node",
"pydot.Dot",
"threading.Lock",
"collections.defaultdict",
"pydot.Edge"
] | [((1584, 1600), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (1598, 1600), False, 'import threading\n'), ((1721, 1750), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (1744, 1750), False, 'import collections\n'), ((3139, 3168), 'collections.defaultdict', 'collections.defaultd... |
"""Flask service to predict the adaptive card json from the card design"""
import os
import logging
from logging.handlers import RotatingFileHandler
from flask import Flask
from flask_cors import CORS
from flask_restplus import Api
from mystique.utils import load_od_instance
from . import resources as res
from mystiqu... | [
"flask_restplus.Api",
"flask_cors.CORS",
"flask.Flask",
"logging.Formatter",
"mystique.utils.load_od_instance",
"logging.handlers.RotatingFileHandler",
"logging.getLogger"
] | [((346, 375), 'logging.getLogger', 'logging.getLogger', (['"""mysitque"""'], {}), "('mysitque')\n", (363, 375), False, 'import logging\n'), ((493, 580), 'logging.handlers.RotatingFileHandler', 'RotatingFileHandler', (['"""mystique_app.log"""'], {'maxBytes': '(1024 * 1024 * 100)', 'backupCount': '(20)'}), "('mystique_ap... |
"""
This module contains updates used with the `hic2cool update` command.
See usage in hic2cool.hic2cool_utils.hic2cool_update
"""
from __future__ import (
absolute_import,
division,
print_function,
unicode_literals
)
import h5py
from .hic2cool_config import *
def prepare_hic2cool_updates(version_nums... | [
"h5py.File"
] | [((3495, 3515), 'h5py.File', 'h5py.File', (['writefile'], {}), '(writefile)\n', (3504, 3515), False, 'import h5py\n'), ((4346, 4366), 'h5py.File', 'h5py.File', (['writefile'], {}), '(writefile)\n', (4355, 4366), False, 'import h5py\n'), ((4719, 4739), 'h5py.File', 'h5py.File', (['writefile'], {}), '(writefile)\n', (472... |
# ----------------------------------------------------
# Generate a random correlations
# ----------------------------------------------------
import numpy as np
def randCorr(size, lower=-1, upper=1):
"""
Create a random matrix T from uniform distribution of dimensions size x m (assumed to be 10000)
normal... | [
"numpy.random.uniform",
"numpy.sum",
"numpy.diag_indices",
"numpy.dot",
"numpy.sqrt"
] | [((704, 746), 'numpy.random.uniform', 'np.random.uniform', (['lower', 'upper', '(size, m)'], {}), '(lower, upper, (size, m))\n', (721, 746), True, 'import numpy as np\n'), ((759, 792), 'numpy.sum', 'np.sum', (['(randomMatrix ** 2)'], {'axis': '(1)'}), '(randomMatrix ** 2, axis=1)\n', (765, 792), True, 'import numpy as ... |
# Copyright (c) 2020, Huawei Technologies.All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law... | [
"numpy.random.uniform",
"torch.bitwise_not",
"numpy.random.randint",
"common_utils.run_tests",
"torch.from_numpy"
] | [((4174, 4185), 'common_utils.run_tests', 'run_tests', ([], {}), '()\n', (4183, 4185), False, 'from common_utils import TestCase, run_tests\n'), ((998, 1022), 'torch.from_numpy', 'torch.from_numpy', (['input1'], {}), '(input1)\n', (1014, 1022), False, 'import torch\n'), ((1178, 1202), 'torch.from_numpy', 'torch.from_nu... |
# BSD 3-Clause License
#
# Copyright (c) 2020, <NAME>
# 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. Redistributions of source code must retain the above copyright notice, this
# ... | [
"mocha.ui.get_widgets"
] | [((3401, 3417), 'mocha.ui.get_widgets', 'ui.get_widgets', ([], {}), '()\n', (3415, 3417), False, 'from mocha import ui\n')] |
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from django.conf import settings
from rest_framework.documentation import include_docs_urls
urlpatterns = [
path('admin/', admin.site.urls),
path('api/user/', include('apps.user.urls'), name='user'... | [
"rest_framework.documentation.include_docs_urls",
"django.conf.urls.static.static",
"django.urls.path",
"django.urls.include"
] | [((458, 519), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n', (464, 519), False, 'from django.conf.urls.static import static\n'), ((227, 258), 'django.urls.path', 'path', (['"""admin/"""', 'admin... |
import numpy as np
from cyvcf2 import VCF, Variant, Writer
import os.path
HERE = os.path.dirname(__file__)
HEM_PATH = os.path.join(HERE, "test-hemi.vcf")
VCF_PATH = os.path.join(HERE, "test.vcf.gz")
def check_var(v):
s = [x.split(":")[0] for x in str(v).split("\t")[9:]]
lookup = {'0/0': 0, '0/1': 1, './1': ... | [
"cyvcf2.VCF",
"numpy.array",
"numpy.all"
] | [((396, 430), 'numpy.array', 'np.array', (['[lookup[ss] for ss in s]'], {}), '([lookup[ss] for ss in s])\n', (404, 430), True, 'import numpy as np\n'), ((463, 486), 'numpy.all', 'np.all', (['(expected == obs)'], {}), '(expected == obs)\n', (469, 486), True, 'import numpy as np\n'), ((675, 681), 'cyvcf2.VCF', 'VCF', (['... |
import pandas as pd
import haziris as hz
df = pd.DataFrame([
['President' , '<NAME>', '1789-04-30 00:00:00', '1797-03-04 00:00:00' ],
['President' , '<NAME>' , '1797-03-04 00:00:00', '1801-03-04 00:00:00' ],
['President' , '<NAME>' , '1801-03-04 00:00:00', '1809-03-04 00:00:00... | [
"pandas.DataFrame",
"haziris.google_timeline_chart"
] | [((47, 1344), 'pandas.DataFrame', 'pd.DataFrame', (["[['President', '<NAME>', '1789-04-30 00:00:00', '1797-03-04 00:00:00'], [\n 'President', '<NAME>', '1797-03-04 00:00:00', '1801-03-04 00:00:00'], [\n 'President', '<NAME>', '1801-03-04 00:00:00', '1809-03-04 00:00:00'], [\n 'Vice President', '<NAME>', '1789-... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"tvm.runtime.const",
"tvm.runtime.convert",
"tvm.target.codegen.llvm_lookup_intrinsic_id"
] | [((2999, 3012), 'tvm.runtime.convert', 'convert', (['args'], {}), '(args)\n', (3006, 3012), False, 'from tvm.runtime import convert, const\n'), ((3582, 3595), 'tvm.runtime.convert', 'convert', (['args'], {}), '(args)\n', (3589, 3595), False, 'from tvm.runtime import convert, const\n'), ((5059, 5097), 'tvm.target.codege... |
# Authors: <NAME> <<EMAIL>>
#
# License: BSD Style.
from functools import partial
from ...utils import verbose
from ..utils import (has_dataset, _data_path, _data_path_doc,
_get_version, _version_doc)
data_name = 'mtrf'
has_mtrf_data = partial(has_dataset, name=data_name)
@verbose
def data_pa... | [
"functools.partial"
] | [((261, 297), 'functools.partial', 'partial', (['has_dataset'], {'name': 'data_name'}), '(has_dataset, name=data_name)\n', (268, 297), False, 'from functools import partial\n')] |
import logging
from typing import List
import math
import itertools
logger = logging.getLogger(__name__)
class RoundStats:
def __init__(self):
self._diff_history = []
self._q_history = []
def push_histories(self, diff=None, q=None):
if diff: self._diff_history.append(diff)
i... | [
"logging.getLogger"
] | [((78, 105), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (95, 105), False, 'import logging\n')] |
import random
import numpy as np
import torch
from torch.utils import data
from torch.utils.data.dataset import Dataset
"""
Example of how to make your own dataset
"""
class ToyDataSet(Dataset):
"""
class that defines what a data-sample looks like
In the __init__ you could for example load in the data f... | [
"numpy.random.normal",
"random.choice",
"torch.tensor",
"torch.from_numpy"
] | [((981, 1019), 'torch.tensor', 'torch.tensor', (['self.classes[item_index]'], {}), '(self.classes[item_index])\n', (993, 1019), False, 'import torch\n'), ((1070, 1109), 'torch.from_numpy', 'torch.from_numpy', (['self.data[item_index]'], {}), '(self.data[item_index])\n', (1086, 1109), False, 'import torch\n'), ((701, 72... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Filename: CountingSort.py
# @Author: olenji - <EMAIL>
# @Description: 适用于K比较少的情况
# @Create: 2019-06-13 20:47
# @Last Modified: 2019-06-13 20:47
import array
import random
class CountingSort:
def counting_sort(self, data, n):
c = array.array('l', [0] * n)
... | [
"random.randint",
"array.array"
] | [((731, 750), 'array.array', 'array.array', (['"""l"""', 'a'], {}), "('l', a)\n", (742, 750), False, 'import array\n'), ((294, 319), 'array.array', 'array.array', (['"""l"""', '([0] * n)'], {}), "('l', [0] * n)\n", (305, 319), False, 'import array\n'), ((672, 698), 'random.randint', 'random.randint', (['(0)', '(max - 1... |
'''DenseNet-BC-100 k=12 adopted from https://github.com/hysts/pytorch_image_classification'''
import torch
import torch.nn as nn
import torch.nn.functional as F
def initialize_weights(m):
if isinstance(m, nn.Conv2d):
nn.init.kaiming_normal_(m.weight.data, mode='fan_out')
elif isinstance(m, nn.BatchNo... | [
"torch.nn.init.kaiming_normal_",
"torch.nn.Sequential",
"torch.nn.functional.avg_pool2d",
"torch.nn.Conv2d",
"torch.nn.functional.dropout",
"torch.cat",
"torch.nn.functional.adaptive_avg_pool2d",
"torch.nn.BatchNorm2d",
"torch.nn.Linear",
"torch.zeros",
"torch.no_grad"
] | [((232, 286), 'torch.nn.init.kaiming_normal_', 'nn.init.kaiming_normal_', (['m.weight.data'], {'mode': '"""fan_out"""'}), "(m.weight.data, mode='fan_out')\n", (255, 286), True, 'import torch.nn as nn\n'), ((640, 667), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', (['in_channels'], {}), '(in_channels)\n', (654, 667), True, ... |
from snpx.snpx_mxnet import SNPXClassifier
import os
LOGS = os.path.join(os.path.dirname(__file__), "..", "log")
MODEL = os.path.join(os.path.dirname(__file__), "..", "model")
classif = SNPXClassifier("mini_vgg", "CIFAR-10", devices=['GPU'],logs_root=LOGS, model_bin_root=MODEL)
classif.train(1)
| [
"snpx.snpx_mxnet.SNPXClassifier",
"os.path.dirname"
] | [((189, 286), 'snpx.snpx_mxnet.SNPXClassifier', 'SNPXClassifier', (['"""mini_vgg"""', '"""CIFAR-10"""'], {'devices': "['GPU']", 'logs_root': 'LOGS', 'model_bin_root': 'MODEL'}), "('mini_vgg', 'CIFAR-10', devices=['GPU'], logs_root=LOGS,\n model_bin_root=MODEL)\n", (203, 286), False, 'from snpx.snpx_mxnet import SNPX... |
from PyQt5 import QtCore, QtWidgets, QtGui, uic
from utils import configs, Connection
import socket
from view import HomePage
class aboutPage(QtWidgets.QWidget):
def __init__(self, user, connection, x, y):
super().__init__()
uic.loadUi('./ui/about.ui', self)
self.user = user
self.co... | [
"PyQt5.QtWidgets.QMessageBox.question",
"PyQt5.uic.loadUi"
] | [((246, 279), 'PyQt5.uic.loadUi', 'uic.loadUi', (['"""./ui/about.ui"""', 'self'], {}), "('./ui/about.ui', self)\n", (256, 279), False, 'from PyQt5 import QtCore, QtWidgets, QtGui, uic\n'), ((782, 922), 'PyQt5.QtWidgets.QMessageBox.question', 'QtWidgets.QMessageBox.question', (['self', '"""Quit"""', '"""Are you sure you... |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import re
import odoo.tests
from odoo.tools import mute_logger
def break_view(view, fr='<p>placeholder</p>', to='<p t-field="not.exist"/>'):
view.arch = view.arch.replace(fr, to)
@odoo.tests.common.tagged('post_install', '-at_install')
... | [
"odoo.tools.mute_logger",
"re.search"
] | [((1275, 1329), 'odoo.tools.mute_logger', 'mute_logger', (['"""odoo.addons.http_routing.models.ir_http"""'], {}), "('odoo.addons.http_routing.models.ir_http')\n", (1286, 1329), False, 'from odoo.tools import mute_logger\n'), ((1805, 1859), 'odoo.tools.mute_logger', 'mute_logger', (['"""odoo.addons.http_routing.models.i... |
import numpy as np
from molsysmt import puw
from ..exceptions import *
def digest_box(box):
return box
def digest_box_lengths_value(box_lengths):
output = None
if type(box_lengths) is not np.ndarray:
box_lengths = np.array(box_lengths)
shape = box_lengths.shape
if len(shape)==1:
... | [
"numpy.array",
"numpy.expand_dims",
"molsysmt.puw.get_value",
"molsysmt.puw.get_unit"
] | [((844, 869), 'molsysmt.puw.get_unit', 'puw.get_unit', (['box_lengths'], {}), '(box_lengths)\n', (856, 869), False, 'from molsysmt import puw\n'), ((894, 920), 'molsysmt.puw.get_value', 'puw.get_value', (['box_lengths'], {}), '(box_lengths)\n', (907, 920), False, 'from molsysmt import puw\n'), ((1766, 1790), 'molsysmt.... |
"""
Process REDCap DETs that are specific to the
Seattle Flu Study - Swab and Send - Asymptomatic Enrollments
"""
import re
import click
import json
import logging
from uuid import uuid4
from typing import Any, Callable, Dict, List, Mapping, Match, Optional, Union, Tuple
from datetime import datetime
from cachetools im... | [
"uuid.uuid4",
"id3c.cli.command.location.location_lookup",
"re.match",
"datetime.datetime.strptime",
"id3c.cli.command.etl.redcap_det.command_for_project",
"id3c.cli.command.geocode.get_geocoded_address",
"datetime.datetime.now",
"logging.getLogger"
] | [((755, 782), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (772, 782), False, 'import logging\n'), ((1113, 1255), 'id3c.cli.command.etl.redcap_det.command_for_project', 'redcap_det.command_for_project', (['"""asymptomatic-swab-n-send"""'], {'redcap_url': 'REDCAP_URL', 'project_id': 'PRO... |
import nltk
import re
import string
from collections import defaultdict
nltk.download("punkt")
nltk.download('averaged_perceptron_tagger')
def tag_pos(text):
tokens = nltk.word_tokenize(text)
tagged = nltk.pos_tag(tokens)
clean = remove_punctuation(tagged)
sorted = sort_by_pos(clean)
return sort... | [
"nltk.download",
"collections.defaultdict",
"nltk.pos_tag",
"nltk.word_tokenize",
"re.compile"
] | [((74, 96), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (87, 96), False, 'import nltk\n'), ((97, 140), 'nltk.download', 'nltk.download', (['"""averaged_perceptron_tagger"""'], {}), "('averaged_perceptron_tagger')\n", (110, 140), False, 'import nltk\n'), ((175, 199), 'nltk.word_tokenize', 'nl... |
"""
"""
from django.contrib import admin
from bestmoments.models import BestImage
from bestmoments.models import WebmVideo
class BestImageAdmin(admin.ModelAdmin):
"""
"""
list_display = ["image"]
class WebmVideoAdmin(admin.ModelAdmin):
"""
"""
list_display = ["video"]
admin.site.register(Bes... | [
"django.contrib.admin.site.register"
] | [((297, 343), 'django.contrib.admin.site.register', 'admin.site.register', (['BestImage', 'BestImageAdmin'], {}), '(BestImage, BestImageAdmin)\n', (316, 343), False, 'from django.contrib import admin\n'), ((344, 390), 'django.contrib.admin.site.register', 'admin.site.register', (['WebmVideo', 'WebmVideoAdmin'], {}), '(... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import pandas as pd
from pandas import DataFrame
from tabulate import tabulate
from base import BaseObject
class PythonParseAPI(BaseObject):
""" API (Orchestrator) for Python Dependency Parsing
"""
def __init__(self,
is_debug: ... | [
"base.BaseObject.__init__",
"dataingest.grammar.dmo.CollectionNameGenerator",
"pandas.read_csv",
"plac.call",
"dataingest.grammar.svc.PerformPythonTransformation",
"dataingest.grammar.svc.ParsePythonImports",
"dataingest.grammar.dmo.PythonDirectoryLoader",
"dataingest.grammar.svc.ParsePythonFiles",
... | [((4324, 4339), 'plac.call', 'plac.call', (['main'], {}), '(main)\n', (4333, 4339), False, 'import plac\n'), ((890, 925), 'base.BaseObject.__init__', 'BaseObject.__init__', (['self', '__name__'], {}), '(self, __name__)\n', (909, 925), False, 'from base import BaseObject\n'), ((1273, 1321), 'dataingest.grammar.dmo.Colle... |
"""Package for loading and running the nuclei and cell segmentation models programmaticly."""
import os
import sys
import cv2
import imageio
import numpy as np
import torch
import torch.nn
import torch.nn.functional as F
from skimage import transform, util
from hpacellseg.constants import (MULTI_CHANNEL_CELL_MODEL_UR... | [
"numpy.dstack",
"skimage.transform.rescale",
"skimage.util.img_as_ubyte",
"imageio.imread",
"os.path.exists",
"cv2.copyMakeBorder",
"numpy.zeros",
"torch.nn.functional.softmax",
"torch.cuda.is_available",
"skimage.transform.resize",
"torch.device",
"torch.as_tensor",
"hpacellseg.utils.downlo... | [((5151, 5241), 'cv2.copyMakeBorder', 'cv2.copyMakeBorder', (['image', '(32)', '(32 - rows % 32)', '(32)', '(32 - cols % 32)', 'cv2.BORDER_REFLECT'], {}), '(image, 32, 32 - rows % 32, 32, 32 - cols % 32, cv2.\n BORDER_REFLECT)\n', (5169, 5241), False, 'import cv2\n'), ((8231, 8335), 'cv2.resize', 'cv2.resize', (['n_... |