code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
class Config(object):
# noinspection SpellCheckingInspection
# import secrets
# secrets.token_hex(16)
SECRET_KEY = 'bcaa436189daf75374ecebec4a652522'
# The three slashes means a relative path so the file will next to the script
SQLALCHEMY_DATABASE_URI = 'sqlite:///site.db'
MAIL_... | [
"os.environ.get"
] | [((410, 441), 'os.environ.get', 'os.environ.get', (['"""MAIL_USERNAME"""'], {}), "('MAIL_USERNAME')\n", (424, 441), False, 'import os\n'), ((462, 493), 'os.environ.get', 'os.environ.get', (['"""MAIL_PASSWORD"""'], {}), "('MAIL_PASSWORD')\n", (476, 493), False, 'import os\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2019 EMBL - European Bioinformatics Institute
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICEN... | [
"emgapianns.management.lib.import_analysis_model.Assembly",
"emgapianns.management.lib.downloadable_files.UnchunkedDownloadFile",
"emgapi.models.StudyDownload.objects.using",
"os.path.isfile",
"emgapi.models.Pipeline.objects.using",
"emgapi.models.FileFormat.objects.using",
"sys.exc_info",
"glob.glob"... | [((1335, 1373), 're.match', 're.match', (['study_accssion_re', 'accession'], {}), '(study_accssion_re, accession)\n', (1343, 1373), False, 'import re\n'), ((1419, 1447), 're.compile', 're.compile', (['run_accession_re'], {}), '(run_accession_re)\n', (1429, 1447), False, 'import re\n'), ((1460, 1484), 're.search', 're.s... |
import fakeSensor
from datetime import datetime, timedelta, timezone
import time
import struct
import queue
from threading import Thread
from datetime import datetime, timedelta, timezone
import sys, os, signal
import socket
from pathlib import Path
import asyncio
import traceback
import faulthandler
import json
impor... | [
"simpleDali.utcnowWithTz",
"json.dumps",
"time.sleep",
"pathlib.Path",
"datetime.datetime.strptime",
"datetime.timedelta",
"simpleMiniseed.unpackMiniseedRecord"
] | [((7999, 8017), 'datetime.timedelta', 'timedelta', ([], {'hours': '(2)'}), '(hours=2)\n', (8008, 8017), False, 'from datetime import datetime, timedelta, timezone\n'), ((938, 963), 'simpleDali.utcnowWithTz', 'simpleDali.utcnowWithTz', ([], {}), '()\n', (961, 963), False, 'import simpleDali\n'), ((1930, 1948), 'pathlib.... |
import os
import cv2
import time
import django
from django.conf import settings
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "main.settings")
django.setup()
from arm.models import ArmImage
from tradition.edge.contour_detect_3d import Contour_3d
def _inner_find_one(rgb_path, depth_path, table_z, output_dir, debug_t... | [
"os.remove",
"os.environ.setdefault",
"django.setup",
"os.path.isdir",
"cv2.waitKey",
"os.path.realpath",
"tradition.edge.contour_detect_3d.Contour_3d",
"time.time",
"arm.models.ArmImage.objects.order_by",
"os.path.isfile",
"os.path.splitext",
"cv2.destroyAllWindows",
"os.path.join",
"os.l... | [((80, 144), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""main.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'main.settings')\n", (101, 144), False, 'import os\n'), ((145, 159), 'django.setup', 'django.setup', ([], {}), '()\n', (157, 159), False, 'import django\n'), ((338, 3... |
# %%
#Function 1 of ChemLibre Texts reading program, takes in a url, path, and browser type and returns the html
#Path location should be in the format ex. C:/Users/bowri/Anaconda3/chromedriver
#If using Firefox, or not Chrome, simply enter "" for path location, requires having downloaded chromedriver first
#See format... | [
"json.dump",
"random.randint",
"selenium.webdriver.Chrome",
"selenium.webdriver.Firefox"
] | [((1542, 1561), 'selenium.webdriver.Firefox', 'webdriver.Firefox', ([], {}), '()\n', (1559, 1561), False, 'from selenium import webdriver\n'), ((2313, 2334), 'random.randint', 'random.randint', (['(1)', '(10)'], {}), '(1, 10)\n', (2327, 2334), False, 'import random\n'), ((4703, 4725), 'random.randint', 'random.randint'... |
# -*- coding: utf-8 -*-
import os
import glob
import random
import numpy as np
from multiprocessing import Pool
from dvs_utils.prepareData import prepareData
NUM_CLASSES = 4
NUM_POINTS = 2**14
DATASET_TRAIN_DIR = "/bigdata_hdd/klein/FrKlein_PoC/data/TrainFiles/"
DATASET_PREP_TRAIN_DIR = "/bigdata_hdd/klein/FrKlein_P... | [
"random.shuffle",
"numpy.asarray",
"dvs_utils.prepareData.prepareData",
"random.seed",
"numpy.array",
"multiprocessing.Pool",
"os.path.join"
] | [((1248, 1282), 'numpy.array', 'np.array', (['points'], {'dtype': 'np.float32'}), '(points, dtype=np.float32)\n', (1256, 1282), True, 'import numpy as np\n'), ((1295, 1327), 'numpy.array', 'np.array', (['labels'], {'dtype': 'np.uint8'}), '(labels, dtype=np.uint8)\n', (1303, 1327), True, 'import numpy as np\n'), ((1340,... |
"""A collection of sphinx docstrings from the wild."""
import ast
FunctionDef = ast.FunctionDef
if hasattr(ast, 'AsyncFunctionDef'):
FunctionDef = (ast.FunctionDef, ast.AsyncFunctionDef)
def publish_msgstr(app, source, source_path, source_line, config, settings):
# From https://github.com/sphinx-doc/sphinx
... | [
"ast.parse"
] | [((8489, 8504), 'ast.parse', 'ast.parse', (['data'], {}), '(data)\n', (8498, 8504), False, 'import ast\n')] |
"""
Based on: https://github.com/openai/baselines/blob/master/baselines/deepq/replay_buffer.py
"""
import random
from typing import List, Tuple
import numpy as np
from pyderl.utils.data_structures import SumSegmentTree, MinSegmentTree
class PrioritizedReplayBuffer:
""" Prioritized replay buffer.
Args:
... | [
"numpy.array",
"random.random",
"pyderl.utils.data_structures.SumSegmentTree",
"pyderl.utils.data_structures.MinSegmentTree"
] | [((895, 922), 'pyderl.utils.data_structures.SumSegmentTree', 'SumSegmentTree', (['it_capacity'], {}), '(it_capacity)\n', (909, 922), False, 'from pyderl.utils.data_structures import SumSegmentTree, MinSegmentTree\n'), ((946, 973), 'pyderl.utils.data_structures.MinSegmentTree', 'MinSegmentTree', (['it_capacity'], {}), '... |
import numpy as np
import scipy.sparse as sp
import SimPEG
from SimPEG import Utils
from SimPEG.EM.Utils import omega
from SimPEG.Utils import Zero, Identity
class Fields(SimPEG.Problem.Fields):
"""
Fancy Field Storage for a FDEM survey. Only one field type is stored for
each problem, the rest are co... | [
"numpy.zeros_like",
"SimPEG.Utils.mkvc",
"numpy.zeros",
"SimPEG.Utils.Identity",
"SimPEG.Utils.Zero",
"SimPEG.EM.Utils.omega"
] | [((1924, 1948), 'numpy.zeros_like', 'np.zeros_like', (['eSolution'], {}), '(eSolution)\n', (1937, 1948), True, 'import numpy as np\n'), ((3926, 3932), 'SimPEG.Utils.Zero', 'Zero', ([], {}), '()\n', (3930, 3932), False, 'from SimPEG.Utils import Zero, Identity\n'), ((4282, 4352), 'numpy.zeros', 'np.zeros', (['[self._edg... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from learn_mongodb.db_test import col
from sfm.decorator import run_if_is_main
if __name__ == "__main__":
data = [
{"_id": "EN-01", "name": "John"},
{"_id": "EN-02", "name": "Mike", "height": 186},
{"_id": ... | [
"learn_mongodb.db_test.col.insert",
"sfm.decorator.run_if_is_main",
"learn_mongodb.db_test.col.find"
] | [((391, 415), 'sfm.decorator.run_if_is_main', 'run_if_is_main', (['__name__'], {}), '(__name__)\n', (405, 415), False, 'from sfm.decorator import run_if_is_main\n'), ((646, 670), 'sfm.decorator.run_if_is_main', 'run_if_is_main', (['__name__'], {}), '(__name__)\n', (660, 670), False, 'from sfm.decorator import run_if_is... |
import numpy as np
from numpy.testing import assert_equal, assert_allclose
from scipy import linalg
from ..dmd import get_dmd, exact_dmd, get_amplitude_spectrum
class TestDMD:
"""Unit tests for the `dmd` module."""
def test__synthetic_example_1__should_find_two_eigenvalues(self):
t = np.linspace(0,... | [
"numpy.abs",
"numpy.empty",
"numpy.sin",
"numpy.array",
"numpy.exp",
"numpy.linspace",
"numpy.cos",
"scipy.linalg.norm",
"numpy.testing.assert_allclose"
] | [((306, 331), 'numpy.linspace', 'np.linspace', (['(0)', '(1)'], {'num': '(11)'}), '(0, 1, num=11)\n', (317, 331), True, 'import numpy as np\n'), ((405, 433), 'numpy.array', 'np.array', (['[[1, -2], [0, +3]]'], {}), '([[1, -2], [0, +3]])\n', (413, 433), True, 'import numpy as np\n'), ((493, 509), 'numpy.array', 'np.arra... |
#!/usr/bin/env python
from mapel.main.objects.Family import Family
from mapel.marriages.objects.Marriages import Marriages
import copy
import mapel.marriages.models.mallows as mallows
class MarriagesFamily(Family):
def __init__(self,
model_id: str = None,
family_id='none',
... | [
"copy.deepcopy",
"mapel.marriages.objects.Marriages.Marriages",
"mapel.marriages.models.mallows.phi_from_relphi"
] | [((2075, 2101), 'copy.deepcopy', 'copy.deepcopy', (['self.params'], {}), '(self.params)\n', (2088, 2101), False, 'import copy\n'), ((2807, 2915), 'mapel.marriages.objects.Marriages.Marriages', 'Marriages', (['experiment_id', 'instance_id'], {'_import': '(False)', 'model_id': 'self.model_id', 'num_agents': 'self.num_age... |
import numpy as np
class RollingCircularMean(object):
def __init__(self, size=800):
self.size = size
self.data = []
def insert_data(self,item):
self.data.append(np.deg2rad(item))
if len(self.data) > self.size:
self.data.pop(0)
def value(self):
if self.... | [
"numpy.sin",
"numpy.cos",
"numpy.deg2rad"
] | [((196, 212), 'numpy.deg2rad', 'np.deg2rad', (['item'], {}), '(item)\n', (206, 212), True, 'import numpy as np\n'), ((582, 595), 'numpy.sin', 'np.sin', (['alpha'], {}), '(alpha)\n', (588, 595), True, 'import numpy as np\n'), ((610, 623), 'numpy.cos', 'np.cos', (['alpha'], {}), '(alpha)\n', (616, 623), True, 'import num... |
from django.shortcuts import redirect, render
from django.http import HttpResponse
from django.contrib.auth.models import User, auth
from django.contrib import messages
# Create your views here.
def login(request):
if request.method == "POST":
username = request.POST['username']
password = request... | [
"django.contrib.auth.models.auth.login",
"django.shortcuts.redirect",
"django.contrib.auth.models.auth.authenticate",
"django.contrib.messages.info",
"django.shortcuts.render",
"django.contrib.auth.models.auth.logout"
] | [((762, 782), 'django.contrib.auth.models.auth.logout', 'auth.logout', (['request'], {}), '(request)\n', (773, 782), False, 'from django.contrib.auth.models import User, auth\n'), ((794, 811), 'django.shortcuts.redirect', 'redirect', (['"""login"""'], {}), "('login')\n", (802, 811), False, 'from django.shortcuts import... |
import json
import os
import subprocess
import requests
import gevent
import sentry_sdk
from datalad_service.config import GRAPHQL_ENDPOINT
def setup_validator():
"""Install nodejs deps if they do not exist."""
if not os.path.exists('./node_modules/.bin/bids-validator'):
subprocess.run(['yarn'])
d... | [
"subprocess.run",
"json.loads",
"sentry_sdk.capture_exception",
"os.path.exists",
"gevent.spawn"
] | [((2967, 3052), 'gevent.spawn', 'gevent.spawn', (['_validate_dataset_eventlet', 'dataset_id', 'dataset_path', 'ref', 'cookies'], {}), '(_validate_dataset_eventlet, dataset_id, dataset_path, ref, cookies\n )\n', (2979, 3052), False, 'import gevent\n'), ((230, 282), 'os.path.exists', 'os.path.exists', (['"""./node_mod... |
import os
import cv2
import numpy as np
start_idx = 1
PREDEFINE_LEN = 6
anno_num = 0
total_anno = 0
class generating:
def __init__(self, path, label_path, dst_dir):
self.Path = path #####视频路径
self.base_name = os.path.basename(self.Path)
self.base_name = os.path.splitext(self.base_name)[0]... | [
"os.makedirs",
"cv2.VideoWriter_fourcc",
"os.path.basename",
"os.path.exists",
"numpy.ones",
"numpy.argsort",
"cv2.VideoCapture",
"numpy.where",
"os.path.splitext",
"numpy.loadtxt",
"cv2.VideoWriter",
"os.path.join",
"os.listdir",
"numpy.concatenate"
] | [((232, 259), 'os.path.basename', 'os.path.basename', (['self.Path'], {}), '(self.Path)\n', (248, 259), False, 'import os\n'), ((347, 396), 'os.path.join', 'os.path.join', (['label_path', "(self.base_name + '.txt')"], {}), "(label_path, self.base_name + '.txt')\n", (359, 396), False, 'import os\n'), ((477, 517), 'os.ma... |
import numpy as np
import matplotlib.pyplot as plt
from .source_pos import gauss
def lc_nodriftcorr(meta, wave_1d, optspec, log):
'''Plot a 2D light curve without drift correction.
Parameters
----------
meta: MetaClass
The metadata object.
wave_1d:
Wavelength array with t... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.suptitle",
"numpy.ma.mean",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"numpy.round",
"matplotlib.pyplot.axvline",
"numpy.std",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.colorbar",
"numpy.max",
"nu... | [((605, 634), 'numpy.ma.masked_invalid', 'np.ma.masked_invalid', (['optspec'], {}), '(optspec)\n', (625, 634), True, 'import numpy as np\n'), ((639, 671), 'matplotlib.pyplot.figure', 'plt.figure', (['(3101)'], {'figsize': '(8, 8)'}), '(3101, figsize=(8, 8))\n', (649, 671), True, 'import matplotlib.pyplot as plt\n'), ((... |
import pandas as pd
import world_bank_data as wb
countries = wb.get_countries()
countries = pd.DataFrame(countries).reset_index()
countries["longitude"] = countries["longitude"].astype(str)
countries["latitude"] = countries["latitude"].astype(str)
countries.to_csv("./datasets/world-bank/countries.csv") | [
"pandas.DataFrame",
"world_bank_data.get_countries"
] | [((63, 81), 'world_bank_data.get_countries', 'wb.get_countries', ([], {}), '()\n', (79, 81), True, 'import world_bank_data as wb\n'), ((94, 117), 'pandas.DataFrame', 'pd.DataFrame', (['countries'], {}), '(countries)\n', (106, 117), True, 'import pandas as pd\n')] |
from typing import Dict
import pytest
import numpy as np
import string
from hyperminhash.perf import estimate_error
from hyperminhash.hyperminhash import HyperMinHash
def rnd_str(size: int):
arr = np.random.choice([_ for _ in string.ascii_letters], size)
return "".join(list(arr))
def test_zeros(exp: float = 0.... | [
"hyperminhash.perf.estimate_error",
"hyperminhash.hyperminhash.HyperMinHash",
"numpy.iinfo",
"numpy.random.choice",
"numpy.float64"
] | [((203, 260), 'numpy.random.choice', 'np.random.choice', (['[_ for _ in string.ascii_letters]', 'size'], {}), '([_ for _ in string.ascii_letters], size)\n', (219, 260), True, 'import numpy as np\n'), ((331, 345), 'hyperminhash.hyperminhash.HyperMinHash', 'HyperMinHash', ([], {}), '()\n', (343, 345), False, 'from hyperm... |
#!/usr/bin/env runaiida
import pytest
from plumpy import ProcessState
from aiida.engine import ExitCode
from aiida import orm
from aiida.common import (LinkType, AttributeDict)
from aiida_siesta.workflows.iterate import set_up_parameters_dict
@pytest.fixture
def generate_workchain_simplex_basis(generate_psml_data, fi... | [
"aiida.orm.Str",
"aiida.orm.Dict",
"aiida.orm.Int"
] | [((694, 833), 'aiida.orm.Dict', 'orm.Dict', ([], {'dict': '{\'%block pao-basis\':\n """\nSi 2\n n=3 0 2\n 4.99376 $sz2 \n n=3 1 2\n 6.2538 $pz2 \n%endblock pao-basis"""\n }'}), '(dict={\'%block pao-basis\':\n """\nSi 2\n n=3 0 2\n 4.99376 $sz2 \n n=3 1 2\n 6.2538 $pz2 \n%endblock ... |
"""Supervisr Core Templatetags"""
import glob
import os
import socket
from urllib.parse import urljoin
from django import template
from django.apps import apps
from django.conf import settings
from django.db.models import Model
from django.template.loaders.app_directories import get_app_template_dirs
from django.urls ... | [
"django.template.Library",
"os.path.isdir",
"django.template.loaders.app_directories.get_app_template_dirs",
"django.urls.reverse",
"socket.gethostname",
"socket.getfqdn",
"django.apps.apps.get_app_config",
"supervisr.core.models.Setting.get",
"supervisr.core.utils.is_url_absolute",
"glob.glob",
... | [((521, 539), 'django.template.Library', 'template.Library', ([], {}), '()\n', (537, 539), False, 'from django import template\n'), ((1465, 1485), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (1483, 1485), False, 'import socket\n'), ((1574, 1590), 'socket.getfqdn', 'socket.getfqdn', ([], {}), '()\n', (... |
from sys import platform
from time import sleep
import subprocess as sp
import argparse
import json
'''
|--------------------------------------------------------------------------
| Blockchain Concept Copyright © 2022 rvnrstnsyh All Rights Reserved
|------------------------------------------------------------... | [
"json.load",
"subprocess.call",
"argparse.ArgumentParser",
"time.sleep"
] | [((502, 517), 'json.load', 'json.load', (['file'], {}), '(file)\n', (511, 517), False, 'import json\n'), ((568, 593), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (591, 593), False, 'import argparse\n'), ((2149, 2157), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (2154, 2157), False, 'from ... |
import logging
from datetime import datetime, timedelta
from django.conf import settings
from django.core.management.base import BaseCommand
from django.db import connection, transaction
from kitsune.questions.models import Question, Answer
from kitsune.search.es7_utils import index_objects_bulk
log = logging.getLo... | [
"django.db.transaction.get_connection",
"logging.basicConfig",
"django.db.connection.cursor",
"kitsune.questions.models.Answer.objects.filter",
"django.db.transaction.commit",
"kitsune.search.es7_utils.index_objects_bulk.delay",
"datetime.timedelta",
"datetime.datetime.now",
"kitsune.questions.model... | [((307, 334), 'logging.getLogger', 'logging.getLogger', (['"""k.cron"""'], {}), "('k.cron')\n", (324, 334), False, 'import logging\n'), ((536, 576), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.ERROR'}), '(level=logging.ERROR)\n', (555, 576), False, 'import logging\n'), ((800, 814), 'datetime.d... |
#
# Copyright © 2020 <NAME> <<EMAIL>>
#
# Distributed under terms of the GPLv3 license.
"""
"""
import numpy as np
import pytest
import pyronn_torch
def test_init():
assert pyronn_torch.cpp_extension
@pytest.mark.parametrize('with_texture', ('with_texture', False))
@pytest.mark.parametrize('with_backward', (... | [
"pyronn_torch.ConeBeamProjector.from_conrad_config",
"pytest.mark.parametrize",
"pytest.importorskip",
"numpy.array"
] | [((212, 276), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""with_texture"""', "('with_texture', False)"], {}), "('with_texture', ('with_texture', False))\n", (235, 276), False, 'import pytest\n'), ((278, 344), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""with_backward"""', "('with_backward'... |
import torch
from torchvision import transforms
from PIL import Image
class MapAdultDataset(object):
"""
The map-style dataset object for the Adult dataset, which is used
as input for the pytorch Dataloader constructor.
"""
def __init__(self, x, y, d) -> None:
"""
Initialization of... | [
"torchvision.transforms.Normalize",
"torchvision.transforms.ToTensor",
"torch.tensor",
"torchvision.transforms.Resize"
] | [((608, 651), 'torch.tensor', 'torch.tensor', (['x.values'], {'dtype': 'torch.float32'}), '(x.values, dtype=torch.float32)\n', (620, 651), False, 'import torch\n'), ((669, 705), 'torch.tensor', 'torch.tensor', (['y'], {'dtype': 'torch.float32'}), '(y, dtype=torch.float32)\n', (681, 705), False, 'import torch\n'), ((723... |
import requests,sys,os
import netifaces
import ipaddress
import socket
import json
import glob
from pyroute2 import IPRoute
import logging
def getPorts():
# scan for available ports. return a list of port names with /dev/ stripped off
ports = glob.glob('/dev/ttyS*') + glob.glob('/dev/ttyUSB*') + glob.glob('/de... | [
"netifaces.interfaces",
"json.dumps",
"socket.gethostname",
"netifaces.ifaddresses",
"glob.glob",
"sys.stderr.write",
"pyroute2.IPRoute"
] | [((848, 870), 'netifaces.interfaces', 'netifaces.interfaces', ([], {}), '()\n', (868, 870), False, 'import netifaces\n'), ((1707, 1727), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (1725, 1727), False, 'import socket\n'), ((2279, 2321), 'json.dumps', 'json.dumps', (['body'], {'sort_keys': '(True)', 'i... |
# -*- coding: utf-8 -*-
import codecs
import logging
import os
import re
import shlex
import shutil
import socket
import stat
import subprocess
import sys
import traceback
import zipfile
from contextlib import contextmanager, ExitStack
from http.server import BaseHTTPRequestHandler, HTTPServer
from logging import getLo... | [
"os.remove",
"os.environ.copy",
"click.option",
"os.fsync",
"logging.Formatter",
"os.path.isfile",
"os.close",
"urllib.parse.urlsplit",
"sys.exc_info",
"os.path.join",
"os.path.abspath",
"logging.FileHandler",
"codecs.open",
"urllib.parse.urlunsplit",
"os.path.dirname",
"threading.Cond... | [((20775, 20790), 'click.command', 'click.command', ([], {}), '()\n', (20788, 20790), False, 'import click\n'), ((20792, 21021), 'click.option', 'click.option', (['"""-C"""', '"""--config-file"""'], {'required': '(False)', 'multiple': '(True)', 'help': '"""Load runner configuration from JSON or YAML file. Values from a... |
import re
s = "Cooool, Python!"
ss = r"Co?"
mo = re.match(ss,s)
if mo: print(mo,type(mo))
ss = r"Co*"
mo = re.match(ss,s)
if mo: print(mo,type(mo))
ss = r"Co+"
mo = re.match(ss,s)
if mo: print(mo,type(mo))
# compile
sso = re.compile(ss)
mo = sso.match(s)
if mo: print(mo,type(mo))
| [
"re.match",
"re.compile"
] | [((53, 68), 're.match', 're.match', (['ss', 's'], {}), '(ss, s)\n', (61, 68), False, 'import re\n'), ((112, 127), 're.match', 're.match', (['ss', 's'], {}), '(ss, s)\n', (120, 127), False, 'import re\n'), ((171, 186), 're.match', 're.match', (['ss', 's'], {}), '(ss, s)\n', (179, 186), False, 'import re\n'), ((230, 244)... |
# -*- coding: utf-8 -*-
"""
Boxy Theme Extras
"""
import sublime
import sublime_plugin
from collections import OrderedDict
NO_SELECTION = -1
SUBLIME_LINTER = 'SublimeLinter'
PLAIN_TASKS = 'PlainTasks'
PLAIN_NOTES = 'PlainNotes'
EXTRAS = OrderedDict(
[
(
'PlainNotes',
{
... | [
"collections.OrderedDict"
] | [((245, 851), 'collections.OrderedDict', 'OrderedDict', (["[('PlainNotes', {'name': 'Plain Notes', 'settings': 'Note.sublime-settings',\n 'desc': 'Choose a color scheme'}), ('PlainTasks', {'name':\n 'Plain Tasks', 'settings': 'PlainTasks.sublime-settings', 'desc':\n 'Choose a color scheme'}), ('SublimeLinter',... |
import time,os
while 1:
os.system("python /Users/hollowayp/Documents/GitHub/kSWAP/examples/run.py") #change to /your/path/run.py
time.sleep(3600) #change 5 to the number of secondss for the frequency of the script e.g. 1800 for 30 mins
| [
"os.system",
"time.sleep"
] | [((28, 103), 'os.system', 'os.system', (['"""python /Users/hollowayp/Documents/GitHub/kSWAP/examples/run.py"""'], {}), "('python /Users/hollowayp/Documents/GitHub/kSWAP/examples/run.py')\n", (37, 103), False, 'import time, os\n'), ((137, 153), 'time.sleep', 'time.sleep', (['(3600)'], {}), '(3600)\n', (147, 153), False,... |
# coding: utf-8
# In[1]:
import sys
import os
import numpy as np
import matplotlib.pyplot as plt
# In[25]:
HEIGHT = 96
WIDTH = 96
DEPTH = 3
SIZE = HEIGHT*WIDTH*DEPTH
# In[26]:
DATA_PATH = '../dataset/stl10_binary/train_X.bin'
LABEL_PATH = '../dataset/stl10_binary/train_y.bin'
# In[27]:
def read_labels(path... | [
"matplotlib.pyplot.show",
"numpy.fromfile",
"matplotlib.pyplot.imshow",
"numpy.transpose",
"numpy.reshape"
] | [((1002, 1053), 'numpy.fromfile', 'np.fromfile', (['image_file'], {'dtype': 'np.uint8', 'count': 'SIZE'}), '(image_file, dtype=np.uint8, count=SIZE)\n', (1013, 1053), True, 'import numpy as np\n'), ((1070, 1107), 'numpy.reshape', 'np.reshape', (['image', '(3, HEIGHT, WIDTH)'], {}), '(image, (3, HEIGHT, WIDTH))\n', (108... |
from ape import Contract
from ape.api import Address
def test_init_at_unknown_address():
address = "0x274b028b03A250cA03644E6c578D81f019eE1323"
contract = Contract(address)
assert type(contract) == Address
assert contract.address == address
| [
"ape.Contract"
] | [((165, 182), 'ape.Contract', 'Contract', (['address'], {}), '(address)\n', (173, 182), False, 'from ape import Contract\n')] |
""" Feature extraction methods
Set of methods to extract features from stimuli in a dataset and generate
the associated predictors
"""
from flask import current_app
from ..core import cache
from ..database import db
import socket
from pathlib import Path
import datetime
from progressbar import progressbar
from ..utils... | [
"pliers.graph.Graph",
"progressbar.progressbar",
"pliers.stimuli.TextStim",
"socket.setdefaulttimeout",
"pathlib.Path",
"pliers.stimuli.ComplexTextStim",
"datetime.datetime.now",
"pliers.transformers.get_transformer",
"pliers.stimuli.load_stims"
] | [((708, 739), 'socket.setdefaulttimeout', 'socket.setdefaulttimeout', (['(10000)'], {}), '(10000)\n', (732, 739), False, 'import socket\n'), ((1237, 1261), 'progressbar.progressbar', 'progressbar', (['stim_models'], {}), '(stim_models)\n', (1248, 1261), False, 'from progressbar import progressbar\n'), ((3516, 3536), 'p... |
from datetime import datetime
from flask_jwt import jwt_required, current_identity
from flask_restful import reqparse, Resource
from static import app_constant
import static.status as status
from models.base_event import BaseEvent
from models.action import BaseAction
class CreateEventRequest(Resource):
@jwt_req... | [
"models.base_event.BaseEvent",
"models.action.BaseAction",
"flask_restful.reqparse.RequestParser",
"datetime.datetime.utcnow",
"flask_jwt.current_identity.user",
"models.base_event.BaseEvent.objects",
"flask_jwt.jwt_required"
] | [((313, 327), 'flask_jwt.jwt_required', 'jwt_required', ([], {}), '()\n', (325, 327), False, 'from flask_jwt import jwt_required, current_identity\n'), ((2020, 2034), 'flask_jwt.jwt_required', 'jwt_required', ([], {}), '()\n', (2032, 2034), False, 'from flask_jwt import jwt_required, current_identity\n'), ((3695, 3709)... |
from unittest import TestCase
from unittest.mock import patch, ANY
import requests
import responses
import azkaban_cli.azkaban
from azkaban_cli.exceptions import LoginError
class AzkabanLoginTest(TestCase):
def setUp(self):
"""
Creates an Azkaban instance for all login tests
"""
... | [
"unittest.mock.patch",
"requests.exceptions.ConnectionError",
"responses.add"
] | [((368, 414), 'unittest.mock.patch', 'patch', (['"""azkaban_cli.azkaban.api.login_request"""'], {}), "('azkaban_cli.azkaban.api.login_request')\n", (373, 414), False, 'from unittest.mock import patch, ANY\n'), ((1197, 1302), 'responses.add', 'responses.add', (['responses.POST', 'host'], {'json': "{'session.id': session... |
import sys, os, re
import sphinx_rtd_theme
if not os.path.exists('api'):
os.mkdir('api')
# Minimum version, enforced by sphinx
needs_sphinx = '2.2.0'
extensions = [
'sphinx.ext.autodoc',
'numpydoc',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.autosum... | [
"os.mkdir",
"astropop.__version__.split",
"os.path.exists",
"sphinx_rtd_theme.get_html_theme_path"
] | [((51, 72), 'os.path.exists', 'os.path.exists', (['"""api"""'], {}), "('api')\n", (65, 72), False, 'import sys, os, re\n'), ((78, 93), 'os.mkdir', 'os.mkdir', (['"""api"""'], {}), "('api')\n", (86, 93), False, 'import sys, os, re\n'), ((860, 898), 'sphinx_rtd_theme.get_html_theme_path', 'sphinx_rtd_theme.get_html_theme... |
"""
Jax integration.
Importing this module registers the Jax backend with `phi.math`.
Without this, Jax tensors cannot be handled by `phi.math` functions.
To make Jax the default backend, import `phi.jax.flow`.
"""
from phi import math as _math
from ._jax_backend import JaxBackend as _JaxBackend
JAX = _JaxBackend()... | [
"phi.math.backend.BACKENDS.append"
] | [((356, 390), 'phi.math.backend.BACKENDS.append', '_math.backend.BACKENDS.append', (['JAX'], {}), '(JAX)\n', (385, 390), True, 'from phi import math as _math\n')] |
import contextlib
import matplotlib.lines as lines
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import numpy as np
class MPLBoss:
def __init__(self, settings):
self.outf_dirname = settings._temp_r_dirname
self.png_dirname = settings.output_dirname
self.png_fname_b... | [
"matplotlib.lines.Line2D",
"matplotlib.pyplot.close",
"matplotlib.pyplot.axis",
"numpy.array",
"matplotlib.pyplot.subplots"
] | [((1443, 1513), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(self.out_width, self.out_height)', 'dpi': 'self._dpi'}), '(figsize=(self.out_width, self.out_height), dpi=self._dpi)\n', (1455, 1513), True, 'import matplotlib.pyplot as plt\n'), ((1544, 1559), 'matplotlib.pyplot.axis', 'plt.axis', (['"""o... |
import random
import time
from text.util import *
if __name__ == '__main__':
size = 100000
word2index = {str(i): i for i in range(size)}
words = [str(i) for i in range(size)]
start = time.time()
for i in range(5000000):
# a = word2index[str(i % size)]
a = words.index(str(i % size))... | [
"time.time"
] | [((201, 212), 'time.time', 'time.time', ([], {}), '()\n', (210, 212), False, 'import time\n'), ((371, 382), 'time.time', 'time.time', ([], {}), '()\n', (380, 382), False, 'import time\n')] |
import re
def unicode_strip(content):
pattern = re.compile("["
u"\U0001F600-\U0001F64F"
u"\U0001F300-\U0001F5FF"
u"\U0001F1E0-\U0001F1FF"
u"\U00002702-\U000027B0"
u"\U000024C2-\U0001F251"
... | [
"re.findall",
"re.compile"
] | [((54, 113), 're.compile', 're.compile', (['"""[😀-🙏🌀-🗿\U0001f1e0-🇿✂-➰Ⓜ-🉑]+"""'], {'flags': 're.UNICODE'}), "('[😀-🙏🌀-🗿\\U0001f1e0-🇿✂-➰Ⓜ-🉑]+', flags=re.UNICODE)\n", (64, 113), False, 'import re\n'), ((493, 537), 're.findall', 're.findall', (['regex', 'input_text', 're.IGNORECASE'], {}), '(regex, input_text, r... |
#!/usr/bin/env python3
from http.server import BaseHTTPRequestHandler, HTTPServer
import urllib
import os
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
# Change these variables to your script locations
# As for what these scripts should do, I recommend calling something l... | [
"http.server.HTTPServer",
"os.system",
"urllib.parse.urlparse"
] | [((3971, 3997), 'os.system', 'os.system', (['SCRIPT_ARM_AWAY'], {}), '(SCRIPT_ARM_AWAY)\n', (3980, 3997), False, 'import os\n'), ((4172, 4198), 'os.system', 'os.system', (['SCRIPT_ARM_HOME'], {}), '(SCRIPT_ARM_HOME)\n', (4181, 4198), False, 'import os\n'), ((4385, 4414), 'os.system', 'os.system', (['SCRIPT_DISARM_AWAY'... |
"""
Utility functions for notifying users about Standards events
"""
from django.conf import settings
from django.contrib.auth.models import User
from common.utils import send_email
def summons_requested(summons_request_count):
"""
Get a message for a summons request.
"""
subject = 'Standards Board: N... | [
"common.utils.send_email",
"django.contrib.auth.models.User.objects.get"
] | [((643, 689), 'django.contrib.auth.models.User.objects.get', 'User.objects.get', ([], {'groups__name': '"""4th Counselor"""'}), "(groups__name='4th Counselor')\n", (659, 689), False, 'from django.contrib.auth.models import User\n'), ((694, 779), 'common.utils.send_email', 'send_email', ([], {'subject': 'subject', 'body... |
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
import os
import requests
import json
import subprocess
from frappe.utils.background_jobs import enqueue
import re
from frappe import utils
from frappe.core.doctype.data_import.data_import import import_doc, export_json
imp... | [
"frappe.scrub",
"frappe.get_app_path"
] | [((1278, 1347), 'frappe.get_app_path', 'frappe.get_app_path', (['"""my_account"""', '"""fixtures"""', '"""property_setter.json"""'], {}), "('my_account', 'fixtures', 'property_setter.json')\n", (1297, 1347), False, 'import frappe\n'), ((1397, 1465), 'frappe.get_app_path', 'frappe.get_app_path', (['"""my_account"""', '"... |
import numpy as np
from engine.optimizers.base_sgd import BaseSGD
def square_loss(x, y, w, c):
return c * np.sum([(np.dot(w.T, x[i]) - y[i]) ** 2 for i in range(x.shape[0])]) + np.dot(w, w) / 2
def square_increment(x_i, y_i, w, c, eps):
return - eps * (c * 2 * x_i * (np.dot(w.T, x_i) - y_i) + w)
class Squ... | [
"numpy.dot"
] | [((183, 195), 'numpy.dot', 'np.dot', (['w', 'w'], {}), '(w, w)\n', (189, 195), True, 'import numpy as np\n'), ((280, 296), 'numpy.dot', 'np.dot', (['w.T', 'x_i'], {}), '(w.T, x_i)\n', (286, 296), True, 'import numpy as np\n'), ((121, 138), 'numpy.dot', 'np.dot', (['w.T', 'x[i]'], {}), '(w.T, x[i])\n', (127, 138), True,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cplotting as cplot
points=[3+1j, -1-4j]
for p in points:
cplot.quniver(p, -3+3j, 4)
cplot.show()
| [
"cplotting.quniver",
"cplotting.show"
] | [((145, 157), 'cplotting.show', 'cplot.show', ([], {}), '()\n', (155, 157), True, 'import cplotting as cplot\n'), ((117, 147), 'cplotting.quniver', 'cplot.quniver', (['p', '(-3 + 3.0j)', '(4)'], {}), '(p, -3 + 3.0j, 4)\n', (130, 147), True, 'import cplotting as cplot\n')] |
from collections import defaultdict
from copy import deepcopy
import time
import pandas as pd
import pickle
import os
from sklearn.preprocessing import MinMaxScaler
from tqdm import tqdm
from xgboost import XGBRegressor
import numpy as np
CIRCUIT_LIST = ["circuitId_1", "circuitId_2", "circuitId_3", "circuitId_4", "ci... | [
"pandas.DataFrame",
"copy.deepcopy",
"pickle.dump",
"pandas.read_csv",
"numpy.std",
"pandas.get_dummies",
"sklearn.preprocessing.MinMaxScaler",
"collections.defaultdict",
"os.path.isfile",
"numpy.mean",
"pickle.load",
"xgboost.XGBRegressor",
"numpy.random.choice"
] | [((1230, 1315), 'pandas.read_csv', 'pd.read_csv', (['"""./envs/race_strategy_model/dataset/finalDataset.csv"""'], {'delimiter': '""","""'}), "('./envs/race_strategy_model/dataset/finalDataset.csv',\n delimiter=',')\n", (1241, 1315), True, 'import pandas as pd\n'), ((3206, 3234), 'xgboost.XGBRegressor', 'XGBRegressor... |
from control import lqr
import numpy as np
# -------------------------------------------------------------------------------------------------
def Correction2D(K):
for i in range(len(K)):
for j in range(len(K[0])):
if abs(K[i][j]) < 1e-6:
K[i][j] = 0
return K
# ---------------------------------------------... | [
"control.lqr",
"numpy.zeros",
"numpy.arcsin",
"numpy.tan",
"numpy.sin",
"numpy.cos"
] | [((2379, 2394), 'control.lqr', 'lqr', (['A', 'B', 'Q', 'R'], {}), '(A, B, Q, R)\n', (2382, 2394), False, 'from control import lqr\n'), ((2641, 2661), 'numpy.zeros', 'np.zeros', (['(10, 4, 9)'], {}), '((10, 4, 9))\n', (2649, 2661), True, 'import numpy as np\n'), ((2714, 2747), 'numpy.arcsin', 'np.arcsin', (['(-Cd * u **... |
# File: builder.py
# Desc: Make Kivy look for a specifically named Kv file to load.
import kivy
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.properties import ObjectProperty
from kivy.lang import Builder
# Load Kv file with whatever path or filename. This looks only for whatever.kv.
Builder.l... | [
"kivy.lang.Builder.load_file",
"kivy.properties.ObjectProperty"
] | [((311, 343), 'kivy.lang.Builder.load_file', 'Builder.load_file', (['"""whatever.kv"""'], {}), "('whatever.kv')\n", (328, 343), False, 'from kivy.lang import Builder\n'), ((534, 554), 'kivy.properties.ObjectProperty', 'ObjectProperty', (['None'], {}), '(None)\n', (548, 554), False, 'from kivy.properties import ObjectPr... |
"""PMSG_disc.py
Created by <NAME>, <NAME>.
Copyright (c) NREL. All rights reserved.
Electromagnetic design based on conventional magnetic circuit laws
Structural design based on McDonald's thesis """
from openmdao.api import Group, Problem, Component,ExecComp,IndepVarComp,ScipyOptimizer,pyOptSparseDriver
from ... | [
"openmdao.api.IndepVarComp",
"openmdao.api.ExecComp",
"math.atan",
"math.sqrt",
"math.tan",
"math.sin",
"math.cosh",
"math.log",
"numpy.array",
"math.cos",
"math.sinh",
"openmdao.drivers.pyoptsparse_driver.pyOptSparseDriver"
] | [((28444, 28463), 'openmdao.drivers.pyoptsparse_driver.pyOptSparseDriver', 'pyOptSparseDriver', ([], {}), '()\n', (28461, 28463), False, 'from openmdao.drivers.pyoptsparse_driver import pyOptSparseDriver\n'), ((32459, 32484), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.0]'], {}), '([0.0, 0.0, 0.0])\n', (32467, 32484), T... |
"""puzzlehunt_server URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')... | [
"django.views.generic.base.RedirectView.as_view",
"django.contrib.auth.views.LoginView.as_view",
"django.contrib.auth.views.LogoutView.as_view",
"django.urls.path",
"django.conf.urls.include",
"django.conf.urls.url"
] | [((997, 1086), 'django.urls.path', 'path', (['"""hunt-info/"""', 'views.flatpage', "{'url': '/hunt-info/'}"], {'name': '"""current_hunt_info"""'}), "('hunt-info/', views.flatpage, {'url': '/hunt-info/'}, name=\n 'current_hunt_info')\n", (1001, 1086), False, 'from django.urls import path\n'), ((1087, 1166), 'django.u... |
import unittest
import numpy as np
from decouple import config
from pysony.graph import GraphDistance
class TestGraphDistance(unittest.TestCase):
def testGraphDistance(self):
myGraphDistance = GraphDistance(
threshold = 20
)
X = np.random.rand(10,2) / 2
X[:,0] += -0.172... | [
"unittest.main",
"numpy.random.rand",
"pysony.graph.GraphDistance"
] | [((523, 549), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (536, 549), False, 'import unittest\n'), ((207, 234), 'pysony.graph.GraphDistance', 'GraphDistance', ([], {'threshold': '(20)'}), '(threshold=20)\n', (220, 234), False, 'from pysony.graph import GraphDistance\n'), ((271, 292)... |
#
# Performs a REST call to controller (possibly localhost) of latest blockchain status.
#
import datetime
import http
import json
import os
import requests
import socket
import sqlite3
import traceback
from flask import g
from common.config import globals
from api.commands import chia_cli, mmx_cli
from api import ... | [
"api.app.app_context",
"api.commands.chia_cli.load_blockchain_show",
"api.app.logger.info",
"api.utils.get_hostname",
"common.config.globals.enabled_blockchains",
"traceback.format_exc",
"api.utils.send_post",
"api.commands.mmx_cli.load_blockchain_show"
] | [((370, 387), 'api.app.app_context', 'app.app_context', ([], {}), '()\n', (385, 387), False, 'from api import app\n'), ((428, 457), 'common.config.globals.enabled_blockchains', 'globals.enabled_blockchains', ([], {}), '()\n', (455, 457), False, 'from common.config import globals\n'), ((528, 548), 'api.utils.get_hostnam... |
import sys
import ply.yacc as yacc
from Analizador_lexico import tokens
VERBOSE = 1
precedence = (
('left', 'INCLUDE', 'REQUIRE'),
('left', 'COMMA'),
('left', 'EQUAL', 'PLUSEQUAL', 'MINUSEQUAL'),
('left', 'SEMI'),
('left', 'OR'),
('left', 'XOR'),
('left', 'AND'),
('nonassoc', 'ISEQUAL'... | [
"ply.yacc.yacc"
] | [((6693, 6704), 'ply.yacc.yacc', 'yacc.yacc', ([], {}), '()\n', (6702, 6704), True, 'import ply.yacc as yacc\n')] |
from django.views.generic import TemplateView
from django.views.decorators.cache import cache_page
class HomeView(TemplateView):
template_name = 'pages/home.html'
home = cache_page(60 * 10)(HomeView.as_view())
| [
"django.views.decorators.cache.cache_page"
] | [((176, 195), 'django.views.decorators.cache.cache_page', 'cache_page', (['(60 * 10)'], {}), '(60 * 10)\n', (186, 195), False, 'from django.views.decorators.cache import cache_page\n')] |
from atexit import register as atexit_register
from os import makedirs, remove
from os.path import abspath, basename, expandvars
from pathlib import Path
from sys import argv, stderr
from time import sleep, time
from click import (
Choice as CHOICE,
INT,
Path as PATH,
STRING,
command,
get_app_d... | [
"atexit.register",
"os.remove",
"os.makedirs",
"loguru.logger.add",
"os.path.basename",
"click.get_app_dir",
"click.option",
"click.command",
"time.time",
"loguru.logger.info",
"os.path.expandvars",
"click.Choice",
"time.sleep",
"loguru.logger.remove",
"pathlib.Path",
"click.Path",
"... | [((591, 597), 'time.time', 'time', ([], {}), '()\n', (595, 597), False, 'from time import sleep, time\n'), ((1581, 1590), 'click.command', 'command', ([], {}), '()\n', (1588, 1590), False, 'from click import Choice as CHOICE, INT, Path as PATH, STRING, command, get_app_dir, option\n'), ((2184, 2263), 'click.option', 'o... |
import argparse
import json
from pathlib import Path
import numpy as np
from model import MultiTaskModel
import parse
import create_data
import asyncio
import websockets
import logging
import logging.handlers
class QueryModel:
def __init__(self,model_file,identifier):
self.config = None
self.model... | [
"json.load",
"websockets.serve",
"argparse.ArgumentParser",
"asyncio.get_event_loop",
"logging.StreamHandler",
"numpy.zeros",
"logging.handlers.RotatingFileHandler",
"json.dumps",
"logging.Formatter",
"parse.parse_json_file_with_index",
"pathlib.Path",
"create_data.DataProcessor",
"logging.g... | [((11317, 11419), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Perform NL classification with pre-trained neural networks"""'}), "(description=\n 'Perform NL classification with pre-trained neural networks')\n", (11340, 11419), False, 'import argparse\n'), ((509, 525), 'pathlib.Path... |
"""Use this template for creating simple Python3 server"""
from http.server import SimpleHTTPRequestHandler
from socketserver import TCPServer
def serve(port: int):
if port > 65535:
print(f"[X] port number, {port}, is not a valid port")
print("[*] will use port 8888 instead")
port = 8888
... | [
"socketserver.TCPServer"
] | [((367, 397), 'socketserver.TCPServer', 'TCPServer', (["('', port)", 'Handler'], {}), "(('', port), Handler)\n", (376, 397), False, 'from socketserver import TCPServer\n')] |
import csv
import json
# Takes the data from a location's CSV file and stores it in a JSON file
# Handles wind prediction data!
# predData
# fileNames : noaaID_wind_pred.csv
# time : YYYY-MM-DD hh:mm:ss
# direction: wind direction [deg]
# speed : wind speed [m/s]
# Note: speed is in m/s, when displaye... | [
"csv.DictReader"
] | [((509, 544), 'csv.DictReader', 'csv.DictReader', (['csvfile', 'fieldnames'], {}), '(csvfile, fieldnames)\n', (523, 544), False, 'import csv\n')] |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from unittest import mock
import numpy as np
from ax.core.metric import Metric
from ax.core.objective import Objective
from ax.core.observation import Observation, ObservationData, ObservationFeatures
from ax.core.optimizat... | [
"ax.core.observation.ObservationFeatures",
"unittest.mock.create_autospec",
"ax.core.parameter.RangeParameter",
"unittest.mock.MagicMock",
"ax.modelbridge.discrete.DiscreteModelBridge",
"ax.core.metric.Metric",
"ax.core.parameter.FixedParameter",
"unittest.mock.patch",
"numpy.array",
"ax.modelbrid... | [((2469, 2558), 'unittest.mock.patch', 'mock.patch', (['"""ax.modelbridge.discrete.DiscreteModelBridge.__init__"""'], {'return_value': 'None'}), "('ax.modelbridge.discrete.DiscreteModelBridge.__init__',\n return_value=None)\n", (2479, 2558), False, 'from unittest import mock\n'), ((4115, 4204), 'unittest.mock.patch'... |
#! /usr/bin/python2
#
# Copyright (c) 2017 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
import logging
import yaml
#
#
def load(filename):
"""
Safely load a YAML document
Follows recomendations from
https://security.openstack.org/guidelines/dg_avoid-dangerous-input-parsing-libraries.h... | [
"logging.warning",
"logging.error",
"yaml.safe_load",
"logging.getLogger"
] | [((2642, 2662), 'yaml.safe_load', 'yaml.safe_load', (['data'], {}), '(data)\n', (2656, 2662), False, 'import yaml\n'), ((1277, 1347), 'logging.warning', 'logging.warning', (['"""can\'t import pykwalify; won\'t validate YAML (%s)"""', 'e'], {}), '("can\'t import pykwalify; won\'t validate YAML (%s)", e)\n', (1292, 1347)... |
import tensorrt as trt
onnx_file_name = "edsr.onnx"
tensorrt_file_name = "edsr.plan"
fp_16_mode = True
TRT_LOGGER = trt.Logger(trt.Logger.WARNING)
EXPLICIT_BATCH = 1 << (int) (trt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH)
builder = trt.Builder(TRT_LOGGER)
network = builder.create_network(EXPLICIT_BATCH)
parser = ... | [
"tensorrt.Logger",
"tensorrt.OnnxParser",
"tensorrt.Builder"
] | [((117, 147), 'tensorrt.Logger', 'trt.Logger', (['trt.Logger.WARNING'], {}), '(trt.Logger.WARNING)\n', (127, 147), True, 'import tensorrt as trt\n'), ((238, 261), 'tensorrt.Builder', 'trt.Builder', (['TRT_LOGGER'], {}), '(TRT_LOGGER)\n', (249, 261), True, 'import tensorrt as trt\n'), ((320, 355), 'tensorrt.OnnxParser',... |
from django.db import models
class Employee(models.Model):
name = models.CharField(max_length=150)
position = models.CharField(max_length=150)
office = models.CharField(max_length=150)
age = models.PositiveIntegerField()
start_date = models.DateField()
salary = models.PositiveIntegerField()
... | [
"django.db.models.CharField",
"django.db.models.PositiveIntegerField",
"django.db.models.DateField"
] | [((72, 104), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(150)'}), '(max_length=150)\n', (88, 104), False, 'from django.db import models\n'), ((120, 152), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(150)'}), '(max_length=150)\n', (136, 152), False, 'from django.db ... |
import numpy as np
import scipy.stats as sts
class Correlation:
"""
Given a dataframe of the automatic metric scores of some candidates along with human DA scores,
it computes the Pearson correlation coefficient (as a default choice) of each candidate,
and make a cluster of their ranks with t... | [
"numpy.argsort",
"numpy.zeros",
"numpy.where",
"numpy.array"
] | [((582, 625), 'numpy.array', 'np.array', (['self.frame[col]'], {'dtype': 'np.float64'}), '(self.frame[col], dtype=np.float64)\n', (590, 625), True, 'import numpy as np\n'), ((1228, 1246), 'numpy.argsort', 'np.argsort', (['values'], {}), '(values)\n', (1238, 1246), True, 'import numpy as np\n'), ((1344, 1372), 'numpy.wh... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
************************************************
@Time : 2019/5/6 5:06 PM
@Author : zxp
@Project : ContractVerification
@File : LoadHitWordForest.py
@Description: ==================================
扫描同义词词林,构建归一化的近义词词典
@license: (C) Copyright 2013-2019.
**... | [
"os.path.isfile"
] | [((551, 583), 'os.path.isfile', 'os.path.isfile', (['word_forest_path'], {}), '(word_forest_path)\n', (565, 583), False, 'import os\n')] |
# Implementation of SoftTriple Loss
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn import init
class SoftTriple(nn.Module):
def __init__(self, la, gamma, tau, margin, dim, cN, K):
super(SoftTriple, self).__init__()
... | [
"math.sqrt",
"torch.sqrt",
"torch.nn.functional.cross_entropy",
"torch.nn.functional.softmax",
"torch.Tensor",
"torch.arange",
"torch.zeros",
"torch.nn.functional.normalize",
"torch.sum"
] | [((831, 863), 'torch.nn.functional.normalize', 'F.normalize', (['self.fc'], {'p': '(2)', 'dim': '(0)'}), '(self.fc, p=2, dim=0)\n', (842, 863), True, 'import torch.nn.functional as F\n'), ((973, 1012), 'torch.nn.functional.softmax', 'F.softmax', (['(simStruc * self.gamma)'], {'dim': '(2)'}), '(simStruc * self.gamma, di... |
"""Module implementing point transformations and their matrices."""
import numpy as np
def axis_angle_rotation(axis, angle, point=None, deg=True):
r"""Return a 4x4 matrix for rotation about any axis by given angle.
Rotations around an axis that contains the origin can easily be
computed using Rodrigues' ... | [
"numpy.outer",
"numpy.asarray",
"numpy.zeros",
"numpy.isclose",
"numpy.sin",
"numpy.linalg.norm",
"numpy.cos",
"numpy.eye"
] | [((2953, 2986), 'numpy.asarray', 'np.asarray', (['axis'], {'dtype': '"""float64"""'}), "(axis, dtype='float64')\n", (2963, 2986), True, 'import numpy as np\n'), ((3292, 3312), 'numpy.linalg.norm', 'np.linalg.norm', (['axis'], {}), '(axis)\n', (3306, 3312), True, 'import numpy as np\n'), ((3320, 3344), 'numpy.isclose', ... |
# Generated by Django 2.2 on 2019-04-24 17:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('courses', '0009_mycourses'),
]
operations = [
migrations.AlterModelOptions(
name='mycourses',
options={'verbose_name': 'My Cou... | [
"django.db.migrations.AlterModelOptions"
] | [((216, 343), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""mycourses"""', 'options': "{'verbose_name': 'My Courses', 'verbose_name_plural': 'My courses'}"}), "(name='mycourses', options={'verbose_name':\n 'My Courses', 'verbose_name_plural': 'My courses'})\n", (244, 343... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: wikiparserlib.py
#
# Copyright 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without lim... | [
"os.makedirs",
"os.path.dirname",
"os.path.exists",
"json.dumps",
"requests.get",
"logging.NullHandler",
"bs4.BeautifulSoup",
"shutil.rmtree",
"logging.getLogger"
] | [((1897, 1931), 'logging.getLogger', 'logging.getLogger', (['LOGGER_BASENAME'], {}), '(LOGGER_BASENAME)\n', (1914, 1931), False, 'import logging\n'), ((1950, 1971), 'logging.NullHandler', 'logging.NullHandler', ([], {}), '()\n', (1969, 1971), False, 'import logging\n'), ((2241, 2306), 'logging.getLogger', 'logging.getL... |
import numpy as np
import scipy as sp
import scipy.linalg
import scipy.sparse
import numba
import time
from .tree import Tree
from .misc.mkl_sparse import SpMV_viaMKL
def get_level_information(node_width, theta):
# get information for this level
dd = 0.01
r1 = 0.5*node_width*(np.sqrt(2)+dd)
r2 = 0.5*no... | [
"numpy.empty",
"numba.njit",
"numpy.argsort",
"numpy.sin",
"numpy.arange",
"numba.prange",
"numpy.zeros_like",
"numpy.logical_not",
"scipy.sparse.coo_matrix",
"numpy.linspace",
"numpy.cos",
"numpy.dot",
"numpy.concatenate",
"numpy.logical_and",
"scipy.linalg.lu_solve",
"numpy.zeros",
... | [((17713, 17802), 'numba.njit', 'numba.njit', (['"""(b1[:],i8[:],i8[:,:],f8[:],f8[:],f8[:,:],f8[:,:,:,:],i8)"""'], {'parallel': '(True)'}), "('(b1[:],i8[:],i8[:,:],f8[:],f8[:],f8[:,:],f8[:,:,:,:],i8)',\n parallel=True)\n", (17723, 17802), False, 'import numba\n'), ((31306, 31359), 'numba.njit', 'numba.njit', (['"""i... |
from copy import deepcopy
from itertools import groupby, chain
def split(values, by):
assert by > 0
if by == 1:
yield values
return
if not values:
yield ()
return
values_len = len(values)
if values_len == 1:
yield (values[0],)
return
if valu... | [
"copy.deepcopy",
"itertools.chain"
] | [((995, 1011), 'copy.deepcopy', 'deepcopy', (['groups'], {}), '(groups)\n', (1003, 1011), False, 'from copy import deepcopy\n'), ((2238, 2270), 'itertools.chain', 'chain', (['((column, group),)', 'items'], {}), '(((column, group),), items)\n', (2243, 2270), False, 'from itertools import groupby, chain\n'), ((793, 809),... |
from requests import get
from builtins import set, tuple, list, frozenset
get.a1 = 1
get.a2 = "2"
get.b1 = set()
get.b2 = frozenset()
get.b3 = ()
get.b4 = tuple()
get.b5 = []
get.b6 = list()
get.c1 = {}
get.c2 = {1, "2", get}
get.c3 = {1: 3, None: 2, "1": "2", get: 3}
get.c4 = (1, "2", get)
get.c5 = (None, True, Fal... | [
"builtins.frozenset",
"builtins.set",
"builtins.tuple",
"builtins.list"
] | [((109, 114), 'builtins.set', 'set', ([], {}), '()\n', (112, 114), False, 'from builtins import set, tuple, list, frozenset\n'), ((124, 135), 'builtins.frozenset', 'frozenset', ([], {}), '()\n', (133, 135), False, 'from builtins import set, tuple, list, frozenset\n'), ((157, 164), 'builtins.tuple', 'tuple', ([], {}), '... |
import os
import sys
from easydict import EasyDict
from .config import CONF as CONF_BASE
import copy
CONF = copy.deepcopy(CONF_BASE)
print('Using Grounding Config')
# output
CONF.PATH.OUTPUT = os.path.join(CONF.PATH.BASE, "outputs/exp_grounding")
# train
CONF.TRAIN = EasyDict()
CONF.TRAIN.MAX_DES_LEN = 126
CONF.TRAI... | [
"copy.deepcopy",
"os.path.join",
"easydict.EasyDict"
] | [((109, 133), 'copy.deepcopy', 'copy.deepcopy', (['CONF_BASE'], {}), '(CONF_BASE)\n', (122, 133), False, 'import copy\n'), ((195, 248), 'os.path.join', 'os.path.join', (['CONF.PATH.BASE', '"""outputs/exp_grounding"""'], {}), "(CONF.PATH.BASE, 'outputs/exp_grounding')\n", (207, 248), False, 'import os\n'), ((271, 281), ... |
import json
from collections import OrderedDict
class Experiment():
@staticmethod
def from_config(config):
exp = Experiment()
exp.dataset = config['dataset']
exp.preprocessing= config['preprocessing']
exp.model = config['model']
exp.learning = config['learnin... | [
"json.load"
] | [((1738, 1794), 'json.load', 'json.load', (['json_data_file'], {'object_pairs_hook': 'OrderedDict'}), '(json_data_file, object_pairs_hook=OrderedDict)\n', (1747, 1794), False, 'import json\n')] |
"""statuses.py: Implementation of class AbstractTwitterStatusesCommand
and its subclasses.
"""
from argparse import ArgumentParser
from . import AbstractTwitterCommand, call_decorator
from ..parsers import (
filter_args,
cache,
parser_user_single,
parser_count_statuses,
parser_cursor,
parser_s... | [
"argparse.ArgumentParser"
] | [((16682, 16712), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'add_help': '(False)'}), '(add_help=False)\n', (16696, 16712), False, 'from argparse import ArgumentParser\n'), ((17065, 17095), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'add_help': '(False)'}), '(add_help=False)\n', (17079, 17095), False, '... |
#!/usr/bin/env python
"""
narrowPeak,
cols 9 and 10 are just blank,
col 5 is 1000 for things that meet the >=3 l2fc and l10pval cutoffs and 200 otherwise (its just for ucsc track coloring)
"""
import numpy as np
import pandas as pd
import argparse
import os
ECLIP_HEADER = [
'chrom','start','end','pValue','signal... | [
"pandas.read_csv",
"argparse.ArgumentParser",
"os.path.basename"
] | [((536, 557), 'os.path.basename', 'os.path.basename', (['bed'], {}), '(bed)\n', (552, 557), False, 'import os\n'), ((847, 893), 'pandas.read_csv', 'pd.read_csv', (['bed'], {'names': 'ECLIP_HEADER', 'sep': '"""\t"""'}), "(bed, names=ECLIP_HEADER, sep='\\t')\n", (858, 893), True, 'import pandas as pd\n'), ((1435, 1460), ... |
"""
Data preparation for KDD cup data.
The result of this script is input for the workshop participants.
This dataset has 3 categorical variables, and seems to give good results with outlier algorithms
Done here:
- transformation from byte-type strings to regular utf8 strings
- mapping of outliers: 'yes'/'no' to 1/0
... | [
"pandas.DataFrame",
"scipy.io.arff.loadarff"
] | [((714, 740), 'scipy.io.arff.loadarff', 'arff.loadarff', (['kddcup_path'], {}), '(kddcup_path)\n', (727, 740), False, 'from scipy.io import arff\n'), ((747, 768), 'pandas.DataFrame', 'pd.DataFrame', (['data[0]'], {}), '(data[0])\n', (759, 768), True, 'import pandas as pd\n')] |
from BaseEntity import BaseEntity
class Utterance(BaseEntity):
def __init__(self, utterance_dir, utterance_id, feature_type, phone_type="PHN39", wav_sampling_rate=16000):
BaseEntity.__init__(self, utterance_dir, utterance_id, feature_type, phone_type="PHN39", wav_sampling_rate=16000)
| [
"BaseEntity.BaseEntity.__init__"
] | [((183, 300), 'BaseEntity.BaseEntity.__init__', 'BaseEntity.__init__', (['self', 'utterance_dir', 'utterance_id', 'feature_type'], {'phone_type': '"""PHN39"""', 'wav_sampling_rate': '(16000)'}), "(self, utterance_dir, utterance_id, feature_type,\n phone_type='PHN39', wav_sampling_rate=16000)\n", (202, 300), False, '... |
#!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
import sys
import os
import re
from collections import Counter
pattern = r'^【([A-Z][A-Z0-9]+-[0-9]+[A-Z]?)】.*$'
if __name__ == '__main__':
counter = Counter()
prefix = Counter()
for file in os.listdir(sys.argv[1]):
with open(os.path.join(sys.argv[1],... | [
"collections.Counter",
"re.findall",
"os.path.join",
"os.listdir"
] | [((203, 212), 'collections.Counter', 'Counter', ([], {}), '()\n', (210, 212), False, 'from collections import Counter\n'), ((226, 235), 'collections.Counter', 'Counter', ([], {}), '()\n', (233, 235), False, 'from collections import Counter\n'), ((252, 275), 'os.listdir', 'os.listdir', (['sys.argv[1]'], {}), '(sys.argv[... |
#!/usr/bin/env python
# -*_ coding: utf-8 -*-
def get_data_path():
import os
import sys
script_dir = sys.path[0]
return os.sep.join([script_dir, 'data', 'data.json'])
def get_data():
import json
data_path = get_data_path()
data_file = open(data_path, 'r')
data_json = data_file.read... | [
"os.sep.join",
"json.loads"
] | [((139, 185), 'os.sep.join', 'os.sep.join', (["[script_dir, 'data', 'data.json']"], {}), "([script_dir, 'data', 'data.json'])\n", (150, 185), False, 'import os\n'), ((339, 360), 'json.loads', 'json.loads', (['data_json'], {}), '(data_json)\n', (349, 360), False, 'import json\n')] |
import numpy as np
import properties
from .... import survey
from ....utils import Zero
class BaseSrc(survey.BaseSrc):
"""
Base DC source
"""
_q = None
def __init__(self, receiver_list, location, current=1.0, **kwargs):
super().__init__(receiver_list=receiver_list, **kwargs)
sel... | [
"numpy.full_like",
"numpy.sum",
"numpy.asarray",
"numpy.zeros",
"numpy.atleast_2d"
] | [((559, 589), 'numpy.asarray', 'np.asarray', (['other'], {'dtype': 'float'}), '(other, dtype=float)\n', (569, 589), True, 'import numpy as np\n'), ((606, 626), 'numpy.atleast_2d', 'np.atleast_2d', (['other'], {}), '(other)\n', (619, 626), True, 'import numpy as np\n'), ((2354, 2389), 'numpy.full_like', 'np.full_like', ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
import requests
def base_url() -> str:
"""get base URL."""
return "http://localhost:5000/v1/"
@pytest.fixture()
def db_setup():
from podcaststore.app import db
# TODO segregate the DB locally
db.create_all()
yield db
db.drop_a... | [
"podcaststore.app.db.create_all",
"pytest.fixture",
"podcaststore.app.db.drop_all",
"requests.get",
"requests.post"
] | [((168, 184), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (182, 184), False, 'import pytest\n'), ((278, 293), 'podcaststore.app.db.create_all', 'db.create_all', ([], {}), '()\n', (291, 293), False, 'from podcaststore.app import db\n'), ((311, 324), 'podcaststore.app.db.drop_all', 'db.drop_all', ([], {}), '()\... |
from time import time as t
def f(x):
"""
"""
return x**2 + x + 3
def time():
"""
"""
return t()
| [
"time.time"
] | [((118, 121), 'time.time', 't', ([], {}), '()\n', (119, 121), True, 'from time import time as t\n')] |
# -*- coding: utf-8 -*-
# adapted from https://github.com/facebookresearch/detectron2/blob/master/detectron2/data/transforms/augmentation.py
import sys
import inspect
import random
import numpy as np
import pprint
from abc import ABCMeta, abstractmethod
from typing import List, Optional, Tuple, Union
from PIL import Im... | [
"numpy.pad",
"numpy.random.uniform",
"pprint.pformat",
"numpy.ceil",
"numpy.asarray",
"numpy.floor",
"random.choice",
"numpy.random.randint",
"numpy.array",
"inspect.signature",
"numpy.random.normal",
"numpy.random.choice",
"numpy.random.rand"
] | [((28939, 28963), 'random.choice', 'random.choice', (['instances'], {}), '(instances)\n', (28952, 28963), False, 'import random\n'), ((28980, 29017), 'numpy.asarray', 'np.asarray', (['crop_size'], {'dtype': 'np.int32'}), '(crop_size, dtype=np.int32)\n', (28990, 29017), True, 'import numpy as np\n'), ((29601, 29644), 'n... |
import cv2
import numpy as np
import pprint
mylist = []
loaded = cv2.imreadmulti(mats = mylist, filename = "2page.tiff", flags = cv2.IMREAD_ANYCOLOR )
print(loaded)
print(len(mylist))
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(mylist)
| [
"pprint.PrettyPrinter",
"cv2.imreadmulti"
] | [((66, 144), 'cv2.imreadmulti', 'cv2.imreadmulti', ([], {'mats': 'mylist', 'filename': '"""2page.tiff"""', 'flags': 'cv2.IMREAD_ANYCOLOR'}), "(mats=mylist, filename='2page.tiff', flags=cv2.IMREAD_ANYCOLOR)\n", (81, 144), False, 'import cv2\n'), ((190, 220), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent'... |
# Copyright 2020 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | [
"scipy.linalg.expm",
"numpy.abs",
"numpy.argmax",
"numpy.linalg.eigh",
"openfermion.prepare_one_body_squared_evolution",
"numpy.real",
"openfermion.low_rank_two_body_decomposition"
] | [((2905, 3032), 'openfermion.low_rank_two_body_decomposition', 'low_rank_two_body_decomposition', (['self.tei'], {'truncation_threshold': 'threshold', 'final_rank': 'self.lmax', 'spin_basis': 'self.spin_basis'}), '(self.tei, truncation_threshold=threshold,\n final_rank=self.lmax, spin_basis=self.spin_basis)\n', (293... |
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from util.ml_and_math.layers import MLP
class Transformer(nn.Module):
def __init__(self, len_sequence, segment_size, embedding_size, hidden_size, trans_layers, readout_layers, device, alphabet_size=4,
dropout=0.0, hea... | [
"torch.nn.Dropout",
"torch.ones",
"torch.eye",
"math.sqrt",
"torch.nn.TransformerEncoderLayer",
"util.ml_and_math.layers.MLP",
"torch.cos",
"torch.nn.LayerNorm",
"torch.arange",
"torch.nn.Linear",
"torch.zeros",
"math.log",
"torch.sin",
"torch.nn.functional.pad"
] | [((4395, 4408), 'torch.eye', 'torch.eye', (['sz'], {}), '(sz)\n', (4404, 4408), False, 'import torch\n'), ((4748, 4767), 'torch.zeros', 'torch.zeros', (['sz', 'sz'], {}), '(sz, sz)\n', (4759, 4767), False, 'import torch\n'), ((1353, 1526), 'util.ml_and_math.layers.MLP', 'MLP', ([], {'in_size': '(len_sequence // segment... |
"""
G R A D I E N T - E N H A N C E D N E U R A L N E T W O R K S (G E N N)
Author: <NAME> <<EMAIL>>
This package is distributed under New BSD license.
"""
import numpy as np
def compute_precision(Y_pred, Y_true):
"""
Compute precision = True positives / Total Number of Predicted Positives
... | [
"numpy.std",
"numpy.mean",
"numpy.square"
] | [((3429, 3452), 'numpy.std', 'np.std', (['(Y_pred - Y_true)'], {}), '(Y_pred - Y_true)\n', (3435, 3452), True, 'import numpy as np\n'), ((3462, 3486), 'numpy.mean', 'np.mean', (['(Y_pred - Y_true)'], {}), '(Y_pred - Y_true)\n', (3469, 3486), True, 'import numpy as np\n'), ((4215, 4230), 'numpy.mean', 'np.mean', (['Y_tr... |
from dfa import DFA
import config
from logia.mdgfmdoc import MdGfmDoc
from logia.program import Program
class Converter:
def __init__(self, nfa, alpha):
self.nfa = nfa
self.alpha = alpha
# returns all states reachable through s by taking char c
# is c is None, does one level of spontanea... | [
"logia.program.Program.instance"
] | [((1537, 1555), 'logia.program.Program.instance', 'Program.instance', ([], {}), '()\n', (1553, 1555), False, 'from logia.program import Program\n')] |
import numpy as np
import pickle
import tensorflow as tf
def DataNormalisationZeroCentred(InputData, AverageData=None):
if AverageData is None:
AverageData = np.mean(InputData, axis=0)
NormalisedData = InputData - AverageData
else:
NormalisedData = InputData - AverageData
return N... | [
"numpy.mean",
"pickle.load",
"tensorflow.keras.models.load_model"
] | [((399, 486), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (["(model_folder + 'BinaryClassification/saved_model.model')"], {}), "(model_folder +\n 'BinaryClassification/saved_model.model')\n", (425, 486), True, 'import tensorflow as tf\n'), ((611, 634), 'pickle.load', 'pickle.load', (['reader_... |
from django.contrib import admin
from .models import ItemPedido, Pedido, CupomDesconto
from django.http import HttpResponse
@admin.register(CupomDesconto)
class CupomDescontoAdmin(admin.ModelAdmin):
list_display = ('codigo', 'desconto', 'ativo')
readonly_fields=('usos',)
class itemPedidoInline(admin.Tabular... | [
"django.contrib.admin.register",
"django.contrib.admin.site.register"
] | [((127, 156), 'django.contrib.admin.register', 'admin.register', (['CupomDesconto'], {}), '(CupomDesconto)\n', (141, 156), False, 'from django.contrib import admin\n'), ((845, 885), 'django.contrib.admin.site.register', 'admin.site.register', (['Pedido', 'PedidoAdmin'], {}), '(Pedido, PedidoAdmin)\n', (864, 885), False... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in complianc... | [
"backend.packages.blue_krill.data_types.enum.EnumField",
"backend.iam.permissions.exceptions.AttrValidationError",
"backend.iam.permissions.request.IAMResource",
"backend.utils.basic.md5_digest"
] | [((2020, 2075), 'backend.packages.blue_krill.data_types.enum.EnumField', 'EnumField', (['"""namespace_create"""'], {'label': '"""namespace_create"""'}), "('namespace_create', label='namespace_create')\n", (2029, 2075), False, 'from backend.packages.blue_krill.data_types.enum import EnumField, StructuredEnum\n'), ((2087... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
"""
用来从消息队列中读取任务,发送验证邮件
"""
import email
import getpass
import os
import smtplib
from email import encoders
from email.header import Header
from email.mime.base import MIMEBase
from email.mime.image import MIMEImage
from email.mime.multipart import MI... | [
"email.header.Header",
"smtplib.SMTP_SSL",
"smtplib.SMTP",
"email.mime.text.MIMEText",
"email.mime.base.MIMEBase",
"email.encoders.encode_base64",
"email.mime.multipart.MIMEMultipart",
"os.path.join"
] | [((1043, 1112), 'os.path.join', 'os.path.join', (['"""/mnt/d/pythonProjects/liu_aistuff/email_template.html"""'], {}), "('/mnt/d/pythonProjects/liu_aistuff/email_template.html')\n", (1055, 1112), False, 'import os\n'), ((1763, 1778), 'email.mime.multipart.MIMEMultipart', 'MIMEMultipart', ([], {}), '()\n', (1776, 1778),... |
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"label": _("oil management"),
"items": [
{
"type": "doctype",
"name": "Order Go",
"onboard": 1,
}
]
},
{
"label": _("Setup"),
"items": [
{
"type": "doctype",
"name": "... | [
"frappe._"
] | [((104, 123), 'frappe._', '_', (['"""oil management"""'], {}), "('oil management')\n", (105, 123), False, 'from frappe import _\n'), ((250, 260), 'frappe._', '_', (['"""Setup"""'], {}), "('Setup')\n", (251, 260), False, 'from frappe import _\n')] |
import logging
from typing import Optional
from thenewboston_node.business_logic.models import AccountState, PrimaryValidatorSchedule
from thenewboston_node.core.logging import timeit_method
from thenewboston_node.core.utils.types import hexstr
from .base import BaseMixin
logger = logging.getLogger(__name__)
class... | [
"logging.getLogger",
"thenewboston_node.core.logging.timeit_method"
] | [((285, 312), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (302, 312), False, 'import logging\n'), ((4208, 4223), 'thenewboston_node.core.logging.timeit_method', 'timeit_method', ([], {}), '()\n', (4221, 4223), False, 'from thenewboston_node.core.logging import timeit_method\n')] |
import logging
import os
import pandas as pd
import wandb
from network import physical_network
def convert_info_into_metrics_summary_dict(info):
"""
Converts the info object returned at the end of the episode with a dictionary
of metrics to log into wandb.
"""
movement_detail_report = info["move... | [
"wandb.log",
"pandas.DataFrame",
"logging.error",
"os.makedirs",
"os.path.exists",
"logging.info",
"pandas.Series",
"pandas.concat"
] | [((2117, 2155), 'wandb.log', 'wandb.log', (['wandb_metrics'], {'commit': '(False)'}), '(wandb_metrics, commit=False)\n', (2126, 2155), False, 'import wandb\n'), ((4870, 5183), 'pandas.DataFrame', 'pd.DataFrame', (['records'], {'columns': "['source_name', 'destination_name', 'source_time', 'destination_time',\n 'comm... |
# Generated by Django 3.0.7 on 2020-11-07 14:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('jobsapp', '0009_favorite'),
]
operations = [
migrations.AddField(
model_name='applicant',
name='comment',
... | [
"django.db.models.SmallIntegerField",
"django.db.models.TextField"
] | [((328, 367), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (344, 367), False, 'from django.db import migrations, models\n'), ((490, 525), 'django.db.models.SmallIntegerField', 'models.SmallIntegerField', ([], {'default': '(1)'}), '(default=1... |
from py_minecraft_server import logger
import re
import os
import subprocess
def get_java_versions(java_calls=None):
""" Returns a dict of key=version val=location java versions located on the computer """
if java_calls is None:
java_calls = ["java"]
version_dict = {}
version_re = re.compile(... | [
"subprocess.run",
"os.path.join",
"os.listdir",
"re.compile"
] | [((309, 383), 're.compile', 're.compile', (['"""java\\\\s*version\\\\s*\\\\"(?P<ver>\\\\d*\\\\.\\\\d*)\\\\."""', 're.IGNORECASE'], {}), '(\'java\\\\s*version\\\\s*\\\\"(?P<ver>\\\\d*\\\\.\\\\d*)\\\\.\', re.IGNORECASE)\n', (319, 383), False, 'import re\n'), ((821, 899), 'subprocess.run', 'subprocess.run', (['args'], {'s... |
# -*- coding: utf-8 -*-
"""Plot module for Seispy Toolbox
"""
import numpy as np
import matplotlib.pyplot as plt
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui
__all__ = ['wiggle', 'traces', 'show']
def insert_zeros(trace, tt=None):
"""Insert zero locations in data trace and tt vector based on linear ... | [
"pyqtgraph.setConfigOption",
"pyqtgraph.Qt.QtGui.QApplication.instance",
"numpy.random.randn",
"numpy.std",
"numpy.zeros",
"numpy.split",
"numpy.min",
"numpy.diff",
"numpy.arange",
"numpy.array",
"numpy.signbit",
"matplotlib.pyplot.gca",
"numpy.max",
"pyqtgraph.plot",
"pyqtgraph.setConfi... | [((651, 675), 'numpy.split', 'np.split', (['tt', '(zc_idx + 1)'], {}), '(tt, zc_idx + 1)\n', (659, 675), True, 'import numpy as np\n'), ((694, 721), 'numpy.split', 'np.split', (['trace', '(zc_idx + 1)'], {}), '(trace, zc_idx + 1)\n', (702, 721), True, 'import numpy as np\n'), ((3781, 3790), 'matplotlib.pyplot.gca', 'pl... |
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to us... | [
"numpy.asarray",
"numpy.array",
"numpy.arange",
"numpy.linalg.norm",
"itertools.product",
"random.gauss",
"psutil.cpu_count"
] | [((1629, 1660), 'psutil.cpu_count', 'psutil.cpu_count', ([], {'logical': '(False)'}), '(logical=False)\n', (1645, 1660), False, 'import psutil\n'), ((2594, 2638), 'numpy.array', 'np.array', (['static_lidar_noise'], {'dtype': 'np.float'}), '(static_lidar_noise, dtype=np.float)\n', (2602, 2638), True, 'import numpy as np... |
# Generated by Django 4.0.3 on 2022-03-21 13:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("shop", "0001_initial"),
]
operations = [
migrations.AlterModelOptions(
name="user",
options={},
),
m... | [
"django.db.models.CharField",
"django.db.migrations.AlterModelOptions"
] | [((221, 274), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""user"""', 'options': '{}'}), "(name='user', options={})\n", (249, 274), False, 'from django.db import migrations, models\n'), ((430, 489), 'django.db.models.CharField', 'models.CharField', ([], {'editable': '(False... |