code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from recognizers_date_time import recognize_datetime, Culture
class Ambiguity:
"""
TIMEX expressions are designed to represent ambiguous rather than definite dates. For
example: "Monday" could be any Monday ever... | [
"recognizers_date_time.recognize_datetime"
] | [((932, 1008), 'recognizers_date_time.recognize_datetime', 'recognize_datetime', (['"""Either Saturday or Sunday would work."""', 'Culture.English'], {}), "('Either Saturday or Sunday would work.', Culture.English)\n", (950, 1008), False, 'from recognizers_date_time import recognize_datetime, Culture\n'), ((1855, 1948)... |
import re
def check(data) :
if not isinstance(data, list) :
data = [data]
maybe_rgs_parsed = [ re.sub("[^0-9]","",r) for r in data ]
true_rgs = []
for r in maybe_rgs_parsed :
r1 = list(map(int,list(r)))
r4 = r1[:8]
r2 = [ r4[rr]*(2+rr) for rr in range(len(r4)) ]
d1 = 11-(sum(r2)%11)
r4.append(d1)
... | [
"re.sub"
] | [((102, 125), 're.sub', 're.sub', (['"""[^0-9]"""', '""""""', 'r'], {}), "('[^0-9]', '', r)\n", (108, 125), False, 'import re\n')] |
import coinlib
class Wallet():
def __init__(self, contents={}):
coins_by_symbol = coinlib.get_all_coins_by_symbol()
coins_by_name = coinlib.get_all_coins_by_name()
self.contents = {}
for coin in contents:
coin_lower = coin.lower().strip()
if (coin_lower not... | [
"coinlib.errors",
"coinlib.get_all_coins_by_name",
"coinlib.get_all_coins_by_symbol"
] | [((97, 130), 'coinlib.get_all_coins_by_symbol', 'coinlib.get_all_coins_by_symbol', ([], {}), '()\n', (128, 130), False, 'import coinlib\n'), ((155, 186), 'coinlib.get_all_coins_by_name', 'coinlib.get_all_coins_by_name', ([], {}), '()\n', (184, 186), False, 'import coinlib\n'), ((771, 803), 'coinlib.errors', 'coinlib.er... |
from django.shortcuts import render, redirect, get_object_or_404
from .models import Image,Profile,Location,tags
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.contrib.auth.models imp... | [
"django.contrib.auth.decorators.login_required",
"django.contrib.auth.models.User.objects.get",
"django.shortcuts.redirect",
"django.shortcuts.render",
"django.http.HttpResponseRedirect",
"django.contrib.auth.models.User.objects.all"
] | [((461, 505), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/accounts/login/"""'}), "(login_url='/accounts/login/')\n", (475, 505), False, 'from django.contrib.auth.decorators import login_required\n'), ((1466, 1510), 'django.contrib.auth.decorators.login_required', 'login_re... |
"""
Author: <NAME>
Licence: Apache 2.0
Version: 0.1
"""
import os
import sys
_colors = ["RED", "BLUE", "CYAN", "YELLOW", "GREEN", "MAGENTA", "WHITE", "BLACK"]
backgrounds = ["BG_RED", "BG_BLUE", "BG_CYAN", "BG_YELLOW", "BG_GREEN", "BG_MAGENTA", "BG_WHITE", "BG_BLACK"]
styles = ['BOLD', 'REVERSE', 'UNDERLINE', 'RESET',... | [
"os.popen"
] | [((682, 792), 'os.popen', 'os.popen', (['"""reg add HKEY_CURRENT_USER\\\\Console /v VirtualTerminalLevel /t REG_DWORD /d 0x00000001 /f"""'], {}), "(\n 'reg add HKEY_CURRENT_USER\\\\Console /v VirtualTerminalLevel /t REG_DWORD /d 0x00000001 /f'\n )\n", (690, 792), False, 'import os\n')] |
# google imports
# standard library imports
import sys
import copy
import pickle
import os
from collections import Counter
from io import BytesIO
from zipfile import ZipFile
import copy
import pickle
from math import ceil
import importlib
import urllib.request
# math imports
from matplotlib import pyplot as plt
impor... | [
"sklearn.preprocessing.StandardScaler",
"matplotlib.pyplot.suptitle",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.classification_report",
"os.path.join",
"pandas.DataFrame",
"sklearn.impute.SimpleImputer",
"matplotlib.pyplot.close",
"IPython.display.display",
"feature_utils.binary... | [((400, 409), 'seaborn.set', 'sns.set', ([], {}), '()\n', (407, 409), True, 'import seaborn as sns\n'), ((1850, 1886), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(3)'], {'figsize': '(20, 10)'}), '(1, 3, figsize=(20, 10))\n', (1862, 1886), True, 'from matplotlib import pyplot as plt\n'), ((2624, 2659), 'mat... |
from subprocess import Popen, PIPE
import sys
import os
from queue import Queue, Empty
import subprocess
import threading
import time
class LocalShell(object):
def __init__(self):
pass
def run(self, cmd):
env = os.environ.copy()
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=subproces... | [
"sys.stdout.write",
"threading.Thread",
"subprocess.Popen",
"sys.stdin.read",
"os.environ.copy",
"time.sleep",
"sys.stdout.flush",
"queue.Queue"
] | [((238, 255), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (253, 255), False, 'import os\n'), ((268, 354), 'subprocess.Popen', 'Popen', (['cmd'], {'stdin': 'PIPE', 'stdout': 'PIPE', 'stderr': 'subprocess.STDOUT', 'shell': '(True)', 'env': 'env'}), '(cmd, stdin=PIPE, stdout=PIPE, stderr=subprocess.STDOUT, she... |
from typing import Optional, Callable
import torch
import numpy as np
from PIL.Image import Image
from ..transforms import TargetHandler
class NormalizeBothInputAndTarget:
transform: Callable[[Image], Image]
target_handler: TargetHandler
def __init__(
self,
transform: Callable[[... | [
"numpy.array"
] | [((554, 565), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (562, 565), True, 'import numpy as np\n'), ((708, 728), 'numpy.array', 'np.array', (['erased_img'], {}), '(erased_img)\n', (716, 728), True, 'import numpy as np\n'), ((1088, 1104), 'numpy.array', 'np.array', (['target'], {}), '(target)\n', (1096, 1104), Tru... |
import aiohttp
async def get_tinyurl(link: str):
url = f"http://tinyurl.com/api-create.php?url={link}"
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
response = (await response.content.read()).decode('utf-8')
return response
| [
"aiohttp.ClientSession"
] | [((124, 147), 'aiohttp.ClientSession', 'aiohttp.ClientSession', ([], {}), '()\n', (145, 147), False, 'import aiohttp\n')] |
'''
Problem Name: Good Number Or Not
Problem Code: ISGOODNM
Problem Link: https://www.codechef.com/problems/ISGOODNM
Solution Link: https://www.codechef.com/viewsolution/47005382
'''
def divisors(m):
from math import sqrt
l = set()
for i in range(1, int(sqrt(m)+1)):
if m%i == 0:
... | [
"math.sqrt"
] | [((284, 291), 'math.sqrt', 'sqrt', (['m'], {}), '(m)\n', (288, 291), False, 'from math import sqrt\n')] |
import sqlite3
import os
class DbUtil:
def __init__(self, db_file):
self.db_path = db_file
self.conn = self.create_connection()
self.c = self.create_cursor()
def create_connection(self):
try:
os.remove(self.db_path)
print("removing existing db file")
... | [
"os.remove",
"sqlite3.connect"
] | [((443, 472), 'sqlite3.connect', 'sqlite3.connect', (['self.db_path'], {}), '(self.db_path)\n', (458, 472), False, 'import sqlite3\n'), ((248, 271), 'os.remove', 'os.remove', (['self.db_path'], {}), '(self.db_path)\n', (257, 271), False, 'import os\n')] |
from typing import Iterator, List, Union, Tuple, Any
from datetime import datetime
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
from tensorflow import keras
import tensorflow_addons as tfa
from tensorflow.keras.preprocessing.image import... | [
"tensorflow.keras.preprocessing.image.ImageDataGenerator",
"tensorflow.keras.layers.MaxPooling2D",
"tensorflow.keras.layers.Dense",
"sklearn.model_selection.train_test_split",
"tensorflow.python.keras.callbacks.TensorBoard",
"tensorflow.keras.losses.MeanAbsolutePercentageError",
"tensorflow.keras.models... | [((923, 961), 'tensorflow.config.list_physical_devices', 'tf.config.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (954, 961), True, 'import tensorflow as tf\n'), ((962, 1029), 'tensorflow.config.experimental.set_memory_growth', 'tf.config.experimental.set_memory_growth', (['physical_devices[0]', '(True)'], ... |
#!/usr/bin/env python3
import sys, os, re
os.chdir(os.getenv('srcdir', os.path.dirname(__file__)))
HBHEADERS = [os.path.basename(x) for x in os.getenv('HBHEADERS', '').split()] or \
[x for x in os.listdir('.') if x.startswith('hb') and x.endswith('.h')]
HBSOURCES = [os.path.basename(x) for x in os.getenv... | [
"os.path.basename",
"os.path.dirname",
"re.findall",
"os.getenv",
"os.listdir",
"sys.exit"
] | [((1486, 1500), 'sys.exit', 'sys.exit', (['stat'], {}), '(stat)\n', (1494, 1500), False, 'import sys, os, re\n'), ((1051, 1086), 're.findall', 're.findall', (['"""#.*include.*"""', 'content'], {}), "('#.*include.*', content)\n", (1061, 1086), False, 'import sys, os, re\n'), ((1391, 1431), 're.findall', 're.findall', ([... |
import os
import sys
import lmdb
import json
import torch
import pickle
import random
import msgpack
import numpy as np
import msgpack_numpy
# from transformers import AutoTokenizer
from lz4.frame import compress, decompress
from os.path import exists, abspath, dirname
from sklearn.metrics.pairwise import cosine_simila... | [
"msgpack_numpy.patch",
"PIL.Image.new",
"msgpack.loads",
"numpy.load",
"torch.load",
"os.path.exists",
"PIL.Image.open",
"pprint.PrettyPrinter",
"lmdb.open",
"PIL.ImageDraw.Draw",
"lz4.frame.decompress"
] | [((403, 425), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {}), '()\n', (423, 425), False, 'import pprint\n'), ((427, 448), 'msgpack_numpy.patch', 'msgpack_numpy.patch', ([], {}), '()\n', (446, 448), False, 'import msgpack_numpy\n'), ((583, 629), 'lmdb.open', 'lmdb.open', (['db_dir'], {'readonly': '(True)', 'cr... |
import requests
from typing import Dict, List
class LIFX:
'''
docs: https://api.developer.lifx.com
selectors: https://api.developer.lifx.com/docs/selectors
'''
url = 'https://api.lifx.com'
def __init__(self, token):
self.headers = {
'Authorization': f'Bearer {token... | [
"requests.put",
"requests.post",
"requests.get"
] | [((593, 667), 'requests.get', 'requests.get', ([], {'url': 'f"""{LIFX.url}/v1/lights/{selector}"""', 'headers': 'self.headers'}), "(url=f'{LIFX.url}/v1/lights/{selector}', headers=self.headers)\n", (605, 667), False, 'import requests\n'), ((1262, 1452), 'requests.put', 'requests.put', ([], {'url': 'f"""{LIFX.url}/v1/li... |
#!/usr/bin/env python
"""Plot both the standard 'is_a' field and the optional 'part_of' relationship."""
from __future__ import print_function
__copyright__ = "Copyright (C) 2016-2018, <NAME>, <NAME>, All rights reserved."
import os
import sys
import timeit
import datetime
from goatools.base import download_go_basic... | [
"goatools.gosubdag.gosubdag.GoSubDag",
"os.path.abspath",
"goatools.obo_parser.GODag",
"timeit.default_timer",
"goatools.base.download_go_basic_obo",
"os.path.join"
] | [((990, 1024), 'os.path.join', 'os.path.join', (['REPO', '"""go-basic.obo"""'], {}), "(REPO, 'go-basic.obo')\n", (1002, 1024), False, 'import os\n'), ((1029, 1082), 'goatools.base.download_go_basic_obo', 'download_go_basic_obo', (['fin_obo', 'prt'], {'loading_bar': 'None'}), '(fin_obo, prt, loading_bar=None)\n', (1050,... |
import torch
import torchvision
from torch.utils.tensorboard import SummaryWriter
from torchvision import datasets, transforms
# Writer will output to ./runs/ directory by default
class TensorboardLogger(object):
def __init__(self, dir):
"""Create a summary writer logging to log_dir."""
self.writer... | [
"torch.utils.tensorboard.SummaryWriter"
] | [((323, 349), 'torch.utils.tensorboard.SummaryWriter', 'SummaryWriter', ([], {'log_dir': 'dir'}), '(log_dir=dir)\n', (336, 349), False, 'from torch.utils.tensorboard import SummaryWriter\n')] |
import json
import os
from dotenv import load_dotenv
from utils.copier import generate_files_from_template
from utils.gitlab_service import GitlabService
from utils.study_data import fetch_new_study_data
from utils.supabase_service import SupabaseService
load_dotenv()
def generate_repo(sbs: SupabaseService, gs: Gi... | [
"os.walk",
"dotenv.load_dotenv",
"os.environ.get",
"utils.study_data.fetch_new_study_data",
"os.path.join"
] | [((258, 271), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (269, 271), False, 'from dotenv import load_dotenv\n'), ((680, 738), 'utils.study_data.fetch_new_study_data', 'fetch_new_study_data', (['sbs', 'gs', 'study_id', 'project', '"""create"""'], {}), "(sbs, gs, study_id, project, 'create')\n", (700, 738), F... |
from deep_utils.vision.face_detection.main import FaceDetector
from deep_utils.utils.lib_utils.lib_decorators import get_from_config, expand_input, get_elapsed_time, rgb2bgr
from deep_utils.utils.lib_utils.download_utils import download_decorator
from deep_utils.utils.box_utils.boxes import Box, Point
from .config impo... | [
"deep_utils.utils.box_utils.boxes.Box.box2box",
"deep_utils.utils.lib_utils.lib_decorators.rgb2bgr",
"cv2.face.createFacemarkLBF",
"deep_utils.utils.lib_utils.lib_decorators.expand_input",
"cv2.CascadeClassifier",
"deep_utils.utils.box_utils.boxes.Point.point2point"
] | [((1398, 1413), 'deep_utils.utils.lib_utils.lib_decorators.expand_input', 'expand_input', (['(3)'], {}), '(3)\n', (1410, 1413), False, 'from deep_utils.utils.lib_utils.lib_decorators import get_from_config, expand_input, get_elapsed_time, rgb2bgr\n'), ((1440, 1455), 'deep_utils.utils.lib_utils.lib_decorators.rgb2bgr', ... |
import random
import unittest
import pandas as pd
from tests.integration.feature_repos.test_repo_configuration import (
Environment,
parametrize_online_test,
)
@parametrize_online_test
def test_online_retrieval(environment: Environment):
fs = environment.feature_store
full_feature_names = environmen... | [
"random.sample",
"unittest.TestCase"
] | [((380, 426), 'random.sample', 'random.sample', (['environment.driver_entities', '(10)'], {}), '(environment.driver_entities, 10)\n', (393, 426), False, 'import random\n'), ((561, 609), 'random.sample', 'random.sample', (['environment.customer_entities', '(10)'], {}), '(environment.customer_entities, 10)\n', (574, 609)... |
# Solving reinforcement learning problems using pgpelib with parallelization
# and with observation normalization
# ==========================================================================
#
# This example demonstrates how to solve locomotion tasks.
# The following techniques are used:
#
# - dynamic population size
... | [
"ray.init",
"pickle.dump",
"gym.make",
"pgpelib.policies.LinearPolicy",
"numpy.argmax",
"numpy.median",
"multiprocessing.cpu_count",
"torch.as_tensor",
"pgpelib.restore.to_torch_module",
"torch.no_grad",
"numpy.sqrt"
] | [((3508, 3522), 'multiprocessing.cpu_count', 'mp.cpu_count', ([], {}), '()\n', (3520, 3522), True, 'import multiprocessing as mp\n'), ((3754, 3764), 'ray.init', 'ray.init', ([], {}), '()\n', (3762, 3764), False, 'import ray\n'), ((7389, 7452), 'pgpelib.policies.LinearPolicy', 'LinearPolicy', ([], {'env_name': 'ENV_NAME... |
import rospy
from std_msgs.msg import String
def callback(data):
rospy.loginfo(rospy.get_caller_id() + "I heard %s", data.data)
def listener():
rospy.init_node('throttled_listener')
rospy.Subscriber('chatter_message_throttled', String, callback)
rospy.Subscriber('chatter_bandwidth_throttled', String,... | [
"rospy.spin",
"rospy.Subscriber",
"rospy.init_node",
"rospy.get_caller_id"
] | [((154, 191), 'rospy.init_node', 'rospy.init_node', (['"""throttled_listener"""'], {}), "('throttled_listener')\n", (169, 191), False, 'import rospy\n'), ((197, 260), 'rospy.Subscriber', 'rospy.Subscriber', (['"""chatter_message_throttled"""', 'String', 'callback'], {}), "('chatter_message_throttled', String, callback)... |
# Copyright 2013-2016 DataStax, 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 writi... | [
"mock.patch",
"cassandra.cluster._Scheduler",
"cassandra.query.SimpleStatement",
"mock.Mock",
"cassandra.cluster.Cluster"
] | [((4756, 4790), 'mock.patch', 'patch', (['"""time.time"""'], {'return_value': '(3)'}), "('time.time', return_value=3)\n", (4761, 4790), False, 'from mock import patch, Mock\n'), ((4825, 4866), 'mock.patch', 'patch', (['"""cassandra.cluster._Scheduler.run"""'], {}), "('cassandra.cluster._Scheduler.run')\n", (4830, 4866)... |
# Copyright The PyTorch Lightning team.
#
# 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 i... | [
"pytorchvideo.transforms.UniformTemporalSubsample",
"kornia.augmentation.Normalize",
"torchvision.transforms.CenterCrop",
"torch.tensor",
"flash.core.utilities.imports.requires",
"torchvision.transforms.RandomCrop"
] | [((1200, 1217), 'flash.core.utilities.imports.requires', 'requires', (['"""video"""'], {}), "('video')\n", (1208, 1217), False, 'from flash.core.utilities.imports import _KORNIA_AVAILABLE, _PYTORCHVIDEO_AVAILABLE, requires\n'), ((1371, 1403), 'torch.tensor', 'torch.tensor', (['[0.45, 0.45, 0.45]'], {}), '([0.45, 0.45, ... |
import argparse
import configparser
import copy
import datetime
import json
import os
import random
import re
import sys
import time
from collections import Counter, defaultdict
from contextlib import contextmanager
from io import StringIO
from threading import current_thread
import networkx as nx
import pandas as pd
... | [
"streamlit.session_state.sens.index",
"streamlit.experimental_rerun",
"streamlit.text_input",
"argparse.ArgumentParser",
"streamlit.session_state.df.reset_index",
"streamlit.radio",
"streamlit.expander",
"streamlit.sidebar.title",
"streamlit.sidebar.button",
"pandas.DataFrame",
"streamlit.set_pa... | [((6940, 6976), 'streamlit.cache', 'st.cache', ([], {'allow_output_mutation': '(True)'}), '(allow_output_mutation=True)\n', (6948, 6976), True, 'import streamlit as st\n'), ((7065, 7075), 'streamlit.cache', 'st.cache', ([], {}), '()\n', (7073, 7075), True, 'import streamlit as st\n'), ((7131, 7167), 'streamlit.cache', ... |
import lue.data_model as ldm
import numpy as np
import csv
def export_partition_shape_results(
lue_dataset,
csv_writer):
# Assert that the number of array shapes for which experiments where
# performed is 1
lue_array = lue_dataset.array.array
assert lue_array.shape.value.nr_arrays == ... | [
"csv.writer",
"numpy.prod",
"numpy.argsort",
"lue.data_model.open_dataset",
"numpy.all"
] | [((512, 551), 'numpy.all', 'np.all', (['(array_shapes == array_shapes[0])'], {}), '(array_shapes == array_shapes[0])\n', (518, 551), True, 'import numpy as np\n'), ((2065, 2087), 'numpy.argsort', 'np.argsort', (['nr_workers'], {}), '(nr_workers)\n', (2075, 2087), True, 'import numpy as np\n'), ((4753, 4775), 'numpy.arg... |
import time
from dataclasses import dataclass, field
from threading import Event, Thread
from typing import Callable, NoReturn
@dataclass
class Clock:
callback: Callable[[], None] = field(repr=False)
thread: Thread = field(init=False, repr=False)
started: Event = field(default_factory=Event, init=False, r... | [
"dataclasses.field",
"threading.Thread",
"time.monotonic",
"time.sleep"
] | [((188, 205), 'dataclasses.field', 'field', ([], {'repr': '(False)'}), '(repr=False)\n', (193, 205), False, 'from dataclasses import dataclass, field\n'), ((227, 256), 'dataclasses.field', 'field', ([], {'init': '(False)', 'repr': '(False)'}), '(init=False, repr=False)\n', (232, 256), False, 'from dataclasses import da... |
import os
from statistics import mean
import numpy as np
import matplotlib.pyplot as pyplot
from simtk import unit
from simtk.openmm.app.pdbfile import PDBFile
from foldamers.cg_model.cgmodel import CGModel
from foldamers.parameters.reweight import *
from foldamers.thermo.calc import *
from foldamers.ensembles.ens_buil... | [
"matplotlib.pyplot.title",
"os.mkdir",
"simtk.openmm.app.pdbfile.PDBFile.writeFile",
"matplotlib.pyplot.figure",
"numpy.unique",
"numpy.meshgrid",
"matplotlib.pyplot.close",
"os.path.exists",
"matplotlib.pyplot.colorbar",
"foldamers.cg_model.cgmodel.CGModel",
"simtk.openmm.app.pdbfile.PDBFile",
... | [((4025, 4818), 'foldamers.cg_model.cgmodel.CGModel', 'CGModel', ([], {'polymer_length': 'polymer_length', 'backbone_lengths': 'backbone_lengths', 'sidechain_lengths': 'sidechain_lengths', 'sidechain_positions': 'sidechain_positions', 'masses': 'masses', 'sigmas': 'sigmas', 'epsilons': 'epsilons', 'bond_lengths': 'bond... |
'''
## PyPoll

* In this challenge, you are tasked with helping a small, rural town
modernize its vote-counting process. (Up until now, Uncle Cleetus had
been trustfully tallying them one-by-one, but unfortunately, his concentration isn't what it used to be.)
* You will be ... | [
"csv.reader",
"os.path.join"
] | [((1372, 1405), 'os.path.join', 'os.path.join', (['"""election_data.csv"""'], {}), "('election_data.csv')\n", (1384, 1405), False, 'import os, csv\n'), ((1696, 1731), 'csv.reader', 'csv.reader', (['csv_file'], {'delimiter': '""","""'}), "(csv_file, delimiter=',')\n", (1706, 1731), False, 'import os, csv\n')] |
import tensorflow as tf
from utils import box_utils
from models import registry
from .loss import MultiBoxLoss
from .inference import PostProcessor
from models.head.box_predictor import make_box_predictor
from models.anchors.prior_box import PriorBox
@registry.BOX_HEADS.register('SSDBoxHead')
class SSDBoxHe... | [
"models.head.box_predictor.make_box_predictor",
"models.anchors.prior_box.PriorBox",
"tensorflow.keras.activations.softmax",
"models.registry.BOX_HEADS.register",
"utils.box_utils.convert_locations_to_boxes",
"utils.box_utils.center_form_to_corner_form"
] | [((263, 304), 'models.registry.BOX_HEADS.register', 'registry.BOX_HEADS.register', (['"""SSDBoxHead"""'], {}), "('SSDBoxHead')\n", (290, 304), False, 'from models import registry\n'), ((471, 494), 'models.head.box_predictor.make_box_predictor', 'make_box_predictor', (['cfg'], {}), '(cfg)\n', (489, 494), False, 'from mo... |
import pymysql
import sys
from mahjong.ai.comb.perm_comb_mahjong import PermCombMahjongGenerator
Tiles = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
db = pymysql.connect(host='127.0.0.1', user='root',
password='<PASSWORD>', db='mahjong', port=3306, charset='utf8')
cur... | [
"mahjong.ai.comb.perm_comb_mahjong.PermCombMahjongGenerator",
"pymysql.connect",
"sys.exc_info"
] | [((183, 298), 'pymysql.connect', 'pymysql.connect', ([], {'host': '"""127.0.0.1"""', 'user': '"""root"""', 'password': '"""<PASSWORD>"""', 'db': '"""mahjong"""', 'port': '(3306)', 'charset': '"""utf8"""'}), "(host='127.0.0.1', user='root', password='<PASSWORD>', db=\n 'mahjong', port=3306, charset='utf8')\n", (198, ... |
#!/usr/bin/env python
"""Unprivileged memory RPC client code."""
import abc
from typing import TypeVar, Generic
from grr_response_client.unprivileged import communication
from grr_response_client.unprivileged.proto import memory_pb2
class ConnectionWrapper:
"""Wraps a connection, adding protobuf serialization of ... | [
"grr_response_client.unprivileged.proto.memory_pb2.Response",
"grr_response_client.unprivileged.proto.memory_pb2.ProcessScanRequest",
"grr_response_client.unprivileged.proto.memory_pb2.UploadSignatureRequest",
"typing.TypeVar",
"grr_response_client.unprivileged.proto.memory_pb2.Request"
] | [((1258, 1280), 'typing.TypeVar', 'TypeVar', (['"""RequestType"""'], {}), "('RequestType')\n", (1265, 1280), False, 'from typing import TypeVar, Generic\n'), ((1296, 1319), 'typing.TypeVar', 'TypeVar', (['"""ResponseType"""'], {}), "('ResponseType')\n", (1303, 1319), False, 'from typing import TypeVar, Generic\n'), ((6... |
from django.db import models
# Create your models here.
class Uber(models.Model):
source = models.CharField(max_length=150)
destination = models.CharField(max_length=150)
time = models.TimeField()
email = models.EmailField()
| [
"django.db.models.CharField",
"django.db.models.TimeField",
"django.db.models.EmailField"
] | [((97, 129), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(150)'}), '(max_length=150)\n', (113, 129), False, 'from django.db import models\n'), ((148, 180), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(150)'}), '(max_length=150)\n', (164, 180), False, 'from django.db... |
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from utils import normalizeFeaturesL2
class SJE_GMPool(nn.Module):
def __init__(self, img_feature_size, num_attributes, margin):
super(SJE_GMPool, self).__ini... | [
"torch.nn.Parameter",
"matplotlib.pyplot.tight_layout",
"torch.zeros_like",
"torch.where",
"matplotlib.pyplot.close",
"matplotlib.pyplot.subplots",
"utils.normalizeFeaturesL2",
"torch.rand",
"torch.zeros",
"torch.tensordot",
"torch.all"
] | [((430, 494), 'torch.rand', 'torch.rand', (['img_feature_size', 'num_attributes'], {'requires_grad': '(True)'}), '(img_feature_size, num_attributes, requires_grad=True)\n', (440, 494), False, 'import torch\n'), ((573, 608), 'torch.nn.Parameter', 'nn.Parameter', (['W'], {'requires_grad': '(True)'}), '(W, requires_grad=T... |
"""UIModules for the error pages plugin"""
import oz
import base64
import pprint
import oz.error_pages
import tornado.web
import tornado.escape
TABLE_FORMAT = """
<table %s %s>
<thead>
<tr>
<th>Variable</th>
<th>Value</th>
</tr>
</thead>
<tbody>
%s
</tbo... | [
"oz.error_pages.prettify_object",
"base64.b64encode"
] | [((756, 789), 'oz.error_pages.prettify_object', 'oz.error_pages.prettify_object', (['v'], {}), '(v)\n', (786, 789), False, 'import oz\n'), ((977, 996), 'base64.b64encode', 'base64.b64encode', (['v'], {}), '(v)\n', (993, 996), False, 'import base64\n')] |
from cryptography.fernet import Fernet
class Key_generate:
def write_key():
"""
Generates a key and save it into a file
"""
key = Fernet.generate_key()
with open("key.key", "wb") as key_file:
key_file.write(key)
key = open("key.key", "rb").read()
pr... | [
"cryptography.fernet.Fernet.generate_key"
] | [((165, 186), 'cryptography.fernet.Fernet.generate_key', 'Fernet.generate_key', ([], {}), '()\n', (184, 186), False, 'from cryptography.fernet import Fernet\n')] |
#!/usr/bin/env python
"""Tests the tdb data store - in memory implementation."""
import shutil
# pylint: disable=unused-import,g-bad-import-order
from grr.lib import server_plugins
# pylint: enable=unused-import,g-bad-import-order
from grr.lib import access_control
from grr.lib import config_lib
from grr.lib import... | [
"grr.lib.flags.StartMain",
"grr.lib.config_lib.CONFIG.Set",
"grr.lib.config_lib.CONFIG.Get",
"grr.lib.test_lib.main",
"grr.lib.data_stores.tdb_data_store.TDBDataStore",
"grr.lib.access_control.ACLToken",
"grr.lib.test_lib.MockSecurityManager"
] | [((1616, 1635), 'grr.lib.test_lib.main', 'test_lib.main', (['args'], {}), '(args)\n', (1629, 1635), False, 'from grr.lib import test_lib\n'), ((1666, 1687), 'grr.lib.flags.StartMain', 'flags.StartMain', (['main'], {}), '(main)\n', (1681, 1687), False, 'from grr.lib import flags\n'), ((566, 630), 'grr.lib.access_control... |
import subprocess
from ExperimentRunner.Script import Script
class MonkeyRunner(Script):
"""
Subclass of `Script` for running MonkeyRunner scripts directly.
As opposed to `MonkeyReplay`, it runs the scripts directly using MonkeyRunner.
Thanks to that it's not necessary to go through a layer of indir... | [
"subprocess.call"
] | [((1503, 1555), 'subprocess.call', 'subprocess.call', (['[self.monkeyrunner_path, self.path]'], {}), '([self.monkeyrunner_path, self.path])\n', (1518, 1555), False, 'import subprocess\n')] |
from django.contrib import admin
from .models import PhotoRecord, KeyValueRecord
admin.site.register(PhotoRecord)
admin.site.register(KeyValueRecord)
| [
"django.contrib.admin.site.register"
] | [((83, 115), 'django.contrib.admin.site.register', 'admin.site.register', (['PhotoRecord'], {}), '(PhotoRecord)\n', (102, 115), False, 'from django.contrib import admin\n'), ((116, 151), 'django.contrib.admin.site.register', 'admin.site.register', (['KeyValueRecord'], {}), '(KeyValueRecord)\n', (135, 151), False, 'from... |
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from orders.models import RaceOrder, LineFollowerRaceOrder
class Command(BaseCommand):
args = '<day>'
help = 'Deletes line follower race orders of the specified day.'
def handle(self, *args, **options):
... | [
"django.core.management.base.CommandError",
"orders.models.LineFollowerRaceOrder.objects.filter"
] | [((494, 540), 'django.core.management.base.CommandError', 'CommandError', (['"""Day interval is 1 <= day <= 2."""'], {}), "('Day interval is 1 <= day <= 2.')\n", (506, 540), False, 'from django.core.management.base import BaseCommand, CommandError\n'), ((406, 443), 'django.core.management.base.CommandError', 'CommandEr... |
# SPDX-License-Identifier: Apache-2.0
import bpy
import math
import os
import time
from xrs import automate as xra
## Depricated - used to render asset submissions
# rename
xra.log_info('Rendering Asset Master Image from angle')
arguments = xra.get_command_line_arguments()
working_dir = arguments[0]
asset_name = argu... | [
"xrs.automate.rotate_object_and_angle_camera",
"xrs.automate.join_collection_objects_into_one",
"xrs.automate.set_render_resolution",
"bpy.ops.object.camera_add",
"math.degrees",
"xrs.automate.append_collection",
"time.time",
"xrs.automate.quit_with_error",
"xrs.automate.log_error",
"bpy.ops.rende... | [((175, 230), 'xrs.automate.log_info', 'xra.log_info', (['"""Rendering Asset Master Image from angle"""'], {}), "('Rendering Asset Master Image from angle')\n", (187, 230), True, 'from xrs import automate as xra\n'), ((243, 275), 'xrs.automate.get_command_line_arguments', 'xra.get_command_line_arguments', ([], {}), '()... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, 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... | [
"logging.getLogger",
"logging.basicConfig",
"ovirtsdk4.types.VnicProfile"
] | [((704, 768), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'filename': '"""example.log"""'}), "(level=logging.DEBUG, filename='example.log')\n", (723, 768), False, 'import logging\n'), ((1109, 1128), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (1126, 1128), False, 'impor... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from rawdisk.util.filetimes import dt_to_filetime, filetime_to_dt, UTC, ZERO
from datetime import datetime
class TestFiletimesModule(unittest.TestCase):
def test_dt_to_filetime(self):
value = datetime(2009, 7, 25, 23, 0)
self.assertEqu... | [
"unittest.main",
"rawdisk.util.filetimes.dt_to_filetime",
"datetime.datetime",
"rawdisk.util.filetimes.filetime_to_dt",
"rawdisk.util.filetimes.UTC"
] | [((694, 709), 'unittest.main', 'unittest.main', ([], {}), '()\n', (707, 709), False, 'import unittest\n'), ((269, 297), 'datetime.datetime', 'datetime', (['(2009)', '(7)', '(25)', '(23)', '(0)'], {}), '(2009, 7, 25, 23, 0)\n', (277, 297), False, 'from datetime import datetime\n'), ((552, 557), 'rawdisk.util.filetimes.U... |
"""update, add constraints
Revision ID: ccc37f794db6
Revises: <PASSWORD>
Create Date: 2020-05-15 14:02:21.163220
"""
from datetime import datetime
from uuid import uuid4
from alembic import op
from geoalchemy2 import Geometry
from sqlalchemy import DATE, Boolean, Column, DateTime, ForeignKey, Integer, MetaData, Stri... | [
"sqlalchemy.MetaData",
"sqlalchemy.orm.declarative_base",
"sqlalchemy.ext.associationproxy.association_proxy",
"sqlalchemy.ForeignKey",
"sqlalchemy.orm.relationship",
"geoalchemy2.Geometry",
"sqlalchemy.Column",
"sqlalchemy.String",
"sqlalchemy.sql.schema.CheckConstraint",
"alembic.op.batch_alter_... | [((1296, 1348), 'sqlalchemy.MetaData', 'MetaData', ([], {'naming_convention': 'sqlite_naming_convention'}), '(naming_convention=sqlite_naming_convention)\n', (1304, 1348), False, 'from sqlalchemy import DATE, Boolean, Column, DateTime, ForeignKey, Integer, MetaData, String\n'), ((1366, 1401), 'sqlalchemy.orm.declarativ... |
# Copyright (c) 2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | [
"wca.config.register",
"pex.vendor._vendored.setuptools.pkg_resources.EntryPoint.parse"
] | [((1832, 1858), 'wca.config.register', 'config.register', (['component'], {}), '(component)\n', (1847, 1858), False, 'from wca import config\n'), ((1968, 2029), 'pex.vendor._vendored.setuptools.pkg_resources.EntryPoint.parse', 'pkg_resources.EntryPoint.parse', (["('external_cls=%s' % component)"], {}), "('external_cls=... |
# Copyright 2020 The TensorFlow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
"numpy.asarray",
"numpy.zeros",
"tensorflow_graphics.datasets.features.camera_feature.Camera",
"tensorflow_datasets.testing.test_main",
"numpy.array",
"tensorflow_datasets.testing.FeatureExpectationItem",
"numpy.eye"
] | [((7184, 7208), 'tensorflow_datasets.testing.test_main', 'tfds.testing.test_main', ([], {}), '()\n', (7206, 7208), True, 'import tensorflow_datasets as tfds\n'), ((1490, 1609), 'numpy.asarray', 'np.asarray', (['[[expected_f, 0, expected_center[0]], [0, expected_f, expected_center[1]],\n [0, 0, 1]]'], {'dtype': 'np.f... |
import os
import shutil
import pytest
from top_secret import FileSecretSource, DirectorySecretSource
from top_secret import SecretMissingError
SECRET_BASE_PATH = os.path.join("/tmp", ".top_secret_test")
@pytest.fixture(scope="module", autouse=True)
def setup_teardown_module():
# Setup
os.makedirs(SECRET_BA... | [
"os.makedirs",
"os.unlink",
"top_secret.DirectorySecretSource",
"pytest.fixture",
"os.path.exists",
"os.path.isfile",
"pytest.raises",
"shutil.rmtree",
"os.path.join",
"os.listdir"
] | [((165, 205), 'os.path.join', 'os.path.join', (['"""/tmp"""', '""".top_secret_test"""'], {}), "('/tmp', '.top_secret_test')\n", (177, 205), False, 'import os\n'), ((209, 253), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'autouse': '(True)'}), "(scope='module', autouse=True)\n", (223, 253), False,... |
# Library Imports
from os import execl
import nextcord, json
from nextcord.ui import button, View, Select
# Custom Imports
from Functions.Embed import *
# Options from Json
with open('Config/Options.json') as RawOptions:
Options = json.load(RawOptions)
# Note: The roles are fetched from IDs. These id's are store... | [
"json.load",
"nextcord.SelectOption"
] | [((237, 258), 'json.load', 'json.load', (['RawOptions'], {}), '(RawOptions)\n', (246, 258), False, 'import nextcord, json\n'), ((584, 697), 'nextcord.SelectOption', 'nextcord.SelectOption', ([], {'label': '"""- 13"""', 'description': '"""Click to get/remove this role"""', 'value': '"""886537316418609172"""'}), "(label=... |
from django.shortcuts import render, get_object_or_404, get_list_or_404
from .models import Article,Comment
from django.core.paginator import Paginator,EmptyPage,PageNotAnInteger
from .forms import ShareEmailForm,CommentForm,SearchForm,ArticleForm
# from django.core.mail import send_mail
from django.db.models import Co... | [
"django.shortcuts.get_list_or_404",
"django.utils.timezone.now",
"django.contrib.messages.error",
"django.urls.reverse",
"django.shortcuts.get_object_or_404",
"django.core.paginator.Paginator",
"django.shortcuts.render",
"django.contrib.messages.success",
"django.db.models.Count"
] | [((837, 863), 'django.core.paginator.Paginator', 'Paginator', (['all_articles', '(3)'], {}), '(all_articles, 3)\n', (846, 863), False, 'from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger\n'), ((2457, 2589), 'django.shortcuts.render', 'render', (['request', '"""article/articles/article_list.html"""... |
from django.contrib.auth.backends import ModelBackend
from 你个人的.models import UserProfile
from social_auth.models import UserSocialAuth
class OAuth2Backend(ModelBackend):
'''
oauth backend
'''
def authenticate(self, provider=None, uid=None):
try:
user_social = UserSocialAuth.object... | [
"social_auth.models.UserSocialAuth.objects.get"
] | [((299, 353), 'social_auth.models.UserSocialAuth.objects.get', 'UserSocialAuth.objects.get', ([], {'provider': 'provider', 'uid': 'uid'}), '(provider=provider, uid=uid)\n', (325, 353), False, 'from social_auth.models import UserSocialAuth\n')] |
"""Generic way to build regex from examples."""
import logging
import regex as re
from typing import List, Dict
import pandas
from tabulate import tabulate
logger = logging.getLogger(__name__)
def merge_regex(regex_tokens: List[str]):
"""Merge a list of regex to one group."""
tokens = r'|'.join(sorted(regex... | [
"pandas.DataFrame",
"regex.findall",
"regex.compile",
"regex.search",
"regex.sub",
"tabulate.tabulate",
"logging.getLogger"
] | [((167, 194), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (184, 194), False, 'import logging\n'), ((495, 531), 'regex.sub', 're.sub', (['"""(?<! ) (?! )"""', '"""[ ]+"""', 'text'], {}), "('(?<! ) (?! )', '[ ]+', text)\n", (501, 531), True, 'import regex as re\n'), ((551, 605), 'regex.s... |
from kurbopy import Point, CubicBez
import math
def test_cubicbez_deriv():
c = CubicBez(
Point(0.0, 0.0),
Point(1.0 / 3.0, 0.0),
Point(2.0 / 3.0, 1.0 / 3.0),
Point(1.0, 1.0),
);
deriv = c.deriv();
n = 10;
for i in range(1, n):
t = 1/(i*n)
delta = 1e-... | [
"math.sqrt",
"kurbopy.Point"
] | [((102, 117), 'kurbopy.Point', 'Point', (['(0.0)', '(0.0)'], {}), '(0.0, 0.0)\n', (107, 117), False, 'from kurbopy import Point, CubicBez\n'), ((127, 148), 'kurbopy.Point', 'Point', (['(1.0 / 3.0)', '(0.0)'], {}), '(1.0 / 3.0, 0.0)\n', (132, 148), False, 'from kurbopy import Point, CubicBez\n'), ((158, 185), 'kurbopy.P... |
"""
Main entrance to the application
"""
# Local application imports
from app import create_app
application = create_app()
if __name__ == '__main__':
application.run()
| [
"app.create_app"
] | [((113, 125), 'app.create_app', 'create_app', ([], {}), '()\n', (123, 125), False, 'from app import create_app\n')] |
"""
Provides ready-made implementations for filters used in templates.
"""
from string import Template
import arrow
from dateutil import tz
from .constants import ThemeColor
__all__ = ('humanize', 'if_true', 'navbar_skin', 'sidebar_skin', 'replace_with_flag')
def humanize(dt, locale='en_us', time_zone=None):
... | [
"dateutil.tz.gettz",
"string.Template"
] | [((398, 417), 'dateutil.tz.gettz', 'tz.gettz', (['time_zone'], {}), '(time_zone)\n', (406, 417), False, 'from dateutil import tz\n'), ((684, 706), 'string.Template', 'Template', (['replace_with'], {}), '(replace_with)\n', (692, 706), False, 'from string import Template\n')] |
"""Management of versions to help users update."""
import os
from configparser import ConfigParser
from datetime import datetime
from distutils.version import StrictVersion
import requests
from .utils.logging import print_warning # pylint: disable=cyclic-import
def get_version() -> str:
"""Get current installe... | [
"os.path.dirname",
"datetime.datetime.now",
"requests.get",
"configparser.ConfigParser",
"os.path.expanduser"
] | [((836, 850), 'configparser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (848, 850), False, 'from configparser import ConfigParser\n'), ((705, 728), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (723, 728), False, 'import os\n'), ((772, 799), 'os.path.dirname', 'os.path.dirname', (['cach... |
import ray
from ray import serve
import requests
import os
import pickle
import numpy as np
import asyncio
# Models locations
RANDOM_FOREST_MODEL_PATH = os.path.join("wine-quality_random_forest.pkl")
XGBOOST_MODEL_PATH = os.path.join("wine-quality_xgboost.pkl")
GRBOOST_MODEL_PATH = os.path.join("wine-quality_grboost.... | [
"ray.init",
"ray.serve.deployment",
"ray.get",
"pickle.load",
"numpy.array",
"requests.get",
"ray.serve.start",
"os.path.join"
] | [((155, 201), 'os.path.join', 'os.path.join', (['"""wine-quality_random_forest.pkl"""'], {}), "('wine-quality_random_forest.pkl')\n", (167, 201), False, 'import os\n'), ((223, 263), 'os.path.join', 'os.path.join', (['"""wine-quality_xgboost.pkl"""'], {}), "('wine-quality_xgboost.pkl')\n", (235, 263), False, 'import os\... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import math
from contextlib import contextmanager
from timeit import default_timer
from redis import StrictRedis
import six
from django.conf import settings
# noinspection PyUnresolvedReferences
from six.moves import xrange
from easy_cac... | [
"timeit.default_timer",
"sys.version.replace",
"easy_cache.decorators.ecached",
"six.moves.xrange",
"tests.conf.REDIS_HOST.split",
"redis.StrictRedis",
"django.get_version"
] | [((1410, 1431), 'tests.conf.REDIS_HOST.split', 'REDIS_HOST.split', (['""":"""'], {}), "(':')\n", (1426, 1431), False, 'from tests.conf import REDIS_HOST, MEMCACHED_HOST\n'), ((3027, 3057), 'easy_cache.decorators.ecached', 'ecached', ([], {'cache_alias': '"""default"""'}), "(cache_alias='default')\n", (3034, 3057), Fals... |
from __future__ import absolute_import, division, print_function, unicode_literals
import wx
import logging
log = logging.getLogger(__name__)
MENU_FILE = wx.NewId()
MENU_VIEW = wx.NewId()
MENU_INTERACT = wx.NewId()
MENU_PROC = wx.NewId()
MENU_DB = wx.NewId()
MENU_SERVER = wx.NewId()
MENU_TOOLS = wx.NewId()
MENU_HEL... | [
"wx.Menu",
"wx.BoxSizer",
"wx.MenuItem",
"wx.Frame.__init__",
"wx.NewId",
"logging.getLogger",
"wx.MenuBar"
] | [((117, 144), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (134, 144), False, 'import logging\n'), ((158, 168), 'wx.NewId', 'wx.NewId', ([], {}), '()\n', (166, 168), False, 'import wx\n'), ((181, 191), 'wx.NewId', 'wx.NewId', ([], {}), '()\n', (189, 191), False, 'import wx\n'), ((208, 2... |
from torch.utils.data import DataLoader
from torch.utils.data.distributed import DistributedSampler
from .s3dis import S3DISDataset
from .scannetv2 import ScanNetDataset
__all__ = ['S3DISDataset', 'ScanNetDataset', 'build_dataset']
def build_dataset(data_cfg, logger):
assert 'type' in data_cfg
_data_cfg = d... | [
"torch.utils.data.distributed.DistributedSampler",
"torch.utils.data.DataLoader"
] | [((739, 783), 'torch.utils.data.distributed.DistributedSampler', 'DistributedSampler', (['dataset'], {'shuffle': 'shuffle'}), '(dataset, shuffle=shuffle)\n', (757, 783), False, 'from torch.utils.data.distributed import DistributedSampler\n'), ((886, 1059), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset'], {'ba... |
import keras
from keras.layers import Activation
from keras.models import load_model
from keras import backend as K
from keras.utils.generic_utils import get_custom_objects
import tensorflow as tf
import numpy as np
import pandas as pd
import timeit
import sys
import argparse
# Constants
#window_size = 1024
def ... | [
"keras.models.load_model",
"argparse.ArgumentParser",
"keras.layers.Activation",
"timeit.default_timer",
"numpy.savetxt",
"numpy.genfromtxt",
"keras.utils.generic_utils.get_custom_objects",
"pandas.Series",
"keras.backend.sigmoid"
] | [((1566, 1662), 'keras.models.load_model', 'load_model', (["('../models/' + exp + '/new_train/' + 'encoder_' + dataset + '.h5')"], {'compile': '(False)'}), "('../models/' + exp + '/new_train/' + 'encoder_' + dataset +\n '.h5', compile=False)\n", (1576, 1662), False, 'from keras.models import load_model\n'), ((3046, ... |
from rest_framework import mixins, response, viewsets
from dateflix_api.models import User
from dateflix_api.serializers import ProfileSerializer
class MeViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
"""
API endpoint that allows current profile to be viewed.
"""
serializer_class = Profile... | [
"dateflix_api.models.User.objects.all"
] | [((346, 364), 'dateflix_api.models.User.objects.all', 'User.objects.all', ([], {}), '()\n', (362, 364), False, 'from dateflix_api.models import User\n')] |
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
p = GPIO.PWM(18, 50)
p.start(2.5)
while True:
p.ChangeDutyCycle(2.5) # 0 degree
time.sleep(1)
p.ChangeDutyCycle(6.75)
time.sleep(1)
p.ChangeDutyCycle(10.5)
time.sleep(1)
| [
"RPi.GPIO.setup",
"RPi.GPIO.setmode",
"RPi.GPIO.PWM",
"time.sleep"
] | [((37, 59), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (49, 59), True, 'import RPi.GPIO as GPIO\n'), ((60, 84), 'RPi.GPIO.setup', 'GPIO.setup', (['(18)', 'GPIO.OUT'], {}), '(18, GPIO.OUT)\n', (70, 84), True, 'import RPi.GPIO as GPIO\n'), ((90, 106), 'RPi.GPIO.PWM', 'GPIO.PWM', (['(18)', '(5... |
# date: 2020.09.11
# author: Bartłomiej "furas" Burek (https://blog.furas.pl)
# https://stackoverflow.com/questions/63840415/how-to-scrape-website-tables-where-the-value-can-be-different-as-we-chose-but-th
import requests
from bs4 import BeautifulSoup
import csv
url = 'https://id.investing.com/instruments/Historical... | [
"bs4.BeautifulSoup",
"requests.post",
"csv.writer"
] | [((878, 892), 'csv.writer', 'csv.writer', (['fh'], {}), '(fh)\n', (888, 892), False, 'import csv\n'), ((1051, 1100), 'requests.post', 'requests.post', (['url'], {'data': 'payload', 'headers': 'headers'}), '(url, data=payload, headers=headers)\n', (1064, 1100), False, 'import requests\n'), ((1136, 1165), 'bs4.BeautifulS... |
import numpy as np
from igp2 import AgentState, plot_map
from igp2.data import ScenarioConfig, InDScenario
from igp2.opendrive.map import Map
import matplotlib.pyplot as plt
from shapely.ops import unary_union
from grit.core.data_processing import get_episode_frames
from grit.core.feature_extraction import FeatureExt... | [
"grit.core.feature_extraction.FeatureExtractor",
"grit.core.data_processing.get_episode_frames",
"shapely.ops.unary_union",
"matplotlib.pyplot.show",
"grit.occlusion_detection.occlusion_detection_geometry.OcclusionDetector2D.plot_area_from_list",
"numpy.deg2rad",
"igp2.plot_map",
"grit.core.base.get_b... | [((637, 695), 'grit.core.feature_extraction.FeatureExtractor', 'FeatureExtractor', (['scenario_map', 'scenario_name', 'episode_idx'], {}), '(scenario_map, scenario_name, episode_idx)\n', (653, 695), False, 'from grit.core.feature_extraction import FeatureExtractor\n'), ((1118, 1146), 'igp2.data.InDScenario', 'InDScenar... |
import glob
import json
import argparse
import os
import os.path as path
from functools import partial
from tqdm import tqdm
import pandas as pd
import numpy as np
import scipy
import plotnine as p9
from scipy.stats import bootstrap
from nlproar.dataset import SNLIDataset, SSTDataset, IMDBDataset, BabiDataset, Mimic... | [
"pandas.DataFrame",
"functools.partial",
"tqdm.tqdm",
"json.load",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.join",
"os.path.realpath",
"numpy.random.default_rng",
"numpy.mean",
"glob.glob",
"pandas.read_pickle",
"pandas.set_option",
"numpy.all"
] | [((2434, 2459), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2457, 2459), False, 'import argparse\n'), ((737, 747), 'numpy.mean', 'np.mean', (['x'], {}), '(x)\n', (744, 747), True, 'import numpy as np\n'), ((756, 773), 'numpy.all', 'np.all', (['(x[0] == x)'], {}), '(x[0] == x)\n', (762, 773)... |
from django.urls import path
from . import views
urlpatterns = [
path('generalchatroom/', views.index, name='index'),
path('generalchatroom/<str:room_name>/', views.room, name='room'),
path('show_Message/', views.show_Message, name='show_Message'),
]
| [
"django.urls.path"
] | [((71, 122), 'django.urls.path', 'path', (['"""generalchatroom/"""', 'views.index'], {'name': '"""index"""'}), "('generalchatroom/', views.index, name='index')\n", (75, 122), False, 'from django.urls import path\n'), ((128, 193), 'django.urls.path', 'path', (['"""generalchatroom/<str:room_name>/"""', 'views.room'], {'n... |
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... | [
"unittest.main",
"s1ap_types.fwNbErrIndMsg_t",
"s1ap_types.ueAttachRequest_t",
"s1ap_wrapper.TestWrapper"
] | [((2849, 2864), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2862, 2864), False, 'import unittest\n'), ((775, 801), 's1ap_wrapper.TestWrapper', 's1ap_wrapper.TestWrapper', ([], {}), '()\n', (799, 801), False, 'import s1ap_wrapper\n'), ((1173, 1203), 's1ap_types.ueAttachRequest_t', 's1ap_types.ueAttachRequest_t'... |
from django.core.exceptions import ValidationError
from constants.account_strings import AccountStrings
from django.db import models
from django.conf import settings
from country.models import City
from django.db.models.signals import post_delete
from django.dispatch import receiver
class ParentProfile(models.Model):
... | [
"django.db.models.ForeignKey",
"django.db.models.OneToOneField",
"django.db.models.CharField",
"django.core.exceptions.ValidationError"
] | [((331, 526), 'django.db.models.OneToOneField', 'models.OneToOneField', (['settings.AUTH_USER_MODEL'], {'on_delete': 'models.CASCADE', 'primary_key': '(True)', 'verbose_name': 'AccountStrings.ParentProfileStrings.user_verbose_name', 'related_name': '"""user_parent"""'}), "(settings.AUTH_USER_MODEL, on_delete=models.CAS... |
import setuptools
from os.path import dirname, join
here = dirname(__file__)
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="algo-trader",
version="2.0.4",
author="<NAME>",
author_email="<EMAIL>",
description="Trade execution engine to process API data... | [
"os.path.dirname",
"os.path.join",
"setuptools.find_packages"
] | [((60, 77), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (67, 77), False, 'from os.path import dirname, join\n'), ((589, 615), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (613, 615), False, 'import setuptools\n'), ((405, 428), 'os.path.join', 'join', (['here', '"""READ... |
import pybullet as p
import time
import math
p.connect(p.GUI)
useMaximalCoordinates = False
p.setGravity(0, 0, -10)
plane = p.loadURDF("plane.urdf", [0, 0, -1], useMaximalCoordinates=useMaximalCoordinates)
p.setRealTimeSimulation(0)
velocity = 1
num = 40
p.configureDebugVisualizer(p.COV_ENABLE_GUI, 0)
p.configureDe... | [
"pybullet.setRealTimeSimulation",
"pybullet.addUserDebugLine",
"pybullet.stepSimulation",
"pybullet.setGravity",
"pybullet.changeDynamics",
"pybullet.configureDebugVisualizer",
"pybullet.getBasePositionAndOrientation",
"pybullet.resetBaseVelocity",
"time.sleep",
"pybullet.setPhysicsEngineParameter... | [((46, 62), 'pybullet.connect', 'p.connect', (['p.GUI'], {}), '(p.GUI)\n', (55, 62), True, 'import pybullet as p\n'), ((94, 117), 'pybullet.setGravity', 'p.setGravity', (['(0)', '(0)', '(-10)'], {}), '(0, 0, -10)\n', (106, 117), True, 'import pybullet as p\n'), ((126, 212), 'pybullet.loadURDF', 'p.loadURDF', (['"""plan... |
import torch
import torch_xla
import torch_xla.core.xla_model as xm
def detect_cuda_device_number():
return torch.cuda.current_device() if torch.cuda.is_available() else -1
def detect_tpu_device_number():
return xm.xla_device().index if xm.xla_device() else -1
| [
"torch.cuda.current_device",
"torch.cuda.is_available",
"torch_xla.core.xla_model.xla_device"
] | [((144, 169), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (167, 169), False, 'import torch\n'), ((113, 140), 'torch.cuda.current_device', 'torch.cuda.current_device', ([], {}), '()\n', (138, 140), False, 'import torch\n'), ((247, 262), 'torch_xla.core.xla_model.xla_device', 'xm.xla_device', ... |
"""Run validation test for CharacterPredictor."""
import os
from pathlib import Path
from time import time
import unittest
from text_recognizer.datasets import EmnistDataset
from text_recognizer.character_predictor import CharacterPredictor
os.environ["CUDA_VISIBLE_DEVICES"] = ""
SUPPORT_DIRNAME = Path(__file__).par... | [
"text_recognizer.character_predictor.CharacterPredictor",
"text_recognizer.datasets.EmnistDataset",
"pathlib.Path",
"time.time"
] | [((469, 489), 'text_recognizer.character_predictor.CharacterPredictor', 'CharacterPredictor', ([], {}), '()\n', (487, 489), False, 'from text_recognizer.character_predictor import CharacterPredictor\n'), ((508, 523), 'text_recognizer.datasets.EmnistDataset', 'EmnistDataset', ([], {}), '()\n', (521, 523), False, 'from t... |
from slack import WebClient
import server.config as config
slack_service = WebClient(token=config.SLACK_TOKEN)
| [
"slack.WebClient"
] | [((77, 112), 'slack.WebClient', 'WebClient', ([], {'token': 'config.SLACK_TOKEN'}), '(token=config.SLACK_TOKEN)\n', (86, 112), False, 'from slack import WebClient\n')] |
#!/home/adam/Documents/revkit-1.3/python
#!/usr/bin/python
# RevKit: A Toolkit for Reversible Circuit Design (www.revkit.org)
# Copyright (C) 2009-2011 The RevKit Developers <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pub... | [
"os.path.dirname",
"os.path.abspath",
"os.path.basename"
] | [((854, 882), 'os.path.dirname', 'os.path.dirname', (['sys.path[0]'], {}), '(sys.path[0])\n', (869, 882), False, 'import os, sys\n'), ((4252, 4277), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (4267, 4277), False, 'import os, sys\n'), ((4311, 4337), 'os.path.basename', 'os.path.basename', ... |
from django.contrib import admin
from src.jobs.models import Job
admin.site.register(Job)
| [
"django.contrib.admin.site.register"
] | [((67, 91), 'django.contrib.admin.site.register', 'admin.site.register', (['Job'], {}), '(Job)\n', (86, 91), False, 'from django.contrib import admin\n')] |
import numpy as np
import json
from graphviz import Digraph
import pickle
import compare_functions
def remove_item(item_list, item):
if item in item_list:
item_list.remove(item)
return list(item_list)
def create_ngrams(trace, n):
#A function that returns a list of n-grams of a trace
return [tr... | [
"json.loads",
"json.dumps"
] | [((5407, 5594), 'json.dumps', 'json.dumps', (['(self.children, self.all_descendants, self.parents, self.all_ancestors,\n self.all_concepts, self.concept_problems, self.all_basic_components,\n self.problem_components)'], {}), '((self.children, self.all_descendants, self.parents, self.\n all_ancestors, self.all_... |
"""Initial Migration
Revision ID: 2d549589ee65
Revises:
Create Date: 2019-10-02 16:59:16.744510
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2d<PASSWORD>9ee65'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands ... | [
"alembic.op.drop_table",
"alembic.op.f",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Text",
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.String",
"sqlalchemy.Integer"
] | [((2545, 2569), 'alembic.op.drop_table', 'op.drop_table', (['"""upvotes"""'], {}), "('upvotes')\n", (2558, 2569), False, 'from alembic import op\n'), ((2574, 2599), 'alembic.op.drop_table', 'op.drop_table', (['"""comments"""'], {}), "('comments')\n", (2587, 2599), False, 'from alembic import op\n'), ((2666, 2687), 'ale... |
import numpy as np
import matplotlib.pyplot as plt
# close all figures
plt.close('all')
years = np.array([1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig"
] | [((74, 90), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (83, 90), True, 'import matplotlib.pyplot as plt\n'), ((100, 456), 'numpy.array', 'np.array', (['[1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, \n 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981... |
import discord
from discord.ext import commands
class Snipe(commands.Cog):
"""Gets the last message sent."""
def __init__(self, bot):
self.bot = bot
self.cache = {}
@commands.Cog.listener()
async def on_raw_message_delete(self, payload):
message = payload.cached_message
... | [
"discord.ext.commands.command",
"discord.Embed",
"discord.ext.commands.Cog.listener"
] | [((197, 220), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (218, 220), False, 'from discord.ext import commands\n'), ((1174, 1266), 'discord.ext.commands.command', 'commands.command', ([], {'description': '"""Gets last deleted message from guild / DM and sends it."""'}), "(description... |
"""Derivation of variable `chlora`."""
from iris import Constraint
from ._baseclass import DerivedVariableBase
class DerivedVariable(DerivedVariableBase):
"""Derivation of variable `chlora`."""
@staticmethod
def required(project):
"""Declare the variables needed for derivation."""
requi... | [
"iris.Constraint"
] | [((663, 758), 'iris.Constraint', 'Constraint', ([], {'name': "('mass_concentration_of_diatoms_expressed_as' + '_chlorophyll_in_sea_water')"}), "(name='mass_concentration_of_diatoms_expressed_as' +\n '_chlorophyll_in_sea_water')\n", (673, 758), False, 'from iris import Constraint\n'), ((836, 956), 'iris.Constraint', ... |
"""
# Name Identifier-name, Poly Reverse Init-value XOR-out Check
[ 'crc-8', 'Crc8', 0x107, NON_REVERSE, 0x00, 0x00, 0xF4, ],
"""
from io import StringIO
from crcmod import Crc
c8 = 0x107
code = StringIO()
Crc(c8,... | [
"io.StringIO",
"crcmod.Crc"
] | [((302, 312), 'io.StringIO', 'StringIO', ([], {}), '()\n', (310, 312), False, 'from io import StringIO\n'), ((313, 331), 'crcmod.Crc', 'Crc', (['c8'], {'rev': '(False)'}), '(c8, rev=False)\n', (316, 331), False, 'from crcmod import Crc\n')] |
from typing import List, Union
import numpy as np
def slice_to_list(
start: Union[int, None],
stop: Union[int, None],
step: Union[int, None],
size: int = None,
) -> List[int]:
if start is None and stop is None:
if size is None:
raise ValueError("size required when start and sto... | [
"numpy.min"
] | [((862, 871), 'numpy.min', 'np.min', (['l'], {}), '(l)\n', (868, 871), True, 'import numpy as np\n')] |
import torchfile
import h5py
dataset_types = ('train', 'valid', 'test')
dataset_path = 'data/cluttered_{}.t7'
outpath = 'data/cluttered_mnist.h5'
with h5py.File(outpath, 'w') as hf:
for dataset_type in dataset_types:
inpath = dataset_path.format(dataset_type)
print('... load {}'.format(inpath))
o = tor... | [
"h5py.File",
"torchfile.load"
] | [((153, 176), 'h5py.File', 'h5py.File', (['outpath', '"""w"""'], {}), "(outpath, 'w')\n", (162, 176), False, 'import h5py\n'), ((317, 339), 'torchfile.load', 'torchfile.load', (['inpath'], {}), '(inpath)\n', (331, 339), False, 'import torchfile\n')] |
from __future__ import absolute_import
import sklearn.neighbors
import sklearn.preprocessing
from ann_benchmarks.algorithms.base import BaseANN
from datasketch import MinHash
class LSHF(BaseANN):
def __init__(self, metric, n_estimators=10, n_candidates=50):
self.name = 'LSHF(n_est=%d, n_cand=%d)' % (n_est... | [
"datasketch.MinHash"
] | [((1198, 1219), 'datasketch.MinHash', 'MinHash', ([], {'num_perm': '(128)'}), '(num_perm=128)\n', (1205, 1219), False, 'from datasketch import MinHash\n'), ((573, 594), 'datasketch.MinHash', 'MinHash', ([], {'num_perm': '(128)'}), '(num_perm=128)\n', (580, 594), False, 'from datasketch import MinHash\n')] |
# Load pickled data
import cv2
import pickle
import numpy as np
import matplotlib.pyplot as plt
from sklearn.utils import shuffle
import tensorflow as tf
import MyAlexNet
import DataAugmentation as func
import glob
import csv
# TODO: Fill this in based on where you saved the training and testing data
... | [
"matplotlib.pyplot.title",
"DataAugmentation.transform_img",
"tensorflow.reset_default_graph",
"matplotlib.pyplot.figure",
"pickle.load",
"numpy.mean",
"numpy.arange",
"glob.glob",
"tensorflow.get_default_graph",
"numpy.unique",
"matplotlib.pyplot.xlabel",
"tensorflow.nn.softmax",
"tensorflo... | [((2052, 2082), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 16.5)'}), '(figsize=(12, 16.5))\n', (2062, 2082), True, 'import matplotlib.pyplot as plt\n'), ((2347, 2357), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2355, 2357), True, 'import matplotlib.pyplot as plt\n'), ((2396, 2423), '... |
import datetime
import random
from config import *
from lib import app, cords, button, led
from utils import time
class Direction:
def __init__(self, x, y, left=None, right=None):
self.x = x
self.y = y
self.left = left
self.right = right
SPEED = 1000
DIR_UP = Direction(0, -1)
... | [
"random.randint",
"lib.cords.Cords",
"utils.time.sleep",
"lib.button.any_button_once",
"datetime.datetime.now",
"lib.led.fill_func"
] | [((1975, 1988), 'utils.time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (1985, 1988), False, 'from utils import time\n'), ((2251, 2282), 'lib.led.fill_func', 'led.fill_func', (['self.render_func'], {}), '(self.render_func)\n', (2264, 2282), False, 'from lib import app, cords, button, led\n'), ((695, 717), 'lib.cords.... |
from django.contrib import admin
from physionet import models
# Register your models here.
admin.site.register(models.StaticPage)
admin.site.register(models.Section)
| [
"django.contrib.admin.site.register"
] | [((92, 130), 'django.contrib.admin.site.register', 'admin.site.register', (['models.StaticPage'], {}), '(models.StaticPage)\n', (111, 130), False, 'from django.contrib import admin\n'), ((131, 166), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Section'], {}), '(models.Section)\n', (150, 166), ... |
from datetime import datetime
from common.forms import DocumentForm
from common.functions import create_thumbnail, delete_thumbnail
from django import forms
from django.conf import settings
from django.utils.dateformat import format
from .models import Article
class ArticleForm(DocumentForm):
UPLOAD_TO = 'blog/... | [
"common.functions.delete_thumbnail",
"datetime.datetime.today",
"django.forms.BooleanField",
"common.functions.create_thumbnail",
"django.forms.TypedChoiceField",
"django.forms.CharField"
] | [((343, 360), 'django.forms.CharField', 'forms.CharField', ([], {}), '()\n', (358, 360), False, 'from django import forms\n'), ((375, 429), 'django.forms.CharField', 'forms.CharField', ([], {'required': '(False)', 'widget': 'forms.Textarea'}), '(required=False, widget=forms.Textarea)\n', (390, 429), False, 'from django... |
# Third party inports
import tensorflow as tf
import numpy as np
# batch_sizexheightxwidthxdepthxchan
def diceLoss(y_true, y_pred):
top = 2*tf.reduce_sum(y_true * y_pred, [1, 2, 3])
bottom = tf.maximum(tf.reduce_sum(y_true+y_pred, [1, 2, 3]), 1e-5)
dice = tf.reduce_mean(top/bottom)
return -dice
de... | [
"tensorflow.ones",
"tensorflow.abs",
"tensorflow.reduce_sum",
"tensorflow.reduce_mean",
"tensorflow.nn.conv3d",
"tensorflow.multiply",
"numpy.finfo",
"tensorflow.nn.conv2d"
] | [((272, 300), 'tensorflow.reduce_mean', 'tf.reduce_mean', (['(top / bottom)'], {}), '(top / bottom)\n', (286, 300), True, 'import tensorflow as tf\n'), ((148, 189), 'tensorflow.reduce_sum', 'tf.reduce_sum', (['(y_true * y_pred)', '[1, 2, 3]'], {}), '(y_true * y_pred, [1, 2, 3])\n', (161, 189), True, 'import tensorflow ... |
from afqueue.common.encoding_utilities import cast_bytes
from afqueue.messages.base_message import BaseMessage #@UnresolvedImport
from afqueue.common.exception_formatter import ExceptionFormatter #@UnresolvedImport
from afqueue.common.client_queue_lock import ClientQueueLock #@UnresolvedImport
from afqueue.messages imp... | [
"afqueue.messages.base_message.BaseMessage._send_with_destination",
"afqueue.common.client_exchange.ClientExchange.create_network_tuple_list",
"afqueue.messages.base_message.BaseMessage.bool_from_string",
"bson.loads",
"afqueue.common.exception_formatter.ExceptionFormatter.get_full_exception",
"simplejson... | [((16381, 16406), 'afqueue.common.encoding_utilities.cast_bytes', 'cast_bytes', (['dumped_string'], {}), '(dumped_string)\n', (16391, 16406), False, 'from afqueue.common.encoding_utilities import cast_bytes\n'), ((16427, 16452), 'bson.loads', 'bson.loads', (['dumped_string'], {}), '(dumped_string)\n', (16437, 16452), F... |
# Copyright (C) 2019 Cancer Care Associates
# 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 ... | [
"collections.namedtuple",
"pymedphys._utilities.transforms.convert_IEC_angle_to_bipolar"
] | [((707, 743), 'collections.namedtuple', 'namedtuple', (['"""Point"""', "('x', 'y', 'z')"], {}), "('Point', ('x', 'y', 'z'))\n", (717, 743), False, 'from collections import namedtuple\n'), ((5504, 5554), 'pymedphys._utilities.transforms.convert_IEC_angle_to_bipolar', 'convert_IEC_angle_to_bipolar', (['cp_gantry_angles_I... |
from flask import Flask
from flask.ext.mail import Mail
from peewee import *
import os
cwd = os.getcwd()
frontend_dest = os.path.join( cwd, 'frontend/' )
app = Flask( __name__, static_url_path = '', static_folder = frontend_dest )
app.config.from_object( 'config' )
mail = Mail( app )
db = SqliteDatabase( app.config... | [
"os.getcwd",
"flask.Flask",
"os.path.join",
"flask.ext.mail.Mail"
] | [((95, 106), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (104, 106), False, 'import os\n'), ((123, 153), 'os.path.join', 'os.path.join', (['cwd', '"""frontend/"""'], {}), "(cwd, 'frontend/')\n", (135, 153), False, 'import os\n'), ((163, 227), 'flask.Flask', 'Flask', (['__name__'], {'static_url_path': '""""""', 'static_... |
from __future__ import annotations
import re
from pathlib import Path
from logging import getLogger, Logger
from fileinput import hook_compressed
from dataclasses import dataclass, field, fields
from typing import Iterator, get_type_hints, Generator
import numpy as np
import numpy.typing as npt
from pysam import Tabix... | [
"typing.get_type_hints",
"fileinput.hook_compressed",
"dataclasses.field",
"numpy.array",
"numpy.all"
] | [((805, 834), 'dataclasses.field', 'field', ([], {'init': '(False)', 'repr': '(False)'}), '(init=False, repr=False)\n', (810, 834), False, 'from dataclasses import dataclass, field, fields\n'), ((7026, 7066), 'dataclasses.field', 'field', ([], {'default_factory': 'tuple', 'init': '(False)'}), '(default_factory=tuple, i... |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
# TODO: pass ft_cse to use fine-tuned feature
# TODO: pass fine_steps -1 to use fine samples
from absl import flags, app
import sys
sys.path.insert(0,'')
sys.path.insert(0,'third_party')
import numpy as np
from matplotlib import pyplot as plt
impor... | [
"matplotlib.cm.get_cmap",
"torch.cat",
"nnutils.loss_utils.feat_match",
"glob.glob",
"torch.no_grad",
"nnutils.geom_utils.sample_xy",
"nnutils.train_utils.v2s_trainer",
"cv2.imwrite",
"nnutils.loss_utils.kp_reproj",
"utils.io.vis_match",
"cv2.resize",
"torch.svd",
"numpy.hstack",
"utils.io... | [((204, 226), 'sys.path.insert', 'sys.path.insert', (['(0)', '""""""'], {}), "(0, '')\n", (219, 226), False, 'import sys\n'), ((226, 259), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""third_party"""'], {}), "(0, 'third_party')\n", (241, 259), False, 'import sys\n'), ((1284, 1324), 'nnutils.geom_utils.raycast', 'r... |
from peering_manager.api import OrderedDefaultRouter
from . import views
router = OrderedDefaultRouter()
router.APIRootView = views.ExtrasRootView
router.register("ix-api", views.IXAPIViewSet)
router.register("job-results", views.JobResultViewSet)
router.register("webhooks", views.WebhookViewSet)
app_name = "extras... | [
"peering_manager.api.OrderedDefaultRouter"
] | [((84, 106), 'peering_manager.api.OrderedDefaultRouter', 'OrderedDefaultRouter', ([], {}), '()\n', (104, 106), False, 'from peering_manager.api import OrderedDefaultRouter\n')] |
from flask_restx import Namespace, Resource
from flask import request
from .lib.parser import UserParser
from .view import UserView
from libs.depends.entry import container
from libs.middleware.auth import login_required, active_required
user = Namespace('user', path='/users', decorators=[active_required(), l... | [
"libs.middleware.auth.active_required",
"libs.middleware.auth.login_required",
"libs.depends.entry.container.get"
] | [((604, 629), 'libs.depends.entry.container.get', 'container.get', (['UserParser'], {}), '(UserParser)\n', (617, 629), False, 'from libs.depends.entry import container\n'), ((300, 317), 'libs.middleware.auth.active_required', 'active_required', ([], {}), '()\n', (315, 317), False, 'from libs.middleware.auth import logi... |
# This script is for the rotate function
import numpy as np
import matplotlib.pyplot as plt
import cv2
def rotate(image, degree, output_path):
"""
Rotates an OpenCV 2 / NumPy image about it's centre by the given degree
(in degrees). The returned image will be large enough to hold the entire
new image,... | [
"numpy.matrix",
"matplotlib.pyplot.imshow",
"cv2.warpAffine",
"numpy.array",
"matplotlib.pyplot.imread",
"cv2.getRotationMatrix2D",
"matplotlib.pyplot.savefig"
] | [((1446, 1474), 'numpy.matrix', 'np.matrix', (['rot_mat[0:2, 0:2]'], {}), '(rot_mat[0:2, 0:2])\n', (1455, 1474), True, 'import numpy as np\n'), ((2875, 2948), 'cv2.warpAffine', 'cv2.warpAffine', (['image', 'affine_mat', '(new_w, new_h)'], {'flags': 'cv2.INTER_LINEAR'}), '(image, affine_mat, (new_w, new_h), flags=cv2.IN... |
#******************************************************************************
#
# MantaGen
# Copyright 2018 <NAME>, <NAME>, <NAME>
#
# This program is free software, distributed under the terms of the
# Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
#**************************************... | [
"numpy.random.uniform",
"random.randint"
] | [((3221, 3254), 'random.randint', 'randint', (['(1)', 'self.max_source_count'], {}), '(1, self.max_source_count)\n', (3228, 3254), False, 'from random import randint\n'), ((1630, 1670), 'numpy.random.uniform', 'numpy.random.uniform', ([], {'low': '(0.25)', 'high': '(1.0)'}), '(low=0.25, high=1.0)\n', (1650, 1670), Fals... |
#! /usr/bin/env python3
import unittest
from main import run_1, run_2
class Test(unittest.TestCase):
def test_1(self):
self.assertEqual(run_1("aa bb cc dd ee\naa bb cc dd aa\naa bb cc dd aaa"), 2)
def test_2(self):
self.assertEqual(
run_2("abcde fghij\nabcde xyz ecdab\na ab abc a... | [
"unittest.main",
"main.run_1",
"main.run_2"
] | [((429, 444), 'unittest.main', 'unittest.main', ([], {}), '()\n', (442, 444), False, 'import unittest\n'), ((151, 209), 'main.run_1', 'run_1', (['"""aa bb cc dd ee\naa bb cc dd aa\naa bb cc dd aaa"""'], {}), '("""aa bb cc dd ee\naa bb cc dd aa\naa bb cc dd aaa""")\n', (156, 209), False, 'from main import run_1, run_2\n... |
import pygame
class Score:
def __init__(self):
self.right_score = 0
self.left_score = 0
self.right_cord = (465, 50)
self.left_cord = (300, 50)
self.left_color = (0, 0, 0)
self.right_color = (0, 0, 0)
def show_score(self, window, color):
"""... | [
"pygame.draw.rect",
"pygame.font.Font"
] | [((488, 528), 'pygame.font.Font', 'pygame.font.Font', (['"""freesansbold.ttf"""', '(80)'], {}), "('freesansbold.ttf', 80)\n", (504, 528), False, 'import pygame\n'), ((699, 749), 'pygame.draw.rect', 'pygame.draw.rect', (['window', 'color', '(400, 0, 10, 275)'], {}), '(window, color, (400, 0, 10, 275))\n', (715, 749), Fa... |