code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import glob
import os
import torchvision.transforms as T
from PIL import Image
from torch.utils.data import Dataset
class KTH(Dataset):
def __init__(self, dataroot, transform=None, train=True):
self.dataroot = os.path.join(dataroot, "KTH")
self.train = train
if transform:
sel... | [
"PIL.Image.open",
"torchvision.transforms.RandomRotation",
"torchvision.transforms.RandomHorizontalFlip",
"os.path.join",
"torchvision.transforms.Normalize",
"torchvision.transforms.Resize",
"torchvision.transforms.ToTensor",
"torchvision.transforms.RandomResizedCrop"
] | [((225, 254), 'os.path.join', 'os.path.join', (['dataroot', '"""KTH"""'], {}), "(dataroot, 'KTH')\n", (237, 254), False, 'import os\n'), ((1096, 1150), 'os.path.join', 'os.path.join', (['self.dataroot', '"""data"""', '"""train"""', '"""*"""', '"""*"""'], {}), "(self.dataroot, 'data', 'train', '*', '*')\n", (1108, 1150)... |
import json
import re
import requests
import threading
from flask import current_app as app
ingredLock = threading.RLock()
posLock = threading.RLock()
recipeLock = threading.RLock()
imgDownloadLock = threading.RLock()
processLocker = threading.RLock()
def recipesByIngredients(ingredientsList, maxRecpts='20', ranki... | [
"threading.RLock",
"requests.request",
"flask.current_app.logger.info"
] | [((107, 124), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (122, 124), False, 'import threading\n'), ((135, 152), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (150, 152), False, 'import threading\n'), ((166, 183), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (181, 183), False, 'import t... |
from flask import Blueprint, render_template, Response
import cv2
face_detection_bp = Blueprint(
'face_detection',
__name__,
template_folder='templates',
static_folder='static',
)
def generate_frames():
cam = cv2.VideoCapture(0)
while True:
# read the camera frame
success, fr... | [
"flask.render_template",
"cv2.rectangle",
"cv2.imencode",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.CascadeClassifier",
"flask.Blueprint"
] | [((88, 182), 'flask.Blueprint', 'Blueprint', (['"""face_detection"""', '__name__'], {'template_folder': '"""templates"""', 'static_folder': '"""static"""'}), "('face_detection', __name__, template_folder='templates',\n static_folder='static')\n", (97, 182), False, 'from flask import Blueprint, render_template, Respo... |
import time
import os
def get_format_time():
'''
:return:
'''
now = time.time()
tl = time.localtime(now)
format_time = time.strftime("%Y-%m-%d", tl)
return format_time
def write_file(filepath, content, filename):
filename += '.log'
path = os.path.join(filepath, filename)
with... | [
"os.path.join",
"time.localtime",
"time.strftime",
"time.time"
] | [((86, 97), 'time.time', 'time.time', ([], {}), '()\n', (95, 97), False, 'import time\n'), ((107, 126), 'time.localtime', 'time.localtime', (['now'], {}), '(now)\n', (121, 126), False, 'import time\n'), ((145, 174), 'time.strftime', 'time.strftime', (['"""%Y-%m-%d"""', 'tl'], {}), "('%Y-%m-%d', tl)\n", (158, 174), Fals... |
from sympy import (symbols, product, factorial, rf, sqrt, cos,
Function, Product, Rational, Sum, oo)
a, k, n = symbols('a,k,n', integer=True)
f = Function('f')
def test_simple_products():
assert product(2, (k, a, n)) == 2**(n-a+1)
assert product(k, (k, 1, n)) == factorial(n)
assert prod... | [
"sympy.cos",
"sympy.factorial",
"sympy.sqrt",
"sympy.rf",
"sympy.Function",
"sympy.product",
"sympy.symbols",
"sympy.Rational"
] | [((131, 161), 'sympy.symbols', 'symbols', (['"""a,k,n"""'], {'integer': '(True)'}), "('a,k,n', integer=True)\n", (138, 161), False, 'from sympy import symbols, product, factorial, rf, sqrt, cos, Function, Product, Rational, Sum, oo\n'), ((166, 179), 'sympy.Function', 'Function', (['"""f"""'], {}), "('f')\n", (174, 179)... |
# Copyright 2021 @apichick
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | [
"apache_beam.Map",
"apache_beam.transforms.window.SlidingWindows",
"apache_beam.options.pipeline_options.PipelineOptions",
"json.dumps",
"apache_beam.io.ReadFromPubSub",
"apache_beam.transforms.combiners.TopCombineFn",
"apache_beam.combiners.Count.PerKey",
"apache_beam.io.WriteToPubSub",
"apache_bea... | [((1190, 1256), 'apache_beam.options.pipeline_options.PipelineOptions', 'PipelineOptions', (['beam_args'], {'save_main_session': '(True)', 'streaming': '(True)'}), '(beam_args, save_main_session=True, streaming=True)\n', (1205, 1256), False, 'from apache_beam.options.pipeline_options import PipelineOptions\n'), ((1266,... |
from sqlalchemy import create_engine
import pandas as pd
import os
def get_gde_url():
try:
if bool(int(os.environ['OUTSIDE_NETWORK'])):
host = 'localhost'
port = '5500'
else:
host = 'digilog-postgres'
port = '5432'
except KeyError:
host =... | [
"pandas.DataFrame",
"sqlalchemy.create_engine"
] | [((585, 617), 'sqlalchemy.create_engine', 'create_engine', (['connection_string'], {}), '(connection_string)\n', (598, 617), False, 'from sqlalchemy import create_engine\n'), ((736, 779), 'pandas.DataFrame', 'pd.DataFrame', (['result'], {'columns': 'columns_crawl'}), '(result, columns=columns_crawl)\n', (748, 779), Tru... |
import settings
import handlers.base_handler
import csv
class CartogramHandler(handlers.base_handler.BaseCartogramHandler):
def get_name(self):
return "Conterminous United States"
def get_gen_file(self):
return "{}/usa_low48conic.gen".format(settings.CARTOGRAM_DATA_DIR)
def validate_... | [
"csv.reader"
] | [((1452, 1471), 'csv.reader', 'csv.reader', (['csvfile'], {}), '(csvfile)\n', (1462, 1471), False, 'import csv\n')] |
import re
import random
import itertools
import math
from collections import defaultdict, deque
from src.utilities import *
from src import channels, users, debuglog, errlog, plog
from src.functions import get_players, get_all_players, get_main_role, get_reveal_role
from src.decorators import command, event_listener
f... | [
"src.channels.Main.send",
"collections.deque",
"src.debuglog",
"src.events.Event",
"src.functions.get_reveal_role",
"src.functions.get_main_role",
"src.decorators.event_listener",
"src.functions.get_players",
"src.functions.get_all_players"
] | [((1455, 1483), 'src.decorators.event_listener', 'event_listener', (['"""del_player"""'], {}), "('del_player')\n", (1469, 1483), False, 'from src.decorators import command, event_listener\n'), ((6659, 6709), 'src.decorators.event_listener', 'event_listener', (['"""transition_night_end"""'], {'priority': '(2)'}), "('tra... |
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.db import models
import pytest
from django_dynamic_fixture import N, G
from django_dynamic_fixture.models_test import *
from django_dynamic_fixture.django_helper import *
class DjangoHelperAppsTest(TestCase):
def test_get_apps_must_return_all_... | [
"django.db.models.OneToOneField",
"django.db.models.IntegerField",
"django_dynamic_fixture.G",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.FileField",
"django_dynamic_fixture.N",
"pytest.raises",
"django.db.models.SmallIntegerField"
] | [((10358, 10377), 'django_dynamic_fixture.N', 'N', (['ModelWithNumbers'], {}), '(ModelWithNumbers)\n', (10359, 10377), False, 'from django_dynamic_fixture import N, G\n'), ((10493, 10512), 'django_dynamic_fixture.G', 'G', (['ModelWithNumbers'], {}), '(ModelWithNumbers)\n', (10494, 10512), False, 'from django_dynamic_fi... |
# coding=utf-8
# Copyright 2021 The Uncertainty Metrics Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | [
"tensorflow.math.argmax",
"tensorflow.linspace",
"tensorflow.shape",
"tensorflow.boolean_mask",
"tensorflow.reduce_sum",
"tensorflow.cond",
"tensorflow.cumsum",
"tensorflow.argmax",
"tensorflow.floor",
"tensorflow.cast",
"tensorflow.gather_nd",
"tensorflow.abs"
] | [((4085, 4113), 'tensorflow.gather_nd', 'tf.gather_nd', (['probs', 'indices'], {}), '(probs, indices)\n', (4097, 4113), True, 'import tensorflow as tf\n'), ((4688, 4714), 'tensorflow.reduce_sum', 'tf.reduce_sum', (['self.counts'], {}), '(self.counts)\n', (4701, 4714), True, 'import tensorflow as tf\n'), ((4872, 4920), ... |
"""
Various utility functions.
"""
from __future__ import absolute_import
import re
import string
from Crypto.Random import random
HASH_REGEXP = re.compile(r'^{([A-Z0-9]+)}(.*)$')
def generate_password(length=12, ascii_lower=True, ascii_upper=True, punctuation=True,
digits=True, strip_ambiguou... | [
"Crypto.Random.random.choice",
"re.compile"
] | [((147, 180), 're.compile', 're.compile', (['"""^{([A-Z0-9]+)}(.*)$"""'], {}), "('^{([A-Z0-9]+)}(.*)$')\n", (157, 180), False, 'import re\n'), ((2032, 2051), 'Crypto.Random.random.choice', 'random.choice', (['pool'], {}), '(pool)\n', (2045, 2051), False, 'from Crypto.Random import random\n')] |
import numpy as np
import math
import operator
import neuralalg as na
i = 1
# A wrapper for various machine learning algorithms.
class HardCodedClassifier(object):
def __init__(self):
self.network = None
self.classOrder = []
# Train the data. Previous trains will be overwritten.
def train(self, info, classOr... | [
"neuralalg.train",
"neuralalg.predict",
"neuralalg.attach_neurons"
] | [((688, 719), 'neuralalg.attach_neurons', 'na.attach_neurons', (['self.network'], {}), '(self.network)\n', (705, 719), True, 'import neuralalg as na\n'), ((744, 821), 'neuralalg.train', 'na.train', (['self.network', 'info[0]', 'info[1]', 'self.classOrder'], {'learning_rate': '(0.01)'}), '(self.network, info[0], info[1]... |
'''
Simple primitive that delays the cobot's behavior for a fixed amount of time.
'''
import time
from ..primitive import Primitive
from ...type_defs import NUMBER_TYPE
class Delay(Primitive):
'''
Data structure methods
'''
@classmethod
def display_name(cls):
return 'Delay'
@class... | [
"time.time"
] | [((2283, 2294), 'time.time', 'time.time', ([], {}), '()\n', (2292, 2294), False, 'import time\n'), ((2545, 2556), 'time.time', 'time.time', ([], {}), '()\n', (2554, 2556), False, 'import time\n'), ((2777, 2788), 'time.time', 'time.time', ([], {}), '()\n', (2786, 2788), False, 'import time\n'), ((2688, 2699), 'time.time... |
#! /usr/bin/env python3
#
# MIT License
#
# (C) Copyright 2018-2022 Hewlett Packard Enterprise Development LP
#
# 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 ... | [
"logging.getLogger",
"logging.basicConfig",
"os.path.exists",
"requests.packages.urllib3.disable_warnings",
"requests.Session",
"xml.etree.ElementTree.parse",
"os.environ.get",
"os.path.join",
"time.sleep",
"os.path.isfile",
"logging.getLevelName",
"os.path.isdir",
"sys.exit",
"requests_oa... | [((1538, 1565), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1555, 1565), False, 'import logging\n'), ((1998, 2039), 'logging.getLevelName', 'logging.getLevelName', (['requested_log_level'], {}), '(requested_log_level)\n', (2018, 2039), False, 'import logging\n'), ((2201, 2256), 'loggi... |
import re
import warnings
from astropy.coordinates import SkyCoord
import astropy.units as u
import numpy as np
from astropy.wcs import WCS, FITSFixedWarning
from astropy.io import fits
def _arange_inclusive(x0, x1, binx):
"""
Return np.arange(x0, x1, binx) except that range is inclusive of x1.
"""
... | [
"numpy.searchsorted",
"warnings.catch_warnings",
"numpy.min",
"astropy.coordinates.SkyCoord",
"numpy.max",
"numpy.argsort",
"numpy.array",
"warnings.simplefilter",
"astropy.io.fits.open",
"numpy.histogram2d",
"astropy.wcs.WCS",
"numpy.arange",
"re.search"
] | [((477, 516), 'numpy.arange', 'np.arange', (['x0', 'x1', 'binx'], {'dtype': 'np.float'}), '(x0, x1, binx, dtype=np.float)\n', (486, 516), True, 'import numpy as np\n'), ((6542, 6580), 'numpy.searchsorted', 'np.searchsorted', (["events['x']", '[x0, x1]'], {}), "(events['x'], [x0, x1])\n", (6557, 6580), True, 'import num... |
# Copyright 2020 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"os.path.exists",
"json.dumps",
"os.path.join",
"tests.storage.test_utils.file_contains_expected_contents",
"pytest.mark.parametrize",
"pytest.raises"
] | [((3342, 3457), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""meta_data,should_raise,result"""', "[({'path': '/path/to/file'}, False, '/path/to/file')]"], {}), "('meta_data,should_raise,result', [({'path':\n '/path/to/file'}, False, '/path/to/file')])\n", (3365, 3457), False, 'import pytest\n'), ((3905... |
"""
Copyright (C) 2022 Red Hat, Inc. (https://github.com/Commonjava/charon)
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 a... | [
"charon.storage.S3Client",
"charon.pkgs.npm.handle_npm_uploading",
"os.getcwd",
"boto3.resource",
"charon.pkgs.npm.read_package_metadata_from_content"
] | [((1099, 1109), 'charon.storage.S3Client', 'S3Client', ([], {}), '()\n', (1107, 1109), False, 'from charon.storage import S3Client\n'), ((1315, 1335), 'boto3.resource', 'boto3.resource', (['"""s3"""'], {}), "('s3')\n", (1329, 1335), False, 'import boto3\n'), ((2755, 2906), 'charon.pkgs.npm.handle_npm_uploading', 'handl... |
from functools import wraps
from django.core.urlresolvers import resolve, reverse
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseForbidden, HttpResponseRedirect
def tenant_profile_required(view_func):
"""
Decorator ensures any application logic associated with having the profile
... | [
"django.core.urlresolvers.reverse"
] | [((514, 544), 'django.core.urlresolvers.reverse', 'reverse', (['"""tenant_profile_lock"""'], {}), "('tenant_profile_lock')\n", (521, 544), False, 'from django.core.urlresolvers import resolve, reverse\n')] |
import json
import os
from pokemongo_bot.base_task import BaseTask
from pokemongo_bot.tree_config_builder import ConfigException
class RecycleItems(BaseTask):
SUPPORTED_TASK_API_VERSION = 1
def initialize(self):
self.min_empty_space = self.config.get('min_empty_space', None)
self.item_filter ... | [
"os.path.join"
] | [((467, 501), 'os.path.join', 'os.path.join', (['"""data"""', '"""items.json"""'], {}), "('data', 'items.json')\n", (479, 501), False, 'import os\n')] |
# -*- coding: utf-8 -*-
"""
Created on Fri May 25 16:11:03 2018
@author: kncv078
"""
# NOTES:
# fingerprint files are very large, i should use sparse matrices
# 1 - import libraries
#import os
import time
import math
import random
import pandas as pd
#import numpy as np
from scipy import sparse
#import matplotlib a... | [
"pandas.read_csv",
"scipy.sparse.load_npz",
"sklearn.ensemble.RandomForestClassifier",
"sklearn.metrics.make_scorer",
"scipy.sparse.hstack",
"time.time"
] | [((1759, 1770), 'time.time', 'time.time', ([], {}), '()\n', (1768, 1770), False, 'import time\n'), ((1834, 1933), 'pandas.read_csv', 'pd.read_csv', (['htsFP_file'], {'sep': '""" """', 'header': 'None', 'index_col': '(0)', 'usecols': '([0] + cols)', 'low_memory': '(True)'}), "(htsFP_file, sep=' ', header=None, index_col... |
import itertools
import pytest
import tubes
def test_static_tube_takes_a_list():
tube = tubes.Each([1, 2, 3])
assert list(tube) == [1, 2, 3]
def test_static_tube_takes_an_iter():
tube = tubes.Each(itertools.count(10)).first(3)
assert list(tube) == [10, 11, 12]
def test_static_tube_with_strings()... | [
"tubes.Each",
"pytest.raises",
"itertools.count"
] | [((96, 117), 'tubes.Each', 'tubes.Each', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (106, 117), False, 'import tubes\n'), ((333, 360), 'tubes.Each', 'tubes.Each', (["['a', 'b', 'c']"], {}), "(['a', 'b', 'c'])\n", (343, 360), False, 'import tubes\n'), ((452, 479), 'tubes.Each', 'tubes.Each', (["['a', 'b', 'c']"], {}), "(['a'... |
#!/usr/bin/env python3
"""Extract noun phrases from image titles.
These are consecutive sequences of capitalized words, e.g.
"Yonge Street" in "Photo at Yonge Street" (the first word is always capitalized).
Usage:
./extract_noun_phrases.py (streets|pois) (cutoff)
This prints a histogram of either street names o... | [
"json.loads",
"argparse.ArgumentParser",
"re.compile",
"weightreservoir.reservoir.UniformSampling",
"re.match",
"collections.Counter"
] | [((944, 986), 're.compile', 're.compile', (['"""\\\\b(?:[A-Z][A-Za-z.\\\\\']* ?)+"""'], {}), '("\\\\b(?:[A-Z][A-Za-z.\\\\\']* ?)+")\n', (954, 986), False, 'import re\n'), ((1728, 2240), 're.compile', 're.compile', (['"""\\\\b(\n Street|St\\\\.?|\n Avenue|Ave\\\\.?|\n Road|Rd\\\\.?|\n Drive|D... |
from happytransformer import HappyGeneration, GENSettings
from transformers.utils.dummy_pt_objects import MaxLengthCriteria
import os
happy_gen = HappyGeneration("GPT-NEO", "EleutherAI/gpt-neo-2.7B")
# min_length - Minimum number of generated tokens
# max_length - Maximum number of generated tokens
# do_sample - When ... | [
"happytransformer.GENSettings",
"happytransformer.HappyGeneration"
] | [((146, 199), 'happytransformer.HappyGeneration', 'HappyGeneration', (['"""GPT-NEO"""', '"""EleutherAI/gpt-neo-2.7B"""'], {}), "('GPT-NEO', 'EleutherAI/gpt-neo-2.7B')\n", (161, 199), False, 'from happytransformer import HappyGeneration, GENSettings\n'), ((995, 1174), 'happytransformer.GENSettings', 'GENSettings', ([], ... |
from django.db.models.signals import post_save
from django.dispatch import receiver
from tracker.integration.client_api import UpdateMeetupGroup
from tracker.models import GroupUrlname
@receiver(post_save, sender=GroupUrlname)
def save_group_urlname(sender, instance, **kwargs):
"""
When a new urlname is adde... | [
"django.dispatch.receiver",
"tracker.integration.client_api.UpdateMeetupGroup"
] | [((189, 229), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'GroupUrlname'}), '(post_save, sender=GroupUrlname)\n', (197, 229), False, 'from django.dispatch import receiver\n'), ((410, 437), 'tracker.integration.client_api.UpdateMeetupGroup', 'UpdateMeetupGroup', (['instance'], {}), '(instance)\n',... |
"""dummies.py
helper classes for testing without a connection to Pokemon Showdown
by Annika"""
import psclient
# pylint: disable=super-init-not-called
class DummyWebsocket:
"""Dummy websocket class
"""
def __init__(self, host):
self.host = host
class DummyConnection(psclient.Connection):
... | [
"psclient.Room"
] | [((551, 582), 'psclient.Room', 'psclient.Room', (['"""testroom"""', 'self'], {}), "('testroom', self)\n", (564, 582), False, 'import psclient\n'), ((584, 616), 'psclient.Room', 'psclient.Room', (['"""testroom2"""', 'self'], {}), "('testroom2', self)\n", (597, 616), False, 'import psclient\n'), ((630, 662), 'psclient.Ro... |
"""
Faça um programa que leia o ano de nascimento de um jovem e informe, de acordo com sua idade,
se ele ainda vai se alistar ao serviço militar, se é a hora de se alistar, ou se já passou
do tempo do alistamento. Seu programa também deverá mostrar o tempo que falta ou que passou do prazo.
"""
from datetime import dat... | [
"datetime.date.today"
] | [((392, 404), 'datetime.date.today', 'date.today', ([], {}), '()\n', (402, 404), False, 'from datetime import date\n')] |
#####################################################
#
# smartcomponent.py
#
# Copyright 2007 Hewlett-Packard Development Company, L.P.
#
# Hewlett-Packard and the Hewlett-Packard logo are trademarks of
# Hewlett-Packard Development Company, L.P. in the U.S. and/or other countries.
#
# Confidential computer software. ... | [
"logging.getLogger",
"tarfile.open",
"xml.dom.minidom.parse",
"os.close",
"os.write",
"os.path.abspath",
"threading.Thread",
"tempfile.mkstemp",
"os.walk",
"os.remove"
] | [((905, 932), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (922, 932), False, 'import logging\n'), ((1338, 1368), 'os.path.abspath', 'os.path.abspath', (['SC_SHARE_PATH'], {}), '(SC_SHARE_PATH)\n', (1353, 1368), False, 'import os\n'), ((1498, 1516), 'os.walk', 'os.walk', (['self.path'],... |
from fairwork_server.settings import *
import django_heroku
import dj_database_url
import os
DEBUG = False
SECURE_SSL_REDIRECT = True
CSRF_COOKIE_SECURE = True
ADMIN_NAME = os.environ['ADMIN_NAME']
ADMIN_EMAIL = os.environ['ADMIN_EMAIL']
ADMINS = [(os.environ['ADMIN_NAME'], os.environ['ADMIN_EMAIL']), ]
HOSTNAME = ... | [
"dj_database_url.config",
"os.getenv"
] | [((628, 652), 'dj_database_url.config', 'dj_database_url.config', ([], {}), '()\n', (650, 652), False, 'import dj_database_url\n'), ((1259, 1297), 'os.getenv', 'os.getenv', (['"""DJANGO_LOG_LEVEL"""', '"""ERROR"""'], {}), "('DJANGO_LOG_LEVEL', 'ERROR')\n", (1268, 1297), False, 'import os\n')] |
#!/usr/bin/env python3
__package__ = 'archivebox.cli'
__command__ = 'archivebox update'
import sys
import argparse
from typing import List, Optional, IO
from ..main import update
from ..util import docstring
from ..config import OUTPUT_DIR
from ..index import (
get_indexed_folders,
get_archived_folders,
... | [
"argparse.ArgumentParser"
] | [((729, 849), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '__command__', 'description': 'update.__doc__', 'add_help': '(True)', 'formatter_class': 'SmartFormatter'}), '(prog=__command__, description=update.__doc__,\n add_help=True, formatter_class=SmartFormatter)\n', (752, 849), False, 'impor... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: <NAME>
#
# save this file as /storage/.kodi/userdata/PWM_fan/PWM_fan.py
#
# Based on:
# https://forum.libreelec.tv/thread/9472-cooling-fan-control-raspberry-pi-libreelec/
# https://hackernoon.com/how-to-control-a-fan-to-cool-the-cpu-of-your-raspberrypi-3313b6e7f92c
#... | [
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"RPi.GPIO.setwarnings",
"time.sleep",
"RPi.GPIO.PWM",
"sys.exit",
"sys.path.append",
"RPi.GPIO.setmode"
] | [((1083, 1145), 'sys.path.append', 'sys.path.append', (['"""/storage/.kodi/addons/virtual.rpi-tools/lib"""'], {}), "('/storage/.kodi/addons/virtual.rpi-tools/lib')\n", (1098, 1145), False, 'import sys\n'), ((1793, 1817), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BOARD'], {}), '(GPIO.BOARD)\n', (1805, 1817), True, 'im... |
import os
import matplotlib.pyplot as plt
import numpy as np
from skimage.feature import plot_matches
def show_correspondences(imgA, imgB, X1, Y1, X2, Y2, matches, good_matches, number_to_display, filename=None):
"""
Visualizes corresponding points between two images, either as
arrows or dots
mode='dots': Co... | [
"matplotlib.pyplot.gcf",
"numpy.logical_not",
"skimage.feature.plot_matches",
"numpy.array",
"os.path.isdir",
"os.mkdir",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((592, 622), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(1)', 'ncols': '(1)'}), '(nrows=1, ncols=1)\n', (604, 622), True, 'import matplotlib.pyplot as plt\n'), ((902, 997), 'skimage.feature.plot_matches', 'plot_matches', (['ax', 'imgA', 'imgB', 'kp1', 'kp2', 'matches[good_matches]'], {'matches_color... |
from pylab import *
import tensorflow as tf
from sklearn.datasets import make_moons
from sklearn.datasets import load_digits
import tensorflow as tf
import time
from sklearn.metrics import normalized_mutual_info_score, adjusted_rand_score
import sys
sys.path.insert(0, '../utils')
from layers import *
from utils imp... | [
"tensorflow.device",
"cPickle.dump",
"sys.path.insert"
] | [((253, 283), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../utils"""'], {}), "(0, '../utils')\n", (268, 283), False, 'import sys\n'), ((4208, 4294), 'cPickle.dump', 'cPickle.dump', (['[LOSSES, reconstruction, XX[:3000], samples1, samples2, samples3]', 'f'], {}), '([LOSSES, reconstruction, XX[:3000], samples1, s... |
from __future__ import absolute_import, division, print_function
import sys
import inspect
from pykwalify.core import Core
from terraform_model.validator import SchemaGenerator
from schema import Schema, And, Use, Optional, SchemaError
def lineno():
"""Returns the current line number in our program."""
return ... | [
"inspect.currentframe",
"schema.Optional",
"schema.Use"
] | [((2496, 2504), 'schema.Use', 'Use', (['int'], {}), '(int)\n', (2499, 2504), False, 'from schema import Schema, And, Use, Optional, SchemaError\n'), ((2679, 2704), 'schema.Optional', 'Optional', (['"""optional_conf"""'], {}), "('optional_conf')\n", (2687, 2704), False, 'from schema import Schema, And, Use, Optional, Sc... |
from typer import Typer, Option, Argument, echo, colors, style
from typer.testing import CliRunner
from pylibup.types import *
from pylibup.utils import get_logger
logger = get_logger()
"""
name: Optional[str] = Default(None),
cls: Optional[Type[click.Command]] = Default(None),
invoke_without_command: bool = Default... | [
"pylibup.utils.get_logger",
"typer.Typer"
] | [((174, 186), 'pylibup.utils.get_logger', 'get_logger', ([], {}), '()\n', (184, 186), False, 'from pylibup.utils import get_logger\n'), ((1233, 1240), 'typer.Typer', 'Typer', ([], {}), '()\n', (1238, 1240), False, 'from typer import Typer, Option, Argument, echo, colors, style\n'), ((1102, 1225), 'typer.Typer', 'Typer'... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import logging
from collections import Iterable
from django.utils.translation import ugettext_lazy as _
from .errors import ConnectionError
LOG = logging.getLogger(__name__)
__all__ = ['BaseDriver', 'DatabaseStatus', 'DatabaseInfraStatu... | [
"logging.getLogger",
"django.utils.translation.ugettext_lazy",
"time.sleep",
"util.get_replication_topology_instance",
"util.exec_remote_command_host"
] | [((229, 256), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (246, 256), False, 'import logging\n'), ((1457, 1533), 'util.get_replication_topology_instance', 'util.get_replication_topology_instance', (['self.replication_topology.class_path'], {}), '(self.replication_topology.class_path)\n... |
"""
The purpose of this code is to first create the raw directory folder and include the following files
starting protein receptor
starting ligand
target ligand
glide pose viewer file
Then the top glide poses are added
Then the decoys are created
It can be run on sherlock using
$ $SCHRODINGER/run python3 decoy.py al... | [
"schrodinger.structure.StructureWriter",
"numpy.arccos",
"schrodinger.structutils.transform.get_centroid",
"schrodinger.structutils.interactions.steric_clash.clash_volume",
"numpy.sin",
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"schrodinger.structutils.transform.rotate_structure",
... | [((9233, 9264), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(np.pi * 2)'], {}), '(0, np.pi * 2)\n', (9250, 9264), True, 'import numpy as np\n'), ((9277, 9301), 'numpy.random.uniform', 'np.random.uniform', (['(-1)', '(1)'], {}), '(-1, 1)\n', (9294, 9301), True, 'import numpy as np\n'), ((9314, 9333), 'numpy.a... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Cleaning script for the output of utool profiling
Removes profiled output of code that never ran
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from six.moves import range, cStringIO
import six
import operator
import utool as ut
... | [
"utool.list_argsort",
"utool.doctest_funcs",
"utool.take",
"utool.listclip",
"multiprocessing.freeze_support",
"utool.regex_search",
"operator.itemgetter",
"re.search",
"utool.get_timestamp",
"utool.util_str.align_lines",
"six.moves.cStringIO",
"utool.writeto",
"utool.regex_split",
"utool.... | [((1078, 1106), 'line_profiler.LineProfiler', 'line_profiler.LineProfiler', ([], {}), '()\n', (1104, 1106), False, 'import line_profiler\n'), ((1171, 1182), 'six.moves.cStringIO', 'cStringIO', ([], {}), '()\n', (1180, 1182), False, 'from six.moves import range, cStringIO\n'), ((1312, 1344), 'utool.clean_line_profile_te... |
# -*- coding:utf-8 -*-
"""
This file generates description of model and
intermediate images of extracted features
"""
import keras
import sys
import json
import numpy as np
from PIL import Image
import os
base_path = os.path.dirname(os.path.abspath(__file__))
x_norm_file = sys.argv[1]
x_test_file = sys.argv[2]
y_tes... | [
"numpy.prod",
"PIL.Image.fromarray",
"keras.models.load_model",
"json.dumps",
"os.path.join",
"numpy.array",
"keras.models.Model",
"os.path.abspath",
"numpy.shape",
"numpy.load"
] | [((557, 592), 'keras.models.load_model', 'keras.models.load_model', (['model_file'], {}), '(model_file)\n', (580, 592), False, 'import keras\n'), ((235, 260), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (250, 260), False, 'import os\n'), ((352, 372), 'numpy.load', 'np.load', (['x_norm_file... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
from pyroute2.iwutil import IW
iw = IW()
for q in iw.get_interfaces_dump():
phyname = 'phy%i' % int(q.get_attr('NL80211_ATTR_WIPHY'))
print('%s\t%s\t%s\t%s' % (q.get_attr('NL80211_ATTR_IFINDEX'), phyname,
q.get_attr('NL80211_ATTR_IFN... | [
"pyroute2.iwutil.IW"
] | [((85, 89), 'pyroute2.iwutil.IW', 'IW', ([], {}), '()\n', (87, 89), False, 'from pyroute2.iwutil import IW\n')] |
from django.db import models
from django.db.models import Q
from django.core.exceptions import ObjectDoesNotExist
import guest.models as mod
class GetOrNoneManager(models.Manager):
def get_or_none(self, **kwargs):
try:
return self.get(**kwargs)
except ObjectDoesNotExist:
r... | [
"guest.models.Guest.objects.attending_brunch",
"guest.models.Guest.objects.attending_dinner",
"guest.models.Guest.objects.attending_cocktail",
"django.db.models.Q"
] | [((780, 816), 'guest.models.Guest.objects.attending_dinner', 'mod.Guest.objects.attending_dinner', ([], {}), '()\n', (814, 816), True, 'import guest.models as mod\n'), ((969, 1007), 'guest.models.Guest.objects.attending_cocktail', 'mod.Guest.objects.attending_cocktail', ([], {}), '()\n', (1005, 1007), True, 'import gue... |
# coding: utf8
"""Generate Cydia/Sileo depictions (from deb packages) for Debian repos.
"""
import json
import re
from datetime import datetime
from xml.etree import ElementTree as etree
# regexes
RE_DEPENDS = re.compile(r"^([a-z0-9+\-\.]+)(?: *\(([<>=]{1,2}) *(.*)?\))?$")
def dict_to_xml(data: dict, rootname: str ... | [
"re.compile",
"json.dumps",
"xml.etree.ElementTree.Element",
"datetime.datetime.today",
"xml.etree.ElementTree.SubElement"
] | [((212, 278), 're.compile', 're.compile', (['"""^([a-z0-9+\\\\-\\\\.]+)(?: *\\\\(([<>=]{1,2}) *(.*)?\\\\))?$"""'], {}), "('^([a-z0-9+\\\\-\\\\.]+)(?: *\\\\(([<>=]{1,2}) *(.*)?\\\\))?$')\n", (222, 278), False, 'import re\n'), ((574, 597), 'xml.etree.ElementTree.Element', 'etree.Element', (['rootname'], {}), '(rootname)\... |
#===============================================================================
# Copyright 2022 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.a... | [
"numpy.dtype",
"numpy.ones_like",
"numpy.reshape",
"numpy.unique",
"numpy.any",
"numpy.errstate",
"numpy.zeros",
"numpy.empty",
"numpy.vstack",
"numpy.all",
"numpy.isinf",
"numpy.arange"
] | [((12504, 12531), 'numpy.all', 'np.all', (['sample_mask'], {'axis': '(1)'}), '(sample_mask, axis=1)\n', (12510, 12531), True, 'import numpy as np\n'), ((12603, 12667), 'numpy.reshape', 'np.reshape', (['neigh_ind[sample_mask]', '(n_queries, n_neighbors - 1)'], {}), '(neigh_ind[sample_mask], (n_queries, n_neighbors - 1))... |
import torch, unittest
from unets import thin_setup, fat_setup, Unet, ThinUnetUpBlock, \
ThinUnetDownBlock, AttentionGate
class BaseTests(unittest.TestCase):
def test_inequal_output_asymmetric(self):
unet = Unet(
in_features=3,
down=[16, 32, 64], up=[40, 4]
... | [
"unittest.main",
"torch.Size",
"torch.zeros",
"unets.Unet"
] | [((3161, 3176), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3174, 3176), False, 'import torch, unittest\n'), ((238, 288), 'unets.Unet', 'Unet', ([], {'in_features': '(3)', 'down': '[16, 32, 64]', 'up': '[40, 4]'}), '(in_features=3, down=[16, 32, 64], up=[40, 4])\n', (242, 288), False, 'from unets import thin_s... |
import numpy as np
import pandas as pd
from classy import Class
import pickle
import sys,os
import astropy
from astropy.cosmology import Planck15
from astropy import units as u
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=Tr... | [
"numpy.log10",
"scipy.signal.argrelextrema",
"numpy.where",
"scipy.integrate.simps",
"scipy.interpolate.interp1d",
"numpy.max",
"matplotlib.rc",
"numpy.min",
"pandas.DataFrame",
"scipy.special.jv",
"numpy.logspace"
] | [((236, 303), 'matplotlib.rc', 'rc', (['"""font"""'], {}), "('font', **{'family': 'sans-serif', 'sans-serif': ['Helvetica']})\n", (238, 303), False, 'from matplotlib import rc\n'), ((300, 323), 'matplotlib.rc', 'rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (302, 323), False, 'from matplotlib ... |
#Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
#SPDX-License-Identifier: Apache-2.0
#!/usr/local/bin/python3
import sys, getopt
import http.client
import urllib
import re
import base64
import jwt
def main(argv):
tenantId = ''
secretKey = ''
try:
opts, args = getopt.getopt(a... | [
"getopt.getopt",
"base64.b64encode",
"jwt.encode",
"sys.exit"
] | [((831, 858), 'base64.b64encode', 'base64.b64encode', (['secretKey'], {}), '(secretKey)\n', (847, 858), False, 'import base64\n'), ((891, 959), 'jwt.encode', 'jwt.encode', (["{'clientID': tenantId}", 'encodedSecret'], {'algorithm': '"""HS256"""'}), "({'clientID': tenantId}, encodedSecret, algorithm='HS256')\n", (901, 9... |
import time
import shutil
from HSTB.kluster.fqpr_intelligence import *
from HSTB.kluster.fqpr_project import *
def get_testfile_paths():
testfile = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'test_data', '0009_20170523_181119_FA2806.all')
testsv = os.path.join(os.path.dirname(testfile), '2020_0... | [
"shutil.rmtree"
] | [((1027, 1067), 'shutil.rmtree', 'shutil.rmtree', (['expected_data_folder_path'], {}), '(expected_data_folder_path)\n', (1040, 1067), False, 'import shutil\n')] |
"""
This script produces a Gantt chart that illustrates the project plan.
"""
import plotly.express as px
import pandas as pd
df = pd.DataFrame(
[
dict(
Task="Scrape Public Recycling Facilities",
Start="2021-10-04",
Finish="2021-10-05",
Type="Data Collection"... | [
"plotly.express.timeline"
] | [((3327, 3459), 'plotly.express.timeline', 'px.timeline', (['df'], {'x_start': '"""Start"""', 'x_end': '"""Finish"""', 'y': '"""Task"""', 'title': '"""MSc Data Analytics ODL Project Plan <<EMAIL>>"""', 'color': '"""Type"""'}), "(df, x_start='Start', x_end='Finish', y='Task', title=\n 'MSc Data Analytics ODL Project ... |
from aiohttp import web, ClientSession, request
from bs4 import BeautifulSoup
from datetime import datetime
import json
import uvloop
import asyncio
import sqlite3
import aiosqlite
import hashlib
import time
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
routes = web.RouteTableDef()
# async def get_session(... | [
"datetime.datetime.utcfromtimestamp",
"aiohttp.ClientSession",
"asyncio.gather",
"aiosqlite.connect",
"asyncio.sleep",
"aiohttp.web.Application",
"bs4.BeautifulSoup",
"uvloop.EventLoopPolicy",
"aiohttp.web.RouteTableDef",
"aiohttp.web.json_response",
"time.time"
] | [((275, 294), 'aiohttp.web.RouteTableDef', 'web.RouteTableDef', ([], {}), '()\n', (292, 294), False, 'from aiohttp import web, ClientSession, request\n'), ((240, 264), 'uvloop.EventLoopPolicy', 'uvloop.EventLoopPolicy', ([], {}), '()\n', (262, 264), False, 'import uvloop\n'), ((915, 945), 'bs4.BeautifulSoup', 'Beautifu... |
from dsbox.template.template import DSBoxTemplate
from d3m.metadata.problem import TaskKeyword
from dsbox.template.template_steps import TemplateSteps
from dsbox.schema import SpecializedProblem
import typing
import numpy as np # type: ignore
class CMUacledProblemTemplate(DSBoxTemplate):
# From primitives/v2... | [
"dsbox.template.template.DSBoxTemplate.__init__"
] | [((486, 514), 'dsbox.template.template.DSBoxTemplate.__init__', 'DSBoxTemplate.__init__', (['self'], {}), '(self)\n', (508, 514), False, 'from dsbox.template.template import DSBoxTemplate\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-06-12 13:16
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('query', '0004_auto_20180612_1255'),
]
operations = [
migrations.RemoveField(
... | [
"django.db.migrations.RemoveField"
] | [((288, 360), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""canonicalshow"""', 'name': '"""is_prime_time"""'}), "(model_name='canonicalshow', name='is_prime_time')\n", (310, 360), False, 'from django.db import migrations\n'), ((405, 474), 'django.db.migrations.RemoveField', 'migr... |
# 07 Web Scraping
# Not every website as an API to work wtih.
# In situations like that the only way to get the data we want is to parse the html behind a webpage, get rid of all the html tags, and extract the avtual data.
# This technic is called Web Scraping
# In this example we are going to write a program that ext... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((568, 619), 'requests.get', 'requests.get', (['"""https://stackoverflow.com/questions"""'], {}), "('https://stackoverflow.com/questions')\n", (580, 619), False, 'import requests\n'), ((795, 837), 'bs4.BeautifulSoup', 'BeautifulSoup', (['content_html', '"""html.parser"""'], {}), "(content_html, 'html.parser')\n", (808... |
#!/usr/bin/python
# Author: <NAME>
# Email: <EMAIL>
# Copyright 2017
# This script will crawl through squeue periodically,
# and if it detects any change to a relevant job, it
# will fire off a post to the slack URL
# For safety, I am reading the information from a file
# whose permission is set to be read only by ... | [
"subprocess.check_output",
"slackweb.Slack",
"time.sleep",
"argparse.ArgumentParser"
] | [((547, 934), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""\n This script will check the status of the jobs of a specified\n user every 10 seconds, and if it detects a change, it will send\n a message to a specified webhook obtained from a file of your choosing.\n For secur... |
from flask import Blueprint, jsonify, request
from cocoa.web.views.utils import userid, format_message
from web.main.backend import get_backend
action = Blueprint('action', __name__)
@action.route('/_select_option/', methods=['GET'])
def select():
backend = get_backend()
selection_id = int(request.args.get('s... | [
"flask.request.args.get",
"web.main.backend.get_backend",
"cocoa.web.views.utils.userid",
"flask.Blueprint",
"flask.jsonify"
] | [((154, 183), 'flask.Blueprint', 'Blueprint', (['"""action"""', '__name__'], {}), "('action', __name__)\n", (163, 183), False, 'from flask import Blueprint, jsonify, request\n'), ((264, 277), 'web.main.backend.get_backend', 'get_backend', ([], {}), '()\n', (275, 277), False, 'from web.main.backend import get_backend\n'... |
# from __future__ import print_function
import os
import os.path
import numpy as np
from plyfile import PlyData
import argparse
import matplotlib.pyplot as plt
import numpy as np
import open3d as o3d
def main():
cloud = o3d.io.read_point_cloud("./ModelNet40/airplane/test/airplane_0627.ply") # Read the point clo... | [
"open3d.visualization.draw_geometries",
"open3d.io.read_point_cloud"
] | [((228, 299), 'open3d.io.read_point_cloud', 'o3d.io.read_point_cloud', (['"""./ModelNet40/airplane/test/airplane_0627.ply"""'], {}), "('./ModelNet40/airplane/test/airplane_0627.ply')\n", (251, 299), True, 'import open3d as o3d\n'), ((327, 369), 'open3d.visualization.draw_geometries', 'o3d.visualization.draw_geometries'... |
import unittest
from nymms.reactor.Reactor import Reactor
from nymms.reactor.handlers.Handler import Handler
enabled_config = {'handler_class': 'nymms.reactor.handlers.Handler.Handler',
'enabled': True}
disabled_config = {'handler_class': 'nymms.reactor.handlers.Handler.Handler',
... | [
"nymms.reactor.Reactor.Reactor"
] | [((443, 452), 'nymms.reactor.Reactor.Reactor', 'Reactor', ([], {}), '()\n', (450, 452), False, 'from nymms.reactor.Reactor import Reactor\n')] |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import pyt... | [
"logging.basicConfig",
"azure.iot.device.provisioning.provisioning_device_client.ProvisioningDeviceClient.create_from_x509_certificate",
"azure.iot.device.provisioning.models.registration_result.RegistrationResult",
"pytest.mark.describe",
"azure.iot.device.provisioning.models.registration_result.Registrati... | [((831, 871), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (850, 871), False, 'import logging\n'), ((1696, 1724), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (1710, 1724), False, 'import pytest\n'), ((2223, 2251), 'py... |
# -*- coding: utf-8 -*-
from future.standard_library import install_aliases
install_aliases()
from past.builtins import basestring
from urllib.request import urlopen
import urllib
import json, os, sys
import datetime, re
from datetime import tzinfo
def json_loader(url):
"""json_loader is to request (JSON) data f... | [
"datetime.datetime",
"json.loads",
"re.compile",
"urllib.request.Request",
"future.standard_library.install_aliases",
"re.sub",
"datetime.timedelta",
"urllib.request.urlopen",
"re.search"
] | [((76, 93), 'future.standard_library.install_aliases', 'install_aliases', ([], {}), '()\n', (91, 93), False, 'from future.standard_library import install_aliases\n'), ((666, 706), 'urllib.request.Request', 'urllib.request.Request', (['url'], {'headers': 'hdr'}), '(url, headers=hdr)\n', (688, 706), False, 'import urllib... |
import traceback
import h5py
import matplotlib.pyplot as plt
import numpy as np
import os
import seaborn as sn
import sys
import tensorflow as tf
from support.data_model import CLASSES, TAG_CLASS_MAP, Track, UNCLASSIFIED_TAGS
from support.track_utils import convert_frames, convert_hdf5_frames
START_TIME = '2021-03... | [
"support.track_utils.convert_hdf5_frames",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"support.data_model.Track",
"numpy.argmax",
"seaborn.heatmap",
"h5py.File",
"matplotlib.pyplot.close",
"numpy.diag",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.matmul",
"numpy.row_stack"... | [((570, 596), 'numpy.zeros', 'np.zeros', (['dims', 'np.float32'], {}), '(dims, np.float32)\n', (578, 596), True, 'import numpy as np\n'), ((1190, 1238), 'numpy.row_stack', 'np.row_stack', (['(normalized_matrix, precision_row)'], {}), '((normalized_matrix, precision_row))\n', (1202, 1238), True, 'import numpy as np\n'),... |
from queue import Queue
from epics import PV
from pyzabbix import ZabbixMetric
class MonitorItem(object):
"""
a class for monitor item
Attributes
----------
host : str
host name of item
pvname : str
pv name to monitor
pv : epics.PV
pv object to be monitored
it... | [
"epics.PV",
"queue.Queue"
] | [((769, 812), 'epics.PV', 'PV', (['pvname_'], {'callback': 'self._on_value_change'}), '(pvname_, callback=self._on_value_change)\n', (771, 812), False, 'from epics import PV\n'), ((907, 914), 'queue.Queue', 'Queue', ([], {}), '()\n', (912, 914), False, 'from queue import Queue\n')] |
import argparse
from .utils import GridSearch
def get_grid_search_params(mode, classifier, n_way, n_val, n_shot, dataset, dot_name, arena):
grid = GridSearch()
grid.add_range('dataset', [dataset])
grid.add_range('mode', [mode])
grid.add_range('n_way', [n_way])
grid.add_range('n_val', [n_val])
g... | [
"argparse.ArgumentParser"
] | [((1713, 1769), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Graph Smoothness."""'}), "(description='Graph Smoothness.')\n", (1736, 1769), False, 'import argparse\n')] |
"""iot URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vie... | [
"django.conf.urls.static.static",
"django.urls.path",
"rest_framework.routers.DefaultRouter",
"django.urls.include"
] | [((853, 876), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (874, 876), False, 'from rest_framework import routers\n'), ((1377, 1438), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=... |
# --------------
#Importing header files
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#Path of the file
path
data = pd.read_csv(path)
data = data.rename(columns={'Total':'Total_Medals'})
data.head()
#Code starts here
# --------------
#Code starts here
data['Better_Event'] = n... | [
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"numpy.where",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.xlabel",
"pandas.DataFrame",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((150, 167), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (161, 167), True, 'import pandas as pd\n'), ((319, 392), 'numpy.where', 'np.where', (["(data['Total_Summer'] > data['Total_Winter'])", '"""Summer"""', '"""Winter"""'], {}), "(data['Total_Summer'] > data['Total_Winter'], 'Summer', 'Winter')\n", ... |
import pandas as pd
from src.data import utils
from src.helpers import paths
pd.options.mode.chained_assignment = None # default='warn'
def transform_data(df):
df = utils.onehot.one_hot_encode(df)
df = utils.age.age_categorization(df)
df = utils.date.transform_date(df)
return df
def split_label(d... | [
"src.helpers.paths.processed.train_labels",
"src.data.utils.session.session_aggregate",
"src.data.utils.sync.sync_clms",
"src.helpers.paths.processed.train_dataset",
"src.data.utils.onehot.one_hot_encode",
"src.data.utils.date.transform_date",
"src.helpers.paths.interim.session_test",
"src.helpers.pat... | [((174, 205), 'src.data.utils.onehot.one_hot_encode', 'utils.onehot.one_hot_encode', (['df'], {}), '(df)\n', (201, 205), False, 'from src.data import utils\n'), ((215, 247), 'src.data.utils.age.age_categorization', 'utils.age.age_categorization', (['df'], {}), '(df)\n', (243, 247), False, 'from src.data import utils\n'... |
##!/usr/bin/env python2
# -*- coding: UTF-8 -*-
import base64
import uuid
import hashlib
def get_hash_password(password, salt = None):
"""
Получить хеш пароля SHA-512
"""
if salt == None:
salt = uuid.uuid4().hex
text = password.encode('utf-8') + salt.encode('utf-8')
h = hashlib.sha512(... | [
"hashlib.sha512",
"uuid.uuid4"
] | [((305, 321), 'hashlib.sha512', 'hashlib.sha512', ([], {}), '()\n', (319, 321), False, 'import hashlib\n'), ((221, 233), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (231, 233), False, 'import uuid\n')] |
# pylint: disable=too-many-instance-attributes
import logging
import os
from operator import itemgetter
import json
import codecs
from typing import List, Dict
from server import base_dir, mc, TOOL_API_KEY
from server.auth import user_mediacloud_client
from server.cache import cache
from server.util.stringutil import... | [
"logging.getLogger",
"server.cache.cache.cache_on_arguments",
"server.auth.user_mediacloud_client",
"os.path.join",
"os.path.isfile",
"server.util.stringutil.snake_to_camel",
"server.mc.tagSetList",
"server.util.config.get_default_config",
"server.mc.tagList",
"json.load",
"operator.itemgetter",... | [((396, 423), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (413, 423), False, 'import logging\n'), ((10268, 10288), 'server.util.config.get_default_config', 'get_default_config', ([], {}), '()\n', (10286, 10288), False, 'from server.util.config import get_default_config\n'), ((12243, 12... |
from datetime import datetime
from elasticsearch_dsl import DocType, String, Date, Integer, Float
from elasticsearch_dsl.connections import connections
# Define a default Elasticsearch client
connections.create_connection(hosts=['localhost'])
class Extension(DocType):
name = String()
url = String()
descri... | [
"elasticsearch_dsl.connections.connections.get_connection",
"elasticsearch_dsl.connections.connections.create_connection",
"elasticsearch_dsl.Integer",
"elasticsearch_dsl.String",
"elasticsearch_dsl.Float"
] | [((193, 243), 'elasticsearch_dsl.connections.connections.create_connection', 'connections.create_connection', ([], {'hosts': "['localhost']"}), "(hosts=['localhost'])\n", (222, 243), False, 'from elasticsearch_dsl.connections import connections\n'), ((282, 290), 'elasticsearch_dsl.String', 'String', ([], {}), '()\n', (... |
from django.db import models
# Create your models here.
from common.constants import STATUS_PUBLISHED, STATUS_CHOICES
from common.models import AbstractPermalink, CommonTrashModel
import files_widget
class Special(CommonTrashModel, AbstractPermalink):
title = models.CharField(max_length=512)
image = files_wi... | [
"files_widget.ImageField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((267, 299), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(512)'}), '(max_length=512)\n', (283, 299), False, 'from django.db import models\n'), ((312, 387), 'files_widget.ImageField', 'files_widget.ImageField', ([], {'verbose_name': '"""Banner Image"""', 'null': '(True)', 'blank': '(True)'}),... |
from turtle import Turtle
STARTING_POSITIONS = [(0, 0), (-20, 0), (-40, 0)]
MOVE_DISTANCE = 20
UP = 90
DOWN = 270
RIGHT = 0
LEFT = 180
class Snake:
def __init__(self):
self.segment_list = []
self.create_snake()
self.head = self.segment_list[0]
self.segment_list_length = len(self.s... | [
"turtle.Turtle"
] | [((509, 517), 'turtle.Turtle', 'Turtle', ([], {}), '()\n', (515, 517), False, 'from turtle import Turtle\n')] |
"""
This file defines utilities for manipulating the stack in an
RPython-compliant way, intended mostly for use by the Stackless PyPy.
"""
import inspect
from pypy.rlib.objectmodel import we_are_translated
from pypy.rpython.extregistry import ExtRegistryEntry
from pypy.rpython.lltypesystem import rffi, lltype
from py... | [
"pypy.rlib.objectmodel.we_are_translated",
"pypy.rpython.lltypesystem.lloperation.llop.stack_frames_depth",
"pypy.rpython.lltypesystem.lloperation.llop.stack_switch",
"inspect.stack",
"pypy.annotation.model.lltype_to_annotation",
"pypy.rpython.lltypesystem.lltype.GcOpaqueType",
"pypy.rpython.lltypesyste... | [((1219, 1268), 'pypy.translator.tool.cbuild.ExternalCompilationInfo', 'ExternalCompilationInfo', ([], {'includes': "['src/stack.h']"}), "(includes=['src/stack.h'])\n", (1242, 1268), False, 'from pypy.translator.tool.cbuild import ExternalCompilationInfo\n'), ((1286, 1414), 'pypy.rpython.lltypesystem.rffi.llexternal', ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019-05-23 13:42
# @Author : minp
# @contact : <EMAIL>
# @Site :
# @File : test_time_strftime.py
# @Software: PyCharm
import unittest
import time
class Test(unittest.TestCase):
"""
python中时间日期格式化符号:
%y 两位数的年份表示(00-99)
%Y 四位数的年... | [
"unittest.main",
"time.localtime",
"time.strftime"
] | [((1237, 1263), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (1250, 1263), False, 'import unittest\n'), ((861, 877), 'time.localtime', 'time.localtime', ([], {}), '()\n', (875, 877), False, 'import time\n'), ((980, 1022), 'time.strftime', 'time.strftime', (['"""%b %d %Y %H:%M:%S"""',... |
from django import template
from django.conf import settings
from apps.testapp.models import *
#from torchbox.utils import *
register = template.Library()
@register.assignment_tag
def get_popular_tags(model):
return model.get_popular_tags()
# settings value
@register.assignment_tag
def get_googe_maps_key():
... | [
"django.template.loader.render_to_string",
"django.template.Library"
] | [((138, 156), 'django.template.Library', 'template.Library', ([], {}), '()\n', (154, 156), False, 'from django import template\n'), ((7295, 7416), 'django.template.loader.render_to_string', 'template.loader.render_to_string', (['"""torchbox/tags/blog_list_item.html"""', "{'post': post, 'request': context['request']}"],... |
import json
import os
config = {}
default_config = {}
extra_config = {}
def load():
global config
load_default()
composer = get_value('project-dir')+'composer.json'
if not os.path.isfile(composer):
raise SystemExit('You have to define a composer.json in your project.')
data = load_json(... | [
"os.path.isfile",
"json.load"
] | [((192, 216), 'os.path.isfile', 'os.path.isfile', (['composer'], {}), '(composer)\n', (206, 216), False, 'import os\n'), ((676, 696), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (690, 696), False, 'import os\n'), ((808, 828), 'json.load', 'json.load', (['data_file'], {}), '(data_file)\n', (817, 828)... |
import copy
import itertools
import operator
import re
import collections
import datetime
from django import urls
from django.contrib import messages
from django.db import transaction
from django.db.models.query_utils import Q
from django.http.response import Http404, HttpResponseNotFound, HttpResponseForbidden, JsonR... | [
"django.http.response.HttpResponseNotFound",
"taskbased.categories.models.Category",
"re.compile",
"django.http.response.HttpResponseForbidden",
"django.contrib.messages.warning",
"taskbased.tasks.models.ManualOpenedTask.objects.filter",
"taskbased.tasks.models.ManualOpenedTask",
"django.urls.reverse"... | [((940, 969), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (963, 969), False, 'import collections\n'), ((1542, 1603), 'django.shortcuts.render', 'render', (['request', '"""contests/list.html"""', "{'contests': contests}"], {}), "(request, 'contests/list.html', {'contests': contests}... |
from graphene import Boolean, Field, Int, List, ObjectType, String, Schema
from riotwatcher import RiotWatcher, ApiError
from .riot_graphene.Champion import ChampionInfo
from .riot_graphene.League import ApexLeagueType, LeagueList, RankedQueue
from .riot_graphene.LolStatus import ShardStatus
from .riot_graphene.Match... | [
"graphene.String",
"graphene.Schema"
] | [((3752, 3771), 'graphene.Schema', 'Schema', ([], {'query': 'Query'}), '(query=Query)\n', (3758, 3771), False, 'from graphene import Boolean, Field, Int, List, ObjectType, String, Schema\n'), ((507, 515), 'graphene.String', 'String', ([], {}), '()\n', (513, 515), False, 'from graphene import Boolean, Field, Int, List, ... |
# Generated by Django 2.2.13 on 2021-02-04 10:09
import directory_validators.string
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('exportpla... | [
"django.db.models.AutoField",
"django.db.models.TextField",
"django.db.models.ForeignKey"
] | [((732, 825), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (748, 825), False, 'from django.db import migrations, models\... |
# This is an example of how to use the read_vtk function
from utils import read_vtk
# Data structure
# case/1,2,3....
# Properties of case/n -> physical properties, step, spatial step
# Properties of case -> simulation parameters, time step
# File to save
save_file = './data/data.h5'
case = 'example'
# File to read... | [
"utils.read_vtk"
] | [((410, 451), 'utils.read_vtk', 'read_vtk', (['save_file', 'case', 'path', 'filename'], {}), '(save_file, case, path, filename)\n', (418, 451), False, 'from utils import read_vtk\n')] |
import matplotlib
matplotlib.use('Agg')
import os, sys
import yaml
from argparse import ArgumentParser
from tqdm import tqdm
import imageio
import numpy as np
from skimage.transform import resize
from skimage import img_as_ubyte
import torch
from sync_batchnorm import DataParallelWithCallback
# from modules.generato... | [
"sync_batchnorm.DataParallelWithCallback",
"argparse.ArgumentParser",
"imageio.imwrite",
"matplotlib.use",
"gzip.open",
"torch.load",
"animate.normalize_kp",
"torch.device",
"modules.keypoint_detector.KPDetector",
"time.sleep",
"yaml.load",
"numpy.array",
"copy.deepcopy",
"torch.no_grad",
... | [((19, 40), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (33, 40), False, 'import matplotlib\n'), ((827, 933), 'modules.keypoint_detector.KPDetector', 'KPDetector', ([], {}), "(**config['model_params']['kp_detector_params'], **config[\n 'model_params']['common_params'])\n", (837, 933), False... |
#!/usr/bin/env python
"""
Plot a depth plane extracted from the SCEC Community Velocity Model.
"""
import math
import numpy as np
import matplotlib.pyplot as plt
import cst.data
import cst.cvms
import cst.cvmh
# parameters
prop = 'rho'
prop = 'Vs'
label = 'S-wave velocity (m/s)'
depth = 500.0
vmin, vmax = 300, 3200
de... | [
"matplotlib.pyplot.gca",
"math.cos",
"matplotlib.pyplot.figure",
"numpy.empty_like",
"numpy.meshgrid",
"numpy.arange"
] | [((429, 475), 'numpy.arange', 'np.arange', (['lon[0]', '(lon[1] + 0.5 * delta)', 'delta'], {}), '(lon[0], lon[1] + 0.5 * delta, delta)\n', (438, 475), True, 'import numpy as np\n'), ((480, 526), 'numpy.arange', 'np.arange', (['lat[0]', '(lat[1] + 0.5 * delta)', 'delta'], {}), '(lat[0], lat[1] + 0.5 * delta, delta)\n', ... |
#!/usr/bin/env python
"""
Copyright 2017 ARC Centre of Excellence for Climate Systems Science
author: <NAME> <<EMAIL>>
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/li... | [
"yaml.dump_all",
"multiprocessing.cpu_count",
"os.path.realpath",
"yamanifest.utils.find_files",
"collections.defaultdict",
"multiprocessing.Pool",
"os.path.basename",
"copy.deepcopy",
"six.moves.zip",
"yaml.safe_load_all"
] | [((4612, 4629), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (4623, 4629), False, 'from collections import defaultdict\n'), ((4666, 4691), 'six.moves.zip', 'zip', (['filepaths', 'fullpaths'], {}), '(filepaths, fullpaths)\n', (4669, 4691), False, 'from six.moves import zip\n'), ((8554, 8585), 'm... |
import os
from pyaedt import aedt_exception_handler
from pyaedt.modeler.GeometryOperators import GeometryOperators
class Part(object):
"""Manages 3D component placement and definition.
Parameters
----------
part_folder : str
Path to the folder with the A3DCOMP files.
part_dict : dict
... | [
"pyaedt.modeler.GeometryOperators.GeometryOperators.is_small",
"os.path.join",
"pyaedt.modeler.GeometryOperators.GeometryOperators.numeric_cs"
] | [((5748, 5809), 'os.path.join', 'os.path.join', (["self._compdef['part_folder']", "self['comp_name']"], {}), "(self._compdef['part_folder'], self['comp_name'])\n", (5760, 5809), False, 'import os\n'), ((8461, 8508), 'pyaedt.modeler.GeometryOperators.GeometryOperators.numeric_cs', 'GeometryOperators.numeric_cs', (['self... |
import os
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from __init__ import db, app
from models import Fish, Supplier, Feed
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
@manager.command
def create_db():
"""Creates database wit... | [
"flask_script.Manager",
"flask_migrate.Migrate",
"__init__.db.drop_all",
"__init__.db.create_all"
] | [((175, 191), 'flask_migrate.Migrate', 'Migrate', (['app', 'db'], {}), '(app, db)\n', (182, 191), False, 'from flask_migrate import Migrate, MigrateCommand\n'), ((202, 214), 'flask_script.Manager', 'Manager', (['app'], {}), '(app)\n', (209, 214), False, 'from flask_script import Manager\n'), ((336, 351), '__init__.db.c... |
# -*- coding: utf-8 -*-
"""
v9s model
* Input: v5_im
Author: Kohei <<EMAIL>>
"""
from logging import getLogger, Formatter, StreamHandler, INFO, FileHandler
from pathlib import Path
import subprocess
import argparse
import math
import glob
import sys
import json
import re
import warnings
import scipy
import tqdm
impo... | [
"logging.getLogger",
"numpy.clip",
"logging.StreamHandler",
"keras.backend.sum",
"pandas.read_csv",
"tables.Atom.from_dtype",
"math.floor",
"keras.callbacks.History",
"numpy.array",
"tables.Filters",
"pathlib.Path",
"click.group",
"subprocess.Popen",
"keras.backend.clip",
"json.dumps",
... | [((4066, 4110), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'UserWarning'], {}), "('ignore', UserWarning)\n", (4087, 4110), False, 'import warnings\n'), ((4121, 4136), 'logging.StreamHandler', 'StreamHandler', ([], {}), '()\n', (4134, 4136), False, 'from logging import getLogger, Formatter, Stre... |
"""Helpers for device automations."""
import asyncio
import logging
import voluptuous as vol
from homeassistant.components import websocket_api
from homeassistant.core import split_entity_id
from homeassistant.helpers.entity_registry import async_entries_for_device
from homeassistant.loader import async_get_integrati... | [
"logging.getLogger",
"voluptuous.Required",
"homeassistant.core.split_entity_id",
"homeassistant.loader.async_get_integration",
"homeassistant.helpers.entity_registry.async_entries_for_device"
] | [((385, 412), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (402, 412), False, 'import logging\n'), ((1753, 1805), 'homeassistant.helpers.entity_registry.async_entries_for_device', 'async_entries_for_device', (['entity_registry', 'device_id'], {}), '(entity_registry, device_id)\n', (1777... |
import sys
import os
import logging
from logging.handlers import TimedRotatingFileHandler
import appdirs
def excepthook(*exc_args):
"""
Log exception and exit cleanly.
"""
logging.error('Unrecoverable error', exc_info=(exc_args))
sys.__excepthook__(*exc_args)
sys.exit(1)
def setupLogger():
... | [
"logging.getLogger",
"os.path.exists",
"os.makedirs",
"logging.Formatter",
"os.path.join",
"appdirs.user_log_dir",
"logging.handlers.TimedRotatingFileHandler",
"sys.exit",
"logging.error",
"sys.__excepthook__"
] | [((189, 244), 'logging.error', 'logging.error', (['"""Unrecoverable error"""'], {'exc_info': 'exc_args'}), "('Unrecoverable error', exc_info=exc_args)\n", (202, 244), False, 'import logging\n'), ((251, 280), 'sys.__excepthook__', 'sys.__excepthook__', (['*exc_args'], {}), '(*exc_args)\n', (269, 280), False, 'import sys... |
import logging
import re
from urllib import request
# 匹配合法 IP 地址
regex_ip = re.compile(
r"\D*("
+ r"(?:1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])\."
+ r"(?:1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\."
+ r"(?:1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\."
+ r"(?:1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)"
+ r")\D*")
#... | [
"urllib.request.urlopen",
"re.compile"
] | [((77, 317), 're.compile', 're.compile', (["('\\\\D*(' + '(?:1\\\\d{2}|2[0-4]\\\\d|25[0-5]|[1-9]\\\\d|[1-9])\\\\.' +\n '(?:1\\\\d{2}|2[0-4]\\\\d|25[0-5]|[1-9]\\\\d|\\\\d)\\\\.' +\n '(?:1\\\\d{2}|2[0-4]\\\\d|25[0-5]|[1-9]\\\\d|\\\\d)\\\\.' +\n '(?:1\\\\d{2}|2[0-4]\\\\d|25[0-5]|[1-9]\\\\d|\\\\d)' + ')\\\\D*')"],... |
from django.contrib import admin
from django.urls import path
from content.views import contentServiceViewSet
urlpatterns = [
path('content', contentServiceViewSet.as_view({
'get':'list',
'post':'create'
})),
path( 'contentfile', contentServiceViewSet.as_view({
'post':'fileupload'
... | [
"content.views.contentServiceViewSet.as_view"
] | [((148, 212), 'content.views.contentServiceViewSet.as_view', 'contentServiceViewSet.as_view', (["{'get': 'list', 'post': 'create'}"], {}), "({'get': 'list', 'post': 'create'})\n", (177, 212), False, 'from content.views import contentServiceViewSet\n'), ((260, 313), 'content.views.contentServiceViewSet.as_view', 'conten... |
# =============================================================================
# Copyright (c) 2016, Cisco Systems, Inc
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions ... | [
"re.search",
"utils.replace_multiple",
"utils.get_software_platform",
"re.compile"
] | [((2792, 2830), 'utils.get_software_platform', 'get_software_platform', (['family', 'os_type'], {}), '(family, os_type)\n', (2813, 2830), False, 'from utils import get_software_platform\n'), ((13602, 13666), 'utils.replace_multiple', 'replace_multiple', (['filename', "{'.pie': '', '.smu': '', '.rpm': ''}"], {}), "(file... |
from random import randint
import numpy as np
try:
import tensorflow as tf
except ImportError:
tf = None
# ToDo: we are using a lot of tf.keras.backend modules below, can we use tf core instead?
class MaskingDense(tf.keras.layers.Layer):
""" Just copied code from keras Dense layer and added masking and ... | [
"tensorflow.keras.constraints.get",
"tensorflow.keras.backend.dropout",
"tensorflow.keras.activations.get",
"tensorflow.keras.backend.in_train_phase",
"tensorflow.keras.backend.bias_add",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.initializers.get",
"tensorflow.keras.regularizers.... | [((1831, 1867), 'tensorflow.keras.activations.get', 'tf.keras.activations.get', (['activation'], {}), '(activation)\n', (1855, 1867), True, 'import tensorflow as tf\n'), ((1898, 1938), 'tensorflow.keras.activations.get', 'tf.keras.activations.get', (['out_activation'], {}), '(out_activation)\n', (1922, 1938), True, 'im... |
from pathlib import Path
from flucoma import fluid
from flucoma.utils import get_buffer
source = Path("Nicol-LoopE-M.wav")
# It might be the case that you want to store the outputs of each process in a specific place
# By specifiying the outputs you don't need to even return anything from a fluid.processor()
resynth... | [
"flucoma.fluid.nmf",
"flucoma.utils.get_buffer",
"pathlib.Path"
] | [((99, 124), 'pathlib.Path', 'Path', (['"""Nicol-LoopE-M.wav"""'], {}), "('Nicol-LoopE-M.wav')\n", (103, 124), False, 'from pathlib import Path\n'), ((323, 342), 'pathlib.Path', 'Path', (['"""resynth.wav"""'], {}), "('resynth.wav')\n", (327, 342), False, 'from pathlib import Path\n'), ((357, 380), 'pathlib.Path', 'Path... |
## Modified from https://github.com/tensorflow/models/blob/master/official/pip_package/setup.py
"""Sets up TensorFlow Official Models."""
import datetime
import os
import sys
from setuptools import find_packages
from setuptools import setup
version = '2.5.0'
project_name = 'tf-models-official'
long_description = "... | [
"setuptools.find_packages",
"sys.argv.remove",
"os.path.dirname",
"datetime.datetime.now",
"sys.argv.index",
"sys.argv.pop"
] | [((672, 704), 'sys.argv.index', 'sys.argv.index', (['"""--project_name"""'], {}), "('--project_name')\n", (686, 704), False, 'import sys\n'), ((755, 788), 'sys.argv.remove', 'sys.argv.remove', (['"""--project_name"""'], {}), "('--project_name')\n", (770, 788), False, 'import sys\n'), ((791, 821), 'sys.argv.pop', 'sys.a... |
import uuid
import os
from datetime import datetime
from django.db import transaction
from api.management.data_script import OperationalDataScript
from api.models.CarbonIntensityLimit import CarbonIntensityLimit
from api.models.CompliancePeriod import CompliancePeriod
from api.models.DefaultCarbonIntensity import De... | [
"api.models.OrganizationActionsType.OrganizationActionsType.objects.get_by_natural_key",
"api.models.Organization.Organization.objects.get",
"api.models.Organization.Organization.objects.filter",
"api.models.User.User.objects.get",
"datetime.datetime.today",
"api.models.Organization.Organization.objects.g... | [((1855, 1893), 'api.models.User.User.objects.filter', 'User.objects.filter', ([], {'username': 'username'}), '(username=username)\n', (1874, 1893), False, 'from api.models.User import User\n'), ((2048, 2085), 'api.models.Organization.Organization.objects.filter', 'Organization.objects.filter', ([], {'name': 'org'}), '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
(c) Copyright 2018 Sensirion AG, Switzerland
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copy... | [
"math.exp"
] | [((2017, 2051), 'math.exp', 'math.exp', (['(17.62 * t / (243.12 + t))'], {}), '(17.62 * t / (243.12 + t))\n', (2025, 2051), False, 'import math\n')] |
# Generated by Django 2.2.3 on 2019-07-19 15:53
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('checkout', '0020_checkoutshipping'),
]
operations = [
migrations.RenameField(
model_name='checkoutshipping',
old_name='order... | [
"django.db.migrations.RenameField"
] | [((226, 322), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""checkoutshipping"""', 'old_name': '"""order"""', 'new_name': '"""checkout"""'}), "(model_name='checkoutshipping', old_name='order',\n new_name='checkout')\n", (248, 322), False, 'from django.db import migrations\n')] |
import bpy
from mathutils import Vector
import gpu
from bgl import *
from gpu_extras.batch import batch_for_shader
def drawVectorBox(a, b, color):
vertices = (
(a.x,a.y),(b.x,a.y),
(a.x,b.y),(b.x,b.y)
)
indices = ((0, 1, 2), (2, 3, 1))
shader = gpu.shader.from_builtin(... | [
"bpy.context.area.tag_redraw",
"gpu_extras.batch.batch_for_shader",
"mathutils.Vector",
"gpu.shader.from_builtin",
"bpy.types.SpaceView3D.draw_handler_remove",
"bpy.types.SpaceView3D.draw_handler_add"
] | [((296, 339), 'gpu.shader.from_builtin', 'gpu.shader.from_builtin', (['"""2D_UNIFORM_COLOR"""'], {}), "('2D_UNIFORM_COLOR')\n", (319, 339), False, 'import gpu\n'), ((353, 421), 'gpu_extras.batch.batch_for_shader', 'batch_for_shader', (['shader', '"""TRIS"""', "{'pos': vertices}"], {'indices': 'indices'}), "(shader, 'TR... |
#!/usr/bin/env python
import speedtest
import logging
import time
LOG_FILE = '../results/speedtest.log'
INTERVALL = 60
def start_testing():
"""Infinite loop executing speedtest every $INTERVAL"""
print("Start testing...")
_setup_logging()
while True:
ping = download = upload = None
p... | [
"logging.basicConfig",
"speedtest.Speedtest",
"logging.info",
"time.sleep"
] | [((577, 700), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': 'LOG_FILE', 'level': 'logging.INFO', 'format': '"""%(asctime)s %(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M"""'}), "(filename=LOG_FILE, level=logging.INFO, format=\n '%(asctime)s %(message)s', datefmt='%Y-%m-%d %H:%M')\n", (596, 700), Fa... |
from model import SRCNN
import tensorflow as tf
import os
"""1.configuration"""
flags = tf.app.flags
flags.DEFINE_integer("epoch", 1000, "Number of epoch [100]")
flags.DEFINE_integer("batch_size", 256, "The size of batch images [128]")
flags.DEFINE_integer("test_batch_size", 1024, "The size of batch images for testing... | [
"os.path.exists",
"model.SRCNN",
"os.makedirs",
"tensorflow.Session",
"tensorflow.app.run"
] | [((2209, 2221), 'tensorflow.app.run', 'tf.app.run', ([], {}), '()\n', (2219, 2221), True, 'import tensorflow as tf\n'), ((1805, 1841), 'os.path.exists', 'os.path.exists', (['FLAGS.checkpoint_dir'], {}), '(FLAGS.checkpoint_dir)\n', (1819, 1841), False, 'import os\n'), ((1851, 1884), 'os.makedirs', 'os.makedirs', (['FLAG... |
# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
from itemloaders.processors import TakeFirst, MapCompose, Join
import re
class NewsLoaderItem(scrapy.Item):
theme = scrapy.Field()
title = scrapy.Field()
text = s... | [
"scrapy.Field"
] | [((266, 280), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (278, 280), False, 'import scrapy\n'), ((293, 307), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (305, 307), False, 'import scrapy\n'), ((319, 333), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (331, 333), False, 'import scrapy\n')] |
#
# Copyright 2022 The AI Flow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | [
"os.path.exists",
"os.makedirs",
"shutil.move",
"os.path.join",
"os.path.basename",
"shutil.copy"
] | [((1586, 1619), 'os.path.basename', 'os.path.basename', (['local_file_path'], {}), '(local_file_path)\n', (1602, 1619), False, 'import os\n'), ((1640, 1678), 'os.path.join', 'os.path.join', (['self.root_dir', 'file_name'], {}), '(self.root_dir, file_name)\n', (1652, 1678), False, 'import os\n'), ((1687, 1726), 'shutil.... |
# Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Tests for bulk update functionality."""
# pylint: disable=no-self-use
# pylint: disable=unused-argument
# pylint: disable=redefined-outer-name
# pylint: disable=invalid-name
# pylint: disable=too-many-argu... | [
"lib.users.set_current_user",
"lib.service.webui_facade.bulk_verify_all",
"lib.users.current_person",
"lib.rest_facades.roles_rest_facade.custom_asmt_read_role",
"pytest.fixture",
"lib.service.webui_facade.soft_assert_bulk_verify_for_in_review_state",
"lib.service.webui_facade.start_and_cancel_bulk_veri... | [((545, 561), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (559, 561), False, 'import pytest\n'), ((1144, 1160), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1158, 1160), False, 'import pytest\n'), ((2155, 2171), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (2169, 2171), False, 'import pytes... |