code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
byceps.services.authentication.password.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 <NAME>
:License: Revised BSD (see `LICENSE` file for details)
"""
from datetime import datetime
from typing import Optional
from werkzeug.security import (
check_password_hash as _check_passw... | [
"werkzeug.security.generate_password_hash",
"werkzeug.security.check_password_hash",
"datetime.datetime.utcnow"
] | [((829, 891), 'werkzeug.security.generate_password_hash', '_generate_password_hash', (['password'], {'method': 'PASSWORD_HASH_METHOD'}), '(password, method=PASSWORD_HASH_METHOD)\n', (852, 891), True, 'from werkzeug.security import check_password_hash as _check_password_hash, generate_password_hash as _generate_password... |
from __future__ import annotations
from manim import *
from manim.utils.testing.frames_comparison import frames_comparison
__module_test__ = "updaters"
@frames_comparison(last_frame=False)
def test_Updater(scene):
dot = Dot()
square = Square()
scene.add(dot, square)
square.add_updater(lambda m: m.ne... | [
"manim.utils.testing.frames_comparison.frames_comparison"
] | [((157, 192), 'manim.utils.testing.frames_comparison.frames_comparison', 'frames_comparison', ([], {'last_frame': '(False)'}), '(last_frame=False)\n', (174, 192), False, 'from manim.utils.testing.frames_comparison import frames_comparison\n'), ((641, 676), 'manim.utils.testing.frames_comparison.frames_comparison', 'fra... |
#!/usr/bin/python3
# lltapes.py - Uses BeautifulSoup and requests to parse and download episodes
# from lovelinetapes.
import re
import sys
import os
import logging
import argparse
# for multi-threading
from queue import Queue
from threading import Thread
import requests
from bs4 import BeautifulSoup
U... | [
"logging.basicConfig",
"logging.getLogger",
"os.path.getsize",
"argparse.ArgumentParser",
"logging.warning",
"os.path.join",
"requests.get",
"bs4.BeautifulSoup",
"os.path.isfile",
"os.path.basename",
"sys.exit",
"os.path.abspath",
"queue.Queue",
"logging.info",
"re.search"
] | [((1098, 1142), 'logging.info', 'logging.info', (["('Downloading page %s...' % url)"], {}), "('Downloading page %s...' % url)\n", (1110, 1142), False, 'import logging\n'), ((1153, 1170), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1165, 1170), False, 'import requests\n'), ((1210, 1241), 'bs4.BeautifulSou... |
#!/usr/bin/env python3
'''
Kubeflow documentation: https://kubeflow-pipelines.readthedocs.io/en/latest/_modules/kfp/dsl/_container_op.html
K8S documentation: https://github.com/kubernetes-client/python/blob/02ef5be4ecead787961037b236ae498944040b43/kubernetes/docs/V1Container.md
Example Triton Inference Server Mod... | [
"triton_ops.TritonVolume",
"triton_ops.TritonDeploy",
"kfp.dsl.pipeline",
"kfp.compiler.Compiler",
"triton_ops.TritonDownload",
"kubernetes.client.V1VolumeMount",
"triton_ops.TritonService",
"kubernetes.client.V1PersistentVolumeClaimVolumeSource",
"kubernetes.client.V1ContainerPort",
"kfp.dsl.Cond... | [((1249, 1322), 'kfp.dsl.pipeline', 'dsl.pipeline', ([], {'name': '"""tritonPipeline"""', 'description': '"""Deploy a Triton server"""'}), "(name='tritonPipeline', description='Deploy a Triton server')\n", (1261, 1322), True, 'import kfp.dsl as dsl\n'), ((1796, 1856), 'triton_ops.TritonVolume', 'triton_ops.TritonVolume... |
# coding=utf-8
# Copyright 2021-present, the Recognai S.L. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | [
"pydantic.Field",
"rubrix.client.models.TokenClassificationRecord",
"pydantic.validator"
] | [((1161, 1211), 'pydantic.Field', 'Field', ([], {'min_length': '(1)', 'max_length': 'MAX_KEYWORD_LENGTH'}), '(min_length=1, max_length=MAX_KEYWORD_LENGTH)\n', (1166, 1211), False, 'from pydantic import BaseModel, Field, validator\n'), ((1231, 1265), 'pydantic.Field', 'Field', ([], {'default': '(1.0)', 'ge': '(0.0)', 'l... |
#!/usr/bin/python
from distutils.core import setup
setup(
name='snapboard',
version='0.2.1',
author='<NAME>',
maintainer='SNAPboard developers',
maintainer_email='<EMAIL>',
url='http://code.google.com/p/snapboard/',
description='Bulletin board application for Django.',
long_description='... | [
"distutils.core.setup"
] | [((51, 1875), 'distutils.core.setup', 'setup', ([], {'name': '"""snapboard"""', 'version': '"""0.2.1"""', 'author': '"""<NAME>"""', 'maintainer': '"""SNAPboard developers"""', 'maintainer_email': '"""<EMAIL>"""', 'url': '"""http://code.google.com/p/snapboard/"""', 'description': '"""Bulletin board application for Djang... |
import plotly.plotly as py
import plotly.graph_objs as go
from plotly.offline import iplot,init_notebook_mode
import numpy as np
from sklearn.neighbors import NearestNeighbors
# plotly.tools.set_credentials_file(username='', api_key='')
def get_plot(pclouds=None,id_of_obj = 0,name = 'chair',mode=False):
init_note... | [
"plotly.graph_objs.Figure",
"plotly.offline.init_notebook_mode",
"plotly.offline.iplot",
"plotly.plotly.iplot"
] | [((311, 335), 'plotly.offline.init_notebook_mode', 'init_notebook_mode', (['mode'], {}), '(mode)\n', (329, 335), False, 'from plotly.offline import iplot, init_notebook_mode\n'), ((865, 900), 'plotly.graph_objs.Figure', 'go.Figure', ([], {'data': 'data', 'layout': 'layout'}), '(data=data, layout=layout)\n', (874, 900),... |
import sys
import time
import random
from .address import Address
__all__ = [
'NameServers',
'NoNameServer',
]
class NoNameServer(Exception):
pass
class IterMixIn:
def iter(self):
if not self.data: raise NoNameServer
return iter(self.data)
def success(self, item):
pass
... | [
"time.time"
] | [((536, 547), 'time.time', 'time.time', ([], {}), '()\n', (545, 547), False, 'import time\n'), ((586, 597), 'time.time', 'time.time', ([], {}), '()\n', (595, 597), False, 'import time\n')] |
#!/usr/bin/env python
# coding: utf-8
# # Conditional GAN으로 생성 컨트롤하기
import os
import torch
import torchvision
import torch.nn as nn
import torch.optim as optim
from torchvision import transforms, datasets
from torchvision.utils import save_image
import matplotlib.pyplot as plt
torch.manual_seed(1) # reproducibl... | [
"matplotlib.pyplot.imshow",
"torch.manual_seed",
"torch.nn.Sigmoid",
"torch.nn.ReLU",
"torch.nn.Tanh",
"torch.nn.LeakyReLU",
"matplotlib.pyplot.show",
"torch.eye",
"torch.randn",
"torch.nn.BCELoss",
"torch.cuda.is_available",
"torch.nn.Linear",
"torch.utils.data.DataLoader",
"torchvision.t... | [((283, 303), 'torch.manual_seed', 'torch.manual_seed', (['(1)'], {}), '(1)\n', (300, 303), False, 'import torch\n'), ((383, 408), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (406, 408), False, 'import torch\n'), ((740, 826), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', ([],... |
"""
Copyright (c) 2021, salesforce.com, inc.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
"""
import os
import hydra
from hydra.utils import to_absolute_path
from omegaconf import DictConfig, Omeg... | [
"trainer.Trainer",
"omegaconf.open_dict",
"hydra.main",
"os.environ.get",
"omegaconf.OmegaConf.load",
"src.p_tuning.relation_classification.RelationClassifier",
"trainer.set_seed",
"hydra.utils.to_absolute_path",
"torch.cuda.is_available",
"omegaconf.OmegaConf.to_container",
"src.data_utils.data... | [((1596, 1654), 'hydra.main', 'hydra.main', ([], {'config_path': '"""../configs"""', 'config_name': '"""config"""'}), "(config_path='../configs', config_name='config')\n", (1606, 1654), False, 'import hydra\n'), ((913, 938), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (936, 938), False, 'imp... |
from flask import Flask
from flask_babel import Babel
from flask_sqlalchemy import SQLAlchemy
from flask_mail import Mail
from flask_login import LoginManager
from flask_pagedown import PageDown
from flask_moment import Moment
from flask_whooshee import Whooshee
from config import config
babel = Babel()
db = SQLAlche... | [
"flask_pagedown.PageDown",
"flask_login.LoginManager",
"flask_mail.Mail",
"flask.Flask",
"flask_babel.Babel",
"flask_moment.Moment",
"flask_sslify.SSLify",
"flask_sqlalchemy.SQLAlchemy",
"flask_whooshee.Whooshee"
] | [((299, 306), 'flask_babel.Babel', 'Babel', ([], {}), '()\n', (304, 306), False, 'from flask_babel import Babel\n'), ((312, 324), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (322, 324), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((331, 345), 'flask_login.LoginManager', 'LoginManager', ([], ... |
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from . import views
from . import forms
app_name = 'accounts'
urlpatterns = [
url(r'login/$', auth_views.LoginView.as_view(
template_name='accounts/login.html', authentication_form=forms.CustomAuthForm), name='login'),
... | [
"django.contrib.auth.views.LoginView.as_view",
"django.conf.urls.url",
"django.contrib.auth.views.LogoutView.as_view"
] | [((453, 511), 'django.conf.urls.url', 'url', (['"""dashboard/$"""', 'views.user_dashboard'], {'name': '"""dashboard"""'}), "('dashboard/$', views.user_dashboard, name='dashboard')\n", (456, 511), False, 'from django.conf.urls import url\n'), ((185, 296), 'django.contrib.auth.views.LoginView.as_view', 'auth_views.LoginV... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017, Data61
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# ABN 41 687 119 230.
#
# This software may be distributed and modified according to the terms of
# the BSD 2-Clause license. Note that NO WARRANTY is provided.
# See "LICENSE... | [
"subprocess.check_output",
"six.moves.range",
"camkes.internal.memoization.memoize",
"os.environ.get",
"capdl.page_sizes",
"capdl.Cap",
"capdl.lookup_architecture"
] | [((1097, 1106), 'camkes.internal.memoization.memoize', 'memoize', ([], {}), '()\n', (1104, 1106), False, 'from camkes.internal.memoization import memoize\n'), ((3210, 3251), 'capdl.lookup_architecture', 'lookup_architecture', (['options.architecture'], {}), '(options.architecture)\n', (3229, 3251), False, 'from capdl i... |
# coding: utf-8
import pymysql
import numpy as np
import pandas as pd
import csv
import xgboost as xgb
from numpy import loadtxt
from xgboost import XGBClassifier
from xgboost import plot_importance
from xgboost import plot_tree
# 필요한 다른 python 파일
import feature
###################### DB connect
db = pymysql.conne... | [
"feature.order_ratio_bychance",
"pandas.merge",
"feature.latest_order",
"pymysql.connect",
"pandas.read_sql"
] | [((307, 369), 'pymysql.connect', 'pymysql.connect', ([], {'host': '""""""', 'port': '(3306)', 'user': '""""""', 'passwd': '""""""', 'db': '""""""'}), "(host='', port=3306, user='', passwd='', db='')\n", (322, 369), False, 'import pymysql\n'), ((507, 527), 'pandas.read_sql', 'pd.read_sql', (['SQL', 'db'], {}), '(SQL, db... |
import unittest
from ldapauthkeys.config import *
from ldapauthkeys.util import *
import glob
import os
class TestMyCode(unittest.TestCase):
def test_cert_to_sshkey(self):
list_of_files = glob.glob('/usr/share/ca-certificates/mozilla/*')
latest_file = max(list_of_files, key=os.path.getctime)
f = open(lat... | [
"glob.glob"
] | [((195, 244), 'glob.glob', 'glob.glob', (['"""/usr/share/ca-certificates/mozilla/*"""'], {}), "('/usr/share/ca-certificates/mozilla/*')\n", (204, 244), False, 'import glob\n')] |
"""
==========================
Yet another Sankey diagram
==========================
This example showcases a more complex sankey diagram.
"""
from __future__ import print_function
__author__ = "<NAME> <<EMAIL>>"
__version__ = "Time-stamp: <10/02/2010 16:49 <EMAIL>>"
import numpy as np
def sankey(ax,
o... | [
"numpy.radians",
"matplotlib.path.Path",
"numpy.absolute",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.patches.PathPatch",
"numpy.sign",
"matplotlib.pyplot.show"
] | [((1071, 1091), 'numpy.absolute', 'np.absolute', (['outputs'], {}), '(outputs)\n', (1082, 1091), True, 'import numpy as np\n'), ((1107, 1123), 'numpy.sign', 'np.sign', (['outputs'], {}), '(outputs)\n', (1114, 1123), True, 'import numpy as np\n'), ((1171, 1190), 'numpy.absolute', 'np.absolute', (['inputs'], {}), '(input... |
# ------------------------------------------------------------------------------
# Functions for parsing and rendering inline markup.
# ------------------------------------------------------------------------------
import html
import hashlib
import re
# ---------------------------------------------------------------... | [
"html.escape",
"re.compile"
] | [((492, 517), 're.compile', 're.compile', (['"""\\\\*(\\\\S)\\\\*"""'], {}), "('\\\\*(\\\\S)\\\\*')\n", (502, 517), False, 'import re\n'), ((544, 586), 're.compile', 're.compile', (['"""\\\\*(\\\\S.*?\\\\S)\\\\*"""', 're.DOTALL'], {}), "('\\\\*(\\\\S.*?\\\\S)\\\\*', re.DOTALL)\n", (554, 586), False, 'import re\n'), ((6... |
import configparser
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class SettingsDialog(Gtk.Dialog):
def __init__(self, parent, config_file):
buttons = (Gtk.STOCK_OK, Gtk.ResponseType.OK)
Gtk.Dialog.__init__(self, "Settings", parent, 0, buttons)
# Load defaults f... | [
"gi.repository.Gtk.RadioButton.new_with_label_from_widget",
"gi.repository.Gtk.SpinButton",
"gi.repository.Gtk.HBox",
"gi.require_version",
"gi.repository.Gtk.Label",
"gi.repository.Gtk.Entry",
"gi.repository.Gtk.Dialog.__init__",
"gi.repository.Gtk.Adjustment",
"configparser.SafeConfigParser"
] | [((30, 62), 'gi.require_version', 'gi.require_version', (['"""Gtk"""', '"""3.0"""'], {}), "('Gtk', '3.0')\n", (48, 62), False, 'import gi\n'), ((236, 293), 'gi.repository.Gtk.Dialog.__init__', 'Gtk.Dialog.__init__', (['self', '"""Settings"""', 'parent', '(0)', 'buttons'], {}), "(self, 'Settings', parent, 0, buttons)\n"... |
import ast
import io
from pyeval.code_transform import ASTNodeTransformer
from pyeval.user_shell import UserShell
def test_execute_code():
buf = io.StringIO()
user_shell = UserShell(print_file=buf)
user_shell.execute_code("a = 1; a + 1; b = 2; a + b")
result = buf.getvalue()
assert result == "2\n... | [
"pyeval.user_shell.UserShell",
"io.StringIO"
] | [((152, 165), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (163, 165), False, 'import io\n'), ((183, 208), 'pyeval.user_shell.UserShell', 'UserShell', ([], {'print_file': 'buf'}), '(print_file=buf)\n', (192, 208), False, 'from pyeval.user_shell import UserShell\n'), ((536, 549), 'io.StringIO', 'io.StringIO', ([], {}... |
"""ISU Soil Moisture Network Time Series"""
import datetime
import psycopg2
import pytz
import pandas as pd
from pandas.io.sql import read_sql
import matplotlib.dates as mdates
from pyiem import meteorology
from pyiem.plot.use_agg import plt
from pyiem.datatypes import temperature, distance
from pyiem.util import get_... | [
"pytz.timezone",
"pyiem.datatypes.distance",
"matplotlib.dates.DateFormatter",
"pandas.io.sql.read_sql",
"pyiem.meteorology.clearsky_shortwave_irradiance_year",
"pyiem.util.get_dbconn",
"datetime.datetime.now",
"matplotlib.dates.DayLocator",
"pyiem.datatypes.temperature",
"datetime.timedelta",
"... | [((2752, 2770), 'pyiem.plot.use_agg.plt.subplots', 'plt.subplots', (['(1)', '(1)'], {}), '(1, 1)\n', (2764, 2770), False, 'from pyiem.plot.use_agg import plt\n'), ((3606, 3741), 'pyiem.meteorology.clearsky_shortwave_irradiance_year', 'meteorology.clearsky_shortwave_irradiance_year', (["ctx['_nt'].sts[ctx['station']]['l... |
import board
import digitalio
class Button:
def __init__(self, pin):
self._id = pin.id
self.button = digitalio.DigitalInOut(pin)
self.button.direction = digitalio.Direction.INPUT
self.button.pull = digitalio.Pull.UP
def isPressed(self):
return self.button.value == False... | [
"digitalio.DigitalInOut"
] | [((122, 149), 'digitalio.DigitalInOut', 'digitalio.DigitalInOut', (['pin'], {}), '(pin)\n', (144, 149), False, 'import digitalio\n')] |
import warnings
warnings.filterwarnings("ignore", message=r"Passing", category=FutureWarning)
import itertools
import os
import random
from opentamp.envs import MJCEnv
from core.parsing import parse_domain_config, parse_problem_config
import main
import policy_hooks.namo.sorting_prob_11 as prob_gen
from pma.namo_grip_... | [
"random.shuffle",
"os.environ.get",
"core.parsing.parse_domain_config.ParseDomainConfig.parse",
"os.getcwd",
"core.parsing.parse_problem_config.ParseProblemConfig.parse",
"main.parse_file_to_dict",
"core.util_classes.openrave_body.OpenRAVEBody.get_wall_dims",
"warnings.filterwarnings",
"opentamp.env... | [((16, 92), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'message': '"""Passing"""', 'category': 'FutureWarning'}), "('ignore', message='Passing', category=FutureWarning)\n", (39, 92), False, 'import warnings\n'), ((1070, 1115), 'main.parse_file_to_dict', 'main.parse_file_to_dict', (['prob_... |
import unittest
from multiprocessing import Process
from threading import Thread
from lib.sushi.tools import HttpMethod
from lib.sushi.tools.utils import Query
from ..sushi.tools import parameter, expose, application
def pi():
return 3.1415
def square(x):
return x * x
def pow(x, y):
return pow(x, y)
... | [
"lib.sushi.tools.utils.Query"
] | [((592, 630), 'lib.sushi.tools.utils.Query', 'Query', ([], {'name': '"""x"""', 'default': 'None', 'cls': 'str'}), "(name='x', default=None, cls=str)\n", (597, 630), False, 'from lib.sushi.tools.utils import Query\n'), ((1011, 1049), 'lib.sushi.tools.utils.Query', 'Query', ([], {'name': '"""x"""', 'default': 'None', 'cl... |
import pickle
class CorpusRepo:
def __init__(self):
with open("fyj/fyj_lm_md.pkl", 'rb') as f:
self.fyj_lm = pickle.load(f)
with open('fyj/fyj_sentences_md.pkl', 'rb') as f:
self.fyj_sentences = pickle.load(f)
with open("en_docs_lms/moby_lm_md.pkl", 'rb') as f:
... | [
"pickle.load"
] | [((136, 150), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (147, 150), False, 'import pickle\n'), ((243, 257), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (254, 257), False, 'import pickle\n'), ((346, 360), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (357, 360), False, 'import pickle\n'), ((463, ... |
from __future__ import unicode_literals
from django.db import models
class CloudRing(models.Model):
class Meta:
db_table = 'cloudring'
app_label = 'dashboard'
identifier = models.CharField(max_length=50)
USERNAME_FIELD = 'identifier'
class CloudNode(models.Model):
class Meta:
... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((201, 232), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (217, 232), False, 'from django.db import models\n'), ((398, 429), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (414, 429), False, 'from django.db im... |
# -*- coding: utf-8 -*-
# @File : session.py
# @Date : 2021/2/25
# @Desc :
from Lib.api import data_return
from Lib.configs import Session_MSG_ZH, CODE_MSG_ZH, RPC_SESSION_OPER_SHORT_REQ, CODE_MSG_EN, Session_MSG_EN
from Lib.log import logger
from Lib.method import Method
from Lib.notice import Notice
from Lib.rpcc... | [
"Lib.log.logger.error",
"Lib.configs.CODE_MSG_ZH.get",
"Lib.configs.CODE_MSG_EN.get",
"Msgrpc.serializers.SessionLibSerializer",
"Lib.rpcclient.RpcClient.call",
"Lib.configs.Session_MSG_ZH.get",
"Lib.xcache.Xcache.set_session_info",
"Lib.configs.Session_MSG_EN.get",
"Lib.sessionlib.SessionLib"
] | [((753, 816), 'Lib.sessionlib.SessionLib', 'SessionLib', (['sessionid'], {'rightinfo': '(True)', 'uacinfo': '(True)', 'pinfo': '(True)'}), '(sessionid, rightinfo=True, uacinfo=True, pinfo=True)\n', (763, 816), False, 'from Lib.sessionlib import SessionLib\n'), ((1216, 1256), 'Lib.xcache.Xcache.set_session_info', 'Xcach... |
try:
import commentjson as json
except ImportError:
import json
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Compare two JSON graphs')
parser.add_argument('--modelA', required=True, type=str, dest='modelFilenameA',
help='Filename of th... | [
"json.load",
"argparse.ArgumentParser"
] | [((129, 191), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Compare two JSON graphs"""'}), "(description='Compare two JSON graphs')\n", (152, 191), False, 'import argparse\n'), ((655, 667), 'json.load', 'json.load', (['f'], {}), '(f)\n', (664, 667), False, 'import json\n'), ((1239, 1251... |
import selectors
import threading
from datetime import datetime
import evdev
from evdev import InputDevice, categorize, ecodes
from app.readers.exceptions import ReaderNotFound
from app.readers.nfc.cards.mifare_classic import MifareClassicCard
from app.readers.port import Port
from app.utils.time import utc_now
SCAN... | [
"app.utils.time.utc_now",
"evdev.list_devices",
"app.readers.port.Port",
"evdev.InputDevice",
"app.readers.exceptions.ReaderNotFound",
"app.readers.nfc.cards.mifare_classic.MifareClassicCard",
"selectors.DefaultSelector",
"evdev.categorize"
] | [((2063, 2090), 'selectors.DefaultSelector', 'selectors.DefaultSelector', ([], {}), '()\n', (2088, 2090), False, 'import selectors\n'), ((1610, 1631), 'evdev.InputDevice', 'evdev.InputDevice', (['fn'], {}), '(fn)\n', (1627, 1631), False, 'import evdev\n'), ((2857, 2879), 'evdev.InputDevice', 'InputDevice', (['port.path... |
# !python3
# coding=UTF-8
'''每小时判断一次,判断是否为上午09点'''
import sys # 系统调用
import os # 用于获取脚本的绝对路径
# 从单一文件ConnectToUSTC.py中引入依赖的方式:其中ConnectToUSTC.py用到的依赖不需要再次引入
from ConnectToUSTC import getYmlConfig, conn_USTC # 连接USTC统一身份认证
from Sign import USTC_dailysign, USTC_dailysign_selenium # 进行一次每日上报
import time # 系统时间
'''自动... | [
"ConnectToUSTC.getYmlConfig",
"ConnectToUSTC.conn_USTC",
"time.sleep",
"Sign.USTC_dailysign_selenium",
"Sign.USTC_dailysign",
"os.path.abspath",
"time.localtime"
] | [((362, 390), 'os.path.abspath', 'os.path.abspath', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (377, 390), False, 'import os\n'), ((463, 500), 'ConnectToUSTC.getYmlConfig', 'getYmlConfig', (["(abs_dir + '/config.yml')"], {}), "(abs_dir + '/config.yml')\n", (475, 500), False, 'from ConnectToUSTC import getYmlConfig, conn... |
# coding: utf-8
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
from oci_cli_resource_search.generated import resourcesearch_cli
from oci_cli import cli_util
from oci_cli import json_skeleton_utils
import click
cli_util.rename_command(resourcesearch_cli.search_root_group, resourcesearch... | [
"oci_cli.cli_util.option",
"oci_cli.json_skeleton_utils.json_skeleton_generation_handler",
"oci_cli.cli_util.rename_command",
"oci_cli.cli_util.copy_params_from_generated_command",
"oci_cli_resource_search.generated.resourcesearch_cli.resource_summary_collection_group.commands.pop",
"oci_cli_resource_sear... | [((244, 375), 'oci_cli.cli_util.rename_command', 'cli_util.rename_command', (['resourcesearch_cli.search_root_group', 'resourcesearch_cli.resource_summary_collection_group', '"""resource"""'], {}), "(resourcesearch_cli.search_root_group,\n resourcesearch_cli.resource_summary_collection_group, 'resource')\n", (267, 3... |
# -*- coding: utf-8 -*-
"""Parser for OLE Compound Files (OLECF)."""
from __future__ import unicode_literals
import pyolecf
from plaso.lib import specification
from plaso.parsers import interface
from plaso.parsers import manager
import os
import time
from dfdatetime import semantic_time as dfdatetime_semantic_tim... | [
"plaso.containers.time_events.DateTimeValuesEvent",
"base64.b64encode",
"pyolecf.file",
"plaso.lib.specification.FormatSpecification",
"hashlib.sha1",
"dfdatetime.semantic_time.SemanticTime",
"plaso.parsers.manager.ParsersManager.RegisterParser",
"os.remove"
] | [((12095, 12145), 'plaso.parsers.manager.ParsersManager.RegisterParser', 'manager.ParsersManager.RegisterParser', (['OLECFParser'], {}), '(OLECFParser)\n', (12132, 12145), False, 'from plaso.parsers import manager\n'), ((1517, 1560), 'plaso.lib.specification.FormatSpecification', 'specification.FormatSpecification', ([... |
import pickle
import keras
import uuid
#pytorch
import torch as t
import torch.nn as nn
from torch.autograd import Variable
import torch.utils.data as Data
import torchvision
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from keras.layers import... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.CrossEntropyLoss",
"pickle.dumps",
"sys.getsizeof",
"flask_socketio.SocketIO",
"torch.nn.Conv2d",
"uuid.uuid4",
"numpy.sum",
"numpy.zeros",
"torch.cuda.is_available",
"torch.nn.MaxPool2d",
"time.sleep",
"torch.nn.Linear",
"time.time"
] | [((7576, 7597), 'torch.cuda.is_available', 't.cuda.is_available', ([], {}), '()\n', (7595, 7597), True, 'import torch as t\n'), ((7646, 7667), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (7665, 7667), True, 'import torch.nn as nn\n'), ((1616, 1636), 'numpy.sum', 'np.sum', (['client_sizes'], {}... |
import glm, random
def generateVoxelPositions(width, height, depth):
blockSize = 1.0
noiseScale = 20.0
amplitude = 20.0
offset = random.randrange(0, 1000000)
data = []
for x in range(width):
for y in range(height):
for z in range(depth):
noise = glm.perlin(gl... | [
"glm.vec3",
"random.randrange"
] | [((146, 174), 'random.randrange', 'random.randrange', (['(0)', '(1000000)'], {}), '(0, 1000000)\n', (162, 174), False, 'import glm, random\n'), ((318, 405), 'glm.vec3', 'glm.vec3', (['(x / noiseScale + offset)', '(y / noiseScale + offset)', '(z / noiseScale + offset)'], {}), '(x / noiseScale + offset, y / noiseScale + ... |
from django.db import models
from django.utils.translation import gettext_lazy as _
from django_countries.fields import CountryField
from .integrations import get_integration
class Subscriber(models.Model):
first_name = models.CharField(_('first name'), max_length=25)
last_name = models.CharField(_('last name... | [
"django.utils.translation.gettext_lazy"
] | [((243, 258), 'django.utils.translation.gettext_lazy', '_', (['"""first name"""'], {}), "('first name')\n", (244, 258), True, 'from django.utils.translation import gettext_lazy as _\n'), ((308, 322), 'django.utils.translation.gettext_lazy', '_', (['"""last name"""'], {}), "('last name')\n", (309, 322), True, 'from djan... |
from time import time
def main():
for i in range(1, 1_000_000): 1+1
if __name__ == '__main__':
start = time()
main()
end = time()
print("main method executed in %fs" % (end-start)) | [
"time.time"
] | [((113, 119), 'time.time', 'time', ([], {}), '()\n', (117, 119), False, 'from time import time\n'), ((141, 147), 'time.time', 'time', ([], {}), '()\n', (145, 147), False, 'from time import time\n')] |
import os
import csv
from golfCourse import GolfCourse
from hole import Hole
from golfer import Golfer
from tournGolfer import TournGolfer
from tournament import Tournament
from round import Round
from golferRoundScores import GolferRoundScores
from golfTourDatabaseHelper import GolfTourDatabaseHelper
def main():
... | [
"os.path.exists",
"golfCourse.GolfCourse.get_course_id",
"tournament.Tournament.get_num_rounds",
"tournament.Tournament",
"tournament.Tournament.get_tourn_name",
"tournGolfer.TournGolfer",
"golferRoundScores.GolferRoundScores",
"golfer.Golfer",
"tournament.Tournament.get_tourn_id",
"golfCourse.Gol... | [((7672, 7701), 'os.path.exists', 'os.path.exists', (['database_name'], {}), '(database_name)\n', (7686, 7701), False, 'import os\n'), ((7803, 7840), 'golfTourDatabaseHelper.GolfTourDatabaseHelper', 'GolfTourDatabaseHelper', (['database_name'], {}), '(database_name)\n', (7825, 7840), False, 'from golfTourDatabaseHelper... |
from lib.distro import get_distro
import unittest
class TestDistro(unittest.TestCase):
def test_get_distro(self):
distro = get_distro('darwin')
self.assertEqual(distro, {'name': 'apple', 'version': 0.0})
| [
"lib.distro.get_distro"
] | [((138, 158), 'lib.distro.get_distro', 'get_distro', (['"""darwin"""'], {}), "('darwin')\n", (148, 158), False, 'from lib.distro import get_distro\n')] |
import os
import argparse
from multiprocessing import Lock, Process, Queue
import subprocess
import traceback
from ytauth import YtAuth
from ytchat import YtChat
from twitchchat import TwitchChat
SECRET_FILE = 'client_secret.json'
def start_yt(prefix, vid_id, tts_queue, ytauth):
# TODO: Search for YouTube events... | [
"multiprocessing.Process",
"subprocess.run",
"ytchat.YtChat",
"ytauth.YtAuth",
"twitchchat.TwitchChat",
"multiprocessing.Queue",
"traceback.print_exc"
] | [((357, 458), 'ytchat.YtChat', 'YtChat', ([], {'secret_file': 'SECRET_FILE', 'vid_id': 'vid_id', 'prefix': 'prefix', 'ytauth': 'ytauth', 'tts_queue': 'tts_queue'}), '(secret_file=SECRET_FILE, vid_id=vid_id, prefix=prefix, ytauth=ytauth,\n tts_queue=tts_queue)\n', (363, 458), False, 'from ytchat import YtChat\n'), ((... |
import os
import sys
from pathlib import Path
import numpy as np
import pandas as pd
from data_pipeline.config import settings
from data_pipeline.utils import (
download_file_from_url,
get_module_logger,
)
logger = get_module_logger(__name__)
def check_score_data_source(
score_csv_data_path: Path,
... | [
"os.path.isfile",
"data_pipeline.utils.download_file_from_url",
"data_pipeline.utils.get_module_logger",
"sys.exit"
] | [((226, 253), 'data_pipeline.utils.get_module_logger', 'get_module_logger', (['__name__'], {}), '(__name__)\n', (243, 253), False, 'from data_pipeline.utils import download_file_from_url, get_module_logger\n'), ((1247, 1341), 'data_pipeline.utils.download_file_from_url', 'download_file_from_url', ([], {'file_url': 'TIL... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from pyowm.commons import exceptions
from pyowm.utils import timestamps, formatting
from pyowm.weatherapi25 import location
from pyowm.weatherapi25 import weather
class Forecast:
"""
A class encapsulating weather forecast data for a certain location... | [
"pyowm.utils.timestamps.now",
"pyowm.commons.exceptions.ParseAPIResponseError",
"pyowm.weatherapi25.weather.Weather.from_dict",
"pyowm.weatherapi25.location.Location.from_dict",
"pyowm.utils.formatting.timeformat",
"time.time",
"pyowm.commons.exceptions.APIResponseError"
] | [((2172, 2220), 'pyowm.utils.formatting.timeformat', 'formatting.timeformat', (['self.rec_time', 'timeformat'], {}), '(self.rec_time, timeformat)\n', (2193, 2220), False, 'from pyowm.utils import timestamps, formatting\n'), ((2442, 2475), 'pyowm.utils.timestamps.now', 'timestamps.now', ([], {'timeformat': '"""unix"""'}... |
# coding: utf-8
import numpy as np
import pandas as pd
import dask.dataframe as dd
from datetime import datetime
#---------------------------- Print Functions --------------------------------------------
# prints a line separator
def print_line():
print('------------------------------------------------------------... | [
"datetime.datetime.now",
"dask.dataframe.read_csv"
] | [((2046, 2300), 'dask.dataframe.read_csv', 'dd.read_csv', (['data_file_name'], {'error_bad_lines': '(False)', 'assume_missing': '(True)', 'dtype': "{'ID': np.int64, 'PrimaryType': 'str', 'FBICode': 'str', 'Beat': np.uint16,\n 'Year': np.uint16, 'Location': 'str'}", 'parse_dates': "['Date']", 'infer_datetime_format':... |
"""
Mutation routines
"""
from __future__ import division
import random
from deap import base
from cea.optimization.constants import N_HR, N_HEAT, N_SOLAR, N_COOL, INDICES_CORRESPONDING_TO_DCN, INDICES_CORRESPONDING_TO_DHN
toolbox = base.Toolbox()
def mutFlip(individual, proba, nBuildings):
"""
For all inte... | [
"random.uniform",
"random.choice",
"random.randint",
"random.random",
"deap.base.Toolbox",
"random.gauss"
] | [((235, 249), 'deap.base.Toolbox', 'base.Toolbox', ([], {}), '()\n', (247, 249), False, 'from deap import base\n'), ((5916, 5978), 'random.gauss', 'random.gauss', (['individual[(N_HEAT + N_SOLAR) * 2 + N_HR]', 'sigma'], {}), '(individual[(N_HEAT + N_SOLAR) * 2 + N_HR], sigma)\n', (5928, 5978), False, 'import random\n')... |
import fastapi
from fastapi import Depends, status
from fastapi.exceptions import HTTPException
from sqlalchemy.future import select
from sqlalchemy.ext.asyncio import AsyncSession
from typing import Optional, List
from app.db import get_session
from app.models.portfolio_model import Project
router = fast... | [
"fastapi.exceptions.HTTPException",
"sqlalchemy.future.select",
"fastapi.APIRouter",
"app.models.portfolio_model.Project",
"fastapi.Depends"
] | [((316, 335), 'fastapi.APIRouter', 'fastapi.APIRouter', ([], {}), '()\n', (333, 335), False, 'import fastapi\n'), ((480, 500), 'fastapi.Depends', 'Depends', (['get_session'], {}), '(get_session)\n', (487, 500), False, 'from fastapi import Depends, status\n'), ((518, 533), 'sqlalchemy.future.select', 'select', (['Projec... |
import multiprocessing
capture_output = True
loglevel = "info"
accesslog = "/var/log/gunicorn.access.log"
errorlog = "/var/log/gunicorn.error.log"
proc_name = "name here"
worker_tmp_dir = "/dev/shm"
bind = "[::]:8000"
workers = multiprocessing.cpu_count() * 2 + 1
| [
"multiprocessing.cpu_count"
] | [((233, 260), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (258, 260), False, 'import multiprocessing\n')] |
"""
License: Apache-2.0
Author: <NAME>
E-mail: <EMAIL>
"""
import tensorflow as tf
from config import cfg
from data_input.utils import softmax
from data_input.utils import get_batch_data
import capslayer
class CapsNet(object):
def __init__(self, height=28, width=28, channels=1, num_label=10):
'''
... | [
"tensorflow.contrib.layers.conv2d",
"data_input.utils.softmax",
"tensorflow.reduce_sum",
"tensorflow.reduce_mean",
"tensorflow.cast",
"tensorflow.summary.image",
"tensorflow.Graph",
"tensorflow.placeholder",
"tensorflow.contrib.layers.fully_connected",
"capslayer.layers.fully_connected",
"tensor... | [((691, 701), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (699, 701), True, 'import tensorflow as tf\n'), ((4247, 4292), 'tensorflow.reshape', 'tf.reshape', (['max_l'], {'shape': '(cfg.batch_size, -1)'}), '(max_l, shape=(cfg.batch_size, -1))\n', (4257, 4292), True, 'import tensorflow as tf\n'), ((4309, 4354), 'te... |
import numpy as np
#from cvxopt import matrix
import pickle
from l1ls import l1ls
import copy
import pdb
import os
feats_file = 'gt_feats.pkl'
mode = 'gt'
with open(feats_file, 'rb') as f:
feats = pickle.load(f)
num_classes = len(feats)
dicts_list = []
dicts_num = 192
max_iters = 25
min_tol = 1e-2
lamda = 1e-3... | [
"numpy.abs",
"pickle.dump",
"pickle.load",
"l1ls.l1ls",
"os.path.dirname",
"numpy.matmul",
"numpy.concatenate",
"numpy.linalg.norm",
"numpy.random.randn"
] | [((203, 217), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (214, 217), False, 'import pickle\n'), ((489, 530), 'numpy.random.randn', 'np.random.randn', (['feat.shape[0]', 'dicts_num'], {}), '(feat.shape[0], dicts_num)\n', (504, 530), True, 'import numpy as np\n'), ((564, 612), 'numpy.linalg.norm', 'np.linalg.nor... |
# test_hscbatch_steal_columns.py
# ALS 2017/05/29
import pytest
import os
import shutil
import astropy.table as at
from .setpaths import *
from .fixture_built_batch import *
fn_tab = 'sdss_xid.csv'
@pytest.fixture(scope="module", autouse=True)
def setUp_tearDown():
""" rm ./testing/ and ./test2/ before and after ... | [
"os.path.isdir",
"os.mkdir",
"shutil.rmtree",
"pytest.fixture",
"astropy.table.join",
"astropy.table.Table.read"
] | [((204, 248), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'autouse': '(True)'}), "(scope='module', autouse=True)\n", (218, 248), False, 'import pytest\n'), ((345, 370), 'os.path.isdir', 'os.path.isdir', (['dir_parent'], {}), '(dir_parent)\n', (358, 370), False, 'import os\n'), ((401, 421), 'os.mk... |
import cv2 as cv
import numpy as np
resizeValue = 1
x,y = np.meshgrid(range(7),range(6))
worldPoints = np.hstack((x.reshape(42,1),y.reshape(42,1),np.zeros((42,1)))).astype(np.float32)
criteria = (cv.TERM_CRITERIA_EPS + cv.TERM_CRITERIA_MAX_ITER, 30, 0.001)
objPoints = []
imgPoints =[]
numberOfFramesUsed = 0
cap ... | [
"cv2.findCirclesGrid",
"cv2.drawChessboardCorners",
"cv2.FileStorage",
"cv2.imshow",
"cv2.cornerSubPix",
"cv2.getOptimalNewCameraMatrix",
"numpy.zeros",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.calibrateCamera",
"cv2.GaussianBlur",
"cv2.waitKey"
] | [((322, 378), 'cv2.VideoCapture', 'cv.VideoCapture', (['"""http://192.168.0.102:8000/stream.mjpg"""'], {}), "('http://192.168.0.102:8000/stream.mjpg')\n", (337, 378), True, 'import cv2 as cv\n'), ((2714, 2736), 'cv2.destroyAllWindows', 'cv.destroyAllWindows', ([], {}), '()\n', (2734, 2736), True, 'import cv2 as cv\n'),... |
import os
def originFolderApp():
path = os.getcwd()
return path
| [
"os.getcwd"
] | [((45, 56), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (54, 56), False, 'import os\n')] |
import maya
from .get_posts import get_posts
def get_posts_for_dates(site_url, start_date, end_date):
# get the posts
posts_all = []
posts_selected = []
pages_tried_max = 100
done = False
for i in list(range(1, pages_tried_max + 1)):
if done is True:
continue
try:
... | [
"maya.when"
] | [((515, 554), 'maya.when', 'maya.when', (["post['date']"], {'timezone': '"""UTC"""'}), "(post['date'], timezone='UTC')\n", (524, 554), False, 'import maya\n')] |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); y... | [
"facility.models.immunodeficiency.Immunodeficiency.objects.filter",
"groups.models.UserGroup.objects.filter",
"MyUser.models.ResultStatus.objects.filter",
"django.http.HttpResponse",
"MyUser.models.HCWorker.objects.create",
"communications.CommunicationHandler.CommunicationHandler",
"MyUser.models.Resul... | [((1950, 1976), 'MyUser.models.ResultStatus.objects.all', 'ResultStatus.objects.all', ([], {}), '()\n', (1974, 1976), False, 'from MyUser.models import HCWorker, ResultStatus\n'), ((2887, 3002), 'MyUser.models.HCWorker.objects.create', 'HCWorker.objects.create', ([], {'hcw_type_id_id': 'hcw_type_id', 'language': 'facil... |
'''
Utility functions to analyze particle data.
@author: <NAME> <<EMAIL>>
Units: unless otherwise noted, all quantities are in (combinations of):
mass [M_sun]
position [kpc comoving]
distance, radius [kpc physical]
velocity [km / s]
time [Gyr]
'''
# system ----
from __future__ import absolute_imp... | [
"numpy.log10",
"numpy.sqrt",
"numpy.array",
"numpy.isfinite",
"numpy.arange",
"numpy.nanargmin",
"numpy.isscalar",
"numpy.sort",
"numpy.asarray",
"numpy.ndim",
"numpy.max",
"numpy.concatenate",
"numpy.min",
"numpy.abs",
"numpy.argmax",
"numpy.interp",
"numpy.shape",
"numpy.intersec... | [((1139, 1159), 'numpy.isscalar', 'np.isscalar', (['species'], {}), '(species)\n', (1150, 1159), True, 'import numpy as np\n'), ((6332, 6382), 'numpy.array', 'np.array', (['ids_all'], {'dtype': 'part[spec][id_name].dtype'}), '(ids_all, dtype=part[spec][id_name].dtype)\n', (6340, 6382), True, 'import numpy as np\n'), ((... |
#!/usr/bin/env python3
# Ensure environmental variable i.e. paths are set to used the modules
from xf_fintech_python import DeviceManager, HJM
import numpy as np
import argparse
def zcbAnalytical(rawData, maturity, tau = 0.5):
# Take last row
fc = np.copy(rawData[rawData.shape[0] - 1])
fc *= 0.... | [
"numpy.copy",
"numpy.random.rand",
"argparse.ArgumentParser",
"xf_fintech_python.DeviceManager.getDeviceList",
"numpy.exp",
"xf_fintech_python.HJM",
"numpy.loadtxt"
] | [((1152, 1254), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Example of Heath-Jarrow-Morton framework running on a FPGA"""'}), "(description=\n 'Example of Heath-Jarrow-Morton framework running on a FPGA')\n", (1175, 1254), False, 'import argparse\n'), ((1500, 1539), 'numpy.loadtxt'... |
#
#*******************************************************************************
# Copyright 2014-2020 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... | [
"numpy.asarray",
"numpy.isscalar"
] | [((1031, 1045), 'numpy.isscalar', 'np.isscalar', (['X'], {}), '(X)\n', (1042, 1045), True, 'import numpy as np\n'), ((1059, 1072), 'numpy.asarray', 'np.asarray', (['X'], {}), '(X)\n', (1069, 1072), True, 'import numpy as np\n')] |
import seaborn as sns
import pandas
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
# ファイルの読み込み
salary = pandas.read_csv('data-salary.txt')
# データの先頭5行の確認
print(salary.head())
# データのサマリを確認
print(salary.describe())
# データの図示
sns.scatterplot(
x='X',
y='Y',
data=salary
)
plt... | [
"seaborn.lmplot",
"pandas.read_csv",
"seaborn.scatterplot",
"sklearn.linear_model.LinearRegression",
"matplotlib.pyplot.show"
] | [((140, 174), 'pandas.read_csv', 'pandas.read_csv', (['"""data-salary.txt"""'], {}), "('data-salary.txt')\n", (155, 174), False, 'import pandas\n'), ((260, 302), 'seaborn.scatterplot', 'sns.scatterplot', ([], {'x': '"""X"""', 'y': '"""Y"""', 'data': 'salary'}), "(x='X', y='Y', data=salary)\n", (275, 302), True, 'import... |
# Generated by Django 1.11.14 on 2018-10-10 22:52
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("zilencer", "0013_remove_customer_billing_user"),
]
operations = [
migrations.AlterUniqueTogether(
name="remotepushdevicetoken",
... | [
"django.db.migrations.AlterUniqueTogether"
] | [((240, 362), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""remotepushdevicetoken"""', 'unique_together': "{('server', 'user_id', 'kind', 'token')}"}), "(name='remotepushdevicetoken',\n unique_together={('server', 'user_id', 'kind', 'token')})\n", (270, 362), False, ... |
import datetime
from django.db import models
from django.contrib.auth.models import User
class Metric(models.Model):
""" holds the types of metrics
"""
slug = models.SlugField(unique=True, max_length=100, db_index=True)
name = models.CharField(max_length=90)
def __unicode__(self): return self.nam... | [
"django.db.models.DateField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.SlugField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((173, 233), 'django.db.models.SlugField', 'models.SlugField', ([], {'unique': '(True)', 'max_length': '(100)', 'db_index': '(True)'}), '(unique=True, max_length=100, db_index=True)\n', (189, 233), False, 'from django.db import models\n'), ((245, 276), 'django.db.models.CharField', 'models.CharField', ([], {'max_lengt... |
# This file is part of the Reproducible Open Benchmarks for Data Analysis
# Platform (ROB).
#
# Copyright (C) 2019 NYU.
#
# ROB is free software; you can redistribute it and/or modify it under the
# terms of the MIT License; see LICENSE file for more details.
"""Test functionality of the multiprocess backend function ... | [
"benchproc.engine.get_commands",
"benchtmpl.io.files.base.FileHandle",
"os.path.join",
"os.path.realpath",
"pytest.raises",
"benchtmpl.workflow.template.loader.DefaultTemplateLoader"
] | [((801, 855), 'os.path.join', 'os.path.join', (['DIR', '"""./.files/multi-step-template.yaml"""'], {}), "(DIR, './.files/multi-step-template.yaml')\n", (813, 855), False, 'import os\n'), ((757, 783), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (773, 783), False, 'import os\n'), ((1794, 1... |
# -*- coding: utf-8 -*-
"""
Tests for gstorage.utils
"""
import os
import tempfile
from mock import patch
from unittest import TestCase
from django.conf import settings
from gstorage.apps import GStorageConfig
from gstorage.utils import find_files, get_config
key = 'GOOGLE_APPLICATION_CREDENTIALS'
class TestUtil(T... | [
"mock.patch",
"gstorage.utils.find_files",
"gstorage.utils.get_config",
"gstorage.apps.GStorageConfig.create",
"tempfile.mkdtemp",
"tempfile.mkstemp"
] | [((1026, 1075), 'mock.patch', 'patch', (['"""gstorage.checks.REQUIRED_SETTINGS"""', '[key]'], {}), "('gstorage.checks.REQUIRED_SETTINGS', [key])\n", (1031, 1075), False, 'from mock import patch\n'), ((1306, 1355), 'mock.patch', 'patch', (['"""gstorage.checks.REQUIRED_SETTINGS"""', '[key]'], {}), "('gstorage.checks.REQU... |
import os
import sys
from multiprocessing import Process
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "src"))
cwd = os.getcwd()
from supervisor import supervisor
if __name__ == "__main__":
args = {}
dir_path = os.path.dirname(os.path.abspath(__file__))
args["ext_config... | [
"os.path.join",
"os.getcwd",
"os.path.realpath",
"os.path.abspath",
"supervisor.supervisor.start"
] | [((158, 169), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (167, 169), False, 'import os\n'), ((335, 388), 'os.path.join', 'os.path.join', (['dir_path', '"""coco_squeezeDet_config.json"""'], {}), "(dir_path, 'coco_squeezeDet_config.json')\n", (347, 388), False, 'import os\n'), ((391, 413), 'supervisor.supervisor.start',... |
import json
import asyncio
import discord
from urllib.parse import quote
from dateutil.parser import parse
from datetime import datetime, timedelta
from utils import aiohttp_wrap as aw
from discord.ext import commands
class News(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.redis_c... | [
"dateutil.parser.parse",
"json.loads",
"discord.ext.commands.clean_content",
"json.dumps",
"urllib.parse.quote",
"utils.aiohttp_wrap.aio_get_json",
"datetime.datetime.today",
"json.load",
"datetime.timedelta",
"discord.Embed",
"discord.ext.commands.command"
] | [((1209, 1238), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""news"""'}), "(name='news')\n", (1225, 1238), False, 'from discord.ext import commands\n'), ((803, 818), 'discord.Embed', 'discord.Embed', ([], {}), '()\n', (816, 818), False, 'import discord\n'), ((1151, 1183), 'dateutil.parser.parse'... |
#El promedio histórico del salario de los egresados de una universidad
#es salario_historico, la desviación estándar es
#de std_salario_historico.
#Calcule con un método Monte Carlo el salario promedio
#salario_promedio que una muestra aleatoria de n_egresados debe tener
#para considerar que cualquier otro grupo de ... | [
"numpy.sort",
"numpy.sqrt"
] | [((1865, 1875), 'numpy.sort', 'np.sort', (['x'], {}), '(x)\n', (1872, 1875), True, 'import numpy as np\n'), ((1794, 1814), 'numpy.sqrt', 'np.sqrt', (['n_egresados'], {}), '(n_egresados)\n', (1801, 1814), True, 'import numpy as np\n')] |
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
from PIL import ImageDraw
import scipy
from scipy import ndimage
import skimage
from skimage.morphology import medial_axis
import time
import cv2
import random
import os
import sys
from scipy import linalg as LA
def find_files(files, dirs=[], con... | [
"os.listdir",
"numpy.load",
"os.path.join"
] | [((1881, 1897), 'numpy.load', 'np.load', (['load_fn'], {}), '(load_fn)\n', (1888, 1897), True, 'import numpy as np\n'), ((1115, 1150), 'os.path.join', 'os.path.join', (['load_root', 'class_name'], {}), '(load_root, class_name)\n', (1127, 1150), False, 'import os\n'), ((1734, 1768), 'os.path.join', 'os.path.join', (['lo... |
import numpy as np
import re
import random
def prepare_data():
"""This method prepares input positive and negative datasets as bitvectors for the Rap1 binding problem. Output: three lists of bitvectors, one containing positive samples, negative samples that are similar to positive samples, and negative examples t... | [
"numpy.ones",
"numpy.array",
"numpy.zeros",
"numpy.concatenate",
"re.findall"
] | [((5076, 5089), 'numpy.array', 'np.array', (['pos'], {}), '(pos)\n', (5084, 5089), True, 'import numpy as np\n'), ((5099, 5112), 'numpy.array', 'np.array', (['neg'], {}), '(neg)\n', (5107, 5112), True, 'import numpy as np\n'), ((5121, 5153), 'numpy.concatenate', 'np.concatenate', (['(Xp, Xn)'], {'axis': '(0)'}), '((Xp,... |
# encoding: utf-8
import os
import torch
import torch.distributed as dist
from exp import Exp as MyExp
class Exp(MyExp):
def __init__(self):
super(Exp, self).__init__()
self.num_classes = 2
self.depth = 0.33
self.width = 0.375
self.input_scale = (416, 416... | [
"os.path.realpath"
] | [((475, 501), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (491, 501), False, 'import os\n'), ((840, 866), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (856, 866), False, 'import os\n')] |
import json
import pytest
from stix2 import TAXIICollectionSource
from test_data.mitre_test_data import ATTACK_PATTERN, COURSE_OF_ACTION, INTRUSION_SET, MALWARE, TOOL, ID_TO_NAME, \
RELATION, STIX_TOOL, STIX_MALWARE, STIX_ATTACK_PATTERN
class MockCollection:
def __init__(self, id_, title):
self.id = i... | [
"test_data.mitre_test_data.MALWARE.get",
"test_data.mitre_test_data.INTRUSION_SET.get",
"FeedMitreAttackv2.is_indicator_deprecated_or_revoked",
"test_data.mitre_test_data.ATTACK_PATTERN.get",
"test_data.mitre_test_data.TOOL.get",
"test_data.mitre_test_data.STIX_TOOL.get",
"pytest.mark.parametrize",
"t... | [((2063, 2494), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""field_name, field_value, expected_result"""', '[(\'created\', \'2017-05-31T21:31:43.540Z\', \'2017-05-31T21:31:43.540Z\'), (\n \'created\', """2019-04-25T20:53:07.719Z\n2019-04-25T20:53:07.814Z""",\n \'2019-04-25T20:53:07.719Z\'), (\'modi... |
import rethinkdb
from pysite.base_route import RouteView
from pysite.mixins import DBMixin, OAuthMixin
class JamsUserTeamListView(RouteView, DBMixin, OAuthMixin):
path = "/jams/my_teams"
name = "jams.user_team_list"
def get(self):
# list teams a user is (or was) a part of
if not self.use... | [
"rethinkdb.desc"
] | [((1122, 1150), 'rethinkdb.desc', 'rethinkdb.desc', (['"""jam.number"""'], {}), "('jam.number')\n", (1136, 1150), False, 'import rethinkdb\n')] |
from dateutil.tz import UTC
from sqlalchemy import types
class UTCDateTime(types.TypeDecorator):
""" Datetime with timezone that always ensures UTC tz """
impl = types.DateTime(timezone=True)
def process_bind_param(self, value, dialect):
if value is not None:
return value.astimezone... | [
"sqlalchemy.types.DateTime"
] | [((174, 203), 'sqlalchemy.types.DateTime', 'types.DateTime', ([], {'timezone': '(True)'}), '(timezone=True)\n', (188, 203), False, 'from sqlalchemy import types\n')] |
# Copyright 2016 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | [
"tensorflow.concat",
"tensorflow.reshape",
"tensorflow.expand_dims",
"tensorflow.sin",
"tensorflow.cos",
"tensorflow.square"
] | [((1070, 1109), 'tensorflow.concat', 'tf.concat', (['[Psi1_cos, Psi1_sin]'], {'axis': '(0)'}), '([Psi1_cos, Psi1_sin], axis=0)\n', (1079, 1109), True, 'import tensorflow as tf\n'), ((1431, 1460), 'tensorflow.expand_dims', 'tf.expand_dims', (['omegas_add', '(0)'], {}), '(omegas_add, 0)\n', (1445, 1460), True, 'import te... |
import click
import requests
import json
import time
import random
session = requests.session()
metric_prefix = "system.load_test"
tagk_prefix = "tagk"
tagv_prefix = "tagv"
def init_prefix():
# one hour one prefix: for tagv
s_one_hour = int(time.time()) / 60 / 60
# one day one prefix: for tagk
s_one... | [
"requests.session",
"click.option",
"json.dumps",
"time.sleep",
"click.echo",
"click.command",
"time.time",
"random.randint"
] | [((78, 96), 'requests.session', 'requests.session', ([], {}), '()\n', (94, 96), False, 'import requests\n'), ((1607, 1622), 'click.command', 'click.command', ([], {}), '()\n', (1620, 1622), False, 'import click\n'), ((1624, 1709), 'click.option', 'click.option', (['"""--duration"""'], {'default': '(-1)', 'help': '"""Te... |
"""A class to hold entity values."""
from __future__ import annotations
from collections import OrderedDict
import fnmatch
import re
from typing import Any
from openpeerpower.core import split_entity_id
# mypy: disallow-any-generics
class EntityValues:
"""Class to store entity id based values."""
def __in... | [
"collections.OrderedDict",
"openpeerpower.core.split_entity_id",
"fnmatch.translate"
] | [((1160, 1186), 'openpeerpower.core.split_entity_id', 'split_entity_id', (['entity_id'], {}), '(entity_id)\n', (1175, 1186), False, 'from openpeerpower.core import split_entity_id\n'), ((805, 818), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (816, 818), False, 'from collections import OrderedDict\n'), (... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from setuptools import setup
with open('README.rst') as f:
readme = f.read()
if sys.argv[-1] == 'publish':
os.system("python setup.py sdist bdist_wheel upload")
sys.exit()
requirements = [
# TODO: put package requirements here
]
tes... | [
"os.system",
"setuptools.setup",
"sys.exit"
] | [((389, 1319), 'setuptools.setup', 'setup', ([], {'name': '"""txttk"""', 'version': '"""0.11.0"""', 'description': '"""Text Toolkit: manipulate text & regular expression"""', 'long_description': 'readme', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/jeroyang/txttk"""', 'packa... |
import os
import shutil
from collections import defaultdict
from pathlib import Path
from typing import List
import utils
# ToDo: add unwtar ?
from .fileSystemBatchCommands import *
from .removeBatchCommands import RmFileOrDir
log = logging.getLogger(__name__)
def _fast_copy_file(src, dst):
# insert faster code... | [
"os.path.exists",
"os.readlink",
"utils.ExpandAndResolvePath",
"utils.compare_files_by_checksum",
"pathlib.Path",
"os.path.expandvars",
"os.link",
"os.scandir",
"os.symlink",
"os.chown",
"collections.defaultdict",
"os.unlink",
"shutil.rmtree",
"os.stat",
"shutil.Error",
"os.fspath",
... | [((365, 379), 'os.unlink', 'os.unlink', (['dst'], {}), '(dst)\n', (374, 379), False, 'import os\n'), ((5408, 5424), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (5419, 5424), False, 'from collections import defaultdict\n'), ((7989, 8025), 'utils.ExpandAndResolvePath', 'utils.ExpandAndResolvePath'... |
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(332, 197)
MainWindow.setMinimumSize(QtCore.QSize(332, 197))
MainWindow.setMaximumSize(QtCore.QSize(332, 197))
... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QMainWindow",
"PyQt5.QtGui.QFont",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtWidgets.QFrame",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidgets.QCheckBox",
"PyQt5.QtWidgets.QPushButton",
"PyQ... | [((10571, 10603), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (10593, 10603), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((10622, 10645), 'PyQt5.QtWidgets.QMainWindow', 'QtWidgets.QMainWindow', ([], {}), '()\n', (10643, 10645), False, 'from PyQt5 import QtC... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('miniblog', '0009_classification_father'),
]
operations = [
migrations.RemoveField(
model_name='classification',
... | [
"django.db.migrations.RemoveField"
] | [((255, 321), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""classification"""', 'name': '"""father"""'}), "(model_name='classification', name='father')\n", (277, 321), False, 'from django.db import models, migrations\n')] |
import utils
import time
import os
from config import *
from tqdm import tqdm
if __name__=="__main__":
vocab = utils.get_vocabulary() # loads vocabulary present in system
citations = utils.get_citations() # loads citation counts for doc_ids
while True:
print("Enter a word to search t... | [
"os.path.exists",
"utils.get_citations",
"utils.load_index",
"utils.get_vocabulary",
"time.time"
] | [((116, 138), 'utils.get_vocabulary', 'utils.get_vocabulary', ([], {}), '()\n', (136, 138), False, 'import utils\n'), ((201, 222), 'utils.get_citations', 'utils.get_citations', ([], {}), '()\n', (220, 222), False, 'import utils\n'), ((405, 416), 'time.time', 'time.time', ([], {}), '()\n', (414, 416), False, 'import tim... |
import os
import sys
import numpy as np
import scipy.io as sio
import more_itertools as mit
chan = ['Fp1','AF3','F3','F7','FC5','FC1','C3','T7','CP5','CP1','P3','P7','PO3','O1','Oz','Pz','Fp2','AF4','Fz','F4','F8','FC6','FC2','Cz','C4','T8','CP6','CP2','P4','P8','PO4','O2']
nLabel, nTrial, nUser, nChannel, nT... | [
"scipy.io.loadmat",
"numpy.savetxt",
"more_itertools.windowed",
"os.system",
"numpy.genfromtxt"
] | [((607, 625), 'scipy.io.loadmat', 'sio.loadmat', (['fname'], {}), '(fname)\n', (618, 625), True, 'import scipy.io as sio\n'), ((1567, 1615), 'numpy.genfromtxt', 'np.genfromtxt', (['"""features_raw.csv"""'], {'delimiter': '""","""'}), "('features_raw.csv', delimiter=',')\n", (1580, 1615), True, 'import numpy as np\n'), ... |
#!/usr/local/python36/bin/python3.6
# -*- coding: utf-8 -*-
'''
用户管理系统V3
Author: WangXiaoYun
'''
import sys, os, getpass,math,csv,logging
from prettytable import PrettyTable
x = PrettyTable()
x.field_names = ["UserID", "Name", "Phone", "Company", "Address", "Email"]
_StuInfo = 'StuInfo.txt'
_TempDict = {}
_HelpMeu = '... | [
"prettytable.PrettyTable",
"os.path.exists",
"logging.basicConfig",
"math.ceil",
"logging.debug",
"csv.writer",
"getpass.getpass",
"sys.exit",
"os.mknod"
] | [((178, 191), 'prettytable.PrettyTable', 'PrettyTable', ([], {}), '()\n', (189, 191), False, 'from prettytable import PrettyTable\n'), ((2517, 2531), 'sys.exit', 'sys.exit', (['_Mes'], {}), '(_Mes)\n', (2525, 2531), False, 'import sys, os, getpass, math, csv, logging\n'), ((1838, 2026), 'logging.basicConfig', 'logging.... |
import logging
from django.conf import settings
from django_twilio.client import twilio_client
from twilio.exceptions import TwilioException
log = logging.getLogger()
def send_sms(to, body):
options = {}
if settings.TWILIO_MESSAGING_SERVICE_ID:
options['messaging_service_sid'] = settings.TWILIO_MES... | [
"logging.getLogger",
"django_twilio.client.twilio_client.messages.create"
] | [((149, 168), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (166, 168), False, 'import logging\n'), ((428, 486), 'django_twilio.client.twilio_client.messages.create', 'twilio_client.messages.create', ([], {'to': 'to', 'body': 'body'}), '(to=to, body=body, **options)\n', (457, 486), False, 'from django_twi... |
"""Translate events from a legacy ``ProtocolContext`` into Protocol Engine commands."""
from collections import defaultdict
from datetime import datetime
from typing import Dict, List, Union
from opentrons.types import MountType, DeckSlotName
from opentrons.commands import types as legacy_command_types
from opentrons... | [
"opentrons.protocol_engine.commands.LoadModuleResult",
"opentrons.protocol_engine.resources.ModelUtils.get_timestamp",
"opentrons.protocol_engine.types.DeckSlotLocation",
"opentrons.protocol_engine.resources.ModelUtils.generate_id",
"opentrons.protocols.models.labware_definition.LabwareDefinition.parse_obj"... | [((1355, 1372), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1366, 1372), False, 'from collections import defaultdict\n'), ((1419, 1442), 'collections.defaultdict', 'defaultdict', (['(lambda : 0)'], {}), '(lambda : 0)\n', (1430, 1442), False, 'from collections import defaultdict\n'), ((2427, 2... |
from __future__ import division, absolute_import
from setuptools import setup, find_packages
setup(
name='ESMO',
version='1.0',
author='<NAME>, <NAME>',
author_email='<EMAIL>',
description=
'Variable Renewable Energy Sources Penetration in the Changing Climate: A Long-Term Electricit... | [
"setuptools.find_packages"
] | [((412, 427), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (425, 427), False, 'from setuptools import setup, find_packages\n')] |
#!/usr/bin/python3
# Usage: ./hack/update-rhcos-bootimage.py https://releases-art-rhcos.svc.ci.openshift.org/storage/releases/ootpa/410.8.20190401.0/meta.json
import codecs,os,sys,json,argparse
import urllib.parse
import urllib.request
# An app running in the CI cluster exposes this public endpoint about ART RHCOS
# b... | [
"codecs.getreader",
"argparse.ArgumentParser",
"os.path.join",
"os.path.dirname",
"json.load",
"json.dump"
] | [((513, 538), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (536, 538), False, 'import codecs, os, sys, json, argparse\n'), ((473, 501), 'os.path.dirname', 'os.path.dirname', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (488, 501), False, 'import codecs, os, sys, json, argparse\n'), ((856, 875), ... |
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: mo-mo-
#
# Created: 05/08/2018
# Copyright: (c) mo-mo- 2018
# Licence: <your licence>
#-------------------------------------------------------------------------------
... | [
"numpy.where",
"numpy.array"
] | [((366, 377), 'numpy.array', 'np.array', (['l'], {}), '(l)\n', (374, 377), True, 'import numpy as np\n'), ((495, 514), 'numpy.where', 'np.where', (["(l2 == 'C')"], {}), "(l2 == 'C')\n", (503, 514), True, 'import numpy as np\n')] |
import numpy as np
import tensorflow as tf
from DeepSparseCoding.tf1x.ops.init_ops import L2NormalizedTruncatedNormalInitializer
from DeepSparseCoding.tf1x.utils.trainable_variable_dict import TrainableVariableDict
class AeModule(object):
def __init__(self, data_tensor, layer_types, enc_channels, dec_channels, patc... | [
"numpy.prod",
"tensorflow.shape",
"tensorflow.group",
"tensorflow.nn.dropout",
"tensorflow.nn.conv2d_transpose",
"tensorflow.matmul",
"tensorflow.compat.v1.keras.initializers.VarianceScaling",
"tensorflow.square",
"DeepSparseCoding.tf1x.ops.init_ops.L2NormalizedTruncatedNormalInitializer",
"tensor... | [((1547, 1570), 'DeepSparseCoding.tf1x.utils.trainable_variable_dict.TrainableVariableDict', 'TrainableVariableDict', ([], {}), '()\n', (1568, 1570), False, 'from DeepSparseCoding.tf1x.utils.trainable_variable_dict import TrainableVariableDict\n'), ((4283, 4348), 'numpy.all', 'np.all', (["('conv' in self.enc_layer_type... |
#!/usr/bin/env python3
"""ipinfo - Gets information about an IP from ipinfo.io's API"""
#
# (c) 2018 <NAME>
# @alexandermerkel
#
# See LICENSE file
#
# --------------------------------------------------------------------------- #
# IMPORTS
import sys
from ipaddress import ip_address
from urllib.parse import urlparse
... | [
"colored.fg",
"urllib.parse.urlparse",
"requests.get",
"socket.getaddrinfo",
"socket.gethostbyaddr",
"colored.attr",
"ipaddress.ip_address"
] | [((828, 848), 'colored.attr', 'colored.attr', (['"""bold"""'], {}), "('bold')\n", (840, 848), False, 'import colored\n'), ((857, 878), 'colored.attr', 'colored.attr', (['"""reset"""'], {}), "('reset')\n", (869, 878), False, 'import colored\n'), ((885, 902), 'colored.fg', 'colored.fg', (['"""red"""'], {}), "('red')\n", ... |
# ---
# jupyter:
# jupytext:
# metadata_filter:
# cells:
# additional: all
# notebook:
# additional: all
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.2'
# jupytext_version: 0.8.6
# kernelspec:
# display_name: Pyth... | [
"ipywidgets.HBox",
"bqplot.Axis",
"ipywidgets.IntSlider",
"ipywidgets.Play",
"os.path.abspath",
"bqplot.Scatter",
"numpy.array",
"ipywidgets.jslink",
"bqplot.Tooltip",
"bqplot.Lines",
"bqplot.Figure",
"numpy.interp",
"bqplot.LinearScale",
"bqplot.LogScale",
"numpy.arange"
] | [((3611, 3714), 'bqplot.Tooltip', 'Tooltip', ([], {'fields': "['name', 'x', 'y']", 'labels': "['Country Name', 'Income per Capita', 'Life Expectancy']"}), "(fields=['name', 'x', 'y'], labels=['Country Name',\n 'Income per Capita', 'Life Expectancy'])\n", (3618, 3714), False, 'from bqplot import LogScale, LinearScale... |
from typing import Sequence, Tuple, List, Union, Dict
from opendp._lib import *
from opendp.mod import UnknownTypeException, OpenDPException, Transformation, Measurement
from opendp.typing import RuntimeType
ATOM_MAP = {
'f32': ctypes.c_float,
'f64': ctypes.c_double,
'u8': ctypes.c_uint8,
'u16': ctyp... | [
"opendp.mod.OpenDPException",
"opendp.typing.RuntimeType.parse",
"opendp._data._object_type",
"opendp._data._slice_as_measure_distance",
"opendp.typing.RuntimeType.infer",
"opendp._data._object_as_slice",
"opendp._data._str_free",
"opendp._data._slice_as_metric_distance",
"opendp._data._to_string",
... | [((5130, 5161), 'opendp.mod.UnknownTypeException', 'UnknownTypeException', (['type_name'], {}), '(type_name)\n', (5150, 5161), False, 'from opendp.mod import UnknownTypeException, OpenDPException, Transformation, Measurement\n'), ((6157, 6188), 'opendp.mod.UnknownTypeException', 'UnknownTypeException', (['type_name'], ... |
from __future__ import division
from collections import defaultdict
from itertools import chain
import simplejson
import copy
import math
from urllib import unquote
from datetime import datetime, timedelta, date
from urllib import unquote
from suds import WebFault
from django.contrib.gis.geos import Point
from djang... | [
"django.template.defaultfilters.capfirst",
"itertools.chain",
"molly.apps.places.get_entity",
"molly.apps.places.models.Route.objects.filter",
"django.core.urlresolvers.reverse",
"molly.apps.places.models.Entity.objects.filter",
"copy.deepcopy",
"datetime.timedelta",
"molly.routing.generate_route",
... | [((2587, 2613), 'molly.apps.places.get_point', 'get_point', (['request', 'entity'], {}), '(request, entity)\n', (2596, 2613), False, 'from molly.apps.places import get_entity, get_point, bus_route_sorter\n'), ((3089, 3140), 'molly.apps.places.models.EntityType.objects.filter', 'EntityType.objects.filter', ([], {'show_i... |
import copy
import sys
class CSP :
""" Class for CSP modeling and solving
"""
def __init__(self, path,numV, c_type='positive'):
""" path: descriptif textual file location \n
numV: number of variables \n
c_type: mention "positive" for positive logic, "negative for prohib... | [
"copy.copy",
"copy.deepcopy"
] | [((582, 608), 'copy.deepcopy', 'copy.deepcopy', (['self.domain'], {}), '(self.domain)\n', (595, 608), False, 'import copy\n'), ((7018, 7047), 'copy.deepcopy', 'copy.deepcopy', (['self.domain[p]'], {}), '(self.domain[p])\n', (7031, 7047), False, 'import copy\n'), ((2327, 2345), 'copy.copy', 'copy.copy', (['ordered'], {}... |
"""Import and setup ready for user interaction"""
from async_v20 import *
import asyncio
import logging
logger = logging.getLogger('async_v20')
handler = logging.StreamHandler()
logger.addHandler(handler)
logger.setLevel(logging.INFO)
client = OandaClient(rest_timeout=40)
loop = asyncio.get_event_loop()
run = loop.r... | [
"logging.getLogger",
"asyncio.get_event_loop",
"logging.StreamHandler"
] | [((115, 145), 'logging.getLogger', 'logging.getLogger', (['"""async_v20"""'], {}), "('async_v20')\n", (132, 145), False, 'import logging\n'), ((156, 179), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (177, 179), False, 'import logging\n'), ((283, 307), 'asyncio.get_event_loop', 'asyncio.get_event... |
import os
from flask import Flask
from public import public_bp
from employeeapi import employeeapi_bp
def create_app():
app = Flask(__name__)
app.config["SECRET_KEY"] = os.getenv("SECRET_KEY")
app.config["ENV"] = "development"
# Blueprints registers
app.register_blueprint(public_bp, url_prefix=... | [
"os.getenv",
"flask.Flask"
] | [((134, 149), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (139, 149), False, 'from flask import Flask\n'), ((181, 204), 'os.getenv', 'os.getenv', (['"""SECRET_KEY"""'], {}), "('SECRET_KEY')\n", (190, 204), False, 'import os\n')] |
# Generated by Django 2.2.1 on 2020-02-16 13:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backstage', '0005_auto_20200216_1702'),
]
operations = [
migrations.AddField(
model_name='carouseldisplay',
name='ca... | [
"django.db.models.ImageField"
] | [((351, 419), 'django.db.models.ImageField', 'models.ImageField', ([], {'default': '"""photos/default.png"""', 'upload_to': '"""photos/"""'}), "(default='photos/default.png', upload_to='photos/')\n", (368, 419), False, 'from django.db import migrations, models\n')] |
import httpx
from . import BaseAdapter
class Instagram(BaseAdapter):
def _base_url(self):
return "https://www.instagram.com"
def url(self):
# https://www.instagram.com/{}/?__a=1
return f"{self._base_url()}/{self.id}/?__a=1"
async def _get(self):
async with httpx.AsyncCli... | [
"httpx.AsyncClient"
] | [((306, 325), 'httpx.AsyncClient', 'httpx.AsyncClient', ([], {}), '()\n', (323, 325), False, 'import httpx\n')] |
from django.db import models
#from django.contrib.auth.models import User
from django.contrib.auth import get_user_model
class Home(models.Model):
class Meta:
ordering = ('name',)
verbose_name_plural = "999999999999999. Homes"
name = models.CharField(max_length=2000, default="")
def __st... | [
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((261, 306), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(2000)', 'default': '""""""'}), "(max_length=2000, default='')\n", (277, 306), False, 'from django.db import models\n'), ((495, 540), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(2000)', 'default': '""""""'})... |
import collections
import logging
import runpy
import typing
from pathlib import Path
import HABApp
log = logging.getLogger('HABApp.Rules')
class RuleFile:
def __init__(self, rule_manager, name: str, path: Path):
from .rule_manager import RuleManager
assert isinstance(rule_manager, RuleManager... | [
"logging.getLogger",
"HABApp.core.wrapper.ExceptionToHABApp",
"collections.defaultdict"
] | [((108, 141), 'logging.getLogger', 'logging.getLogger', (['"""HABApp.Rules"""'], {}), "('HABApp.Rules')\n", (125, 141), False, 'import logging\n'), ((538, 573), 'collections.defaultdict', 'collections.defaultdict', (['(lambda : 1)'], {}), '(lambda : 1)\n', (561, 573), False, 'import collections\n'), ((2269, 2318), 'HAB... |
# Search indexing adaptor using tantivy
# Source: https://github.com/tantivy-search/tantivy-py
import os
import tantivy
from base.search_engine import SearchEngineBase
class TantivyAdapter(SearchEngineBase):
def __init__(self,
index_path='tantivy_index',
fields=[
... | [
"os.path.exists",
"tantivy.Document",
"tantivy.SchemaBuilder",
"tantivy.Index",
"os.mkdir"
] | [((586, 609), 'tantivy.SchemaBuilder', 'tantivy.SchemaBuilder', ([], {}), '()\n', (607, 609), False, 'import tantivy\n'), ((853, 891), 'tantivy.Index', 'tantivy.Index', (['self.schema', 'index_path'], {}), '(self.schema, index_path)\n', (866, 891), False, 'import tantivy\n'), ((771, 797), 'os.path.exists', 'os.path.exi... |
# -*- coding: utf-8 -*-
"""
Graph of the system
x - 2y = 0
x - 4y = 8
I calculated solution as (-8,-4)
graph agrees
"""
#%reset -f
import matplotlib.pyplot as plt
def get_x_i(y):
"""
Returns x -2y = 0 solved for x
i.e. x = 2y
"""
return 2*y
def get_x_ii(y):
... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.title",
"matplotlib.pyplot.axvline",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((533, 585), 'matplotlib.pyplot.plot', 'plt.plot', (['x_i', 'y_i'], {'color': '"""blue"""', 'label': '"""x - 2y = 0"""'}), "(x_i, y_i, color='blue', label='x - 2y = 0')\n", (541, 585), True, 'import matplotlib.pyplot as plt\n'), ((583, 636), 'matplotlib.pyplot.plot', 'plt.plot', (['x_ii', 'y_ii'], {'color': '"""red"""... |
import os
import xml.etree.ElementTree as ET
import xml.dom.minidom as MD
def register_all_namespaces(filename):
namespaces = dict(
[node for _, node in ET.iterparse(filename, events=['start-ns'])])
for ns in namespaces:
ET.register_namespace(ns, namespaces[ns])
def file_to_dict(filename):
... | [
"os.listdir",
"xml.etree.ElementTree.parse",
"os.path.join",
"xml.etree.ElementTree.register_namespace",
"xml.etree.ElementTree.iterparse",
"os.path.abspath"
] | [((1613, 1654), 'os.path.join', 'os.path.join', (['dir', '"""../OpenUtau/Strings/"""'], {}), "(dir, '../OpenUtau/Strings/')\n", (1625, 1654), False, 'import os\n'), ((1672, 1687), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (1682, 1687), False, 'import os\n'), ((1782, 1809), 'os.path.join', 'os.path.join', ([... |
import os
import os.path as path
class WithFixtures(object):
"""Preload class fixtures (if any) on class initialization and
check with special fixture tester function does the computed
result equal precomputed output in fixture.
Example of location:
tests/
test_serializers.py
test... | [
"os.path.dirname",
"os.listdir",
"os.path.join"
] | [((1290, 1330), 'os.path.join', 'path.join', (['base_dir', '"""fixtures"""', 'cls_dir'], {}), "(base_dir, 'fixtures', cls_dir)\n", (1299, 1330), True, 'import os.path as path\n'), ((1203, 1225), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (1215, 1225), True, 'import os.path as path\n'), ((136... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
try:
import cPickle as pickle
except:
import pickle
import numpy as np
import scipy.misc
IMAGE_SIZE = 32
def to_one_hot(y, num_label):
"""Converts a one-dimensional label array to a two-dime... | [
"numpy.mean",
"numpy.eye",
"pickle.dump",
"os.path.join",
"numpy.array",
"os.path.dirname",
"numpy.std",
"numpy.genfromtxt",
"numpy.arange",
"numpy.random.shuffle"
] | [((354, 371), 'numpy.eye', 'np.eye', (['num_label'], {}), '(num_label)\n', (360, 371), True, 'import numpy as np\n'), ((3542, 3580), 'os.path.join', 'os.path.join', (['prefix', '"""testLabels.csv"""'], {}), "(prefix, 'testLabels.csv')\n", (3554, 3580), False, 'import os\n'), ((3600, 3672), 'numpy.genfromtxt', 'np.genfr... |