code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from barrel import Store, Field, FloatField, EmbeddedStoreField
from barrel.rpc import RpcMixin
from barrel_reaktor.document.models import Document
from . import get_search_sources
class Stat(Store):
"""The reaktor always passes in `name` as the value to use for the search
facet. Since it's a value, let's ren... | [
"barrel.FloatField",
"barrel.EmbeddedStoreField",
"barrel.Field"
] | [((411, 432), 'barrel.Field', 'Field', ([], {'target': '"""count"""'}), "(target='count')\n", (416, 432), False, 'from barrel import Store, Field, FloatField, EmbeddedStoreField\n'), ((445, 465), 'barrel.Field', 'Field', ([], {'target': '"""name"""'}), "(target='name')\n", (450, 465), False, 'from barrel import Store, ... |
import math
from random import randint
from numpy import sqrt
def GCD(a, b):
if b == 0:
return a
return GCD(b, a % b)
#######################################
def ExtendedEuclid(a, b):
if b == 0:
return (1, 0)
(x, y) = ExtendedEuclid(b, a % b)
k = a // b
return (y, x - k * y)
... | [
"numpy.sqrt"
] | [((2985, 2992), 'numpy.sqrt', 'sqrt', (['n'], {}), '(n)\n', (2989, 2992), False, 'from numpy import sqrt\n'), ((2967, 2974), 'numpy.sqrt', 'sqrt', (['n'], {}), '(n)\n', (2971, 2974), False, 'from numpy import sqrt\n')] |
#!/Users/isobar/.virtualenvs/py3/bin/python
# -*- coding: utf-8 -*-
# <bitbar.title>JPY to NTD</bitbar.title>
# <bitbar.version>1.0</bitbar.version>
# <bitbar.author>wwwins</bitbar.author>
# <bitbar.author.github>wwwins</bitbar.author.github>
# <bitbar.desc>Japanese Yen to Taiwan New Dollar Rate</bitbar.desc>
# <bitbar... | [
"time.strftime",
"requests.get",
"lxml.html.fromstring"
] | [((598, 652), 'requests.get', 'requests.get', (['"""https://rate.bot.com.tw/xrt?Lang=zh-TW"""'], {}), "('https://rate.bot.com.tw/xrt?Lang=zh-TW')\n", (610, 652), False, 'import requests\n'), ((659, 682), 'lxml.html.fromstring', 'html.fromstring', (['r.text'], {}), '(r.text)\n', (674, 682), False, 'from lxml import html... |
import json
def supe(digit):
digit = str(digit)
if len(digit)==1:
return digit
else:
cont = 0
for i in range(len(digit)):
cont+= int(digit[i])
return supe(cont)
# TODO Complete!
def super_digit(n, k):
digit = str(str(n)*k)
return int(sup... | [
"json.load"
] | [((410, 422), 'json.load', 'json.load', (['f'], {}), '(f)\n', (419, 422), False, 'import json\n')] |
from spec2scl import settings
from spec2scl import transformer
from spec2scl.decorators import matches
@transformer.Transformer.register_transformer
class PerlTransformer(transformer.Transformer):
def __init__(self, options={}):
super(PerlTransformer, self).__init__(options)
@matches(r'^[^\n]*%{__per... | [
"spec2scl.decorators.matches"
] | [((296, 385), 'spec2scl.decorators.matches', 'matches', (['"""^[^\\\\n]*%{__perl}\\\\s+"""'], {'one_line': '(False)', 'sections': 'settings.RUNTIME_SECTIONS'}), "('^[^\\\\n]*%{__perl}\\\\s+', one_line=False, sections=settings.\n RUNTIME_SECTIONS)\n", (303, 385), False, 'from spec2scl.decorators import matches\n'), (... |
import smtplib
from email.message import EmailMessage
# function to send email to listed email address
def send_email(info,news):
email = EmailMessage()
email['From'] = '< Sender Name >'
email['To'] = info[1]
email['Subject'] = 'Hello '+info[0]
email.set_content(news,'html')
with smtplib.SMTP(... | [
"email.message.EmailMessage",
"smtplib.SMTP"
] | [((144, 158), 'email.message.EmailMessage', 'EmailMessage', ([], {}), '()\n', (156, 158), False, 'from email.message import EmailMessage\n'), ((307, 352), 'smtplib.SMTP', 'smtplib.SMTP', ([], {'host': '"""smtp.gmail.com"""', 'port': '(587)'}), "(host='smtp.gmail.com', port=587)\n", (319, 352), False, 'import smtplib\n'... |
#!/usr/bin/env python3
from pathlib import Path
def get_project_root() -> Path:
"""
Get project root directory with assumed structure as:
${PACKAGE_ROOT}/core/common/path.py
"""
return Path(__file__).resolve().parent.parent.parent
def get_config_file() -> Path:
"""
Get default config fi... | [
"pathlib.Path"
] | [((208, 222), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (212, 222), False, 'from pathlib import Path\n')] |
# See LICENSE.incore for details
import pathlib
import logging
import argparse
import os
import sys
import subprocess
import operator
import shlex
import ruamel
from ruamel.yaml import YAML
#from riscof.log import logger
yaml = YAML(typ="rt")
yaml.default_flow_style = False
yaml.allow_unicode = True
logger = loggin... | [
"os.path.abspath",
"subprocess.Popen",
"os.path.join",
"logging.basicConfig",
"os.getcwd",
"os.path.exists",
"shlex.split",
"ruamel.yaml.YAML",
"argparse.Action.__init__",
"pathlib.Path",
"operator.attrgetter",
"sys.stderr.write",
"os.path.expanduser",
"logging.getLogger"
] | [((231, 245), 'ruamel.yaml.YAML', 'YAML', ([], {'typ': '"""rt"""'}), "(typ='rt')\n", (235, 245), False, 'from ruamel.yaml import YAML\n'), ((314, 341), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (331, 341), False, 'import logging\n'), ((964, 994), 'os.path.expanduser', 'os.path.expand... |
from __future__ import absolute_import
from __future__ import division
from __future__ import with_statement
import abc
import json
import logging
import numpy as np
import os
import keras
from keras.optimizers import Adadelta, SGD, RMSprop, Adam
from nlplingo.nn.constants import supported_pytorch_models
from nlplin... | [
"keras.models.load_model",
"keras.optimizers.Adadelta",
"numpy.random.seed",
"keras.optimizers.SGD",
"torch.manual_seed",
"torch.cuda.manual_seed",
"data.loader.DataLoader",
"json.dumps",
"keras.optimizers.Adam",
"random.seed",
"torch.cuda.is_available",
"numpy.vstack",
"keras.optimizers.RMS... | [((544, 571), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (561, 571), False, 'import logging\n'), ((8820, 8875), 'keras.models.load_model', 'keras.models.load_model', (['filename', 'keras_custom_objects'], {}), '(filename, keras_custom_objects)\n', (8843, 8875), False, 'import keras\n'... |
from jumpscale.core.base import Base, fields
from enum import Enum
import hashlib
class ThreebotState(Enum):
RUNNING = "RUNNING" # the workloads are deployed and running
DELETED = "DELETED" # workloads and backups deleted
STOPPED = "STOPPED" # expired or manually stoped (delete workloads only)
class ... | [
"jumpscale.core.base.fields.Integer",
"jumpscale.core.base.fields.String",
"jumpscale.core.base.fields.Enum"
] | [((415, 430), 'jumpscale.core.base.fields.String', 'fields.String', ([], {}), '()\n', (428, 430), False, 'from jumpscale.core.base import Base, fields\n'), ((450, 466), 'jumpscale.core.base.fields.Integer', 'fields.Integer', ([], {}), '()\n', (464, 466), False, 'from jumpscale.core.base import Base, fields\n'), ((478, ... |
import graphene
from graphene import Int
class TotalItemsConnection(graphene.relay.Connection):
class Meta:
abstract = True
total = Int()
def resolve_total(self, info, **kwargs):
return len(self.iterable)
class BaseConnectionField(graphene.relay.ConnectionField):
def __init__(self,... | [
"graphene.Int"
] | [((151, 156), 'graphene.Int', 'Int', ([], {}), '()\n', (154, 156), False, 'from graphene import Int\n')] |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from swagger_server.models.base_model_ import Model
from swagger_server import util
class Preferences(Model):
"""NOTE: This class is auto generated by the swagger... | [
"swagger_server.util.deserialize_model"
] | [((1574, 1607), 'swagger_server.util.deserialize_model', 'util.deserialize_model', (['dikt', 'cls'], {}), '(dikt, cls)\n', (1596, 1607), False, 'from swagger_server import util\n')] |
#
# Copyright (c) 2013-2018 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the top-level directory
# of this distribution and at:
#
# http:... | [
"unittest.main",
"os.path.realpath",
"logging.StreamHandler",
"copy.copy",
"logging.Formatter",
"irma.configuration.ini.TemplatedConfiguration",
"logging.getLogger"
] | [((912, 931), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (929, 931), False, 'import logging\n'), ((6428, 6443), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6441, 6443), False, 'import unittest\n'), ((978, 1053), 'logging.Formatter', 'logging.Formatter', (["('%(asctime)s [%(name)s] ' + '%(level... |
#!/usr/bin/python3
'''
NAME:
lf_check.py
PURPOSE:
lf_check.py will run a series of tests based on the test TEST_DICTIONARY listed in lf_check_config.ini.
The lf_check_config.ini file is copied from lf_check_config_template.ini and local configuration is made
to the lf_check_config.ini.
EXAMPLE:
lf_check.py
NOTES:
B... | [
"argparse.ArgumentParser",
"logging.Formatter",
"os.path.join",
"os.chdir",
"sys.path.append",
"logging.FileHandler",
"os.path.dirname",
"socket.gethostbyname",
"socket.gethostname",
"lf_report.lf_report",
"shutil.copyfile",
"configparser.ConfigParser",
"datetime.datetime.now",
"time.local... | [((1024, 1059), 'sys.path.insert', 'sys.path.insert', (['(0)', 'parent_dir_path'], {}), '(0, parent_dir_path)\n', (1039, 1059), False, 'import sys\n'), ((1117, 1137), 'sys.path.append', 'sys.path.append', (['"""/"""'], {}), "('/')\n", (1132, 1137), False, 'import sys\n'), ((928, 954), 'os.path.realpath', 'os.path.realp... |
"""
Name: <NAME>
"""
import heapq
g4 = [('S',['a','S','S']),
('S',[])]
def tdpstep(g, input_categories_parses): # compute all possible next steps from (ws,cs)
global n_steps
(ws,cs,p) = input_categories_parses
if len(cs)>0:
cs1=cs[1:] # copy of predicted categories except cs[0]
p1... | [
"heapq.heappush",
"heapq.heapify",
"heapq.heappop"
] | [((1458, 1477), 'heapq.heapify', 'heapq.heapify', (['beam'], {}), '(beam)\n', (1471, 1477), False, 'import heapq\n'), ((939, 958), 'heapq.heappop', 'heapq.heappop', (['beam'], {}), '(beam)\n', (952, 958), False, 'import heapq\n'), ((1648, 1667), 'heapq.heappop', 'heapq.heappop', (['beam'], {}), '(beam)\n', (1661, 1667)... |
from unittest import TestCase
from day7 import TreeCreator
INPUT = '''pbga (66)
xhth (57)
ebii (61)
havc (66)
ktlj (57)
fwft (72) -> ktlj, cntj, xhth
qoyq (66)
padx (45) -> pbga, havc, qoyq
tknk (41) -> ugml, padx, fwft
jptl (61)
ugml (68) -> gyxo, ebii, jptl
gyxo (61)
cntj (57)'''
class TestTreeCreator(TestCase):
... | [
"day7.TreeCreator"
] | [((366, 384), 'day7.TreeCreator', 'TreeCreator', (['INPUT'], {}), '(INPUT)\n', (377, 384), False, 'from day7 import TreeCreator\n'), ((521, 539), 'day7.TreeCreator', 'TreeCreator', (['INPUT'], {}), '(INPUT)\n', (532, 539), False, 'from day7 import TreeCreator\n')] |
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Pango, Gdk, GLib
import datetime
import ui
import conv
def icon_image(icon_name):
theme = Gtk.IconTheme.get_default()
icon = theme.load_icon(icon_name, -1, Gtk.IconLookupFlags.FORCE_SIZE)
img = Gtk.Image.new_from_pixbuf(icon)
re... | [
"gi.require_version",
"gi.repository.Gtk.main",
"gi.repository.Gtk.IconTheme.get_default",
"gi.repository.Gtk.Image.new_from_pixbuf",
"ui.frame",
"gi.repository.Gtk.Label"
] | [((10, 42), 'gi.require_version', 'gi.require_version', (['"""Gtk"""', '"""3.0"""'], {}), "('Gtk', '3.0')\n", (28, 42), False, 'import gi\n'), ((170, 197), 'gi.repository.Gtk.IconTheme.get_default', 'Gtk.IconTheme.get_default', ([], {}), '()\n', (195, 197), False, 'from gi.repository import Gtk, Pango, Gdk, GLib\n'), (... |
# coding: utf-8
"""
Modern Logic Api
Manage and version your customer decision logic outside of your codebase # noqa: E501
OpenAPI spec version: 1.0.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class C... | [
"six.iteritems"
] | [((11197, 11230), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (11210, 11230), False, 'import six\n')] |
from interrogatio.core.exceptions import ValidationError
from interrogatio.validators import Validator
class PythonIdentifierValidator(Validator):
def validate(self, value, context=None):
if not value:
return
if not value.isidentifier():
raise ValidationError('Introduced d... | [
"interrogatio.core.exceptions.ValidationError"
] | [((291, 358), 'interrogatio.core.exceptions.ValidationError', 'ValidationError', (['"""Introduced data is not a valid Python identifier"""'], {}), "('Introduced data is not a valid Python identifier')\n", (306, 358), False, 'from interrogatio.core.exceptions import ValidationError\n')] |
import os
import re
import subprocess
from dogen.tools import Tools, Chdir
from dogen.plugin import Plugin
class DistGitPlugin(Plugin):
@staticmethod
def info():
return "dist-git", "Support for dist-git repositories"
@staticmethod
def inject_args(parser):
parser.add_argument('--dist-g... | [
"dogen.tools.Tools.decision",
"dogen.tools.Chdir",
"subprocess.check_output",
"os.path.dirname",
"os.path.exists",
"subprocess.call",
"os.path.join",
"subprocess.check_call"
] | [((4067, 4106), 'os.path.join', 'os.path.join', (['self.output', '"""Dockerfile"""'], {}), "(self.output, 'Dockerfile')\n", (4079, 4106), False, 'import os\n'), ((4464, 4533), 'subprocess.call', 'subprocess.call', (["['git', 'diff-index', '--quiet', '--cached', 'HEAD']"], {}), "(['git', 'diff-index', '--quiet', '--cach... |
from sys import path, stdout
path.insert(0, './git_management')
path.insert(0, './gradle_management')
from git_management import git_init
from gradle_management import migrateFromEclipseToAS
from os import path
from os import scandir
from os import remove
import migration
import errno, os, stat, shutil
import subproces... | [
"colorama.init",
"os.remove",
"os.path.isdir",
"os.path.insert",
"colorama.deinit",
"migration.migrate",
"os.scandir"
] | [((29, 63), 'os.path.insert', 'path.insert', (['(0)', '"""./git_management"""'], {}), "(0, './git_management')\n", (40, 63), False, 'from os import path\n'), ((64, 101), 'os.path.insert', 'path.insert', (['(0)', '"""./gradle_management"""'], {}), "(0, './gradle_management')\n", (75, 101), False, 'from os import path\n'... |
from pydub import AudioSegment
import parselmouth
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
def draw_pitch(pitch):
# Extract selected pitch contour, and
# replace unvoiced samples by NaN to not plot
pitch_values = pitch.selected_array['frequency']
pitch_values[pitch_va... | [
"matplotlib.pyplot.xlim",
"parselmouth.Sound",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.twinx",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylabel",
"numpy.log10",
"matplotlib.pyplot.xlabel",
"seaborn.set",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.grid"
] | [((471, 486), 'matplotlib.pyplot.grid', 'plt.grid', (['(False)'], {}), '(False)\n', (479, 486), True, 'import matplotlib.pyplot as plt\n'), ((491, 517), 'matplotlib.pyplot.ylim', 'plt.ylim', (['(0)', 'pitch.ceiling'], {}), '(0, pitch.ceiling)\n', (499, 517), True, 'import matplotlib.pyplot as plt\n'), ((522, 562), 'mat... |
import setuptools
import os
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'reactopya', 'VERSION')) as version_file:
version = version_file.read().strip()
setuptools.setup(
name="reactopya",
version=version,
author="<NAME>",
author_email="<EMAIL>",
description="",
pack... | [
"os.path.realpath",
"setuptools.find_packages"
] | [((325, 351), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (349, 351), False, 'import setuptools\n'), ((68, 94), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (84, 94), False, 'import os\n')] |
import sys
sys.path.append('/Users/kolbt/Desktop/compiled/hoomd-blue/build')
import hoomd
from hoomd import md
from hoomd import dem
from hoomd import deprecated
import numpy as np
# Simulation box mesh into grid delimit by particle diameter
# list of mesh indices random number generator to select index
# remove index... | [
"hoomd.md.nlist.cell",
"hoomd.group.type",
"numpy.sin",
"hoomd.dump.gsd",
"sys.path.append",
"numpy.zeros_like",
"hoomd.run",
"hoomd.data.boxdim",
"hoomd.init.read_snapshot",
"hoomd.group.all",
"hoomd.md.pair.lj",
"hoomd.context.initialize",
"hoomd.md.integrate.mode_minimize_fire",
"numpy.... | [((11, 76), 'sys.path.append', 'sys.path.append', (['"""/Users/kolbt/Desktop/compiled/hoomd-blue/build"""'], {}), "('/Users/kolbt/Desktop/compiled/hoomd-blue/build')\n", (26, 76), False, 'import sys\n'), ((880, 906), 'hoomd.context.initialize', 'hoomd.context.initialize', ([], {}), '()\n', (904, 906), False, 'import ho... |
from intake.middleware import MiddlewareBase
from easyaudit.middleware.easyaudit import clear_request
class ClearRequestMiddleware(MiddlewareBase):
def process_response(self, response):
clear_request()
| [
"easyaudit.middleware.easyaudit.clear_request"
] | [((201, 216), 'easyaudit.middleware.easyaudit.clear_request', 'clear_request', ([], {}), '()\n', (214, 216), False, 'from easyaudit.middleware.easyaudit import clear_request\n')] |
"""server docstring"""
import json
import random
import time
from datetime import datetime
from flask import Flask, Response, render_template, redirect, url_for
from flask_mongoengine import MongoEngine
from sensores.db.models import Sensor, Medition
from sensores.db import util
from .businesslogic import get_sensors... | [
"flask_mongoengine.MongoEngine",
"flask.Flask",
"json.dumps",
"time.sleep",
"sensores.db.models.Medition.objects",
"random.seed",
"sensores.db.util.conectdb"
] | [((377, 392), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (382, 392), False, 'from flask import Flask, Response, render_template, redirect, url_for\n'), ((455, 479), 'flask_mongoengine.MongoEngine', 'MongoEngine', (['application'], {}), '(application)\n', (466, 479), False, 'from flask_mongoengine impor... |
import matplotlib.pyplot as plt
plt.rcParams['toolbar'] = 'None'
import numpy as np # importando numpy
def genera_montecarlo(N=100000):
plt.figure(figsize=(6,6))
x, y = np.random.uniform(-1, 1, size=(2, N))
interior = (x**2 + y**2) <= 1
pi = interior.sum() * 4 / N
error = abs((pi - np.pi) / ... | [
"numpy.random.uniform",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.invert",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure"
] | [((143, 169), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6, 6)'}), '(figsize=(6, 6))\n', (153, 169), True, 'import matplotlib.pyplot as plt\n'), ((185, 222), 'numpy.random.uniform', 'np.random.uniform', (['(-1)', '(1)'], {'size': '(2, N)'}), '(-1, 1, size=(2, N))\n', (202, 222), True, 'import numpy as... |
import sys
sys.path.append("../")
sys.path.append("../examples/")
import argparse
from configs import supported
from configs.utils import populate_defaults
import wilds
# Taken from https://sumit-ghosh.com/articles/parsing-dictionary-key-value-pairs-kwargs-argparse-python/
class ParseKwargs(argparse.Action):
def... | [
"sys.path.append",
"configs.utils.populate_defaults",
"argparse.ArgumentParser",
"argparse.ArgumentTypeError"
] | [((11, 33), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (26, 33), False, 'import sys\n'), ((34, 65), 'sys.path.append', 'sys.path.append', (['"""../examples/"""'], {}), "('../examples/')\n", (49, 65), False, 'import sys\n'), ((1277, 1302), 'argparse.ArgumentParser', 'argparse.ArgumentParser'... |
"""
The MIT License (MIT)
Copyright (c) 2017 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publis... | [
"tensorflow.trace",
"tensorflow.matrix_band_part",
"tensorflow.reduce_sum",
"tensorflow.maximum",
"numpy.ones",
"tensorflow.diag_part",
"tensorflow.matmul",
"tensorflow.sqrt",
"tensorflow.contrib.keras.backend.floatx",
"tensorflow.abs",
"tensorflow.diag",
"tensorflow.exp",
"tensorflow.consta... | [((1930, 1967), 'tensorflow.random_normal_initializer', 'tf.random_normal_initializer', (['(0)', '(0.01)'], {}), '(0, 0.01)\n', (1958, 1967), True, 'import tensorflow as tf\n'), ((3970, 4002), 'tensorflow.expand_dims', 'tf.expand_dims', (['self.batch_u', '(-1)'], {}), '(self.batch_u, -1)\n', (3984, 4002), True, 'import... |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Author: <NAME> (<EMAIL>)
#
from __future__ import absolute_import, division, unicode_literals
... | [
"mo_dots.Data.__init__",
"math.sqrt",
"math.ceil",
"mo_math.vendor.strangman.stats.chisquare",
"math.floor",
"mo_testing.fuzzytestcase.assertAlmostEqualValue",
"mo_math.almost_equal",
"mo_dots.coalesce",
"numpy.array",
"mo_future.text",
"mo_logs.Log.error",
"mo_math.OR"
] | [((9098, 9127), 'mo_math.OR', 'OR', (['(v == None for v in values)'], {}), '(v == None for v in values)\n', (9100, 9127), False, 'from mo_math import OR, almost_equal\n'), ((877, 916), 'mo_math.vendor.strangman.stats.chisquare', 'strangman.stats.chisquare', (['f_obs', 'f_exp'], {}), '(f_obs, f_exp)\n', (902, 916), Fals... |
# organize data, read wav to get duration and split train/test
# to a csv file
# author: Max, 2020.08.05
import os
import librosa
from tqdm import tqdm
import pandas as pd
from sklearn.model_selection import StratifiedKFold
def main(root_pth):
if not os.path.exists('df.csv'):
data = []
folds = os... | [
"pandas.DataFrame",
"tqdm.tqdm",
"pandas.pivot_table",
"pandas.read_csv",
"os.path.exists",
"sklearn.model_selection.StratifiedKFold",
"os.path.join",
"os.listdir",
"librosa.get_duration"
] | [((1010, 1031), 'pandas.read_csv', 'pd.read_csv', (['"""df.csv"""'], {}), "('df.csv')\n", (1021, 1031), True, 'import pandas as pd\n'), ((1062, 1120), 'sklearn.model_selection.StratifiedKFold', 'StratifiedKFold', ([], {'n_splits': '(5)', 'shuffle': '(True)', 'random_state': '(42)'}), '(n_splits=5, shuffle=True, random_... |
from django.db import models
# Create your models here.
class Location(models.Model):
"""
class facilitates the creation of location objects
"""
location_name = models.CharField(max_length=70)
def __str__(self):
return self.location_name
def save_location(self):
"""
me... | [
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.ImageField",
"django.db.models.DateField"
] | [((178, 209), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(70)'}), '(max_length=70)\n', (194, 209), False, 'from django.db import models\n'), ((1047, 1078), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(70)'}), '(max_length=70)\n', (1063, 1078), False, 'from django.d... |
from excel_text.factory import get_text_function
text = get_text_function({"decimal": ".", "thousands": ",", "raise": True})
| [
"excel_text.factory.get_text_function"
] | [((57, 125), 'excel_text.factory.get_text_function', 'get_text_function', (["{'decimal': '.', 'thousands': ',', 'raise': True}"], {}), "({'decimal': '.', 'thousands': ',', 'raise': True})\n", (74, 125), False, 'from excel_text.factory import get_text_function\n')] |
import os
import typing as ta
from omnibus import lang
from ._registry import register
@lang.cached_nullary
def _load_dot_env() -> ta.Optional[ta.Mapping[str, str]]:
fp = os.path.join(os.path.dirname(os.path.dirname(__file__)), '../../.env')
if not os.path.isfile(fp):
return None
with open(fp, '... | [
"os.path.isfile",
"os.path.dirname"
] | [((261, 279), 'os.path.isfile', 'os.path.isfile', (['fp'], {}), '(fp)\n', (275, 279), False, 'import os\n'), ((208, 233), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (223, 233), False, 'import os\n')] |
# coding=utf-8
from dateutil.easter import EASTER_WESTERN
from holidata.utils import SmartDayArrow
from .holidays import Locale, Holiday
"""
source: https://www.riksdagen.se/sv/dokument-lagar/dokument/svensk-forfattningssamling/lag-1989253-om-allmanna-helgdagar_sfs-1989-253
source: https://www.riksdagen.se/sv/dokumen... | [
"holidata.utils.SmartDayArrow"
] | [((1054, 1085), 'holidata.utils.SmartDayArrow', 'SmartDayArrow', (['self.year', '(6)', '(19)'], {}), '(self.year, 6, 19)\n', (1067, 1085), False, 'from holidata.utils import SmartDayArrow\n'), ((1931, 1963), 'holidata.utils.SmartDayArrow', 'SmartDayArrow', (['self.year', '(10)', '(30)'], {}), '(self.year, 10, 30)\n', (... |
import json
from datetime import datetime
import pandas as pd
import argparse
import boto3
import os
import itertools
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
from urllib3.exceptions import ProtocolError
class StdOutListener(StreamListener):
def __in... | [
"pandas.DataFrame",
"json.load",
"argparse.ArgumentParser",
"boto3.client",
"json.loads",
"datetime.datetime.utcnow",
"tweepy.Stream",
"tweepy.OAuthHandler",
"itertools.chain.from_iterable"
] | [((937, 990), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Collect tweets"""'}), "(description='Collect tweets')\n", (960, 990), False, 'import argparse\n'), ((2113, 2217), 'tweepy.OAuthHandler', 'OAuthHandler', (["configuration['twitter']['consumer_key']", "configuration['twitter']['c... |
import typing
import hypothesis
from hypothesis import strategies
from src.packages.rescue import Rescue as _Rescue
from src.packages.rat import Rat as _Rat
from src.packages.utils import sanitize, Platforms as _Platforms
import string
# Anything that isn't a whitespace other than the space character, and isn't a con... | [
"hypothesis.strategies.lists",
"hypothesis.strategies.characters",
"hypothesis.strategies.sampled_from",
"hypothesis.strategies.none",
"hypothesis.strategies.booleans",
"hypothesis.strategies.text",
"hypothesis.strategies.uuids",
"src.packages.utils.sanitize",
"hypothesis.strategies.integers"
] | [((355, 416), 'hypothesis.strategies.characters', 'strategies.characters', ([], {'blacklist_categories': "['C', 'Zl', 'Zp']"}), "(blacklist_categories=['C', 'Zl', 'Zp'])\n", (376, 416), False, 'from hypothesis import strategies\n'), ((847, 901), 'hypothesis.strategies.characters', 'strategies.characters', ([], {'blackl... |
"""Added unique for name in Tiers
Revision ID: <KEY>
Revises: 330568e8928c
Create Date: 2015-02-06 12:05:09.151253
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '330568e8928c'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic... | [
"alembic.op.f"
] | [((374, 400), 'alembic.op.f', 'op.f', (['"""uq_usagetiers_name"""'], {}), "('uq_usagetiers_name')\n", (378, 400), False, 'from alembic import op\n'), ((565, 591), 'alembic.op.f', 'op.f', (['"""uq_usagetiers_name"""'], {}), "('uq_usagetiers_name')\n", (569, 591), False, 'from alembic import op\n')] |
from collections import defaultdict
from typing import Union, Set, List
import click
import logging
import networkx as nx
import os
import rdflib
import uuid
from prefixcommons.curie_util import read_remote_jsonld_context
from rdflib import Namespace, URIRef
from rdflib.namespace import RDF, RDFS, OWL
from kgx.prefix... | [
"prefixcommons.curie_util.read_remote_jsonld_context",
"kgx.utils.kgx_utils.get_toolkit",
"rdflib.Graph",
"click.progressbar",
"kgx.utils.rdf_utils.find_category",
"os.path.basename",
"uuid.uuid4",
"kgx.prefix_manager.PrefixManager",
"rdflib.term.Literal",
"rdflib.URIRef",
"rdflib.Namespace",
... | [((566, 655), 'prefixcommons.curie_util.read_remote_jsonld_context', 'read_remote_jsonld_context', (['"""https://biolink.github.io/biolink-model/context.jsonld"""'], {}), "(\n 'https://biolink.github.io/biolink-model/context.jsonld')\n", (592, 655), False, 'from prefixcommons.curie_util import read_remote_jsonld_con... |
#
# Copyright (c) 2016 Nordic Semiconductor ASA
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of con... | [
"blatann.nrf.nrf_dll_load.driver.sd_rpc_serial_port_desc_array.frompointer",
"blatann.nrf.nrf_dll_load.driver.ble_gattc_desc_array.frompointer",
"blatann.nrf.nrf_dll_load.driver.ble_gattc_attr_info16_array.frompointer",
"blatann.nrf.nrf_dll_load.driver.char_array.frompointer",
"blatann.nrf.nrf_dll_load.driv... | [((2697, 2741), 'blatann.nrf.nrf_dll_load.driver.char_array.frompointer', 'driver.char_array.frompointer', (['array_pointer'], {}), '(array_pointer)\n', (2726, 2741), False, 'from blatann.nrf.nrf_dll_load import driver\n'), ((2927, 2972), 'blatann.nrf.nrf_dll_load.driver.uint8_array.frompointer', 'driver.uint8_array.fr... |
"""
This whole file is dedicated to the creation of spreadsheets. It's existence is for marketing related
stuff. It does involve programming, but it's more related to marketing.
Note: This code is not accessible through normal runtime
"""
from datetime import date, timedelta
from .models import User
def get_user(t... | [
"datetime.date",
"datetime.timedelta"
] | [((775, 797), 'datetime.date', 'date', (['year', 'month', 'day'], {}), '(year, month, day)\n', (779, 797), False, 'from datetime import date, timedelta\n'), ((2507, 2527), 'datetime.date', 'date', (['year', 'month', '(1)'], {}), '(year, month, 1)\n', (2511, 2527), False, 'from datetime import date, timedelta\n'), ((826... |
import sys
import schema_pa
class ArgsParser:
def parse(self, argv):
self.config = schema_pa.parse("schema",
"Test schema", argv)
if __name__ == "__main__":
parser = ArgsParser()
parser.parse(sys.argv[1:])
print(parser.config)
| [
"schema_pa.parse"
] | [((97, 143), 'schema_pa.parse', 'schema_pa.parse', (['"""schema"""', '"""Test schema"""', 'argv'], {}), "('schema', 'Test schema', argv)\n", (112, 143), False, 'import schema_pa\n')] |
import warnings
import torch.nn as nn
from skssl.utils.initialization import linear_init
from skssl.utils.torchextend import identity
__all__ = ["MLP", "get_uninitialized_mlp"]
def get_uninitialized_mlp(**kwargs):
return lambda *args, **kargs2: MLP(*args, **kwargs, **kargs2)
class MLP(nn.Module):
"""Gene... | [
"torch.nn.Dropout",
"skssl.utils.initialization.linear_init",
"torch.nn.Linear"
] | [((1695, 1750), 'torch.nn.Linear', 'nn.Linear', (['self.input_size', 'self.hidden_size'], {'bias': 'bias'}), '(self.input_size, self.hidden_size, bias=bias)\n', (1704, 1750), True, 'import torch.nn as nn\n'), ((1946, 2002), 'torch.nn.Linear', 'nn.Linear', (['self.hidden_size', 'self.output_size'], {'bias': 'bias'}), '(... |
from discord.ext import commands
from util.data.user_data import UserData
from util.decorators import delete_original
class Preferences(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(name="botdms", aliases=["botdm"])
@commands.cooldown(1, 2, commands.BucketType.user)
... | [
"discord.ext.commands.cooldown",
"discord.ext.commands.command",
"util.decorators.delete_original"
] | [((212, 262), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""botdms"""', 'aliases': "['botdm']"}), "(name='botdms', aliases=['botdm'])\n", (228, 262), False, 'from discord.ext import commands\n'), ((268, 317), 'discord.ext.commands.cooldown', 'commands.cooldown', (['(1)', '(2)', 'commands.BucketT... |
import plotly.graph_objects as go
from plotly.subplots import make_subplots
def plot_freq_labels(data, template="plotly"):
X = ["Non Hate Speech", "Hate Speech"]
Y = data["label"].value_counts().values
fig = go.Figure()
fig.add_trace(
go.Bar(
x=X,
y=Y,
tex... | [
"plotly.subplots.make_subplots",
"plotly.graph_objects.Figure",
"plotly.graph_objects.Bar",
"plotly.graph_objects.Histogram"
] | [((223, 234), 'plotly.graph_objects.Figure', 'go.Figure', ([], {}), '()\n', (232, 234), True, 'import plotly.graph_objects as go\n'), ((708, 719), 'plotly.graph_objects.Figure', 'go.Figure', ([], {}), '()\n', (717, 719), True, 'import plotly.graph_objects as go\n'), ((1415, 1426), 'plotly.graph_objects.Figure', 'go.Fig... |
from Bubot.Helpers.ExtException import ExtException, KeyNotFound
from Bubot_CoAP.resources.resource import Resource
class OcfResource(Resource):
def __init__(self, name, coap_server=None, visible=True, observable=True, allow_children=True):
super().__init__(name, coap_server=None, visible=True, observable... | [
"Bubot.Helpers.ExtException.KeyNotFound"
] | [((1217, 1324), 'Bubot.Helpers.ExtException.KeyNotFound', 'KeyNotFound', ([], {'action': '"""OcfDevice.get_param"""', 'detail': 'f"""{args[0]} ({self.__class__.__name__}{self._href})"""'}), "(action='OcfDevice.get_param', detail=\n f'{args[0]} ({self.__class__.__name__}{self._href})')\n", (1228, 1324), False, 'from ... |
from django.shortcuts import render, get_object_or_404, redirect
from .models import Post
from django.views.generic import ListView, DetailView
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from django.contrib.auth.models import User
from django.db import IntegrityError
from django.contrib... | [
"django.shortcuts.redirect",
"django.contrib.auth.forms.AuthenticationForm",
"django.contrib.auth.models.User.objects.create_user",
"django.contrib.auth.logout",
"django.contrib.auth.forms.UserCreationForm",
"django.contrib.auth.authenticate",
"django.shortcuts.render",
"django.contrib.auth.login"
] | [((758, 787), 'django.shortcuts.render', 'render', (['request', '"""about.html"""'], {}), "(request, 'about.html')\n", (764, 787), False, 'from django.shortcuts import render, get_object_or_404, redirect\n'), ((846, 877), 'django.shortcuts.render', 'render', (['request', '"""contact.html"""'], {}), "(request, 'contact.... |
from typing import (
TYPE_CHECKING,
Any,
Dict,
Iterable,
List,
Optional,
Sequence,
Tuple,
Union,
)
import numpy as np
import scipy.sparse as sps
from irspack.definitions import DenseScoreArray, UserIndexArray
from irspack.utils._util_cpp import retrieve_recommend_from_score
from ir... | [
"irspack.utils.threading.get_n_threads",
"numpy.asarray",
"irspack.utils._util_cpp.retrieve_recommend_from_score",
"numpy.isinf"
] | [((4405, 4465), 'numpy.asarray', 'np.asarray', (['[self.user_id_to_index[user_id]]'], {'dtype': 'np.int64'}), '([self.user_id_to_index[user_id]], dtype=np.int64)\n', (4415, 4465), True, 'import numpy as np\n'), ((10426, 10517), 'irspack.utils._util_cpp.retrieve_recommend_from_score', 'retrieve_recommend_from_score', ([... |
# -*- coding: utf-8 -*-
"""
session component module.
"""
from pyrin.application.decorators import component
from pyrin.security.session import SessionPackage
from pyrin.security.session.manager import SessionManager
from pyrin.application.structs import Component
@component(SessionPackage.COMPONENT_NAME)
class Sess... | [
"pyrin.application.decorators.component"
] | [((269, 309), 'pyrin.application.decorators.component', 'component', (['SessionPackage.COMPONENT_NAME'], {}), '(SessionPackage.COMPONENT_NAME)\n', (278, 309), False, 'from pyrin.application.decorators import component\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-25 22:03
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('Testings', '0003_collection'),
]
operations = [
migrations.RenameField(
... | [
"django.db.migrations.RenameField"
] | [((285, 377), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""collection"""', 'old_name': '"""products"""', 'new_name': '"""product"""'}), "(model_name='collection', old_name='products',\n new_name='product')\n", (307, 377), False, 'from django.db import migrations\n')] |
import os
from celery.schedules import crontab
CELERY_BROKER_URL='amqp://guest@localhost//'
CELERY_RESULT_BACKEND = 'mongodb://localhost:27017/'
CELERY_MONGODB_BACKEND_SETTINGS = {
'database': 'wowgicflaskapp',
'taskmeta_collection': 'my_taskmeta_collection',
}
#CELERY_ACCEPT_CONTENT = ['pickle', '... | [
"os.uname",
"celery.schedules.crontab"
] | [((450, 460), 'os.uname', 'os.uname', ([], {}), '()\n', (458, 460), False, 'import os\n'), ((796, 818), 'celery.schedules.crontab', 'crontab', ([], {'minute': '"""*/15"""'}), "(minute='*/15')\n", (803, 818), False, 'from celery.schedules import crontab\n')] |
import boto3
#class Command:
# def __init__(self, description,
class Config:
dynamodb = boto3.resource('dynamodb')
def __init__(self, table_name):
self.table = self.dynamodb.Table(table_name)
def get(self, key):
response = self.table.get_item(Key = {'Key' : key}, ConsistentRe... | [
"boto3.resource"
] | [((98, 124), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {}), "('dynamodb')\n", (112, 124), False, 'import boto3\n')] |
import requests
from pprint import pprint
def find_vacancies(parameters):
URL = 'https://www.cbr-xml-daily.ru/daily_json.js'
response = requests.get(URL).json()
usd_rate = response['Valute']['USD']['Value']
euro_rate = response['Valute']['EUR']['Value']
URL_HH = 'https://api.hh.ru/vacancies'
... | [
"requests.get"
] | [((146, 163), 'requests.get', 'requests.get', (['URL'], {}), '(URL)\n', (158, 163), False, 'import requests\n'), ((381, 420), 'requests.get', 'requests.get', (['URL_HH'], {'params': 'parameters'}), '(URL_HH, params=parameters)\n', (393, 420), False, 'import requests\n'), ((768, 803), 'requests.get', 'requests.get', (['... |
"""
Example to read a FITS file.
Created on Jul 9, 2019
Be aware that hdus.close () needs to be called to limit the number of open files at a given time.
@author: skwok
"""
import astropy.io.fits as pf
from astropy.utils.exceptions import AstropyWarning
import warnings
import numpy as np
from keckdrpframework.mode... | [
"warnings.simplefilter",
"keckdrpframework.primitives.base_primitive.BasePrimitive.__init__",
"keckdrpframework.models.arguments.Arguments",
"warnings.catch_warnings",
"astropy.io.fits.open",
"numpy.concatenate"
] | [((460, 485), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (483, 485), False, 'import warnings\n'), ((495, 542), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'AstropyWarning'], {}), "('ignore', AstropyWarning)\n", (516, 542), False, 'import warnings\n'), ((558, 589), 'a... |
""" timg_denoise.py
"""
import numpy as np
import torch
import torch.nn as nn
class Timg_DenoiseNet_LinT_1Layer(nn.Module):
def __init__(self):
super(Timg_DenoiseNet_LinT_1Layer, self).__init__()
self.C = 64
self.K = 13
self.centre = 3/255.0
self.scale = 2.0
self.c... | [
"torch.nn.ReLU",
"numpy.log",
"torch.nn.Conv2d",
"torch.nn.Threshold",
"torch.exp",
"torch.nn.BatchNorm2d",
"torch.pow",
"torch.log",
"torch.nn.Hardtanh"
] | [((327, 376), 'torch.nn.Conv2d', 'nn.Conv2d', (['(1)', 'self.C', 'self.K'], {'padding': '(self.K // 2)'}), '(1, self.C, self.K, padding=self.K // 2)\n', (336, 376), True, 'import torch.nn as nn\n'), ((396, 418), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', (['self.C'], {}), '(self.C)\n', (410, 418), True, 'import torch.nn... |
#!/usr/bin/env python
#
# Copyright 2016 the original author or 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 require... | [
"twisted.internet.defer.returnValue",
"netconf.nc_common.error.BadMsg",
"dicttoxml.dicttoxml",
"structlog.get_logger"
] | [((950, 972), 'structlog.get_logger', 'structlog.get_logger', ([], {}), '()\n', (970, 972), False, 'import structlog\n'), ((1800, 1845), 'dicttoxml.dicttoxml', 'dicttoxml.dicttoxml', (['res_dict'], {'attr_type': '(True)'}), '(res_dict, attr_type=True)\n', (1819, 1845), False, 'import dicttoxml\n'), ((2145, 2175), 'twis... |
from queue import PriorityQueue
from components import *
class AStar:
"""
A star algorithm implementation
f(n) = g(n) + h(n)
"""
def __init__(self):
self.paths = [
KEY_RIGHT,
KEY_LEFT,
KEY_UP,
KEY_DOWN
]
self.invalid = {
... | [
"queue.PriorityQueue"
] | [((782, 797), 'queue.PriorityQueue', 'PriorityQueue', ([], {}), '()\n', (795, 797), False, 'from queue import PriorityQueue\n')] |
from config import MONGO_CONNECTION_URL,MONGO_DB_SCHEMA
from config import REDIS_SERVER_HOST,REDIS_SERVER_PORT
from app import server
from pymongo import MongoClient
from anuvaad_auditor.loghandler import log_info, log_exception
from utilities import AppContext
from flask import g
import redis
client = MongoClient(MONG... | [
"pymongo.MongoClient",
"redis.Redis"
] | [((304, 337), 'pymongo.MongoClient', 'MongoClient', (['MONGO_CONNECTION_URL'], {}), '(MONGO_CONNECTION_URL)\n', (315, 337), False, 'from pymongo import MongoClient\n'), ((620, 685), 'redis.Redis', 'redis.Redis', ([], {'host': 'REDIS_SERVER_HOST', 'port': 'REDIS_SERVER_PORT', 'db': '(4)'}), '(host=REDIS_SERVER_HOST, por... |
import logging
from app import db
from app.models import Inventory, Datacenter, Rack, Item
import random
import string
from datetime import datetime
log = logging.getLogger(__name__)
DC_RACK_MAX = 20
ITEM_MAX = 1000
cities = ["Lisbon", "Porto", "Madrid", "Barcelona", "Frankfurt", "London"]
models = ["Server MX", "S... | [
"app.models.Rack",
"app.db.session.rollback",
"random.choice",
"app.db.session.commit",
"app.models.Item",
"app.db.session.add",
"logging.getLogger",
"app.models.Datacenter"
] | [((156, 183), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (173, 183), False, 'import logging\n'), ((681, 693), 'app.models.Datacenter', 'Datacenter', ([], {}), '()\n', (691, 693), False, 'from app.models import Inventory, Datacenter, Rack, Item\n'), ((800, 826), 'app.db.session.add', '... |
from ansible_task_executor import AnsibleTaskExecutor
import os
class HOST(object):
def __init__(self, ip, user, password, subnet=None, role=None):
self.ip = ip
self.user = user
self.password = password
self.role = role
self.cpu = None
self.memory = None
se... | [
"ansible_task_executor.AnsibleTaskExecutor",
"os.getenv"
] | [((535, 556), 'ansible_task_executor.AnsibleTaskExecutor', 'AnsibleTaskExecutor', ([], {}), '()\n', (554, 556), False, 'from ansible_task_executor import AnsibleTaskExecutor\n'), ((578, 602), 'os.getenv', 'os.getenv', (['"""https_proxy"""'], {}), "('https_proxy')\n", (587, 602), False, 'import os\n'), ((4537, 4558), 'a... |
#!/usr/bin/env python
from __future__ import division, absolute_import, print_function
import numpy as np
import jams.const as const
def tcherkez(Rstar, Phi=0.3, T=0.056,
a2=1.0012, a3=1.0058, a4=1.0161,
t1=0.9924, t2=1.0008, g=20e-3,
RG=False, Rchl=False, Rcyt=False, fullmodel=T... | [
"numpy.array",
"doctest.testmod"
] | [((6383, 6440), 'doctest.testmod', 'doctest.testmod', ([], {'optionflags': 'doctest.NORMALIZE_WHITESPACE'}), '(optionflags=doctest.NORMALIZE_WHITESPACE)\n', (6398, 6440), False, 'import doctest\n'), ((5918, 5933), 'numpy.array', 'np.array', (['Rstar'], {}), '(Rstar)\n', (5926, 5933), True, 'import numpy as np\n')] |
import re
import typing as t
from .typed import StringTyped
class RegexDescriptor(StringTyped):
def __init__(self, *args, pattern: t.Union[str, re.Pattern], **kwargs) -> None:
super().__init__(*args, **kwargs)
if isinstance(pattern, str):
pattern = re.compile(pattern)
self.p... | [
"re.compile"
] | [((285, 304), 're.compile', 're.compile', (['pattern'], {}), '(pattern)\n', (295, 304), False, 'import re\n')] |
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/DSTU2/substance.html
Release: DSTU2
Version: 1.0.2
Revision: 7202
"""
from typing import List as ListType
from pydantic import Field
from . import domainresource, fhirtypes
from .backboneelement import BackboneElement
class Substance(domainresource.DomainReso... | [
"pydantic.Field"
] | [((470, 500), 'pydantic.Field', 'Field', (['"""Substance"""'], {'const': '(True)'}), "('Substance', const=True)\n", (475, 500), False, 'from pydantic import Field\n'), ((555, 736), 'pydantic.Field', 'Field', (['None'], {'alias': '"""identifier"""', 'title': '"""List of Unique identifier (represented as \'dict\' in JSON... |
from django.utils import translation
from bitcaster.config import settings
from bitcaster.utils.language import get_attr
class UserLanguageMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
if request.user and request.user.is_authentic... | [
"django.utils.translation.activate",
"bitcaster.utils.language.get_attr"
] | [((338, 381), 'django.utils.translation.activate', 'translation.activate', (['request.user.language'], {}), '(request.user.language)\n', (358, 381), False, 'from django.utils import translation\n'), ((515, 557), 'bitcaster.utils.language.get_attr', 'get_attr', (['request', '"""user.is_authenticated"""'], {}), "(request... |
#!/usr/bin/env python
import time
import sys
millis = int(round(time.time() * 1000))
sys.stdout.write("~/.ros/rtabmap_test_" + str(millis)+ '.db')
| [
"time.time"
] | [((64, 75), 'time.time', 'time.time', ([], {}), '()\n', (73, 75), False, 'import time\n')] |
"""Admin pages for schemes models.
On default generates list view admins for all models
"""
from django.contrib.admin import StackedInline, register
from espressodb.base.admin import register_admins
from espressodb.base.admin import ListViewAdmin as LVA
from strops.schemes.models import (
ExpansionScheme,
Ex... | [
"django.contrib.admin.register",
"espressodb.base.admin.register_admins"
] | [((479, 504), 'django.contrib.admin.register', 'register', (['ExpansionScheme'], {}), '(ExpansionScheme)\n', (487, 504), False, 'from django.contrib.admin import StackedInline, register\n'), ((668, 779), 'espressodb.base.admin.register_admins', 'register_admins', (['"""strops.schemes"""'], {'exclude_models': "['Expansi... |
"""Setup"""
import os
from setuptools import setup, find_packages
# figure out the version
# about = {}
# here = os.path.abspath(os.path.dirname(__file__))
# with open(os.path.join(here, "synapsemonitor", "__version__.py")) as f:
# exec(f.read(), about)
with open("README.md", "r") as fh:
long_description = fh... | [
"setuptools.find_packages"
] | [((717, 732), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (730, 732), False, 'from setuptools import setup, find_packages\n')] |
import urllib.request
import shutil
import gzip
import json
import re
import os
from collections import defaultdict
from scholarmetrics import hindex
from tqdm import tqdm
from app.dblp_parser import parse_dblp, parse_dblp_person, get_dblp_country
from app.myfunctions import get_dblp_url
URL = 'http://dblp.org/xml/'... | [
"os.mkdir",
"tqdm.tqdm",
"app.dblp_parser.parse_dblp",
"gzip.open",
"json.load",
"json.loads",
"json.dump",
"os.remove",
"os.path.dirname",
"os.path.exists",
"collections.defaultdict",
"app.dblp_parser.get_dblp_country",
"shutil.copyfileobj",
"app.dblp_parser.parse_dblp_person",
"os.list... | [((347, 372), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (362, 372), False, 'import os\n'), ((1662, 1688), 'app.dblp_parser.parse_dblp', 'parse_dblp', (['source', 'target'], {}), '(source, target)\n', (1672, 1688), False, 'from app.dblp_parser import parse_dblp, parse_dblp_person, get_dbl... |
import random
import numpy as np
import cv2
import torch
import torch.utils.data as data
import logging
from . import util
class LQGTDataset3D(data.Dataset):
'''
Read LQ (Low Quality, here is LR) and GT vti file pairs.
If only GT image is provided, generate LQ vti on-the-fly.
The pair is ensured by '... | [
"numpy.copy",
"numpy.ascontiguousarray",
"logging.getLogger"
] | [((396, 421), 'logging.getLogger', 'logging.getLogger', (['"""base"""'], {}), "('base')\n", (413, 421), False, 'import logging\n'), ((3340, 3355), 'numpy.copy', 'np.copy', (['vti_GT'], {}), '(vti_GT)\n', (3347, 3355), True, 'import numpy as np\n'), ((4421, 4449), 'numpy.ascontiguousarray', 'np.ascontiguousarray', (['vt... |
import multiprocessing
import threading
import numpy as np
import os
import shutil
import matplotlib.pyplot as plt
import sys
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.multiprocessing as mp
from shared_adam import SharedAdam
import math, os
import cv2
import torchvi... | [
"numpy.random.seed",
"torch.nn.init.constant_",
"torch.device",
"pybullet.connect",
"torch.nn.functional.tanh",
"os.path.join",
"imageio.mimsave",
"numpy.set_printoptions",
"os.path.exists",
"Wrench_Manipulation_Env.RobotEnv",
"numpy.reshape",
"torch.nn.Linear",
"math.log",
"torch.log",
... | [((410, 430), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (422, 430), False, 'import torch\n'), ((432, 479), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(4)', 'suppress': '(True)'}), '(precision=4, suppress=True)\n', (451, 479), True, 'import numpy as np\n'), ((512, 546)... |
# test via
# python protest.py dm2_download_megatest.py
from pygr import nlmsa_utils
import pygr.Data
import os, tempfile, time
def rm_recursive(top):
'recursively remove top and everything in it!'
for root, dirs, files in os.walk(top, topdown=False):
for name in files:
os.remove(os.path.j... | [
"os.mkdir",
"random.randint",
"tempfile.gettempdir",
"os.walk",
"time.time",
"pygr.apps.catalog_downloads.save_NLMSA_downloaders",
"os.rmdir",
"os.path.join"
] | [((233, 260), 'os.walk', 'os.walk', (['top'], {'topdown': '(False)'}), '(top, topdown=False)\n', (240, 260), False, 'import os, tempfile, time\n'), ((414, 427), 'os.rmdir', 'os.rmdir', (['top'], {}), '(top)\n', (422, 427), False, 'import os, tempfile, time\n'), ((724, 745), 'tempfile.gettempdir', 'tempfile.gettempdir',... |
from math import floor, log2
from operator import itemgetter
def argmin(*args):
if len(args) == 1:
iterable = args[0]
else:
iterable = args
return min((j, i) for i, j in enumerate(iterable))[1]
def greatest_pow2(n):
return 2 ** floor(log2(n))
def inverse_index(a):
return {v: k ... | [
"math.log2"
] | [((270, 277), 'math.log2', 'log2', (['n'], {}), '(n)\n', (274, 277), False, 'from math import floor, log2\n')] |
# -*- coding: utf-8 -*-
# <Lettuce - Behaviour Driven Development for python>
# Copyright (C) <2010-2012> <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of ... | [
"lettuce.terrain.after.each_step",
"lettuce.terrain.after.each_scenario",
"lettuce.terrain.before.each_scenario",
"lettuce.core.fs.relpath",
"lettuce.terrain.after.all"
] | [((1431, 1484), 'lettuce.terrain.before.each_scenario', 'before.each_scenario', (['reporter.print_scenario_running'], {}), '(reporter.print_scenario_running)\n', (1451, 1484), False, 'from lettuce.terrain import before\n'), ((1485, 1533), 'lettuce.terrain.after.each_scenario', 'after.each_scenario', (['reporter.print_s... |
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2021 ominocutherium
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the righ... | [
"os.path.join"
] | [((4078, 4118), 'os.path.join', 'os.path.join', (['"""automation"""', '"""config.txt"""'], {}), "('automation', 'config.txt')\n", (4090, 4118), False, 'import os\n'), ((4142, 4182), 'os.path.join', 'os.path.join', (['"""automation"""', '"""config.txt"""'], {}), "('automation', 'config.txt')\n", (4154, 4182), False, 'im... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('hosts', '0002_sshconfig'),
('projects', '0002_auto_20140912_1509'),
]
operations = [
migrations.AddField(
... | [
"django.db.models.ForeignKey",
"django.db.models.CharField"
] | [((402, 491), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'verbose_name': "b'Value'", 'blank': '(True)', 'to': '"""hosts.SSHConfig"""', 'null': '(True)'}), "(verbose_name=b'Value', blank=True, to='hosts.SSHConfig',\n null=True)\n", (419, 491), False, 'from django.db import models, migrations\n'), ((619... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# 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... | [
"numpy.dot",
"numpy.matmul"
] | [((2452, 2490), 'numpy.dot', 'np.dot', (['img', '[24.966, 128.553, 65.481]'], {}), '(img, [24.966, 128.553, 65.481])\n', (2458, 2490), True, 'import numpy as np\n'), ((2526, 2628), 'numpy.matmul', 'np.matmul', (['img', '[[24.966, 112.0, -18.214], [128.553, -74.203, -93.786], [65.481, -37.797, \n 112.0]]'], {}), '(im... |
import time
import random
import os
from GPS import gps
from GPS import redisHelper
from GPS import helper
from GPS import args
from GPS import postProcess
# Parse the command line arguments, then, if provided, parse the arguments in
# the scenario file. Then adds default values for paramaters without definitions
# ... | [
"GPS.gps.gps",
"GPS.helper.cd",
"GPS.redisHelper.deleteDB",
"GPS.helper.generateID",
"GPS.helper.mkdir",
"GPS.gps.getLogger",
"GPS.redisHelper.getReadyCount",
"GPS.gps.getParamString",
"GPS.args.ArgumentParser",
"time.time",
"GPS.redisHelper.connect",
"time.sleep",
"random.randrange",
"GPS... | [((517, 538), 'GPS.args.ArgumentParser', 'args.ArgumentParser', ([], {}), '()\n', (536, 538), False, 'from GPS import args\n'), ((732, 770), 'GPS.helper.cd', 'helper.cd', (["arguments['experiment_dir']"], {}), "(arguments['experiment_dir'])\n", (741, 770), False, 'from GPS import helper\n'), ((816, 930), 'GPS.redisHelp... |
import sys
sys.path.append('/home/kenta/pinky')
from itertools import groupby
import time
from database import session
from model import Motion, Promise
def run_loop():
while True:
filepath = '/home/kenta/pinky/demon/test.log'
log_file = open(filepath,'a')
matching()
try:
... | [
"sys.path.append",
"itertools.groupby",
"database.session.delete",
"database.session.query",
"time.sleep",
"database.session.commit",
"database.session.bulk_save_objects",
"database.session.close"
] | [((11, 47), 'sys.path.append', 'sys.path.append', (['"""/home/kenta/pinky"""'], {}), "('/home/kenta/pinky')\n", (26, 47), False, 'import sys\n'), ((653, 715), 'itertools.groupby', 'groupby', (['all_motion'], {'key': '(lambda tmp_motion: tmp_motion.user_id)'}), '(all_motion, key=lambda tmp_motion: tmp_motion.user_id)\n'... |
"""Classes describing a FreeBSD Port and the various structures."""
from abc import ABCMeta, abstractmethod
from io import StringIO
from itertools import groupby
from math import ceil, floor
from pathlib import Path
from typing import (Any, Callable, Dict, Generic, IO, Iterable, Iterator, List, Optional, Set, Tuple, Ty... | [
"typing.cast",
"typing.TypeVar",
"io.StringIO"
] | [((578, 606), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'covariant': '(True)'}), "('T', covariant=True)\n", (585, 606), False, 'from typing import Any, Callable, Dict, Generic, IO, Iterable, Iterator, List, Optional, Set, Tuple, TypeVar, Union, cast\n'), ((4214, 4245), 'typing.TypeVar', 'TypeVar', (['"""T2"""'], {'bo... |
import os
import pytest
import numpy as np
import easy_dna as dna
def test_extract_from_input(tmpdir):
parts = []
for i in range(10):
part_id = "part_%s" % ("ABCDEFGHAB"[i]) # id is nonunique on purpose
alias = "part_%d" % i # alias is unique
part_length = np.random.randint(1000, 150... | [
"easy_dna.annotate_record",
"easy_dna.sequence_to_biopython_record",
"easy_dna.random_dna_sequence",
"pytest.raises",
"numpy.random.randint",
"easy_dna.extract_from_input"
] | [((1009, 1082), 'easy_dna.extract_from_input', 'dna.extract_from_input', ([], {'construct_list': 'constructs', 'output_path': 'target_dir'}), '(construct_list=constructs, output_path=target_dir)\n', (1031, 1082), True, 'import easy_dna as dna\n'), ((293, 322), 'numpy.random.randint', 'np.random.randint', (['(1000)', '(... |
# Generated by Django 3.2.7 on 2021-11-30 00:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('workOrder', '0005_remove_workorder_forg'),
]
operations = [
migrations.AddField(
model_name='workorder',
name='FORG'... | [
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((340, 374), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (359, 374), False, 'from django.db import migrations, models\n'), ((500, 544), 'django.db.models.CharField', 'models.CharField', ([], {'default': '""""""', 'max_length': '(256)'}), "(default='', max_... |
from django.contrib import admin
# Register your models here.
from blog.models import Post
admin.site.register(Post)
| [
"django.contrib.admin.site.register"
] | [((94, 119), 'django.contrib.admin.site.register', 'admin.site.register', (['Post'], {}), '(Post)\n', (113, 119), False, 'from django.contrib import admin\n')] |
#!/usr/bin/env python3
""" Basic python object resource pool.
"""
import copy
import time
import traceback
from threading import RLock, Thread
from contextlib import contextmanager
# Callback attribute name when adding a return callback to an object
CALLBACK_ATTRIBUTE = 'resource_pool_return_callback'
class AllRes... | [
"threading.Thread",
"traceback.print_exc",
"threading.RLock",
"copy.copy",
"time.sleep"
] | [((2057, 2075), 'copy.copy', 'copy.copy', (['objects'], {}), '(objects)\n', (2066, 2075), False, 'import copy\n'), ((2097, 2104), 'threading.RLock', 'RLock', ([], {}), '()\n', (2102, 2104), False, 'from threading import RLock, Thread\n'), ((5179, 5194), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (5189, 519... |
# -*- coding:utf-8 -*-
import logging
from toybox.simpleapi import run
from pyramid_rpc.jsonrpc import jsonrpc_method
# please: pip install pyramid_rpc
# see also: http://docs.pylonsproject.org/projects/pyramid_rpc/en/latest/jsonrpc.html
"""
python ./jsonrpc_server.py
$ echo '{"id": "1", "params": {"name": "foo"}, "me... | [
"pyramid_rpc.jsonrpc.jsonrpc_method",
"toybox.simpleapi.run",
"logging.basicConfig",
"toybox.simpleapi.run.include"
] | [((456, 486), 'pyramid_rpc.jsonrpc.jsonrpc_method', 'jsonrpc_method', ([], {'endpoint': '"""api"""'}), "(endpoint='api')\n", (470, 486), False, 'from pyramid_rpc.jsonrpc import jsonrpc_method\n'), ((700, 740), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (71... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^(?P<slug>[a-z0-9-_]+?)-(?P<product_id>[0-9]+)/$',
views.product_details, name='details'),
url(r'^category/(?P<path>[a-z0-9-_/]+?)-(?P<category_id>[0-9]+)/$',
views.category_index, name='category'),
url(r'^brand/(?P... | [
"django.conf.urls.url"
] | [((75, 174), 'django.conf.urls.url', 'url', (['"""^(?P<slug>[a-z0-9-_]+?)-(?P<product_id>[0-9]+)/$"""', 'views.product_details'], {'name': '"""details"""'}), "('^(?P<slug>[a-z0-9-_]+?)-(?P<product_id>[0-9]+)/$', views.\n product_details, name='details')\n", (78, 174), False, 'from django.conf.urls import url\n'), ((... |
import unittest
from jarr.controllers.feed_builder import FeedBuilderController as FBC
from jarr.lib.enums import FeedType
class ConstructFeedFromTest(unittest.TestCase):
@property
def jdh_feed(self):
return {'icon_url': 'https://www.journalduhacker.net/assets/jdh-ico-31'
... | [
"jarr.controllers.feed_builder.FeedBuilderController"
] | [((821, 860), 'jarr.controllers.feed_builder.FeedBuilderController', 'FBC', (['"""https://www.journalduhacker.net/"""'], {}), "('https://www.journalduhacker.net/')\n", (824, 860), True, 'from jarr.controllers.feed_builder import FeedBuilderController as FBC\n'), ((965, 999), 'jarr.controllers.feed_builder.FeedBuilderCo... |
# coding=utf-8
import tensorflow as tf
import numpy as np
import helpers
tf.reset_default_graph()
sess = tf.InteractiveSession()
PAD = 0
EOS = 1
vocab_size = 10
input_embedding_size = 20
encoder_hidden_units = 512
decoder_hidden_units = encoder_hidden_units * 2
# define inputs
encoder_input = tf.placeholder(shape=(... | [
"tensorflow.reset_default_graph",
"numpy.ones",
"tensorflow.contrib.layers.linear",
"tensorflow.nn.bidirectional_dynamic_rnn",
"tensorflow.InteractiveSession",
"tensorflow.one_hot",
"tensorflow.contrib.rnn.LSTMStateTuple",
"tensorflow.concat",
"tensorflow.placeholder",
"helpers.batch",
"tensorfl... | [((75, 99), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (97, 99), True, 'import tensorflow as tf\n'), ((107, 130), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (128, 130), True, 'import tensorflow as tf\n'), ((298, 371), 'tensorflow.placeholder', 'tf.plac... |
import math
import pygame as pg
from collections import OrderedDict
from data.core import tools, constants
from data.components.labels import Button, ButtonGroup
from data.components.special_buttons import GameButton, NeonButton
from data.components.animation import Animation
from data.components.state_machine import... | [
"data.core.tools.strip_from_sheet",
"data.components.labels.Button",
"pygame.Rect",
"data.components.special_buttons.GameButton",
"data.components.labels.ButtonGroup",
"pygame.sprite.Group",
"data.components.special_buttons.NeonButton",
"data.components.animation.Animation",
"data.core.tools.scaled_... | [((677, 694), 'pygame.sprite.Group', 'pg.sprite.Group', ([], {}), '()\n', (692, 694), True, 'import pygame as pg\n'), ((762, 800), 'pygame.Rect', 'pg.Rect', (['(0, 0)', 'constants.RENDER_SIZE'], {}), '((0, 0), constants.RENDER_SIZE)\n', (769, 800), True, 'import pygame as pg\n'), ((1177, 1215), 'data.components.labels.... |
# Copyright (c) 2020 <NAME>
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
from os import listdir, path
from time import sleep, strftime
from PIL import Image, ImageDraw
from threading import Thread
from math import floor
class pic:
def __init__(self, fpath, cropFactor... | [
"threading.Thread",
"PIL.Image.new",
"os.path.basename",
"math.floor",
"time.strftime",
"time.sleep",
"PIL.Image.open",
"os.path.getmtime",
"PIL.ImageDraw.Draw",
"os.listdir"
] | [((3023, 3039), 'os.listdir', 'listdir', (['rawPath'], {}), '(rawPath)\n', (3030, 3039), False, 'from os import listdir, path\n'), ((4870, 4878), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (4875, 4878), False, 'from time import sleep, strftime\n'), ((5384, 5432), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(mapWi... |
# Copyright 2021 <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... | [
"numpy.sum",
"numpy.log",
"numpy.median",
"numpy.asarray",
"open3d.geometry.KDTreeFlann",
"numpy.linalg.eig",
"numpy.mean",
"numpy.linalg.inv",
"numpy.linalg.norm",
"numpy.linalg.det",
"numpy.cov"
] | [((797, 829), 'open3d.geometry.KDTreeFlann', 'o3d.geometry.KDTreeFlann', (['pc_map'], {}), '(pc_map)\n', (821, 829), True, 'import open3d as o3d\n'), ((843, 868), 'numpy.asarray', 'np.asarray', (['pc_map.points'], {}), '(pc_map.points)\n', (853, 868), True, 'import numpy as np\n'), ((1367, 1399), 'open3d.geometry.KDTre... |
import tensorflow as tf
from tensorflow.keras import layers
from tensorflow.python.ops.gen_image_ops import resize_nearest_neighbor
@tf.function
def kp2gaussian(kp_value, spatial_size, kp_variance):
"""
Transform a keypoint into gaussian like representation
"""
mean = kp_value # B, 10, 2
coordin... | [
"tensorflow.reduce_sum",
"tensorflow.reshape",
"tensorflow.keras.backend.spatial_2d_padding",
"tensorflow.nn.conv2d",
"tensorflow.repeat",
"tensorflow.split",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.python.ops.gen_image_ops.resize_nearest_neighbor",
"tensorflow.concat",
"tensorfl... | [((408, 433), 'tensorflow.shape', 'tf.shape', (['coordinate_grid'], {}), '(coordinate_grid)\n', (416, 433), True, 'import tensorflow as tf\n'), ((456, 524), 'tensorflow.reshape', 'tf.reshape', (['coordinate_grid', '[1, grid_shape[0], grid_shape[1], 1, 2]'], {}), '(coordinate_grid, [1, grid_shape[0], grid_shape[1], 1, 2... |
import os, sys
import unittest
import tlsh
from logging import *
sys.path.append(os.path.join(os.path.dirname(__file__),'UT'))
# from ut_trendx_predictor import TrendXPredictorTestCase
from ut_dna_manager import DNAManagerTestCase
from ut_housecallx_report import HouseCallXReportTestCase
from ut_trendx_wrappe... | [
"unittest.main",
"ut_workflow.AdversaryWorkflowTestCase",
"os.getpid",
"unittest.TestSuite",
"os.path.dirname"
] | [((569, 589), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (587, 589), False, 'import unittest\n'), ((3420, 3454), 'unittest.main', 'unittest.main', ([], {'defaultTest': '"""suite"""'}), "(defaultTest='suite')\n", (3433, 3454), False, 'import unittest\n'), ((100, 125), 'os.path.dirname', 'os.path.dirna... |
# Copyright 2013, AnsibleWorks Inc.
# <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/licenses/LICENSE-2.0
#
# Unless required by applicable law... | [
"exceptions.NotImplementedError"
] | [((791, 823), 'exceptions.NotImplementedError', 'exceptions.NotImplementedError', ([], {}), '()\n', (821, 823), False, 'import exceptions\n')] |
from flask import Flask, send_from_directory, jsonify
import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
CLIENT_DIR = os.path.join(BASE_DIR, "client", "dist")
STATIC_DIR = os.path.join(BASE_DIR, "static")
app = Flask(__name__)
app.secret_key = "Developer Key"
@app.route('/')
def index():
return sen... | [
"os.path.dirname",
"flask.Flask",
"flask.jsonify",
"flask.send_from_directory",
"os.path.join"
] | [((132, 172), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""client"""', '"""dist"""'], {}), "(BASE_DIR, 'client', 'dist')\n", (144, 172), False, 'import os\n'), ((186, 218), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""static"""'], {}), "(BASE_DIR, 'static')\n", (198, 218), False, 'import os\n'), ((226, 241), ... |
from flask import Flask, request
import argparse
import time
import threading
from p4_controller import P4Controller
from state_allocator import EntryManager
app = Flask(__name__)
p4_controller = None
entry_manager = None
@app.route('/test')
def test():
return "Hello from switch control plane controller~!"
@ap... | [
"argparse.ArgumentParser",
"flask.Flask",
"p4_controller.P4Controller",
"time.time",
"state_allocator.EntryManager",
"flask.request.get_json"
] | [((165, 180), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (170, 180), False, 'from flask import Flask, request\n'), ((400, 418), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (416, 418), False, 'from flask import Flask, request\n'), ((818, 836), 'flask.request.get_json', 'request.get_j... |
from docutils import nodes
import sphinx.domains.std
# Borrowed from: http://stackoverflow.com/questions/13848328/sphinx-references-to-other-sections-containing-section-number-and-section-title
class CustomStandardDomain(sphinx.domains.std.StandardDomain):
def __init__(self, env):
env.settings['footnote_references... | [
"docutils.nodes.Text"
] | [((1583, 1654), 'docutils.nodes.Text', 'nodes.Text', (["('Chapter %s Section %s - %s' % (chapter, section, textnode))"], {}), "('Chapter %s Section %s - %s' % (chapter, section, textnode))\n", (1593, 1654), False, 'from docutils import nodes\n'), ((1694, 1745), 'docutils.nodes.Text', 'nodes.Text', (["('Chapter %s - %s'... |
import torch
from torch.utils.data import TensorDataset
from torchvision import datasets, transforms
from base import BaseDataLoader, BaseDataLoader_2
from torch.utils.data import DataLoader
import numpy as np
import pandas as pd
from .utils import readmts_uci_har, transform_labels
class MnistDataLoader(BaseDataLoader... | [
"numpy.random.seed",
"numpy.random.shuffle",
"torchvision.transforms.ToTensor",
"numpy.array",
"torch.utils.data.TensorDataset",
"torchvision.transforms.Normalize",
"torchvision.datasets.MNIST",
"numpy.concatenate",
"torch.from_numpy"
] | [((694, 771), 'torchvision.datasets.MNIST', 'datasets.MNIST', (['self.data_dir'], {'train': 'training', 'download': '(True)', 'transform': 'trsfm'}), '(self.data_dir, train=training, download=True, transform=trsfm)\n', (708, 771), False, 'from torchvision import datasets, transforms\n'), ((1583, 1616), 'numpy.concatena... |
#-------------------------------------------------------------------------------
#
# Aggregated Magnetic Model
#
# Author: <NAME> <<EMAIL>>
#
#-------------------------------------------------------------------------------
# Copyright (C) 2018 EOX IT Services GmbH
#
# Permission is hereby granted, free of charge, to a... | [
"numpy.asarray",
"numpy.zeros",
"collections.namedtuple"
] | [((1678, 1736), 'collections.namedtuple', 'namedtuple', (['"""_Component"""', "['model', 'scale', 'parameters']"], {}), "('_Component', ['model', 'scale', 'parameters'])\n", (1688, 1736), False, 'from collections import namedtuple\n'), ((3161, 3174), 'numpy.asarray', 'asarray', (['time'], {}), '(time)\n', (3168, 3174),... |
"""
Author: Igor
Date: 2020.06.07
"""
import logging
import sys
from datetime import datetime
from logging.handlers import TimedRotatingFileHandler
LOG_FORMATTING_STRING = logging.Formatter('%(asctime)s - %(module)s - %(filename)s - '
'%(lineno)d - %(levelname)s - %(message)... | [
"logging.StreamHandler",
"logging.Formatter",
"datetime.datetime.utcnow",
"logging.handlers.TimedRotatingFileHandler",
"logging.getLogger"
] | [((174, 288), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s - %(module)s - %(filename)s - %(lineno)d - %(levelname)s - %(message)s"""'], {}), "(\n '%(asctime)s - %(module)s - %(filename)s - %(lineno)d - %(levelname)s - %(message)s'\n )\n", (191, 288), False, 'import logging\n'), ((450, 511), 'logg... |
import operator
import sqlalchemy
import pandas as pd
import numpy as np
from math import ceil
DEFAULT_VARCHAR_LENGTH=100
def get_detected_column_types(df):
""" Get data type of each columns ('DATETIME', 'NUMERIC' or 'STRING')
Parameters:
df (df): pandas dataframe
Returns
df (df): datafr... | [
"numpy.vectorize",
"sqlalchemy.types.DateTime",
"math.ceil",
"sqlalchemy.types.INTEGER",
"sqlalchemy.types.VARCHAR",
"pandas.to_datetime",
"sqlalchemy.types.Text",
"sqlalchemy.types.DECIMAL",
"pandas.to_numeric"
] | [((1950, 1967), 'numpy.vectorize', 'np.vectorize', (['len'], {}), '(len)\n', (1962, 1967), True, 'import numpy as np\n'), ((983, 1007), 'pandas.to_datetime', 'pd.to_datetime', (['col_data'], {}), '(col_data)\n', (997, 1007), True, 'import pandas as pd\n'), ((1422, 1443), 'pandas.to_numeric', 'pd.to_numeric', (['series'... |