code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#########################################
### IMPORT LIBRARIES AND SET VARIABLES
#########################################
#Import python mo... | [
"pyspark.sql.functions.lit",
"awsglue.dynamicframe.DynamicFrame.fromDF",
"pyspark.sql.types.IntegerType",
"datetime.datetime.now",
"pyspark.sql.functions.col",
"pyspark.context.SparkContext.getOrCreate",
"awsglue.utils.getResolvedOptions",
"awsglue.context.GlueContext"
] | [((770, 796), 'pyspark.context.SparkContext.getOrCreate', 'SparkContext.getOrCreate', ([], {}), '()\n', (794, 796), False, 'from pyspark.context import SparkContext\n'), ((812, 838), 'awsglue.context.GlueContext', 'GlueContext', (['spark_context'], {}), '(spark_context)\n', (823, 838), False, 'from awsglue.context impo... |
import sys
import numpy as np
import io
from termcolor import colored, cprint
import glob
import os
import subprocess
import shutil
import xml.etree.ElementTree as ET
import itk
import vtk
import vtk.util.numpy_support
from CommonUtils import *
def rename(inname, outDir, extension_addition, extension_change=''):
... | [
"vtk.vtkImplicitPlaneRepresentation",
"numpy.array",
"vtk.vtkPolyDataReader",
"os.remove",
"os.path.exists",
"itk.imread",
"shutil.move",
"numpy.asarray",
"numpy.max",
"vtk.vtkRenderer",
"os.mkdir",
"vtk.vtkImplicitPlaneWidget2",
"subprocess.check_call",
"vtk.vtkCamera",
"vtk.vtkRenderWi... | [((434, 457), 'os.path.dirname', 'os.path.dirname', (['inname'], {}), '(inname)\n', (449, 457), False, 'import os\n'), ((795, 840), 'termcolor.cprint', 'cprint', (["('Input Filename : ', inname)", '"""cyan"""'], {}), "(('Input Filename : ', inname), 'cyan')\n", (801, 840), False, 'from termcolor import colored, cprint\... |
import pygame
import Wall
import math
import Enemy
import time
import random
pygame.init()
clock = pygame.time.Clock()
tilesize = 64
width = tilesize*18
height = tilesize*12
screen = pygame.display.set_mode((width,height))
#tileIMG = pygame.image.load('tile.jpg')
font = pygame.font.Font("frankknows.ttf", 4... | [
"pygame.init",
"pygame.quit",
"math.sqrt",
"time.sleep",
"Wall.Wall",
"math.cos",
"pygame.font.Font",
"math.atan",
"pygame.mixer.Channel",
"pygame.display.set_mode",
"pygame.mixer.Sound",
"pygame.draw.rect",
"pygame.image.load",
"pygame.display.update",
"random.randint",
"pygame.time.C... | [((83, 96), 'pygame.init', 'pygame.init', ([], {}), '()\n', (94, 96), False, 'import pygame\n'), ((106, 125), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (123, 125), False, 'import pygame\n'), ((194, 234), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(width, height)'], {}), '((width, height)... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""
This is a fake set of symbols to allow spack to import typing in python
versions where we do not support type checking ... | [
"collections.defaultdict"
] | [((498, 526), 'collections.defaultdict', 'defaultdict', (['(lambda : object)'], {}), '(lambda : object)\n', (509, 526), False, 'from collections import defaultdict\n')] |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 uralbash <<EMAIL>>
#
# Distributed under terms of the MIT license.
"""
Resources fro Docker
"""
import time
from zope.interface import implementer
import docker
from pyramid_sacrud.interfaces import ISacrudResource
@implementer(IS... | [
"zope.interface.implementer",
"docker.Client"
] | [((306, 334), 'zope.interface.implementer', 'implementer', (['ISacrudResource'], {}), '(ISacrudResource)\n', (317, 334), False, 'from zope.interface import implementer\n'), ((424, 476), 'docker.Client', 'docker.Client', ([], {'base_url': '"""unix://var/run/docker.sock"""'}), "(base_url='unix://var/run/docker.sock')\n",... |
import os
import sys
import numpy as np
import cv2
from PIL import Image
import time
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(BASE_DIR)
sys.path.append(os.path.join(ROOT_DIR, 'mayavi'))
sys.path.append(os.path.join(BASE_DIR, '../kitti'))
import kitti_uti... | [
"numpy.minimum",
"kitti_util.compute_box_3d",
"numpy.where",
"os.path.join",
"numpy.argsort",
"os.path.dirname",
"numpy.array",
"numpy.loadtxt",
"os.path.abspath",
"numpy.maximum",
"numpy.fromstring",
"sys.path.append"
] | [((150, 175), 'os.path.dirname', 'os.path.dirname', (['BASE_DIR'], {}), '(BASE_DIR)\n', (165, 175), False, 'import os\n'), ((176, 201), 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), '(BASE_DIR)\n', (191, 201), False, 'import sys\n'), ((112, 137), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(_... |
from pandas import read_csv
import numpy as np
# Calculates 3 of missing values given in the original csv
def calculateMissingValues(data):
missing_data = data.isnull().sum()
print("Missing values for each feature (feature | # missing values): ")
print(missing_data)
# Finds average age of pat... | [
"numpy.amin",
"pandas.read_csv",
"numpy.array",
"numpy.isnan",
"numpy.amax"
] | [((1175, 1192), 'numpy.array', 'np.array', (['glucose'], {}), '(glucose)\n', (1183, 1192), True, 'import numpy as np\n'), ((1313, 1323), 'numpy.amax', 'np.amax', (['x'], {}), '(x)\n', (1320, 1323), True, 'import numpy as np\n'), ((1339, 1349), 'numpy.amin', 'np.amin', (['x'], {}), '(x)\n', (1346, 1349), True, 'import n... |
"""
Functions for reading MATLAB data '.mat' files
recomended usage is read_struct_from_file(filepath)
"""
import numpy as np
from scipy.io import loadmat
from pathlib import Path
def read_struct_from_file(filepath: Path, struct_name=None) -> dict:
"""
Reads a struct called struct_name from a file at filepat... | [
"scipy.io.loadmat"
] | [((448, 486), 'scipy.io.loadmat', 'loadmat', (['filepath'], {'simplify_cells': '(True)'}), '(filepath, simplify_cells=True)\n', (455, 486), False, 'from scipy.io import loadmat\n'), ((992, 1030), 'scipy.io.loadmat', 'loadmat', (['filepath'], {'simplify_cells': '(True)'}), '(filepath, simplify_cells=True)\n', (999, 1030... |
import sys
import time
import pytest
from django.test import SimpleTestCase, override_settings
from django_linear_migrations.apps import check_max_migration_files
class CheckMaxMigrationFilesTests(SimpleTestCase):
@pytest.fixture(autouse=True)
def tmp_path_fixture(self, tmp_path):
migrations_module_... | [
"django_linear_migrations.apps.check_max_migration_files",
"sys.path.pop",
"django.test.override_settings",
"pytest.fixture",
"time.time"
] | [((223, 251), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (237, 251), False, 'import pytest\n'), ((812, 839), 'django_linear_migrations.apps.check_max_migration_files', 'check_max_migration_files', ([], {}), '()\n', (837, 839), False, 'from django_linear_migrations.apps import c... |
# Copyright 2020 The TensorFlow Ranking 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 ag... | [
"tensorflow_ranking.keras.metrics.default_keras_metrics",
"absl.flags.DEFINE_bool",
"tensorflow_ranking.keras.model.create_keras_model",
"absl.flags.DEFINE_integer",
"tensorflow.compat.v1.app.run",
"tensorflow.feature_column.numeric_column",
"absl.flags.DEFINE_string",
"absl.flags.DEFINE_float"
] | [((3151, 3226), 'absl.flags.DEFINE_bool', 'flags.DEFINE_bool', (['"""local_training"""', '(True)', '"""If true, run training locally."""'], {}), "('local_training', True, 'If true, run training locally.')\n", (3168, 3226), False, 'from absl import flags\n'), ((3228, 3324), 'absl.flags.DEFINE_string', 'flags.DEFINE_stri... |
import pytest
from sovtoken.constants import ADDRESS, AMOUNT
from plenum.common.txn_util import get_seq_no
from plenum.test import waits
from plenum.test.stasher import delay_rules, delay_rules_without_processing
from plenum.test.delayers import cDelay
from sovtokenfees.test.helper import get_amount_from_token_txn, se... | [
"plenum.test.view_change.helper.ensure_view_change",
"plenum.common.txn_util.get_seq_no",
"sovtokenfees.test.helper.send_and_check_nym_with_fees",
"sovtokenfees.test.helper.ensure_all_nodes_have_same_data",
"pytest.mark.skip",
"sovtokenfees.test.helper.get_amount_from_token_txn",
"plenum.test.delayers.c... | [((633, 649), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (647, 649), False, 'import pytest\n'), ((727, 743), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (741, 743), False, 'import pytest\n'), ((882, 915), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""ST-537"""'}), "(reason='ST-537')\n... |
from django.contrib.flatpages.models import FlatPage
from django.contrib.flatpages.admin import FlatPageAdmin
import frontendadmin
class FlatPageFrontendadminAdmin(FlatPageAdmin, frontendadmin.ServeeModelAdmin):
"""
This class extends from the normal FlatPageAdmin, as well as frontendadmin.ServeeModelAdmin
... | [
"frontendadmin.site.register"
] | [((460, 525), 'frontendadmin.site.register', 'frontendadmin.site.register', (['FlatPage', 'FlatPageFrontendadminAdmin'], {}), '(FlatPage, FlatPageFrontendadminAdmin)\n', (487, 525), False, 'import frontendadmin\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Extract methylation from fast5 files into a RocksDB file. Also has an interface to read those values.
Created on Thursday, 25. July 2019.
"""
import glob
import os.path
def main():
import argparse
parser = argparse.ArgumentParser(description="Extract methylat... | [
"logging.basicConfig",
"rocksdb.Options",
"uuid.UUID",
"itertools.repeat",
"argparse.ArgumentParser",
"os.path.join",
"ont_fast5_api.fast5_interface.get_fast5_file",
"multiprocessing.Pool",
"os.getpid",
"rocksdb.BloomFilterPolicy",
"multiprocessing.Manager",
"numpy.frombuffer",
"rocksdb.DB",... | [((267, 342), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Extract methylation from fast5 files"""'}), "(description='Extract methylation from fast5 files')\n", (290, 342), False, 'import argparse\n'), ((6265, 6279), 'logging.info', 'log.info', (['args'], {}), '(args)\n', (6273, 6279),... |
from contextlib import contextmanager
import socket
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session
from sqlalchemy.orm import sessionmaker
from sqlalchemy_utils import database_exists, create_database
from settings import settings
class DbSession():
__engine = None
__session = Non... | [
"sqlalchemy.orm.sessionmaker",
"socket.gethostbyname",
"sqlalchemy_utils.database_exists",
"sqlalchemy.create_engine",
"sqlalchemy.orm.scoped_session",
"sqlalchemy_utils.create_database"
] | [((376, 417), 'socket.gethostbyname', 'socket.gethostbyname', (['settings.MYSQL_HOST'], {}), '(settings.MYSQL_HOST)\n', (396, 417), False, 'import socket\n'), ((690, 711), 'sqlalchemy.create_engine', 'create_engine', (['db_url'], {}), '(db_url)\n', (703, 711), False, 'from sqlalchemy import create_engine\n'), ((832, 86... |
from decorator import decorator
from pylons import tmpl_context as c
import civicboom.lib.errors as errors
from civicboom.model.member import has_role_required as has_role_required
from cbutils.misc import calculate_age
from civicboom.lib.form_validators.base import IsoFormatDateConvert... | [
"logging.getLogger",
"civicboom.lib.form_validators.base.IsoFormatDateConverter",
"pylons.tmpl_context.logged_in_persona.has_account_required",
"civicboom.lib.errors.error_age",
"civicboom.lib.errors.error_role",
"civicboom.lib.errors.error_account_level",
"pylons.tmpl_context.logged_in_persona.config.g... | [((574, 601), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (591, 601), False, 'import logging\n'), ((349, 373), 'civicboom.lib.form_validators.base.IsoFormatDateConverter', 'IsoFormatDateConverter', ([], {}), '()\n', (371, 373), False, 'from civicboom.lib.form_validators.base import Iso... |
from django.db import models
from django.utils import timezone
import requests
from django_vend.core.exceptions import VendSyncError
class AbstractVendAPISingleObjectManager(models.Manager):
def synchronise(self, retailer, object_id):
return self._retrieve_object_from_api(retailer, object_id)
class Abs... | [
"django.utils.timezone.now",
"requests.get"
] | [((3224, 3238), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (3236, 3238), False, 'from django.utils import timezone\n'), ((1443, 1477), 'requests.get', 'requests.get', (['url'], {'headers': 'headers'}), '(url, headers=headers)\n', (1455, 1477), False, 'import requests\n'), ((4405, 4419), 'django.util... |
""" A EmployeeController Module """
from masonite.controllers import Controller
from masonite.request import Request
from app.Employee import Employee
class EmployeeController(Controller):
"""Class Docstring Description
"""
def __init__(self, request: Request):
self.request = request
... | [
"app.Employee.Employee.all",
"app.Employee.Employee.create",
"app.Employee.Employee.where",
"app.Employee.Employee.find"
] | [((526, 543), 'app.Employee.Employee.find', 'Employee.find', (['id'], {}), '(id)\n', (539, 543), False, 'from app.Employee import Employee\n'), ((714, 728), 'app.Employee.Employee.all', 'Employee.all', ([], {}), '()\n', (726, 728), False, 'from app.Employee import Employee\n'), ((1071, 1158), 'app.Employee.Employee.cre... |
###############################################################################
# Version: 1.1
# Last modified on: 3 April, 2016
# Developers: <NAME>
# email: m_(DOT)_epitropakis_(AT)_lancaster_(DOT)_ac_(DOT)_uk
###############################################################################
from builtins import o... | [
"numpy.ones",
"numpy.arange",
"os.path.join",
"numpy.max",
"numpy.exp",
"numpy.sum",
"numpy.zeros",
"numpy.dot",
"os.path.dirname",
"numpy.cos",
"numpy.loadtxt",
"numpy.divide"
] | [((1001, 1043), 'os.path.join', 'os.path.join', (['self.path', '"""data/optima.dat"""'], {}), "(self.path, 'data/optima.dat')\n", (1013, 1043), False, 'import os\n'), ((1061, 1082), 'numpy.loadtxt', 'np.loadtxt', (['file_path'], {}), '(file_path)\n', (1071, 1082), True, 'import numpy as np\n'), ((2031, 2053), 'numpy.ze... |
"""
A module that contains a metaclass mixin that provides GF(2^m) arithmetic using explicit calculation.
"""
import numba
import numpy as np
from ._main import FieldClass, DirMeta
MULTIPLY = lambda a, b, *args: a * b
RECIPROCAL = lambda a, *args: 1 / a
class GF2mMeta(FieldClass, DirMeta):
"""
A metaclass f... | [
"numpy.array"
] | [((958, 1020), 'numpy.array', 'np.array', (['cls.primitive_element'], {'dtype': 'cls.dtypes[-1]', 'ndmin': '(1)'}), '(cls.primitive_element, dtype=cls.dtypes[-1], ndmin=1)\n', (966, 1020), True, 'import numpy as np\n')] |
from keras.backend import expand_dims
from keras.datasets.mnist import load_data
from keras.models import Sequential
from numpy.random import randint
from numpy.random import randn
from numpy import zeros
from numpy import ones
def loadDataset():
# load mnist dataset
(trainX, trainY), (_, _) = load_data()
... | [
"numpy.ones",
"keras.datasets.mnist.load_data",
"numpy.random.randint",
"numpy.zeros",
"keras.backend.expand_dims",
"numpy.random.randn"
] | [((304, 315), 'keras.datasets.mnist.load_data', 'load_data', ([], {}), '()\n', (313, 315), False, 'from keras.datasets.mnist import load_data\n'), ((371, 399), 'keras.backend.expand_dims', 'expand_dims', (['trainX'], {'axis': '(-1)'}), '(trainX, axis=-1)\n', (382, 399), False, 'from keras.backend import expand_dims\n')... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 14 13:15:24 2021
Animates streams of points/particles given their starting and ending locations
and number of particles in each flow.
@author: Mateusz
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from numpy.random import unifo... | [
"numpy.abs",
"matplotlib.pyplot.Circle",
"numpy.sqrt",
"foodwebviz.utils.squeeze_map",
"matplotlib.pyplot.gca",
"numpy.min",
"numpy.max",
"numpy.sign",
"numpy.interp",
"numpy.random.uniform",
"pandas.DataFrame",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim"
] | [((1375, 1402), 'numpy.random.uniform', 'uniform', (['(0)', '(1)', 'flow_density'], {}), '(0, 1, flow_density)\n', (1382, 1402), False, 'from numpy.random import uniform\n'), ((1532, 1581), 'foodwebviz.utils.squeeze_map', 'squeeze_map', (['flows', '(1)', 'max_part', 'map_fun', '(0.05)', '(3)'], {}), '(flows, 1, max_par... |
from django.db import models
from bets.models import Bet
from account.models import User
# Create your models here.
class Cart(models.Model):
user=models.OneToOneField(User,on_delete=models.CASCADE,related_name="user")
bets=models.ManyToManyField(Bet,blank=True)
| [
"django.db.models.OneToOneField",
"django.db.models.ManyToManyField"
] | [((148, 221), 'django.db.models.OneToOneField', 'models.OneToOneField', (['User'], {'on_delete': 'models.CASCADE', 'related_name': '"""user"""'}), "(User, on_delete=models.CASCADE, related_name='user')\n", (168, 221), False, 'from django.db import models\n'), ((226, 265), 'django.db.models.ManyToManyField', 'models.Man... |
from http import HTTPStatus
from flask import jsonify, request
from .. import bp_api, utils
from app.schemas.user import UserIn, UserUpdate
from app.controllers.user import UserController
@bp_api.post("/users")
def create_user():
data = request.form
# user = UserController.create(UserIn(**data))
user = ... | [
"app.controllers.user.UserController.update_model",
"app.schemas.user.UserIn",
"app.controllers.user.UserController.get_by_id",
"app.controllers.user.UserController.delete",
"app.controllers.user.UserController.get_all",
"app.schemas.user.UserUpdate",
"flask.jsonify"
] | [((913, 931), 'app.schemas.user.UserUpdate', 'UserUpdate', ([], {}), '(**data)\n', (923, 931), False, 'from app.schemas.user import UserIn, UserUpdate\n'), ((1199, 1229), 'app.controllers.user.UserController.delete', 'UserController.delete', (['user_id'], {}), '(user_id)\n', (1220, 1229), False, 'from app.controllers.u... |
import numpy as np
import torch
from .features_implementation import FeaturesImplementation
class PyTorchFeatures(FeaturesImplementation):
def __init__(self, tensor_list, device=None):
self._phi = tensor_list
self._device = device
def __call__(self, *args):
x = self._concatenate(args... | [
"numpy.atleast_2d",
"torch.stack"
] | [((457, 484), 'torch.stack', 'torch.stack', (['y_list'], {'dim': '(-1)'}), '(y_list, dim=-1)\n', (468, 484), False, 'import torch\n'), ((352, 368), 'numpy.atleast_2d', 'np.atleast_2d', (['x'], {}), '(x)\n', (365, 368), True, 'import numpy as np\n')] |
#!/usr/bin/env python
from setuptools import find_packages, setup
VERSION = "0.0.1"
setup(
name="My Node",
version=VERSION,
description="Bitcoin Node Manager",
author="<NAME>",
author_email="<EMAIL>",
url="https://github.com/gnulnx/mynode",
packages=find_packages(),
entry_points={"con... | [
"setuptools.find_packages"
] | [((281, 296), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (294, 296), False, 'from setuptools import find_packages, setup\n')] |
import os
import cv2
import numpy as np
import tensorflow as tf
from keras.models import load_model
from styx_msgs.msg import TrafficLight
class TLClassifier(object):
def __init__(self):
# load classifier
cwd = os.path.dirname(os.path.realpath(__file__))
# load the keras Lenet model from... | [
"tensorflow.Graph",
"keras.models.load_model",
"tensorflow.Session",
"numpy.argmax",
"tensorflow.GraphDef",
"numpy.squeeze",
"os.path.realpath",
"cv2.cvtColor",
"numpy.expand_dims",
"tensorflow.import_graph_def",
"cv2.resize",
"tensorflow.get_default_graph"
] | [((374, 411), 'keras.models.load_model', 'load_model', (["(cwd + '/tl_classifier.h5')"], {}), "(cwd + '/tl_classifier.h5')\n", (384, 411), False, 'from keras.models import load_model\n'), ((437, 459), 'tensorflow.get_default_graph', 'tf.get_default_graph', ([], {}), '()\n', (457, 459), True, 'import tensorflow as tf\n'... |
import os.path
from data.base_dataset import BaseDataset, get_transform
from data.image_folder import make_dataset
from PIL import Image
import random
import cv2 as cv
import numpy as np
import os
class ROI_transforms(object):
def __init__(self, size=(128, 128)):
super(ROI_transforms).__init__()
s... | [
"numpy.clip",
"cv2.convertScaleAbs",
"numpy.random.rand",
"numpy.count_nonzero",
"numpy.array",
"os.walk",
"os.listdir",
"numpy.where",
"cv2.threshold",
"numpy.random.random",
"numpy.max",
"cv2.getGaussianKernel",
"numpy.resize",
"data.base_dataset.get_transform",
"numpy.min",
"data.ba... | [((7939, 7968), 'numpy.where', 'np.where', (['(gray_mask > 0)', '(1)', '(0)'], {}), '(gray_mask > 0, 1, 0)\n', (7947, 7968), True, 'import numpy as np\n'), ((8506, 8550), 'cv2.threshold', 'cv.threshold', (['mask', '(1)', '(255)', 'cv.THRESH_BINARY'], {}), '(mask, 1, 255, cv.THRESH_BINARY)\n', (8518, 8550), True, 'impor... |
import logging
import operator
import sys
from translator import elffile
def main():
logging.basicConfig(level=logging.INFO)
assert(len(sys.argv) > 1)
# Required argument 1 - path to binary to analyze
target_binary = sys.argv[1]
# Optional argument 2 - path to archive/library file with symbols that we want... | [
"logging.basicConfig",
"operator.itemgetter",
"translator.elffile.ELFFile"
] | [((89, 128), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (108, 128), False, 'import logging\n'), ((508, 548), 'translator.elffile.ELFFile', 'elffile.ELFFile', (['sys.stderr', 'filter_file'], {}), '(sys.stderr, filter_file)\n', (523, 548), False, 'from transla... |
import flask
import requests
import os
import json
import time
import uuid
from kafka import KafkaProducer
from kafka import KafkaConsumer
from flask import Response
from json import dumps
from json import loads
app = flask.Flask(__name__)
current_milli_time = lambda: int(round(time.time() * 1000))
def init_producer... | [
"json.loads",
"flask.Flask",
"json.dumps",
"uuid.uuid4",
"time.time"
] | [((219, 240), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (230, 240), False, 'import flask\n'), ((700, 730), 'json.loads', 'json.loads', (['flask.request.data'], {}), '(flask.request.data)\n', (710, 730), False, 'import json\n'), ((748, 760), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (758, 760... |
""" TensorMONK :: layers :: CarryResidue """
__all__ = ["ResidualOriginal", "ResidualComplex", "ResidualInverted",
"ResidualShuffle", "ResidualNeXt",
"SEResidualComplex", "SEResidualNeXt",
"SimpleFire", "CarryModular", "DenseBlock",
"ContextNet_Bottleneck", "SeparableConvolu... | [
"torch.nn.functional.conv2d",
"numpy.prod",
"torch.nn.functional.adaptive_avg_pool2d",
"torch.nn.Sequential",
"torch.nn.Dropout2d",
"torch.nn.functional.avg_pool2d",
"torch.nn.init.kaiming_uniform_",
"torch.nn.MaxPool2d",
"copy.deepcopy",
"torch.nn.AvgPool2d",
"random.randint",
"torch.rand",
... | [((1428, 1466), 'torch.nn.init.kaiming_uniform_', 'nn.init.kaiming_uniform_', (['self.squeeze'], {}), '(self.squeeze)\n', (1452, 1466), True, 'import torch.nn as nn\n'), ((1475, 1516), 'torch.nn.init.kaiming_uniform_', 'nn.init.kaiming_uniform_', (['self.excitation'], {}), '(self.excitation)\n', (1499, 1516), True, 'im... |
# Generated by Django 2.1.5 on 2019-02-09 16:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('asset', '0006_auto_20190209_1644'),
]
operations = [
migrations.AlterField(
model_name='domainlist',
name='domain',
... | [
"django.db.models.GenericIPAddressField",
"django.db.models.CharField"
] | [((338, 416), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', 'null': '(True)', 'unique': '(True)', 'verbose_name': '"""Domain"""'}), "(max_length=50, null=True, unique=True, verbose_name='Domain')\n", (354, 416), False, 'from django.db import migrations, models\n'), ((545, 603), 'django.d... |
"""Copyright (c) 2020 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Cisco Sample
Code License, Version 1.1 (the "License"). You may obtain a copy of the
License at
https://developer.cisco.com/docs/licenses
All use of the material herein must be in accordance with... | [
"pymongo.MongoClient"
] | [((744, 890), 'pymongo.MongoClient', 'pymongo.MongoClient', (['f"""mongodb://{config[\'MONGO_USER\']}:{config[\'MONGO_PASS\']}@db:27017/?compressors=disabled&gssapiServiceName=mongodb"""'], {}), '(\n f"mongodb://{config[\'MONGO_USER\']}:{config[\'MONGO_PASS\']}@db:27017/?compressors=disabled&gssapiServiceName=mongod... |
import os
import pickle
import random
import traceback
from collections import defaultdict
from telethon import utils as telethon_utils
from telethon.sync import events
from plugins.base import Telegram, PluginMount
from utils import get_url
class Action(Telegram, metaclass=PluginMount):
command_name = "auto_repl... | [
"traceback.print_exc"
] | [((849, 870), 'traceback.print_exc', 'traceback.print_exc', ([], {}), '()\n', (868, 870), False, 'import traceback\n')] |
# -*- coding: utf-8 -*-
import os
import sys
# ensure `tests` directory path is on top of Python's module search
filedir = os.path.dirname(__file__)
sys.path.insert(0, filedir)
while filedir in sys.path[1:]:
sys.path.pop(sys.path.index(filedir)) # avoid duplication
import pytest
import numpy as np
import matplotl... | [
"deeptrain.util.algorithms.ordered_shuffle",
"sys.path.insert",
"backend.tempdir",
"deeptrain.DataGenerator",
"numpy.array",
"copy.deepcopy",
"backend.notify",
"deeptrain.util.misc.argspec",
"matplotlib.pyplot.plot",
"pytest.main",
"sys.path.index",
"io.StringIO",
"deeptrain.util.misc.pass_o... | [((123, 148), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (138, 148), False, 'import os\n'), ((149, 176), 'sys.path.insert', 'sys.path.insert', (['(0)', 'filedir'], {}), '(0, filedir)\n', (164, 176), False, 'import sys\n'), ((707, 745), 'os.path.join', 'os.path.join', (['BASEDIR', '"""test... |
import json
import mock
from datetime import datetime
from collections import namedtuple
from elasticsearch_dsl.utils import AttrList
from service import app
from service.server import db_access, es_access, api_client
FakeTitleRegisterData = namedtuple(
'TitleRegisterData',
['title_number', 'register_data', 'g... | [
"datetime.datetime",
"collections.namedtuple",
"mock.patch.dict",
"mock.patch",
"service.app.test_client",
"mock.patch.object",
"elasticsearch_dsl.utils.AttrList"
] | [((243, 352), 'collections.namedtuple', 'namedtuple', (['"""TitleRegisterData"""', "['title_number', 'register_data', 'geometry_data', 'official_copy_data']"], {}), "('TitleRegisterData', ['title_number', 'register_data',\n 'geometry_data', 'official_copy_data'])\n", (253, 352), False, 'from collections import named... |
#!/bin/python
import httplib2
import os
import io
from apiclient import discovery
from apiclient.http import MediaIoBaseDownload
from oauth2client import client, file, tools
from oauth2client.file import Storage
import openpyxl
from openpyxl import Workbook
# import employees
try:
import argparse
flags = ... | [
"os.path.exists",
"os.listdir",
"oauth2client.file.get",
"argparse.ArgumentParser",
"os.makedirs",
"openpyxl.load_workbook",
"apiclient.http.MediaIoBaseDownload",
"os.path.join",
"oauth2client.client.flow_from_clientsecrets",
"oauth2client.tools.run",
"openpyxl.Workbook",
"oauth2client.file.St... | [((898, 939), 'apiclient.discovery.build', 'discovery.build', (['"""drive"""', '"""v3"""'], {'http': 'http'}), "('drive', 'v3', http=http)\n", (913, 939), False, 'from apiclient import discovery\n'), ((1296, 1319), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (1314, 1319), False, 'import os... |
import os
import toml
import jsbsim
configuration = toml.load('../config/default_configuration.toml') # included: '/Users/######/Programme/jsbsim-code' #an System anpassen.
sim = jsbsim.FGFDMExec(os.path.expanduser(configuration["simulation"]["path_jsbsim"]))
sim.load_model('c172p')
print(sim.print_property_catalog(... | [
"toml.load",
"os.path.expanduser"
] | [((54, 103), 'toml.load', 'toml.load', (['"""../config/default_configuration.toml"""'], {}), "('../config/default_configuration.toml')\n", (63, 103), False, 'import toml\n'), ((198, 260), 'os.path.expanduser', 'os.path.expanduser', (["configuration['simulation']['path_jsbsim']"], {}), "(configuration['simulation']['pat... |
try:
from conf import Conf
except ImportError:
from ..conf import Conf
import os
def setup_fixture():
# Clean the map db from MongoDb
if Conf.Instance().APP_MODE == "Test_Aws":
os.system('service mongod stop')
os.system('rm -Rf /data-mongodb/rs0-1/*')
os.system('rm -Rf /data-m... | [
"os.system",
"conf.Conf.Instance"
] | [((568, 606), 'os.system', 'os.system', (["('rm -Rf sql_db %s' % sql_db)"], {}), "('rm -Rf sql_db %s' % sql_db)\n", (577, 606), False, 'import os\n'), ((204, 236), 'os.system', 'os.system', (['"""service mongod stop"""'], {}), "('service mongod stop')\n", (213, 236), False, 'import os\n'), ((245, 286), 'os.system', 'os... |
'''
Multicollor logger by <NAME>
'''
import datetime
class LOGLEVEL:
def __init__(self):
pass
FATAL = -1
ERROR = 0
WARN = 1
INFO = 2
DEBUG = 3
class Log:
def __init__(self, level=LOGLEVEL.WARN):
self._lvl = level
def fatal(self, text): # Red
print("{}--:\0... | [
"datetime.datetime.now"
] | [((356, 379), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (377, 379), False, 'import datetime\n'), ((557, 580), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (578, 580), False, 'import datetime\n'), ((756, 779), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '(... |
# -*- coding:utf-8 -*-
from setuptools import setup, find_packages
from src import __version__, __author__, __email__
setup(
name='Pirat3me0w',
version=__version__,
author=__author__,
author_email=__email__,
keywords='Downloader, nhentai.net',
description='Download manga from nhentai.net',
... | [
"setuptools.setup"
] | [((119, 478), 'setuptools.setup', 'setup', ([], {'name': '"""Pirat3me0w"""', 'version': '__version__', 'author': '__author__', 'author_email': '__email__', 'keywords': '"""Downloader, nhentai.net"""', 'description': '"""Download manga from nhentai.net"""', 'url': '"""https://github.com/Hanaasagi/Pirat3me0w"""', 'packag... |
"""
Test the file reader
"""
import datetime
import pytest
import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], "../../.."))
from mabel.adapters.disk import DiskReader, DiskWriter
from mabel.data import Reader, BatchWriter
from mabel.errors import DataNotFoundError
from rich import traceback
traceback.in... | [
"rich.traceback.install",
"os.path.join",
"mabel.data.Reader",
"mabel.data.BatchWriter",
"os.getcwd",
"pytest.raises",
"datetime.date",
"mabel.adapters.disk.DiskReader"
] | [((308, 327), 'rich.traceback.install', 'traceback.install', ([], {}), '()\n', (325, 327), False, 'from rich import traceback\n'), ((100, 137), 'os.path.join', 'os.path.join', (['sys.path[0]', '"""../../.."""'], {}), "(sys.path[0], '../../..')\n", (112, 137), False, 'import os\n'), ((526, 562), 'mabel.adapters.disk.Dis... |
from django.contrib.gis import admin
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.utils import simplejson
from django.conf.urls.defaults import patterns, url
from django.core.urlresolvers import reverse
from django.http import HttpResponse
fr... | [
"django.shortcuts.get_object_or_404",
"django.template.RequestContext",
"django.utils.simplejson.dumps",
"yachter.courses.models.Course.objects.all",
"django.contrib.gis.admin.site.register",
"yachter.courses.models.Course.objects.get",
"yachter.courses.models.Mark.objects.all"
] | [((3310, 3350), 'django.contrib.gis.admin.site.register', 'admin.site.register', (['Course', 'CourseAdmin'], {}), '(Course, CourseAdmin)\n', (3329, 3350), False, 'from django.contrib.gis import admin\n'), ((3351, 3387), 'django.contrib.gis.admin.site.register', 'admin.site.register', (['Mark', 'MarkAdmin'], {}), '(Mark... |
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from google.oauth2 import id_token
from google.auth.transport import requests
from flashsale.misc.provider.ProviderBase import ProviderBase
from flashsale.misc.lib.exceptions import OAuthAuthenticationError
# refer to https://d... | [
"flashsale.misc.lib.exceptions.OAuthAuthenticationError",
"django.utils.translation.gettext_lazy",
"google.auth.transport.requests.Request"
] | [((593, 611), 'google.auth.transport.requests.Request', 'requests.Request', ([], {}), '()\n', (609, 611), False, 'from google.auth.transport import requests\n'), ((1065, 1102), 'flashsale.misc.lib.exceptions.OAuthAuthenticationError', 'OAuthAuthenticationError', (['inst.detail'], {}), '(inst.detail)\n', (1089, 1102), F... |
#!/usr/bin/env python
import os
import re
from collections import OrderedDict
from functools import reduce
import pandas as pd
from unidecode import unidecode
def get_place_names(data_dir):
places = []
for fn in os.listdir(data_dir):
if not fn.endswith('.xlsx'):
continue
print(... | [
"os.listdir",
"os.path.join",
"pandas.read_excel",
"unidecode.unidecode",
"re.sub"
] | [((225, 245), 'os.listdir', 'os.listdir', (['data_dir'], {}), '(data_dir)\n', (235, 245), False, 'import os\n'), ((2472, 2496), 're.sub', 're.sub', (['"""\\\\W+"""', '"""_"""', 'key'], {}), "('\\\\W+', '_', key)\n", (2478, 2496), False, 'import re\n'), ((2507, 2531), 're.sub', 're.sub', (['"""^_|_$"""', '""""""', 'key'... |
import random
from binary_search_tree import BinarySearchTree
def test_bst_size():
bst = BinarySearchTree()
assert len(bst) == 0
for i in range(5):
bst.insert(i)
assert len(bst) == i + 1
def test_bst_insert_at_right_pos():
bst = BinarySearchTree()
bst.insert(15)
assert bst._... | [
"random.shuffle",
"binary_search_tree.BinarySearchTree"
] | [((95, 113), 'binary_search_tree.BinarySearchTree', 'BinarySearchTree', ([], {}), '()\n', (111, 113), False, 'from binary_search_tree import BinarySearchTree\n'), ((266, 284), 'binary_search_tree.BinarySearchTree', 'BinarySearchTree', ([], {}), '()\n', (282, 284), False, 'from binary_search_tree import BinarySearchTree... |
import logging, os
# Create Logger
logger = logging.getLogger()
logger.setLevel(logging.INFO)
# Debug if enable
debugmode = os.getenv('DEBUG', False)
if debugmode:
# Format Log
logFormatter = logging.Formatter("%(asctime)s [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s")
rootLogger = logging.getL... | [
"logging.getLogger",
"logging.Formatter",
"logging.StreamHandler",
"os.getenv"
] | [((45, 64), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (62, 64), False, 'import logging, os\n'), ((126, 151), 'os.getenv', 'os.getenv', (['"""DEBUG"""', '(False)'], {}), "('DEBUG', False)\n", (135, 151), False, 'import logging, os\n'), ((202, 295), 'logging.Formatter', 'logging.Formatter', (['"""%(asct... |
from __future__ import print_function # Python 2/3 compatibility
import boto3
def create_quotes():
table = client.create_table(
TableName='Quotes.EOD',
KeySchema=[
{
'AttributeName': 'Symbol',
'KeyType': 'HASH' # Partition key
},
... | [
"boto3.client"
] | [((1873, 1922), 'boto3.client', 'boto3.client', (['"""dynamodb"""'], {'region_name': '"""us-east-1"""'}), "('dynamodb', region_name='us-east-1')\n", (1885, 1922), False, 'import boto3\n')] |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from protocol import communication_pb2 as protocol_dot_communication__pb2
class ServerStub(object):
"""Missing associated documentation comment in .proto f... | [
"grpc.unary_stream_rpc_method_handler",
"grpc.method_handlers_generic_handler",
"grpc.stream_stream_rpc_method_handler",
"grpc.unary_unary_rpc_method_handler",
"grpc.experimental.stream_stream",
"grpc.experimental.unary_stream",
"grpc.experimental.unary_unary"
] | [((8277, 8344), 'grpc.method_handlers_generic_handler', 'grpc.method_handlers_generic_handler', (['"""Server"""', 'rpc_method_handlers'], {}), "('Server', rpc_method_handlers)\n", (8313, 8344), False, 'import grpc\n'), ((5557, 5801), 'grpc.unary_stream_rpc_method_handler', 'grpc.unary_stream_rpc_method_handler', (['ser... |
import json
import shutil
import sys
from pathlib import Path
import os
import subprocess
import argparse
SCRIPT_DIR = Path(__file__).parent.absolute()
ROOT_DIR = SCRIPT_DIR.parent.parent.absolute()
FRONTEND_DIR = ROOT_DIR / "src" / "frontend"
WEB_DIR = ROOT_DIR / "src"
def build_new_static(env):
shutil.rmtree("... | [
"sys.exit",
"argparse.ArgumentParser",
"pathlib.Path",
"subprocess.run",
"os.chdir",
"shutil.rmtree"
] | [((305, 346), 'shutil.rmtree', 'shutil.rmtree', (['"""dist"""'], {'ignore_errors': '(True)'}), "('dist', ignore_errors=True)\n", (318, 346), False, 'import shutil\n'), ((768, 860), 'subprocess.run', 'subprocess.run', (['f"""firebase deploy --only hosting:{env}"""'], {'shell': '(True)', 'capture_output': '(True)'}), "(f... |
import os
import pandas as pd
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
import graphviz as gv
class HiddenMarkovModel:
def __init__(
self,
observable_states,
hidden_states,
transition_matrix,
emission_matrix,
title="HMM",
):
... | [
"IPython.display.display",
"networkx.MultiDiGraph",
"numpy.isclose",
"numpy.linalg.eig",
"networkx.drawing.nx_pydot.graphviz_layout",
"graphviz.Source.from_file",
"numpy.argmax",
"networkx.drawing.nx_pydot.write_dot",
"numpy.max",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"os.mkdir",
"pan... | [((986, 1071), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'transition_matrix', 'columns': 'hidden_states', 'index': 'hidden_states'}), '(data=transition_matrix, columns=hidden_states, index=hidden_states\n )\n', (998, 1071), True, 'import pandas as pd\n'), ((1120, 1207), 'pandas.DataFrame', 'pd.DataFrame', ([... |
#!/usr/bin/env python
# coding=utf-8
'''
@描述: 读取图片数据
@版本: V1_0
@作者: LiWanglin
@创建时间: 2020.02.06
@最后编辑人: LiWanglin
@最后编辑时间: 2020.02.06
'''
import cv2 as cv
image = cv.imread("../test_image/lena512.bmp", cv.IMREAD_UNCHANGED)
print("image的类型为:", type(image))# 打印图片类型
print("image = \n", image)# 打印图片数据 | [
"cv2.imread"
] | [((165, 224), 'cv2.imread', 'cv.imread', (['"""../test_image/lena512.bmp"""', 'cv.IMREAD_UNCHANGED'], {}), "('../test_image/lena512.bmp', cv.IMREAD_UNCHANGED)\n", (174, 224), True, 'import cv2 as cv\n')] |
# Auto-Discovery of Content Files
# print('This is working')
# write in base.html the navigation links
template = open("template/base.html").read()
#read files in the content directory
import glob
all_html_files = glob.glob("content/*.html")
i=0
pages = []
template = open("template/base.html").read()
navbar = ... | [
"os.path.splitext",
"os.path.basename",
"glob.glob"
] | [((222, 249), 'glob.glob', 'glob.glob', (['"""content/*.html"""'], {}), "('content/*.html')\n", (231, 249), False, 'import glob\n'), ((516, 543), 'os.path.basename', 'os.path.basename', (['file_path'], {}), '(file_path)\n', (532, 543), False, 'import os\n'), ((578, 605), 'os.path.splitext', 'os.path.splitext', (['file_... |
from figures import GeometricObject, Circle, ResizableCircle, Resizable, Rectangle, ResizableRectangle
def print_figure(gf):
print(f'{gf}, perimeter = {gf.perimeter():.3f}, area = {gf.area():.3f}')
def double_size(gf):
if isinstance(gf,Resizable):
gf.resize(200)
else:
print('Figure cannot be... | [
"figures.Rectangle",
"figures.Circle",
"figures.ResizableRectangle",
"figures.ResizableCircle"
] | [((389, 397), 'figures.Circle', 'Circle', ([], {}), '()\n', (395, 397), False, 'from figures import GeometricObject, Circle, ResizableCircle, Resizable, Rectangle, ResizableRectangle\n'), ((418, 435), 'figures.Rectangle', 'Rectangle', (['(10)', '(20)'], {}), '(10, 20)\n', (427, 435), False, 'from figures import Geometr... |
from pyopenproject.api_connection.exceptions.request_exception import RequestError
from pyopenproject.api_connection.requests.get_request import GetRequest
from pyopenproject.business.exception.business_error import BusinessError
from pyopenproject.business.services.command.group.group_command import GroupCommand
from ... | [
"pyopenproject.business.exception.business_error.BusinessError",
"pyopenproject.model.group.Group",
"pyopenproject.api_connection.requests.get_request.GetRequest"
] | [((805, 820), 'pyopenproject.model.group.Group', 'Group', (['json_obj'], {}), '(json_obj)\n', (810, 820), False, 'from pyopenproject.model.group import Group\n'), ((874, 934), 'pyopenproject.business.exception.business_error.BusinessError', 'BusinessError', (['f"""Error finding group by id: {self.group.id}"""'], {}), "... |
import yaml
import logging
import requests
import os
REL_PATH = os.path.realpath(__file__).rsplit('/', 1)[0]
class MirrorConfig:
"""Class that contains config for crypto-mirror UI and stuff"""
def __init__(self, *args, **kwargs):
self.__dict__.update(kwargs)
self.validate_token()
def valid... | [
"os.path.realpath",
"os.path.exists",
"yaml.load",
"requests.get"
] | [((975, 1004), 'os.path.exists', 'os.path.exists', (['self.key_path'], {}), '(self.key_path)\n', (989, 1004), False, 'import os\n'), ((2285, 2364), 'requests.get', 'requests.get', (['f"""https://api.darksky.net/forecast/{key}/38,-77?lang=en&units=us"""'], {}), "(f'https://api.darksky.net/forecast/{key}/38,-77?lang=en&u... |
import matplotlib.pyplot as plt
import numpy as np
lines = open('log.txt').readlines()
scores = []
# print(len(lines))
for line in lines:
score = line.split(' ')[5]
score = score.split('\n')
if len(score) > 1:
scores.append(float(score[0]))
plt.plot(scores)
plt.show() | [
"matplotlib.pyplot.plot",
"matplotlib.pyplot.show"
] | [((250, 266), 'matplotlib.pyplot.plot', 'plt.plot', (['scores'], {}), '(scores)\n', (258, 266), True, 'import matplotlib.pyplot as plt\n'), ((267, 277), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (275, 277), True, 'import matplotlib.pyplot as plt\n')] |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Author: i2cy(<EMAIL>)
# Filename: remote_controller
# Created on: 2020/9/17
"""
WARNING: INTERNAL NETWORK USE ONLY
WARNING: INTERNAL NETWORK USE ONLY
WARNING: INTERNAL NETWORK USE ONLY
"""
import socket
import time
import os
import threading
LISTENING_P... | [
"socket.socket",
"time.sleep",
"os.popen",
"threading.Thread",
"time.time"
] | [((3178, 3217), 'threading.Thread', 'threading.Thread', ([], {'target': 'listening_loop'}), '(target=listening_loop)\n', (3194, 3217), False, 'import threading\n'), ((1607, 1620), 'os.popen', 'os.popen', (['cmd'], {}), '(cmd)\n', (1615, 1620), False, 'import os\n'), ((1630, 1645), 'time.sleep', 'time.sleep', (['(0.5)']... |
###########################################################
###########################################################
### Created on Wed May 24 11:27:54 2017 ###
### Updated on Thu May 25 13:36:15 2017 ###
### By <NAME> ###
### Atmospheric Densi... | [
"math.cos",
"math.sin"
] | [((944, 956), 'math.cos', 'math.cos', (['E1'], {}), '(E1)\n', (952, 956), False, 'import math\n'), ((906, 918), 'math.sin', 'math.sin', (['E1'], {}), '(E1)\n', (914, 918), False, 'import math\n')] |
from pathlib import Path
from typing import Optional, Dict, List
from pandas import DataFrame, read_excel, Series, isnull
from aws_managers.utils.dtype_mappings import FS_NAME_TO_ATHENA_NAME
class FeaturesMetadata(object):
def __init__(self, metadata_fn: Path, dataset_name: str):
"""
Class to r... | [
"pandas.isnull",
"pandas.read_excel"
] | [((633, 700), 'pandas.read_excel', 'read_excel', (['metadata_fn'], {'sheet_name': '"""attributes"""', 'engine': '"""openpyxl"""'}), "(metadata_fn, sheet_name='attributes', engine='openpyxl')\n", (643, 700), False, 'from pandas import DataFrame, read_excel, Series, isnull\n'), ((483, 550), 'pandas.read_excel', 'read_exc... |
import frappe
from frappe.patches.v7_0.re_route import update_routes
from frappe.installer import remove_from_installed_apps
def execute():
if 'knowledge_base' in frappe.get_installed_apps():
frappe.reload_doc('website', 'doctype', 'help_category')
frappe.reload_doc('website', 'doctype', 'help_article')
updat... | [
"frappe.get_all",
"frappe.db.exists",
"frappe.reload_doc",
"frappe.installer.remove_from_installed_apps",
"frappe.patches.v7_0.re_route.update_routes",
"frappe.delete_doc",
"frappe.get_doc",
"frappe.get_installed_apps"
] | [((167, 194), 'frappe.get_installed_apps', 'frappe.get_installed_apps', ([], {}), '()\n', (192, 194), False, 'import frappe\n'), ((198, 254), 'frappe.reload_doc', 'frappe.reload_doc', (['"""website"""', '"""doctype"""', '"""help_category"""'], {}), "('website', 'doctype', 'help_category')\n", (215, 254), False, 'import... |
import pandas as pd
import quandl
import math
import numpy as np
from sklearn import preprocessing, cross_validation, svm
from sklearn.linear_model import LinearRegression
import datetime
import matplotlib.pyplot as plt
from matplotlib import style
import pickle
style.use('ggplot')
df = quandl.get('WIKI/GOOGL')
# pri... | [
"datetime.datetime.fromtimestamp",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"pickle.load",
"numpy.array",
"quandl.get",
"matplotlib.style.use",
"sklearn.cross_validation.train_test_split",
"sklearn.preprocessing.scale",
"matplotlib.pyplot.show"
] | [((265, 284), 'matplotlib.style.use', 'style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (274, 284), False, 'from matplotlib import style\n'), ((290, 314), 'quandl.get', 'quandl.get', (['"""WIKI/GOOGL"""'], {}), "('WIKI/GOOGL')\n", (300, 314), False, 'import quandl\n'), ((896, 918), 'sklearn.preprocessing.scale', 'pr... |
from django.shortcuts import render
from django.shortcuts import HttpResponse
from django.views.decorators.csrf import csrf_exempt
import json
from assets import models
from assets import assets_handler
from django.shortcuts import get_object_or_404
# Create your views here.
@csrf_exempt
def report(request):
if r... | [
"json.loads",
"django.shortcuts.HttpResponse",
"assets.models.Assets.objects.all",
"assets.assets_handler.UpdateAssets",
"assets.assets_handler.NewAssets",
"assets.models.Assets.objects.filter"
] | [((1289, 1313), 'django.shortcuts.HttpResponse', 'HttpResponse', (['"""怎么就200了!"""'], {}), "('怎么就200了!')\n", (1301, 1313), False, 'from django.shortcuts import HttpResponse\n'), ((1349, 1376), 'assets.models.Assets.objects.all', 'models.Assets.objects.all', ([], {}), '()\n', (1374, 1376), False, 'from assets import mod... |
import os
from dotenv import load_dotenv
load_dotenv()
controll_id = {
"user": os.getenv('USER_CONTROLL_ID'),
"password": os.getenv('<PASSWORD>')
}
| [
"os.getenv",
"dotenv.load_dotenv"
] | [((41, 54), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (52, 54), False, 'from dotenv import load_dotenv\n'), ((84, 113), 'os.getenv', 'os.getenv', (['"""USER_CONTROLL_ID"""'], {}), "('USER_CONTROLL_ID')\n", (93, 113), False, 'import os\n'), ((131, 154), 'os.getenv', 'os.getenv', (['"""<PASSWORD>"""'], {}), ... |
from pyramid.httpexceptions import HTTPFound
from substanced.sdi import mgmt_view
from substanced.form import FormView
from substanced.interfaces import IFolder
from .resources.document import DocumentSchema
from .resources.collection import CollectionSchema
#
# SDI "add" view for documents
#
@mgmt_view(
cont... | [
"substanced.sdi.mgmt_view"
] | [((301, 479), 'substanced.sdi.mgmt_view', 'mgmt_view', ([], {'context': 'IFolder', 'name': '"""add_document"""', 'tab_title': '"""Add Document"""', 'permission': '"""sdi.add-content"""', 'renderer': '"""substanced.sdi:templates/form.pt"""', 'tab_condition': '(False)'}), "(context=IFolder, name='add_document', tab_title... |
import traceback
import asyncio
# got the semaphore idea from https://asyncpyneng.readthedocs.io/ru/latest/book/using_asyncio/semaphore.html
class WithSemaphore(object):
def __init__(self, num_workers: int = 20) -> None:
self.num_workers = num_workers
def run(self, task, name=None, inven... | [
"traceback.format_exc",
"asyncio.get_event_loop",
"asyncio.Semaphore",
"asyncio.gather"
] | [((570, 594), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (592, 594), False, 'import asyncio\n'), ((618, 653), 'asyncio.Semaphore', 'asyncio.Semaphore', (['self.num_workers'], {}), '(self.num_workers)\n', (635, 653), False, 'import asyncio\n'), ((862, 889), 'asyncio.gather', 'asyncio.gather', ... |
"""
Determine whether there exists a one-to-one character
mapping from one string s1 to another s2.
For example,
given s1 = abc and s2 = bcd, return true
since we can map a to b, b to c, and c to d.
Given s1 = foo and s2 = bar, return false
since the o cannot map to two characters.
"""
from collections... | [
"collections.defaultdict"
] | [((513, 529), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (524, 529), False, 'from collections import defaultdict\n'), ((540, 556), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (551, 556), False, 'from collections import defaultdict\n')] |
"""
@AmineHorseman
Sep, 12th, 2016
"""
import tensorflow as tf
from tflearn import DNN
import time
import numpy as np
import argparse
import dlib
import cv2
import os
from skimage.feature import hog
from parameters import DATASET, TRAINING, NETWORK, VIDEO_PREDICTOR
from model import build_model
window_size = 24
windo... | [
"cv2.imwrite",
"tensorflow.Graph",
"tflearn.DNN",
"dlib.rectangle",
"numpy.asarray",
"dlib.shape_predictor",
"os.path.isfile",
"model.build_model",
"skimage.feature.hog",
"cv2.cvtColor",
"time.time",
"numpy.concatenate",
"cv2.CascadeClassifier",
"cv2.resize",
"cv2.imread"
] | [((3370, 3430), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""haarcascade_frontalface_default.xml"""'], {}), "('haarcascade_frontalface_default.xml')\n", (3391, 3430), False, 'import cv2\n'), ((3441, 3458), 'cv2.imread', 'cv2.imread', (['image'], {}), '(image)\n', (3451, 3458), False, 'import cv2\n'), ((3470,... |
__author__ = 'rogerjiang'
'''
This file performs the training of a U-net convolutional neural network
for pixel-wise classification (or segmentation) of satellite images.
The model performs binary classification for each class. The model parameters
is loaded from ./hypes/hypes.json and you can change "class_type" pa... | [
"tensorflow.contrib.slim.arg_scope",
"tensorflow.reduce_sum",
"tensorflow.nn.moments",
"utils.train_utils.input_data",
"tensorflow.contrib.layers.variance_scaling_initializer",
"tensorflow.multiply",
"tensorflow.gradients",
"simplejson.load",
"tensorflow.control_dependencies",
"tensorflow.cast",
... | [((7571, 7659), 'tensorflow.slice', 'tf.slice', (['logits'], {'begin': '[0, start_ind, start_ind]', 'size': '[-1, valid_size, valid_size]'}), '(logits, begin=[0, start_ind, start_ind], size=[-1, valid_size,\n valid_size])\n', (7579, 7659), True, 'import tensorflow as tf\n'), ((11685, 11717), 'tensorflow.placeholder'... |
from flask import Flask
from flask import request
import uuid
import subprocess
from subprocess import Popen
import simplejson as json
app = Flask(__name__)
@app.route('/')
def index():
return "hello world"
@app.route('/api/v0/workflow', methods=['POST'])
def api_v0_workflow():
uid = str(uuid.uuid4())
INFILE_PATH... | [
"subprocess.Popen",
"flask.request.get_data",
"uuid.uuid4",
"flask.Flask"
] | [((142, 157), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (147, 157), False, 'from flask import Flask\n'), ((397, 415), 'flask.request.get_data', 'request.get_data', ([], {}), '()\n', (413, 415), False, 'from flask import request\n'), ((647, 657), 'subprocess.Popen', 'Popen', (['cmd'], {}), '(cmd)\n', (... |
import pytest
from django.urls import reverse
from pytest_django.asserts import assertContains
from webdev.tasks.models import Task
@pytest.fixture
def pending_task(db):
return Task.objects.create(name='Task 1', done='False')
@pytest.fixture
def response_with_pending_task(client, pending_task):
resp = c... | [
"django.urls.reverse",
"webdev.tasks.models.Task.objects.first",
"webdev.tasks.models.Task.objects.create"
] | [((187, 235), 'webdev.tasks.models.Task.objects.create', 'Task.objects.create', ([], {'name': '"""Task 1"""', 'done': '"""False"""'}), "(name='Task 1', done='False')\n", (206, 235), False, 'from webdev.tasks.models import Task\n'), ((738, 785), 'webdev.tasks.models.Task.objects.create', 'Task.objects.create', ([], {'na... |
import structlog
from eth_utils import to_checksum_address
from raiden.utils import get_contract_path
from raiden.utils.solc import compile_files_cwd
log = structlog.get_logger(__name__)
# Source files for all to be deployed solidity contracts
RAIDEN_CONTRACT_FILES = [
'NettingChannelLibrary.sol',
'ChannelM... | [
"structlog.get_logger",
"eth_utils.to_checksum_address",
"raiden.utils.solc.compile_files_cwd",
"raiden.utils.get_contract_path"
] | [((158, 188), 'structlog.get_logger', 'structlog.get_logger', (['__name__'], {}), '(__name__)\n', (178, 188), False, 'import structlog\n'), ((1466, 1503), 'raiden.utils.solc.compile_files_cwd', 'compile_files_cwd', (['contracts_expanded'], {}), '(contracts_expanded)\n', (1483, 1503), False, 'from raiden.utils.solc impo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 20 14:29:03 2020
@author: <NAME>
Script used to create the formatted table for lag phase calculation by DMFit
DMFit requires data to be formatted in a specific way to be analysed by the
Excel add-in DMFit. In brief, the excel file needs to have tw... | [
"pandas.read_excel",
"pandas.DataFrame",
"pandas.ExcelWriter",
"pandas.concat",
"numpy.arange"
] | [((6298, 6519), 'pandas.DataFrame', 'pd.DataFrame', (["['WT', 'WT GFP', 'WT RFP', 'E2', 'E2 GFP', 'E2 RFP', 'E7', 'E7 RFP', 'E8',\n 'E8 RFP', 'A', 'A GFP', 'A RFP', 'btuB', 'btuB GFP', 'btuB RFP',\n 'pC001', 'ImmE2 Ypet', 'ImmE2 NeonGreen']"], {'columns': "['logc']"}), "(['WT', 'WT GFP', 'WT RFP', 'E2', 'E2 GFP',... |
# Copyright 2022 VMware, Inc.
# SPDX-License-Identifier: Apache License 2.0
import time
def return_name():
return {"name": time.strftime("test%Y%m%d%H%M")} | [
"time.strftime"
] | [((129, 160), 'time.strftime', 'time.strftime', (['"""test%Y%m%d%H%M"""'], {}), "('test%Y%m%d%H%M')\n", (142, 160), False, 'import time\n')] |
from Code.ML_Modeling.FightPredictor_Common import masked_binary_crossentropy, masked_mse_loss, masked_r2_loss, OverallCategoricalAccuracy, OverallForcePickCategoricalAccuracy, masked_mae_accuracy
class global_common:
model_load_name = "fight_predict_ensemble_model"
# Set to load specific checkpoint for model
... | [
"Code.ML_Modeling.FightPredictor_Common.OverallCategoricalAccuracy",
"Code.ML_Modeling.FightPredictor_Common.OverallForcePickCategoricalAccuracy"
] | [((797, 825), 'Code.ML_Modeling.FightPredictor_Common.OverallCategoricalAccuracy', 'OverallCategoricalAccuracy', ([], {}), '()\n', (823, 825), False, 'from Code.ML_Modeling.FightPredictor_Common import masked_binary_crossentropy, masked_mse_loss, masked_r2_loss, OverallCategoricalAccuracy, OverallForcePickCategoricalAc... |
import keras
from keras.models import load_model
from keras import backend as K
import math
import sys
import argparse
import numpy as np
import scipy.io as sio
import os
import glob
import h5py
import cv2
import gc
''' This code is based on <NAME>., <NAME>., & Arganda-Carreras,
I. (2017). "Vision-Based Fall Dete... | [
"numpy.tile",
"os.listdir",
"keras.models.load_model",
"argparse.ArgumentParser",
"scipy.io.loadmat",
"os.path.join",
"h5py.File",
"numpy.zeros",
"keras.backend.clear_session",
"gc.collect",
"numpy.expand_dims",
"numpy.transpose",
"cv2.imread",
"glob.glob"
] | [((17493, 17559), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Do feature extraction tasks"""'}), "(description='Do feature extraction tasks')\n", (17516, 17559), False, 'import argparse\n'), ((1476, 1493), 'keras.models.load_model', 'load_model', (['model'], {}), '(model)\n', (1486, 1... |
import numpy as np
import abc as ABC
import haiku as hk
import jax
import jax.numpy as jnp
from typing import List
class PreProcess(hk.Module):
def __init__(self,state_size,cnn_mode="normal"):
super(PreProcess, self).__init__()
self.embedding = [
visual_embedding(cnn_mode)
... | [
"jax.numpy.zeros",
"jax.numpy.concatenate",
"jax.lax.stop_gradient",
"jax.numpy.exp",
"jax.numpy.cumsum",
"jax.numpy.sum",
"haiku.Flatten",
"haiku.Conv2D",
"haiku.Linear"
] | [((1055, 1073), 'jax.numpy.exp', 'jnp.exp', (['log_probs'], {}), '(log_probs)\n', (1062, 1073), True, 'import jax.numpy as jnp\n'), ((1090, 1129), 'jax.numpy.zeros', 'jnp.zeros', (['(batch, 1)'], {'dtype': 'np.float32'}), '((batch, 1), dtype=np.float32)\n', (1099, 1129), True, 'import jax.numpy as jnp\n'), ((1146, 1171... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import unittest
from unittest.case import TestCase
from hwtBuildsystem.yosys.logParser.synthesis import YosysSynthesisLogParser
from tests.vivadoSynthLogParser_test import getFile
def getCmdResFromTrace(trace_file_name, cmd_str):
with open(trace_file_na... | [
"unittest.TestSuite",
"hwtBuildsystem.yosys.logParser.synthesis.YosysSynthesisLogParser",
"tests.vivadoSynthLogParser_test.getFile",
"unittest.makeSuite",
"json.load",
"unittest.TextTestRunner"
] | [((611, 662), 'tests.vivadoSynthLogParser_test.getFile', 'getFile', (['"""ExampleTop0_synth_trace.yosys_ice40.json"""'], {}), "('ExampleTop0_synth_trace.yosys_ice40.json')\n", (618, 662), False, 'from tests.vivadoSynthLogParser_test import getFile\n'), ((1396, 1416), 'unittest.TestSuite', 'unittest.TestSuite', ([], {})... |
import json
def extract_json_data(filename):
with open(filename, "r") as file:
data = json.load(file)
return data | [
"json.load"
] | [((99, 114), 'json.load', 'json.load', (['file'], {}), '(file)\n', (108, 114), False, 'import json\n')] |
from sklearn.linear_model import LogisticRegression, SGDClassifier
def fit_sklearn_logisic_regression(data):
"""Given flattened `data` (a dict with `data` and `labels`), create and
return a LogisticRegression trained on the data."""
lr = LogisticRegression()
print("Fitting regression on %d data poin... | [
"sklearn.linear_model.SGDClassifier",
"sklearn.linear_model.LogisticRegression"
] | [((253, 273), 'sklearn.linear_model.LogisticRegression', 'LogisticRegression', ([], {}), '()\n', (271, 273), False, 'from sklearn.linear_model import LogisticRegression, SGDClassifier\n'), ((443, 458), 'sklearn.linear_model.SGDClassifier', 'SGDClassifier', ([], {}), '()\n', (456, 458), False, 'from sklearn.linear_model... |
import unittest
import numpy as np
from sklearn.datasets import make_classification
from skactiveml.classifier import ParzenWindowClassifier
from skactiveml.stream import (
FixedUncertainty,
VariableUncertainty,
Split,
RandomVariableUncertainty,
)
class TemplateTestUncertaintyZliobaite:
def setU... | [
"skactiveml.classifier.ParzenWindowClassifier",
"numpy.ones",
"numpy.random.RandomState"
] | [((407, 431), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {}), '(0)\n', (428, 431), True, 'import numpy as np\n'), ((812, 836), 'skactiveml.classifier.ParzenWindowClassifier', 'ParzenWindowClassifier', ([], {}), '()\n', (834, 836), False, 'from skactiveml.classifier import ParzenWindowClassifier\n'),... |
import asyncio
from lib.elapsed_time import ET
async def task(name, work_queue):
while not work_queue.empty():
delay = await work_queue.get()
et = ET()
print(f"Task {name} running")
await asyncio.sleep(delay)
print(f"Task {name} total elapsed time: {et():.1f}")
async def ... | [
"asyncio.Queue",
"lib.elapsed_time.ET",
"asyncio.sleep"
] | [((443, 458), 'asyncio.Queue', 'asyncio.Queue', ([], {}), '()\n', (456, 458), False, 'import asyncio\n'), ((592, 596), 'lib.elapsed_time.ET', 'ET', ([], {}), '()\n', (594, 596), False, 'from lib.elapsed_time import ET\n'), ((169, 173), 'lib.elapsed_time.ET', 'ET', ([], {}), '()\n', (171, 173), False, 'from lib.elapsed_... |
"""
Module for interacting with Gold
Takes a summarized Gratia job and either charges or refunds it.
"""
from datetime import datetime, timedelta
from dateutil import parser
import logging
import os
import time
import re
log = logging.getLogger("gracc_gold.gold")
logname = None
def setup_env(cp):
global logna... | [
"logging.getLogger",
"dateutil.parser.parse",
"datetime.datetime",
"os.dup2",
"os.execvp",
"os.path.join",
"time.sleep",
"datetime.datetime.today",
"os._exit",
"os.wait",
"os.fork",
"re.sub",
"datetime.timedelta",
"time.time"
] | [((232, 268), 'logging.getLogger', 'logging.getLogger', (['"""gracc_gold.gold"""'], {}), "('gracc_gold.gold')\n", (249, 268), False, 'import logging\n'), ((3003, 3016), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (3013, 3016), False, 'import time\n'), ((3060, 3087), 're.sub', 're.sub', (['"""\\\\..*"""', '"""""... |
# Used to assemble and send an email for Scan reports
# This example uses Gmail, therefore need to allow less secure apps to use a Gmail account
from email.mime.text import MIMEText
import os
import smtplib
class EmailHandler:
# Constructor - take email details and run the different functions in the const... | [
"smtplib.SMTP",
"email.mime.text.MIMEText"
] | [((3494, 3516), 'email.mime.text.MIMEText', 'MIMEText', (['body', '"""html"""'], {}), "(body, 'html')\n", (3502, 3516), False, 'from email.mime.text import MIMEText\n'), ((3780, 3815), 'smtplib.SMTP', 'smtplib.SMTP', (['"""smtp.gmail.com"""', '(587)'], {}), "('smtp.gmail.com', 587)\n", (3792, 3815), False, 'import smtp... |
import datetime
import gnupg
import os
import zipfile
from time import strftime, localtime, sleep
import boto3
FORMATED_DATE = strftime("%m%d%Y", localtime())
# Set your list gnupg recipient for the encryption
GPG_RECIPIENTS=[]
# Set S3 bucket upload
S3_BUCKET_NAME = ''
def zipDir(dir_to_zip):
zip_file_name... | [
"os.path.join",
"datetime.date.today",
"time.sleep",
"boto3.resource",
"os.path.isdir",
"time.localtime",
"gnupg.GPG",
"os.walk"
] | [((149, 160), 'time.localtime', 'localtime', ([], {}), '()\n', (158, 160), False, 'from time import strftime, localtime, sleep\n'), ((557, 576), 'os.walk', 'os.walk', (['dir_to_zip'], {}), '(dir_to_zip)\n', (564, 576), False, 'import os\n'), ((1280, 1300), 'boto3.resource', 'boto3.resource', (['"""s3"""'], {}), "('s3')... |
import time
import logging
from conf.conf import CONFIG as conf
from radiator_fritz_o365_sync.core import Core
if __name__ == "__main__":
if conf['DEBUG_LOGGING']:
logging.basicConfig(level=logging.DEBUG)
else:
logging.basicConfig(level=logging.INFO)
logging.info("started radiator_fritz_o3... | [
"logging.basicConfig",
"logging.debug",
"time.sleep",
"radiator_fritz_o365_sync.core.Core",
"logging.info"
] | [((281, 412), 'logging.info', 'logging.info', (['"""started radiator_fritz_o365_sync runner. Syncing intervall is set to %s seconds"""', "conf['POLLING_INTERVAL']"], {}), "(\n 'started radiator_fritz_o365_sync runner. Syncing intervall is set to %s seconds'\n , conf['POLLING_INTERVAL'])\n", (293, 412), False, 'im... |
#!/usr/bin/python
import sys
import json
import os
import time
from collections import OrderedDict
password=sys.argv[1]
aadTenant=sys.argv[2]
aadClientId=sys.argv[3]
postgresqlConnectionString=sys.argv[4]
certLocation = "/home/webnode_usr/.dotnet/corefx/cryptography/x509stores/root"
certFileName = "25706AA4612FC4247... | [
"os.system",
"json.dump",
"time.sleep",
"os.makedirs"
] | [((349, 374), 'os.makedirs', 'os.makedirs', (['certLocation'], {}), '(certLocation)\n', (360, 374), False, 'import os\n'), ((375, 427), 'os.system', 'os.system', (["('cp ' + certFileName + ' ' + certLocation)"], {}), "('cp ' + certFileName + ' ' + certLocation)\n", (384, 427), False, 'import os\n'), ((428, 487), 'os.sy... |
"""Solve problems that have manufactured solutions."""
import unittest
import numpy as np
from skfem.models.poisson import laplace, mass
from skfem.mesh import MeshHex, MeshLine, MeshQuad, MeshTet, MeshTri
from skfem.element import (ElementHex1, ElementHexS2,
ElementLineP1, ElementLineP2, ... | [
"numpy.testing.assert_array_almost_equal",
"skfem.asm",
"skfem.condense",
"unittest.main",
"skfem.element.ElementLineP1",
"skfem.assembly.InteriorBasis",
"skfem.element.ElementLineP2",
"skfem.solve",
"numpy.linspace",
"numpy.sum",
"skfem.assembly.FacetBasis",
"skfem.element.ElementLineMini"
] | [((708, 723), 'skfem.element.ElementLineP1', 'ElementLineP1', ([], {}), '()\n', (721, 723), False, 'from skfem.element import ElementHex1, ElementHexS2, ElementLineP1, ElementLineP2, ElementLineMini, ElementQuad1, ElementQuad2, ElementTetP1, ElementTriP2\n'), ((1304, 1319), 'skfem.element.ElementLineP2', 'ElementLineP2... |
import os
import argparse
from helper import constant
from neural_network import NeuralNetwork
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
ap = argparse.ArgumentParser()
ap.add_argument("-m", "--model", default=constant.MODEL_PATH, help="path to output model")
ap.add_argument("-d", "--dataset", default=constant.DATASET_... | [
"neural_network.NeuralNetwork",
"argparse.ArgumentParser"
] | [((143, 168), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (166, 168), False, 'import argparse\n'), ((709, 724), 'neural_network.NeuralNetwork', 'NeuralNetwork', ([], {}), '()\n', (722, 724), False, 'from neural_network import NeuralNetwork\n')] |
from tsunami import web
from tsunami.core import get_appname
from functools import wraps
def route(path, pattern=None):
def decorator(cls):
_path = path
_appname = get_appname(cls)
version = getattr(cls, '__VERSION__', 'v1.0')
if pattern:
_path = pattern.format(
... | [
"tsunami.core.get_appname"
] | [((187, 203), 'tsunami.core.get_appname', 'get_appname', (['cls'], {}), '(cls)\n', (198, 203), False, 'from tsunami.core import get_appname\n')] |
import datetime
from Poem.api.internal_views.utils import get_tenant_resources
from Poem.tenants.models import Tenant
from django_tenants.utils import get_public_schema_name, get_tenant_domain_model
from rest_framework import status
from rest_framework.authentication import SessionAuthentication
from rest_framework.re... | [
"django_tenants.utils.get_public_schema_name",
"Poem.tenants.models.Tenant.objects.filter",
"Poem.api.internal_views.utils.get_tenant_resources",
"Poem.tenants.models.Tenant.objects.get",
"Poem.tenants.models.Tenant.objects.all",
"rest_framework.response.Response",
"datetime.date.strftime",
"django_te... | [((2355, 2372), 'rest_framework.response.Response', 'Response', (['results'], {}), '(results)\n', (2363, 2372), False, 'from rest_framework.response import Response\n'), ((1054, 1074), 'Poem.tenants.models.Tenant.objects.all', 'Tenant.objects.all', ([], {}), '()\n', (1072, 1074), False, 'from Poem.tenants.models import... |
#!/usr/bin/env python
# encoding: utf-8
import re
from unittest import TestCase
from ycyc.base import resources
class TestRegex(TestCase):
def pattern_equal_rex(self, pattern):
return re.compile(pattern.rstrip("$") + "$")
def test_num_less_than(self):
with self.assertRaises(Va... | [
"ycyc.base.resources.Regex.num_less_than"
] | [((355, 387), 'ycyc.base.resources.Regex.num_less_than', 'resources.Regex.num_less_than', (['(0)'], {}), '(0)\n', (384, 387), False, 'from ycyc.base import resources\n'), ((461, 495), 'ycyc.base.resources.Regex.num_less_than', 'resources.Regex.num_less_than', (['num'], {}), '(num)\n', (490, 495), False, 'from ycyc.base... |
#======== no 1=========#
class mhs(object): #membuat class
def __init__(self, nama, nim, kota, us): #metode pemanggil ketikan pemnuatan object terjadi
self.nama = nama
self.nim = nim
self.kota = kota
self.uang = us
def __str__(self): #metode pemanggil ketika string akan di... | [
"time.time",
"random.shuffle"
] | [((5488, 5496), 'random.shuffle', 'kocok', (['k'], {}), '(k)\n', (5493, 5496), True, 'from random import shuffle as kocok\n'), ((5563, 5570), 'time.time', 'detak', ([], {}), '()\n', (5568, 5570), True, 'from time import time as detak\n'), ((5591, 5598), 'time.time', 'detak', ([], {}), '()\n', (5596, 5598), True, 'from ... |
import os
import sys
import argparse
import json
class Disabler:
modifiers = []
def __init__(self, disable):
if not disable:
return
for part in disable:
self.modifiers.extend(part.strip('"').split())
def disable(self, spec):
return spec.get('disable') in self.modifiers
def mergeStrings(args):
result = [... | [
"json.load",
"os.path.join",
"argparse.ArgumentParser",
"os.getcwd"
] | [((716, 851), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Exports tactical information from the specified server to the DCS Ka-50 ABRIS system."""'}), "(description=\n 'Exports tactical information from the specified server to the DCS Ka-50 ABRIS system.'\n )\n", (739, 851), F... |
import socket
import json
from get_device import get_device
def Logstash(event, context):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
get_device_list=get_device(event, context)
s.connect(('10.11.2.7', 6001))
s.send(str(json.dumps(get_device_list)).encode('utf-8'))
s.close()
| [
"get_device.get_device",
"json.dumps",
"socket.socket"
] | [((97, 146), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (110, 146), False, 'import socket\n'), ((173, 199), 'get_device.get_device', 'get_device', (['event', 'context'], {}), '(event, context)\n', (183, 199), False, 'from get_device import... |
import ipaddress
from django.urls import resolve
from django.contrib.auth.models import User, Group
from django.db.models import F
from datetime import datetime, timedelta
from collections import OrderedDict
from inbound.models import Rule
def validate_inbound_rules(request=None, path=None):
if request:
... | [
"inbound.models.Rule.objects.filter",
"ipaddress.ip_address",
"django.urls.resolve",
"django.contrib.auth.models.User.objects.get",
"ipaddress.ip_network"
] | [((712, 747), 'inbound.models.Rule.objects.filter', 'Rule.objects.filter', ([], {'is_active': '(True)'}), '(is_active=True)\n', (731, 747), False, 'from inbound.models import Rule\n'), ((1258, 1294), 'django.contrib.auth.models.User.objects.get', 'User.objects.get', ([], {'id': 'request.user.id'}), '(id=request.user.id... |
# import botocore
import datetime
import os
import unittest
# from botocore.stub import ANY, Stubber
from unittest.mock import Mock, patch
# Setup Environment and import script
os.environ['DATA_BUCKET'] = 'test-bucket'
from weather import put_data_s3
class TestHandler(unittest.TestCase):
"""Test handler methods... | [
"weather.put_data_s3",
"unittest.mock.patch",
"unittest.mock.Mock"
] | [((1497, 1526), 'unittest.mock.patch', 'patch', (['"""weather.boto3.client"""'], {}), "('weather.boto3.client')\n", (1502, 1526), False, 'from unittest.mock import Mock, patch\n'), ((2041, 2047), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (2045, 2047), False, 'from unittest.mock import Mock, patch\n'), ((2127, 224... |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Address(models.Model):
user = models.ForeignKey(User, verbose_name="User", on_delete=models.CASCADE)
locality = models.CharField(max_length=150, verbose_name="Nearest Location")
city = models.CharField... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"django.db.models.BooleanField",
"django.db.models.SlugField",
"django.db.models.PositiveIntegerField",
"django.db.models.ImageField",
"django.db.models.DecimalField",
"django.db.models.CharField"
] | [((141, 211), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'verbose_name': '"""User"""', 'on_delete': 'models.CASCADE'}), "(User, verbose_name='User', on_delete=models.CASCADE)\n", (158, 211), False, 'from django.db import models\n'), ((227, 292), 'django.db.models.CharField', 'models.CharField', ([]... |
import requests
import pytest
from currency_converter.currencies.models import Currency
from currency_converter.currencies.models import ExchangeRate
from currency_converter.currencies.tasks import update_exchange_rates
pytestmark = pytest.mark.django_db
class MockResponse:
"""Mock the request.get function"""
... | [
"currency_converter.currencies.tasks.update_exchange_rates",
"currency_converter.currencies.models.Currency.objects.all",
"currency_converter.currencies.models.ExchangeRate.objects.get"
] | [((1883, 1906), 'currency_converter.currencies.tasks.update_exchange_rates', 'update_exchange_rates', ([], {}), '()\n', (1904, 1906), False, 'from currency_converter.currencies.tasks import update_exchange_rates\n'), ((2364, 2387), 'currency_converter.currencies.tasks.update_exchange_rates', 'update_exchange_rates', ([... |
## emotionProcessor-threaded.py
## This is a variation of the emotionProcessor class.
## The main difference between the two classes is that this
## class utilizes python's threading module to collect the
## audio metrics.
## Since this proved to offer little to no performance gains
## while still expending ex... | [
"pyAudioAnalysis.audioBasicIO.readAudioFile",
"math.ceil",
"pydub.silence.split_on_silence",
"numpy.arange",
"python_speech_features.delta",
"python_speech_features.logfbank",
"python_speech_features.mfcc",
"numpy.array",
"pyAudioAnalysis.audioFeatureExtraction.stFeatureExtraction",
"scipy.io.wavf... | [((1720, 1758), 'pyAudioAnalysis.audioBasicIO.readAudioFile', 'audioBasicIO.readAudioFile', (['self.fname'], {}), '(self.fname)\n', (1746, 1758), False, 'from pyAudioAnalysis import audioBasicIO\n'), ((1824, 1862), 'python_speech_features.mfcc', 'mfcc', (['sig'], {'samplerate': '(44100)', 'nfft': '(1103)'}), '(sig, sam... |
import re
import sys
from ptrlib import *
import itertools
import copy
with open(sys.argv[1], "r") as f:
instList = []
for line in f:
r = re.findall("[0-9a-f]{2}\t(.+) (R\d), (.+)", line)
if r:
instList.append(r[0])
def search(instList, current_i, regs, chain=[]):
for i in rang... | [
"itertools.combinations",
"re.findall",
"copy.deepcopy"
] | [((155, 205), 're.findall', 're.findall', (['"""[0-9a-f]{2}\t(.+) (R\\\\d), (.+)"""', 'line'], {}), "('[0-9a-f]{2}\\t(.+) (R\\\\d), (.+)', line)\n", (165, 205), False, 'import re\n'), ((1903, 1937), 'itertools.combinations', 'itertools.combinations', (['posList', 'l'], {}), '(posList, l)\n', (1925, 1937), False, 'impor... |