code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
import sys
players = open(os.path.join(sys.path[0], 'day22_data.txt')).read().strip().split('\n\n')
player1, player2 = [[int(line) for line in player.split('\n')[1:]] for player in players]
while len(player1) > 0 and len(player2) > 0:
c1, c2 = player1.pop(0), player2.pop(0)
if c1 > c2:
... | [
"os.path.join"
] | [((40, 83), 'os.path.join', 'os.path.join', (['sys.path[0]', '"""day22_data.txt"""'], {}), "(sys.path[0], 'day22_data.txt')\n", (52, 83), False, 'import os\n')] |
import pandas as pd
import numpy as np
from misc import data_io
DATA_DIR = 'data/ut-interaction/'
""" Folder structure
<'set1' or 'set2'>/keypoints
<video_name>/
<video_name>_<frame_num>_keypoints.json
...
Ex: DATA_DIR + 'set1/keypoints/0_1_4/0_1_4_000000000042_keypoints.json'
"""
VIDEOS = [
... | [
"pandas.DataFrame",
"misc.data_io.get_data",
"numpy.arange"
] | [((5236, 5295), 'misc.data_io.get_data', 'data_io.get_data', (['gt_split'], {'pose_style': '"""OpenPose"""'}), "(gt_split, pose_style='OpenPose', **kwargs)\n", (5252, 5295), False, 'from misc import data_io\n'), ((2532, 2545), 'numpy.arange', 'np.arange', (['(10)'], {}), '(10)\n', (2541, 2545), True, 'import numpy as n... |
# ch19/example3.py
from datetime import datetime
import time
import os
from apscheduler.schedulers.background import BackgroundScheduler
def task():
print(f'From process {os.getpid()}: The time is {datetime.now()}')
print(f'Starting job inside {os.getpid()}')
time.sleep(4)
print(f'Ending job inside {... | [
"apscheduler.schedulers.background.BackgroundScheduler",
"os.getpid",
"datetime.datetime.now",
"time.sleep"
] | [((275, 288), 'time.sleep', 'time.sleep', (['(4)'], {}), '(4)\n', (285, 288), False, 'import time\n'), ((379, 400), 'apscheduler.schedulers.background.BackgroundScheduler', 'BackgroundScheduler', ([], {}), '()\n', (398, 400), False, 'from apscheduler.schedulers.background import BackgroundScheduler\n'), ((575, 588), 't... |
from website_downloader.services.files import FilesService
from website_downloader.services.utils import is_google_font, is_favicon
class StylesService(FilesService):
def extract_elements_from_page(self):
raw_links = self.page.find_all('link')
for raw in raw_links:
# TODO: remove this... | [
"website_downloader.services.utils.is_favicon",
"website_downloader.services.utils.is_google_font"
] | [((710, 730), 'website_downloader.services.utils.is_google_font', 'is_google_font', (['elem'], {}), '(elem)\n', (724, 730), False, 'from website_downloader.services.utils import is_google_font, is_favicon\n'), ((805, 821), 'website_downloader.services.utils.is_favicon', 'is_favicon', (['elem'], {}), '(elem)\n', (815, 8... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Benchmark different GUI image draw times in tkinter
Environment setup instructions:
conda create -n gui-test tk matplotlib pillow vispy
pip install pyopengltk
"""
import time
import tkinter as tk
import numpy as np
from PIL import Image, ImageTk
from matplo... | [
"vispy.app.use_app",
"PIL.Image.fromarray",
"vispy.scene.visuals.Image",
"matplotlib.figure.Figure",
"vispy.scene.SceneCanvas",
"numpy.random.randint",
"tkinter.Tk",
"tkinter.Label",
"vispy.scene.PanZoomCamera",
"time.time",
"matplotlib.backends.backend_tkagg.FigureCanvasTkAgg"
] | [((646, 653), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (651, 653), True, 'import tkinter as tk\n'), ((671, 682), 'time.time', 'time.time', ([], {}), '()\n', (680, 682), False, 'import time\n'), ((745, 756), 'time.time', 'time.time', ([], {}), '()\n', (754, 756), False, 'import time\n'), ((817, 842), 'tkinter.Label', 't... |
#!/usr/bin/python3
"""module containing class for proxy_lists
"""
import requests
class Proxy_List:
"""proxy list class for use in generating custom lists of proxies
currently only works with provided url, using non default produces
unknown behavior
"""
default_url = "https://raw.githubus... | [
"requests.get"
] | [((1645, 1662), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1657, 1662), False, 'import requests\n')] |
#!/usr/bin/python
import kaldi_io
import sys
import os
from os.path import join, isdir
from numpy.random import permutation
import itertools
import keras
import numpy as np
from keras.preprocessing.sequence import pad_sequences
import queue
from threading import Thread
import random
import glob
import sys
sys.path.in... | [
"sys.path.insert",
"kaldi_io.read_mat",
"random.shuffle",
"numpy.zeros",
"threading.Thread",
"queue.Queue",
"MT_TransV1.CMVN.CMVN"
] | [((309, 375), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/mnt/matylda3/vydana/HOW2_EXP/MT_Transformer"""'], {}), "(0, '/mnt/matylda3/vydana/HOW2_EXP/MT_Transformer')\n", (324, 375), False, 'import sys\n'), ((1558, 1595), 'queue.Queue', 'queue.Queue', (["input_dict['queue_size']"], {}), "(input_dict['queue_size'... |
"""Standard library imports"""
import numpy as np # 1.19.4
import pandas as pd # 1.2.0
import scipy as sp #
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
from scipy.optimize import fsolve
"""Local modules"""
from pyloads.blade_data import BladeFeatures
from pyloads.aerodynamic_profiles impo... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"pyloads.blade_data.BladeFeatures",
"scipy.interpolate.interp1d",
"numpy.array",
"numpy.sin",
"pyloads.aerodynamic_profiles.AeroProfiles",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"pandas.DataFrame",
"numpy.rad2... | [((1130, 1596), 'pandas.DataFrame', 'pd.DataFrame', (["{'u': [4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, \n 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0], 'pitch': [\n 2.751, 1.966, 0.896, 0.0, 0.0, 0.0, 0.0, 0.0, 4.502, 7.266, 9.292, \n 10.958, 12.499, 13.896, 15.2, 16.432... |
import logging
from logging.handlers import RotatingFileHandler
import os
from flask import Flask
from .utils import ensure_dir
from .extensions import db
from .views import bp
from .renderers import format_datetime, format_iso8601_notz, format_iso8601, render_post
def create_app(config=None):
app = Flask(__name... | [
"os.path.dirname",
"logging.Formatter",
"logging.handlers.RotatingFileHandler",
"flask.Flask"
] | [((308, 323), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (313, 323), False, 'from flask import Flask\n'), ((934, 1006), 'logging.handlers.RotatingFileHandler', 'RotatingFileHandler', (['log_path'], {'maxBytes': '(100 * 1024 * 1024)', 'backupCount': '(5)'}), '(log_path, maxBytes=100 * 1024 * 1024, backu... |
# -*- coding: utf-8 -*-
'''
this module will represent possible version control system objects
'''
# Import Python libs
import logging
log = logging.getLogger(__name__) # pylint: disable=C0103
class GITRepo(object):
'''
Represent git version control system
https://en.wikipedia.org/wiki/Git_(software)
... | [
"logging.getLogger"
] | [((143, 170), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (160, 170), False, 'import logging\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('oyster', '0005_task_task_rule'),
]
operations = [
migrations.AddField(
model_name='userprofile',
nam... | [
"django.db.models.FloatField"
] | [((356, 385), 'django.db.models.FloatField', 'models.FloatField', ([], {'default': '(10)'}), '(default=10)\n', (373, 385), False, 'from django.db import models, migrations\n'), ((514, 542), 'django.db.models.FloatField', 'models.FloatField', ([], {'default': '(5)'}), '(default=5)\n', (531, 542), False, 'from django.db ... |
# -*- coding: utf-8 -*-
from enum import Enum
ORDER_STATUS = Enum("ORDER_STATUS", [
"OPEN",
"FILLED",
"REJECTED",
"CANCELLED",
])
EVENT_TYPE = Enum("EVENT_TYPE", [
"DAY_START",
"HANDLE_BAR",
"DAY_END",
])
EXECUTION_PHASE = Enum("EXECUTION_PHASE", [
"INIT",
"HANDLE_BAR",
"B... | [
"enum.Enum"
] | [((64, 129), 'enum.Enum', 'Enum', (['"""ORDER_STATUS"""', "['OPEN', 'FILLED', 'REJECTED', 'CANCELLED']"], {}), "('ORDER_STATUS', ['OPEN', 'FILLED', 'REJECTED', 'CANCELLED'])\n", (68, 129), False, 'from enum import Enum\n'), ((164, 222), 'enum.Enum', 'Enum', (['"""EVENT_TYPE"""', "['DAY_START', 'HANDLE_BAR', 'DAY_END']"... |
from flask import Blueprint, render_template, abort, request, redirect, url_for, session, current_app as app
from model import User
from botimpl import ChatBotController, FacebookMessenger
import json
from splitwise import Splitwise
import urllib
from app.botimpl.botexception import BotException, LoginException
from a... | [
"flask.render_template",
"flask.current_app.logger.debug",
"json.loads",
"flask.request.args.get",
"urllib.unquote",
"botimpl.ChatBotController",
"model.User.query.filter_by",
"botimpl.FacebookMessenger.getSenderId",
"flask.redirect",
"botimpl.FacebookMessenger",
"model.User",
"flask.abort",
... | [((386, 443), 'flask.Blueprint', 'Blueprint', (['"""pages"""', '__name__'], {'template_folder': '"""templates"""'}), "('pages', __name__, template_folder='templates')\n", (395, 443), False, 'from flask import Blueprint, render_template, abort, request, redirect, url_for, session, current_app as app\n'), ((760, 861), 'b... |
import numpy as np
from sklearn.metrics import average_precision_score
def load_data(data_path):
"""load array data from data_path"""
data = np.load(data_path)
return data['X_train'], data['y_train'], data['X_test'], data['y_test']
def calculate_average_precision(label, index, similarity, num_search_sam... | [
"numpy.where",
"numpy.array",
"numpy.load",
"sklearn.metrics.average_precision_score"
] | [((151, 169), 'numpy.load', 'np.load', (['data_path'], {}), '(data_path)\n', (158, 169), True, 'import numpy as np\n'), ((473, 512), 'numpy.array', 'np.array', (['[label[idx] for idx in index]'], {}), '([label[idx] for idx in index])\n', (481, 512), True, 'import numpy as np\n'), ((544, 573), 'numpy.where', 'np.where',... |
# -*- coding: utf-8 -*-
"""
Copyright 2019 <NAME>, Aprar s.r.o.
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 ... | [
"logging.basicConfig",
"PIL.Image.open",
"identification.detector.fan_detect",
"flask.Flask",
"flask.abort",
"flask.jsonify",
"torch.load",
"os.environ.get",
"identification.detector.load_model",
"os.path.join",
"torch.cuda.is_available",
"tempfile.gettempdir",
"werkzeug.utils.secure_filenam... | [((940, 965), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (963, 965), False, 'import torch\n'), ((1006, 1042), 'os.environ.get', 'os.environ.get', (['"""VS_FAN_MODEL"""', 'None'], {}), "('VS_FAN_MODEL', None)\n", (1020, 1042), False, 'import os\n'), ((1135, 1176), 'identification.detector.lo... |
'''
https://leetcode.com/problems/populating-next-right-pointers-in-each-node/
'''
from collections import deque
class Solution:
def connect(self, root: 'Node') -> 'Node':
if not root: return root
k=1
q=deque()
q.append(root)
while q:
for i in range(k):
... | [
"collections.deque"
] | [((231, 238), 'collections.deque', 'deque', ([], {}), '()\n', (236, 238), False, 'from collections import deque\n')] |
# coding:utf-8
import os
import sys
import json
import subprocess
import argparse
# local
try:
# need when 「python3 gfzs/cmd/config.py」
if __name__ == "__main__":
# https://codechacha.com/ja/how-to-import-python-files/
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))... | [
"runtime.config.init",
"os.path.exists",
"os.environ.get",
"utils.logger.init_properties",
"os.path.dirname",
"argparse.Namespace",
"utils.logger.error",
"subprocess.call",
"sys.exit",
"utils.logger.debug"
] | [((1344, 1380), 'utils.logger.init_properties', 'logger.init_properties', ([], {}), '(**properties)\n', (1366, 1380), True, 'import utils.logger as logger\n'), ((1385, 1420), 'utils.logger.debug', 'logger.debug', (["('start %s' % progname)"], {}), "('start %s' % progname)\n", (1397, 1420), True, 'import utils.logger as... |
# -*- coding: utf-8 -*-
import os
import logging
import time
from elasticsearch import Elasticsearch, helpers
from configparser import ConfigParser
# 生成日志文件
logging.basicConfig(filename='logging_es.log', level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = ... | [
"logging.basicConfig",
"logging.getLogger",
"os.listdir",
"configparser.ConfigParser",
"elasticsearch.helpers.bulk",
"os.getcwd",
"time.localtime",
"logging.info",
"os.remove"
] | [((161, 295), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""logging_es.log"""', 'level': 'logging.INFO', 'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""'}), "(filename='logging_es.log', level=logging.INFO, format=\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n... |
import ipfsapi
import json
#replace this part with ethereum connection :)
cert_id = "example_cert"
cert_test_rules_ipfs = "QmRpf56gT995wnmBwQsbiCAKRFZhHVpdcBkkAdQWjPUGze"
cert_test_proofs_ipfs = "QmTDLmKYLRxEw6Hjb8swSi1xDZvQs6R9jPb5isyZKPuXBX"
api = ipfsapi.connect('127.0.0.1', 5001)
def getJSONfromIPFS(ipfscat):
... | [
"json.loads",
"ipfsapi.connect"
] | [((254, 288), 'ipfsapi.connect', 'ipfsapi.connect', (['"""127.0.0.1"""', '(5001)'], {}), "('127.0.0.1', 5001)\n", (269, 288), False, 'import ipfsapi\n'), ((401, 420), 'json.loads', 'json.loads', (['resjson'], {}), '(resjson)\n', (411, 420), False, 'import json\n')] |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import insightconnect_plugin_runtime
import json
class Input:
CLIENT_ID = "client_id"
CLIENT_SECRET = "client_secret"
CREDENTIALS = "credentials"
TENANT_ID = "tenant_id"
URL = "url"
class ConnectionSchema(insightconnect_plugin_runtime.Input):
schem... | [
"json.loads"
] | [((324, 2118), 'json.loads', 'json.loads', (['"""\n {\n "type": "object",\n "title": "Variables",\n "properties": {\n "client_id": {\n "type": "string",\n "title": "Client ID",\n "description": "Client ID, also called Application ID",\n "order": 3\n },\n "client_secret": {\n "type... |
import pytest
import attr
import xsimlab as xs
from xsimlab.tests.fixture_process import SomeProcess, AnotherProcess, ExampleProcess
from xsimlab.variable import _as_dim_tuple, _as_group_tuple
@pytest.mark.parametrize(
"dims,expected",
[
((), ((),)),
([], ((),)),
("", ((),)),
... | [
"xsimlab.foreign",
"xsimlab.variable._as_group_tuple",
"xsimlab.variable._as_dim_tuple",
"pytest.mark.parametrize",
"xsimlab.variable",
"xsimlab.any_object",
"pytest.raises",
"attr.fields",
"xsimlab.global_ref",
"xsimlab.group",
"xsimlab.on_demand",
"xsimlab.index",
"xsimlab.group_dict",
"... | [((197, 423), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dims,expected"""', "[((), ((),)), ([], ((),)), ('', ((),)), ('x', (('x',),)), (['x'], (('x',),)\n ), ('x', (('x',),)), (('x', 'y'), (('x', 'y'),)), ([(), 'x', ('x', 'y')\n ], ((), ('x',), ('x', 'y')))]"], {}), "('dims,expected', [((), ((),)... |
from decimal import Decimal
def test_convert_to_decimal_units(get_contract, assert_tx_failed):
code = """
units: {
meter: "Meter"
}
@public
def test() -> decimal(meter):
a: decimal(meter) = convert(5001, decimal)
return a
@public
def test2() -> decimal(meter):
b: int128(meter) = 1234
a: deci... | [
"decimal.Decimal"
] | [((425, 440), 'decimal.Decimal', 'Decimal', (['"""5001"""'], {}), "('5001')\n", (432, 440), False, 'from decimal import Decimal\n'), ((465, 480), 'decimal.Decimal', 'Decimal', (['"""1234"""'], {}), "('1234')\n", (472, 480), False, 'from decimal import Decimal\n'), ((1462, 1482), 'decimal.Decimal', 'Decimal', (['max_dec... |
import itertools
from math import modf
def encode(message: str, rails: int):
rail_list = [list() for i in range(rails)] #Create one list for each rail
indices = [*[i for i in range(rails)], *[i for i in range(rails-2,0,-1)]] #The order of the lists needs to do this smart loop
#If it's 3 rails, it should b... | [
"math.modf",
"itertools.chain.from_iterable",
"itertools.cycle"
] | [((1168, 1201), 'math.modf', 'modf', (['(message_size / pattern_size)'], {}), '(message_size / pattern_size)\n', (1172, 1201), False, 'from math import modf\n'), ((381, 405), 'itertools.cycle', 'itertools.cycle', (['indices'], {}), '(indices)\n', (396, 405), False, 'import itertools\n'), ((1884, 1908), 'itertools.cycle... |
from TikTokApi import TikTokApi
import os
def test_video_attributes():
with TikTokApi(custom_verify_fp=os.environ.get("verifyFp", None)) as api:
tag_name = "funny"
for video in api.hashtag(name=tag_name).videos():
# Test hashtags on video.
tag_included = False
f... | [
"os.environ.get"
] | [((109, 141), 'os.environ.get', 'os.environ.get', (['"""verifyFp"""', 'None'], {}), "('verifyFp', None)\n", (123, 141), False, 'import os\n')] |
"""Module that handles shared information for all network objects."""
import xml.etree.ElementTree as et
import numbers
import numpy as np
import pandas as pd
import scipy.sparse as sps
from paminco.utils.readin import parse_number, xml_find_root
from paminco.utils.misc import Cache
from paminco.utils.typing import s... | [
"numpy.hstack",
"paminco.utils.misc.Cache",
"paminco.utils.typing.sparse_format",
"numpy.argsort",
"numpy.array",
"numpy.savez",
"numpy.where",
"numpy.delete",
"numpy.sort",
"scipy.sparse.coo_matrix",
"pandas.DataFrame",
"scipy.sparse.csr_matrix",
"numpy.ones",
"paminco.utils.typing.is_int... | [((7761, 7799), 'numpy.array', 'np.array', (['labels'], {'dtype': 'str', 'copy': 'copy'}), '(labels, dtype=str, copy=copy)\n', (7769, 7799), True, 'import numpy as np\n'), ((7823, 7868), 'numpy.array', 'np.array', (['indices'], {'dtype': 'dtype_int', 'copy': 'copy'}), '(indices, dtype=dtype_int, copy=copy)\n', (7831, 7... |
#!/usr/bin/env python3
#
# Copyright (c) 2021 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
"""
Class for Dictionary-based Logging Database
"""
import base64
import copy
import json
from .utils import extract_string_from_section
ARCHS = {
"arc" : {
"kconfig": "CONFIG_ARC",
},
"arm" ... | [
"base64.b64encode",
"json.dumps",
"base64.b64decode",
"copy.deepcopy",
"json.load"
] | [((5998, 6030), 'copy.deepcopy', 'copy.deepcopy', (['database.database'], {}), '(database.database)\n', (6011, 6030), False, 'import copy\n'), ((5734, 5768), 'base64.b64decode', 'base64.b64decode', (["sect['data_b64']"], {}), "(sect['data_b64'])\n", (5750, 5768), False, 'import base64\n'), ((6166, 6196), 'base64.b64enc... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-12-03 20:01
from __future__ import unicode_literals
from django.db import migrations
def make_candidates(apps, schema_editor):
Candidate = apps.get_model('medic', 'Candidate')
BloodRequest = apps.get_model('medic', 'BloodRequest')
for req in Blo... | [
"django.db.migrations.RunPython"
] | [((608, 645), 'django.db.migrations.RunPython', 'migrations.RunPython', (['make_candidates'], {}), '(make_candidates)\n', (628, 645), False, 'from django.db import migrations\n')] |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
"""
import setuptools
from glob import glob
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="isrpy",
version="0.0.1",
author="<NAME>",
author_email="<EMAIL>",
... | [
"setuptools.find_packages"
] | [((508, 534), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (532, 534), False, 'import setuptools\n')] |
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# 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 b... | [
"nova.ipv6.to_global",
"sqlalchemy.Table",
"nova.utils.utcnow",
"json.dumps",
"nova.log.getLogger",
"sqlalchemy.MetaData",
"sqlalchemy.select"
] | [((775, 802), 'nova.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (792, 802), True, 'from nova import log as logging\n'), ((845, 855), 'sqlalchemy.MetaData', 'MetaData', ([], {}), '()\n', (853, 855), False, 'from sqlalchemy import select, MetaData, Table\n'), ((932, 982), 'sqlalchemy.Table', ... |
# Importing Libraries
from requests import get
from pathlib import Path
import os
from dotenv import load_dotenv
import Scripts.zNumberFormat
import Scripts.zSBStalk
# Loading Data From .env File
load_dotenv()
env_path = Path('.') / '.env'
api_key = os.getenv("API_KEY")
username = 'NottCurious'
# Getting UUID Using ... | [
"requests.get",
"pathlib.Path",
"os.getenv",
"dotenv.load_dotenv"
] | [((197, 210), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (208, 210), False, 'from dotenv import load_dotenv\n'), ((251, 271), 'os.getenv', 'os.getenv', (['"""API_KEY"""'], {}), "('API_KEY')\n", (260, 271), False, 'import os\n'), ((222, 231), 'pathlib.Path', 'Path', (['"""."""'], {}), "('.')\n", (226, 231), ... |
import functools
import gc
import itertools
import logging
import pathlib
import shutil
import hetnetpy.hetnet
import hetnetpy.matrix
import hetnetpy.permute
import hetnetpy.readwrite
import numpy
import pandas
import scipy.sparse
import hetmatpy.degree_weight
import hetmatpy.matrix
def hetmat_from_graph(
graph... | [
"pandas.read_csv",
"shutil.move",
"pathlib.Path",
"itertools.product",
"logging.warning",
"itertools.count",
"gc.collect",
"shutil.rmtree",
"pandas.DataFrame",
"functools.lru_cache",
"numpy.load",
"pandas.concat",
"numpy.save"
] | [((3935, 3953), 'pathlib.Path', 'pathlib.Path', (['path'], {}), '(path)\n', (3947, 3953), False, 'import pathlib\n'), ((7334, 7355), 'functools.lru_cache', 'functools.lru_cache', ([], {}), '()\n', (7353, 7355), False, 'import functools\n'), ((10614, 10635), 'functools.lru_cache', 'functools.lru_cache', ([], {}), '()\n'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Ensure OSC responses from the controller build correctly."""
import pytest
from stepseries import responses
def test_booted() -> None:
message = "/booted 0"
osc_message1 = responses.Booted(*message.split())
osc_message2 = responses.Booted(message)
... | [
"stepseries.responses.Booted",
"stepseries.responses.OverCurrent",
"stepseries.responses.ErrorCommand",
"stepseries.responses.MotorStatus",
"stepseries.responses.HomingStatus",
"stepseries.responses.Uvlo",
"stepseries.responses.ThermalStatus",
"stepseries.responses.Stall",
"stepseries.responses.HiZ"... | [((289, 314), 'stepseries.responses.Booted', 'responses.Booted', (['message'], {}), '(message)\n', (305, 314), False, 'from stepseries import responses\n'), ((329, 359), 'stepseries.responses.Booted', 'responses.Booted', (['"""/booted"""', '(0)'], {}), "('/booted', 0)\n", (345, 359), False, 'from stepseries import resp... |
import pypianoroll
import os
from tqdm import tqdm
def get_all_file_from_directory(path):
all_files_with_full_path = []
for path, subdirs, files in os.walk(path):
for name in files:
xx = os.path.join(path, name)
all_files_with_full_path.append((name, xx))
return all_files_... | [
"os.path.join",
"tqdm.tqdm",
"pypianoroll.load",
"os.walk"
] | [((456, 471), 'tqdm.tqdm', 'tqdm', (['all_files'], {}), '(all_files)\n', (460, 471), False, 'from tqdm import tqdm\n'), ((159, 172), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (166, 172), False, 'import os\n'), ((485, 516), 'pypianoroll.load', 'pypianoroll.load', ([], {'filepath': 'each'}), '(filepath=each)\n', ... |
from django.db import models
from students.models import Class, Subject, Teacher
from .validators import validate_date
class Exam(models.Model):
subject = models.ForeignKey(Subject, on_delete=models.CASCADE)
date = models.DateField(auto_now=False, validators=[validate_date])
clazz = models.ForeignKey(Cl... | [
"django.db.models.TextField",
"django.db.models.DateField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((163, 215), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Subject'], {'on_delete': 'models.CASCADE'}), '(Subject, on_delete=models.CASCADE)\n', (180, 215), False, 'from django.db import models\n'), ((227, 287), 'django.db.models.DateField', 'models.DateField', ([], {'auto_now': '(False)', 'validators': '[val... |
r"""
=========================================================
Utilities Abaqus (:mod:`desicos.abaqus.abaqus_functions`)
=========================================================
.. currentmodule:: desicos.abaqus.abaqus_functions
Includes all utilities functions that must be executed from Abaqus.
"""
from __future__... | [
"abaqus.session.autoColors.setValues",
"numpy.cross",
"abaqus.session.psOptions.setValues",
"abaqus.session.xyDataObjects.keys",
"abaqus.session.xyPlots.keys",
"abaqus.session.XYPlot",
"numpy.array",
"numpy.concatenate",
"abaqus.session.printToFile",
"abaqus.session.printOptions.setValues",
"aba... | [((761, 789), 'abaqus.session.xyDataObjects.keys', 'session.xyDataObjects.keys', ([], {}), '()\n', (787, 789), False, 'from abaqus import session\n'), ((1003, 1031), 'abaqus.session.xyDataObjects.keys', 'session.xyDataObjects.keys', ([], {}), '()\n', (1029, 1031), False, 'from abaqus import session\n'), ((1112, 1137), ... |
# --- Do not remove these libs ---
from functools import reduce
from freqtrade.strategy import IStrategy
from freqtrade.strategy import timeframe_to_minutes
from freqtrade.strategy import BooleanParameter, IntParameter
from pandas import DataFrame
from technical.util import resample_to_interval, resampled_merge
import ... | [
"functools.reduce",
"talib.abstract.CCI",
"talib.abstract.STOCHF",
"freqtrade.vendor.qtpylib.indicators.bollinger_bands",
"freqtrade.strategy.timeframe_to_minutes",
"technical.util.resampled_merge",
"talib.abstract.ADX",
"talib.abstract.RSI",
"talib.abstract.MFI",
"freqtrade.strategy.IntParameter"... | [((1316, 1361), 'freqtrade.strategy.IntParameter', 'IntParameter', (['(20)', '(50)'], {'default': '(32)', 'space': '"""buy"""'}), "(20, 50, default=32, space='buy')\n", (1328, 1361), False, 'from freqtrade.strategy import BooleanParameter, IntParameter\n'), ((1378, 1423), 'freqtrade.strategy.IntParameter', 'IntParamete... |
import datetime
timenow = datetime.datetime.now()
class user:
def __init__(self, name, information) -> str:
self.name = name
self.information = information
def get_username(self) -> str:
return self.name
def get_user_information(self) -> str:
return self.information
cl... | [
"datetime.datetime.now"
] | [((27, 50), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (48, 50), False, 'import datetime\n'), ((381, 404), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (402, 404), False, 'import datetime\n')] |
"""Person defines a person with his cooresponding properties.
This class allows a person to get names.
"""
import re
import os
import json
from scripts.utils.dumark import DuMark
from scripts.data import Data
from scripts.utils.ducrawler import DuCrawler
from scripts.utils.constants import SCHOLAR_PHOTO_LOCAL, SCHOLAR... | [
"re.compile",
"scripts.utils.dumark.DuMark.get_website",
"scripts.data.Data.has_pid",
"scripts.utils.ducrawler.DuCrawler.download_image",
"scripts.utils.ducrawler.DuCrawler.download_file",
"json.dumps",
"scripts.utils.dumark.DuMark.get_github",
"scripts.utils.dumark.DuMark.get_vimeo",
"datetime.date... | [((413, 449), 're.compile', 're.compile', (['"""(\\\\d+)\\\\/(\\\\d+)\\\\/\\\\d+"""'], {}), "('(\\\\d+)\\\\/(\\\\d+)\\\\/\\\\d+')\n", (423, 449), False, 'import re\n'), ((1287, 1320), 'json.dumps', 'json.dumps', (["{'_data': self._data}"], {}), "({'_data': self._data})\n", (1297, 1320), False, 'import json\n'), ((4504,... |
#put your lfcs inside below quotes
LFCS="0204ff5678"
#put your id0 inside below quotes
ID0="<KEY>"
#note: both numbers need to be hex, but don't preface them with the 0x
import struct,sys
pad=b"\x00"
lfcs_int=int(LFCS,16)
isnew=lfcs_int>>32
lfcs_base=lfcs_int & 0xffffffff
if LFCS=="0204ff5678":
print("Error: y... | [
"struct.pack",
"sys.exit"
] | [((398, 409), 'sys.exit', 'sys.exit', (['(6)'], {}), '(6)\n', (406, 409), False, 'import struct, sys\n'), ((519, 530), 'sys.exit', 'sys.exit', (['(7)'], {}), '(7)\n', (527, 530), False, 'import struct, sys\n'), ((660, 671), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (668, 671), False, 'import struct, sys\n'), ((11... |
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import StringProperty
from kivy.uix.button import Button
from kivy.uix.modalview import ModalView
from kivymd.dialog import MDDialog
from kivymd.theming import ThemeManager
from kivyic.dialog import ICDialog, FileExplorerDialog
from kivyic.fil... | [
"kivymd.theming.ThemeManager",
"kivyic.dialog.FileExplorerDialog",
"kivyic.fileexplorer.FileExplorer",
"kivy.lang.Builder.load_string",
"kivyic.dialog.ICDialog",
"kivy.properties.StringProperty"
] | [((609, 623), 'kivymd.theming.ThemeManager', 'ThemeManager', ([], {}), '()\n', (621, 623), False, 'from kivymd.theming import ThemeManager\n'), ((639, 655), 'kivy.properties.StringProperty', 'StringProperty', ([], {}), '()\n', (653, 655), False, 'from kivy.properties import StringProperty\n'), ((699, 727), 'kivy.lang.B... |
import discord
from discord.ext import commands, tasks
from discord.ext.commands import has_permissions, CheckFailure
from typing import Union
import random
import json
import utils.embed as embed
from utils.colors import *
import utils.converters as converters
import os
# ENV
from dotenv import do... | [
"random.randint",
"discord.ext.commands.RoleNotFound",
"json.load",
"utils.converters.CtxRoleConverter",
"os.path.abspath",
"discord.ext.commands.command"
] | [((1063, 1137), 'discord.ext.commands.command', 'commands.command', ([], {'aliases': "['pegar', 'add', 'add_roles']", 'pass_context': '(True)'}), "(aliases=['pegar', 'add', 'add_roles'], pass_context=True)\n", (1079, 1137), False, 'from discord.ext import commands, tasks\n'), ((4404, 4460), 'discord.ext.commands.comman... |
import re
pattern = r'(!([A-Z][a-z]{3,})!:\[([a-zA-Z]{8,})\])'
n = int(input())
for i in range(n):
message = input()
match = re.findall(pattern, message)
if not match:
print('The message is invalid')
continue
valid_message = match[0][0]
command = match[0][1]
text... | [
"re.findall"
] | [((142, 170), 're.findall', 're.findall', (['pattern', 'message'], {}), '(pattern, message)\n', (152, 170), False, 'import re\n')] |
from minicps.devices import PLC
from utils import *
import time
import logging
PLC201_ADDR = IP['plc201']
P201 = ('P201', 2)
class PP201(PLC):
def pre_loop(self, sleep=0.1):
logging.basicConfig(filename=LOG_P201_FILE, level=logging.DEBUG)
time.sleep(sleep)
def main_loop(self):
count = 0
while count<=PLC... | [
"logging.basicConfig",
"logging.debug",
"time.sleep"
] | [((182, 246), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': 'LOG_P201_FILE', 'level': 'logging.DEBUG'}), '(filename=LOG_P201_FILE, level=logging.DEBUG)\n', (201, 246), False, 'import logging\n'), ((249, 266), 'time.sleep', 'time.sleep', (['sleep'], {}), '(sleep)\n', (259, 266), False, 'import time\n')... |
"""Added session
Revision ID: 1fcee2e6280
Revises: 1<PASSWORD>
Create Date: 2013-11-08 19:24:18.721591
"""
# revision identifiers, used by Alembic.
revision = '1fcee2e6280'
down_revision = '1925329c798a'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ple... | [
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.DateTime",
"alembic.op.drop_table",
"sqlalchemy.Boolean",
"alembic.op.drop_column",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Unicode",
"sqlalchemy.Integer",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.UnicodeText"
] | [((1884, 1908), 'alembic.op.drop_table', 'op.drop_table', (['"""session"""'], {}), "('session')\n", (1897, 1908), False, 'from alembic import op\n'), ((1913, 1952), 'alembic.op.drop_column', 'op.drop_column', (['"""venue_room"""', '"""bgcolor"""'], {}), "('venue_room', 'bgcolor')\n", (1927, 1952), False, 'from alembic ... |
#!/usr/bin/python3
"""
使用Pygame进行游戏开发
Pygame是一个开源的Python模块,专门用于多媒体应用(如电子游戏)的开发,
其中包含对图像、声音、视频、事件、碰撞等的支持。
下面我们来完成一个简单的小游戏,游戏的名字叫“大球吃小球”,
当然完成这个游戏并不是重点,学会使用Pygame也不是重点,
最重要的我们要在这个过程中体会如何使用前面讲解的面向对象程序设计,
学会用这种编程思想去解决现实中的问题。
version: 0.1
author: icro
"""
import pygame
def main():
# 初始化导入的pygame中的模块
pygame.i... | [
"pygame.draw.circle",
"pygame.init",
"pygame.time.delay",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.display.set_caption"
] | [((312, 325), 'pygame.init', 'pygame.init', ([], {}), '()\n', (323, 325), False, 'import pygame\n'), ((363, 398), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(800, 600)'], {}), '((800, 600))\n', (386, 398), False, 'import pygame\n'), ((419, 454), 'pygame.display.set_caption', 'pygame.display.set_caption', ... |
# coding=utf-8
import xml.dom
import xml.dom.minidom
import os
import cv2
import json
_INDENT = '' * 4
_NEW_LINE = '\n'
_FOLDER_NODE = 'train2017'
_ROOT_NODE = 'annotation'
_DATABASE_NAME = 'COCO'
_ANNOTATION = 'train2017'
_DIFFICULT = '0'
_TRUNCATED = '0'
_POSE = 'Unspecified'
# 保存的目录
_ANNOTATION_SAVE_PATH = r'G:\Da... | [
"os.path.exists",
"cv2.imwrite",
"os.listdir",
"os.path.join",
"os.mkdir",
"os._exit",
"json.load"
] | [((2900, 2920), 'os.listdir', 'os.listdir', (['img_path'], {}), '(img_path)\n', (2910, 2920), False, 'import os\n'), ((2951, 2963), 'os._exit', 'os._exit', (['(-1)'], {}), '(-1)\n', (2959, 2963), False, 'import os\n'), ((3111, 3123), 'json.load', 'json.load', (['f'], {}), '(f)\n', (3120, 3123), False, 'import json\n'),... |
import argparse
import pickle
from sklearn.datasets import load_svmlight_file
from sklearn.gaussian_process import GaussianProcessClassifier
from sklearn.gaussian_process.kernels import RBF
from sklearn.model_selection import GridSearchCV
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add... | [
"sklearn.model_selection.GridSearchCV",
"sklearn.gaussian_process.kernels.RBF",
"argparse.ArgumentParser",
"sklearn.datasets.load_svmlight_file",
"sklearn.gaussian_process.GaussianProcessClassifier"
] | [((264, 308), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (287, 308), False, 'import argparse\n'), ((555, 589), 'sklearn.datasets.load_svmlight_file', 'load_svmlight_file', (['args.data_file'], {}), '(args.data_file)\n', (573, 589), False, 'from skl... |
import datetime
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import AbstractUser
from django.core.validators import MinValueValidator, MaxValueValidator
# Create your models here.
class Question(models.Model):
question_text = models.CharField(max_length=200)
pu... | [
"django.core.validators.MaxValueValidator",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.utils.timezone.now",
"django.db.models.DateTimeField",
"django.core.validators.MinValueValidator",
"datetime.timedelta",
"django.db.models.PositiveSmal... | [((281, 313), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (297, 313), False, 'from django.db import models\n'), ((329, 367), 'django.db.models.DateTimeField', 'models.DateTimeField', (['"""date published"""'], {}), "('date published')\n", (349, 367), False, 'fr... |
import pymongo
def setUpMongoDB(db_name="testing", col_name="S&P 500"):
client = pymongo.MongoClient(
"mongodb+srv://lzcai:<EMAIL>/test?retryWrites=true&w=majority")
# db = client['testing']
# collection = db['S&P500']
db = client[db_name]
collection = db[col_name]
return client, db, ... | [
"pymongo.MongoClient"
] | [((87, 175), 'pymongo.MongoClient', 'pymongo.MongoClient', (['"""mongodb+srv://lzcai:<EMAIL>/test?retryWrites=true&w=majority"""'], {}), "(\n 'mongodb+srv://lzcai:<EMAIL>/test?retryWrites=true&w=majority')\n", (106, 175), False, 'import pymongo\n')] |
__author__ = 'Dante'
import random
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score as acc
import numpy as np
import density_weight as dw
import matplotlib as plt
from matplotlib import pyplot
import math
from sklearn import cross_validation as cv
from collections import Counter
impor... | [
"matplotlib.pyplot.ylabel",
"math.sqrt",
"numpy.array",
"matplotlib.pyplot.errorbar",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.ylim",
"random.sample",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.xlim",
"sklearn.metrics.accuracy_score",
"matplotlib.pyplot.legend",
... | [((5006, 5126), 'matplotlib.pyplot.errorbar', 'pyplot.errorbar', (['n', 'rand_avg'], {'fmt': '"""s-"""', 'yerr': 'rand_err', 'color': '"""darkred"""', 'markersize': '(9)', 'lw': '(2)', 'label': '"""Random Selection"""'}), "(n, rand_avg, fmt='s-', yerr=rand_err, color='darkred',\n markersize=9, lw=2, label='Random Se... |
"""
filename: generic_model.py
author: <NAME>
version: 15.04.2021
description: helper functions (plotting, report generation, vgg base model)
"""
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import tensorflow as tf
import cv2
from glob import glob
from sklearn.metrics import confusion_mat... | [
"matplotlib.pyplot.ylabel",
"sklearn.metrics.classification_report",
"sklearn.metrics.roc_auc_score",
"numpy.array",
"tensorflow.keras.layers.Dense",
"sklearn.preprocessing.LabelBinarizer",
"tensorflow.keras.layers.Input",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.yt... | [((1888, 1947), 'sklearn.model_selection.train_test_split', 'train_test_split', (['covid_images', 'covid_labels'], {'test_size': '(0.2)'}), '(covid_images, covid_labels, test_size=0.2)\n', (1904, 1947), False, 'from sklearn.model_selection import train_test_split\n'), ((2015, 2076), 'sklearn.model_selection.train_test_... |
# -*- coding: utf-8 -*-
"""
femagtools.dxfsl.machine
~~~~~~~~~~~~~~~~~~~~~~~~
a machine consists of 2 parts and has a geometry
Authors: <NAME>, <NAME>
"""
from __future__ import print_function
import numpy as np
import logging
from .shape import Element, Circle, Arc, Line, Shape
from .corner import Cor... | [
"logging.getLogger",
"numpy.abs",
"numpy.isclose"
] | [((640, 676), 'logging.getLogger', 'logging.getLogger', (['"""femagtools.geom"""'], {}), "('femagtools.geom')\n", (657, 676), False, 'import logging\n'), ((3251, 3283), 'numpy.isclose', 'np.isclose', (['self.startangle', '(0.0)'], {}), '(self.startangle, 0.0)\n', (3261, 3283), True, 'import numpy as np\n'), ((9954, 999... |
"""
File: tonality_permutation_function.py
Purpose: Class defining a function based on a permutation of a tonality's tones.
"""
from transformation.functions.tonalfunctions.tonal_function import TonalFunction
from transformation.functions.tonalfunctions.tonality_permutation import TonalityPermutation
class Tonalit... | [
"transformation.functions.tonalfunctions.tonal_function.TonalFunction.__init__",
"transformation.functions.tonalfunctions.tonality_permutation.TonalityPermutation"
] | [((1049, 1143), 'transformation.functions.tonalfunctions.tonal_function.TonalFunction.__init__', 'TonalFunction.__init__', (['self', 'domain_tonality', 'domain_tonality', 'primary_map', 'extension_map'], {}), '(self, domain_tonality, domain_tonality, primary_map,\n extension_map)\n', (1071, 1143), False, 'from trans... |
import re
from huey import RedisHuey
from huey.consumer import EVENT_FINISHED, EVENT_STARTED, EVENT_ERROR_TASK
from prometheus_client import Summary, Counter
from huey_exporter.RedisEnqueuedEventHuey import EVENT_ENQUEUED
# Create a metric to track time spent and requests made.
ENQUEUED_COUNTER = Counter('huey_enqueu... | [
"prometheus_client.Summary",
"re.sub",
"prometheus_client.Counter",
"huey.RedisHuey"
] | [((300, 386), 'prometheus_client.Counter', 'Counter', (['"""huey_enqueued_tasks"""', '"""Huey Tasks enqueued"""', "['queue_name', 'task_name']"], {}), "('huey_enqueued_tasks', 'Huey Tasks enqueued', ['queue_name',\n 'task_name'])\n", (307, 386), False, 'from prometheus_client import Summary, Counter\n'), ((401, 486)... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | [
"Kamaelia.Util.DataSource.DataSource",
"Kamaelia.Util.Console.ConsoleEchoer"
] | [((3095, 3158), 'Kamaelia.Util.DataSource.DataSource', 'DataSource', (["[(1, 4, 2, 3), ('d', 'a', 'b', 'c'), ('xx', 'xxx')]"], {}), "([(1, 4, 2, 3), ('d', 'a', 'b', 'c'), ('xx', 'xxx')])\n", (3105, 3158), False, 'from Kamaelia.Util.DataSource import DataSource\n'), ((3192, 3207), 'Kamaelia.Util.Console.ConsoleEchoer', ... |
"""
Copyright (C) 2019 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
"""
# based on https://github.com/pytorch/vision/blob/master/torchvision/models/vgg.py
import torch.nn as nn
import torch.utils.model_zoo as model_... | [
"torch.nn.BatchNorm2d",
"collections.OrderedDict",
"torch.nn.ReLU",
"torch.nn.Sequential",
"layers.gate_layer.GateLayer",
"torch.utils.model_zoo.load_url",
"torch.nn.Conv2d",
"torch.nn.BatchNorm1d",
"torch.nn.MaxPool2d",
"torch.nn.Linear",
"torch.nn.init.kaiming_normal"
] | [((2462, 2484), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (2475, 2484), True, 'import torch.nn as nn\n'), ((4145, 4169), 'collections.OrderedDict', 'OrderedDict', (['module_list'], {}), '(module_list)\n', (4156, 4169), False, 'from collections import OrderedDict\n'), ((871, 904), 'torch.... |
import unittest
import main
class Tests(unittest.TestCase):
def test_is_none(self):
self.assertTrue(main.is_none_or_empty(None))
def test_is_empty(self):
self.assertTrue(main.is_none_or_empty(''))
def test_not_none_or_empty(self):
strings = ('a', 'None')
for s in strings:... | [
"unittest.main",
"main.is_none_or_empty"
] | [((409, 424), 'unittest.main', 'unittest.main', ([], {}), '()\n', (422, 424), False, 'import unittest\n'), ((114, 141), 'main.is_none_or_empty', 'main.is_none_or_empty', (['None'], {}), '(None)\n', (135, 141), False, 'import main\n'), ((197, 222), 'main.is_none_or_empty', 'main.is_none_or_empty', (['""""""'], {}), "(''... |
import random
from collections import defaultdict
from aalpy.base import Automaton, AutomatonState
class StochasticMealyState(AutomatonState):
""" """
def __init__(self, state_id):
super().__init__(state_id)
# each child is a tuple (newNode, output, probability)
self.transitions = def... | [
"random.random",
"collections.defaultdict"
] | [((317, 334), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (328, 334), False, 'from collections import defaultdict\n'), ((838, 853), 'random.random', 'random.random', ([], {}), '()\n', (851, 853), False, 'import random\n')] |
import torch.nn as nn
import torch
import numpy as np
class VNet(nn.Module):
def __init__(self, nb_classes, in_channels=1, depth=5,
start_filters=16, batchnorm=True, mode="AE", input_size=None):
assert mode in ['AE', 'classifier'], "Unknown mode selected, currently supported are: 'AE' an... | [
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.ConvTranspose3d",
"torch.nn.init.constant_",
"torch.nn.ModuleList",
"torch.nn.Sequential",
"torch.nn.init.xavier_normal_",
"numpy.array",
"torch.nn.init.normal_",
"torch.nn.Linear",
"torch.nn.BatchNorm3d",
"torch.cat",
"torch.nn.Conv3d"
] | [((1836, 1860), 'torch.nn.ModuleList', 'nn.ModuleList', (['self.down'], {}), '(self.down)\n', (1849, 1860), True, 'import torch.nn as nn\n'), ((4131, 4144), 'torch.nn.ReLU', 'nn.ReLU', (['(True)'], {}), '(True)\n', (4138, 4144), True, 'import torch.nn as nn\n'), ((4164, 4208), 'torch.nn.Sequential', 'nn.Sequential', ([... |
import datetime
import logging
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.test import Client, TestCase
from django.urls import reverse
from cms.contexts.models import (EditorialBoardLock,
EditorialBoardL... | [
"logging.getLogger",
"cms.contexts.tests.ContextUnitTest.create_webpath",
"django.contrib.contenttypes.models.ContentType.objects.get_for_model",
"cms.contexts.tests.ContextUnitTest.create_website",
"cms.contexts.models.EditorialBoardLockUser.objects.create",
"cms.contexts.models.WebPath.objects.filter",
... | [((429, 456), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (446, 456), False, 'import logging\n'), ((600, 608), 'django.test.Client', 'Client', ([], {}), '()\n', (606, 608), False, 'from django.test import Client, TestCase\n'), ((623, 667), 'cms.contexts.tests.ContextUnitTest.create_edi... |
from django.conf.urls import url
from django.contrib import admin
from django.urls import path,include
from . import views
urlpatterns = [
path('', views.onetoone, name='onetoone'),
path('detail/<int:college_id>/', views.detail, name='detail')
]
| [
"django.urls.path"
] | [((144, 185), 'django.urls.path', 'path', (['""""""', 'views.onetoone'], {'name': '"""onetoone"""'}), "('', views.onetoone, name='onetoone')\n", (148, 185), False, 'from django.urls import path, include\n'), ((191, 252), 'django.urls.path', 'path', (['"""detail/<int:college_id>/"""', 'views.detail'], {'name': '"""detai... |
# Copyright © 2018 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause OR GPL-3.0-only
#!/usr/bin/python
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: vcd_vapp_vm_nic
short_description: Ansible Mo... | [
"pyvcloud.vcd.vapp.VApp",
"pyvcloud.vcd.client.E.IpAddressAllocationMode",
"pyvcloud.vcd.client.E.IsConnected",
"pyvcloud.vcd.vm.VM",
"pyvcloud.vcd.client.E.IpAddress",
"pyvcloud.vcd.client.E.NetworkAdapterType",
"collections.defaultdict",
"pyvcloud.vcd.exceptions.EntityNotFoundException",
"pyvcloud... | [((5730, 5771), 'pyvcloud.vcd.vapp.VApp', 'VApp', (['self.client'], {'resource': 'vapp_resource'}), '(self.client, resource=vapp_resource)\n', (5734, 5771), False, 'from pyvcloud.vcd.vapp import VApp\n'), ((6453, 6470), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (6464, 6470), False, 'from col... |
"""
Filename: visualization.py
Purpose: Set of go-to plotting functions
Author: <NAME>
Date created: 28.11.2018
Possible problems:
1.
"""
import os
import numpy as np
from tractor.galaxy import ExpGalaxy
from tractor import EllipseE
from tractor.galaxy import ExpGalaxy
import matplotlib
matplotlib.use('Agg')
impor... | [
"logging.getLogger",
"numpy.log10",
"numpy.sqrt",
"numpy.nanpercentile",
"skimage.segmentation.find_boundaries",
"numpy.nanmean",
"numpy.array",
"scipy.stats.normaltest",
"numpy.nanmin",
"numpy.arange",
"matplotlib.colors.LogNorm",
"numpy.mean",
"astropy.visualization.hist",
"numpy.max",
... | [((293, 314), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (307, 314), False, 'import matplotlib\n'), ((728, 769), 'logging.getLogger', 'logging.getLogger', (['"""farmer.visualization"""'], {}), "('farmer.visualization')\n", (745, 769), False, 'import logging\n'), ((857, 875), 'numpy.arange', '... |
from rest_framework import viewsets, mixins
from rest_framework.authentication import TokenAuthentication
from rest_framework.permissions import IsAuthenticated
from core.models import Tag, Ingredient, Recepi
from recepi import serializers
class BaseRecepiViewSet(viewsets.GenericViewSet,
mix... | [
"core.models.Ingredient.objects.all",
"core.models.Recepi.objects.all",
"core.models.Tag.objects.all"
] | [((912, 929), 'core.models.Tag.objects.all', 'Tag.objects.all', ([], {}), '()\n', (927, 929), False, 'from core.models import Tag, Ingredient, Recepi\n'), ((1086, 1110), 'core.models.Ingredient.objects.all', 'Ingredient.objects.all', ([], {}), '()\n', (1108, 1110), False, 'from core.models import Tag, Ingredient, Recep... |
from django.contrib import admin
from django.forms import ModelForm, ModelMultipleChoiceField
from server.models import *
from server.utils import reload_plugins_model
class BusinessUnitFilter(admin.SimpleListFilter):
title = 'Business Unit'
parameter_name = 'business_unit'
def lookups(self, request, mo... | [
"django.contrib.admin.site.unregister",
"django.contrib.admin.widgets.FilteredSelectMultiple",
"django.contrib.admin.site.register",
"server.utils.reload_plugins_model"
] | [((7961, 8001), 'django.contrib.admin.site.register', 'admin.site.register', (['ApiKey', 'ApiKeyAdmin'], {}), '(ApiKey, ApiKeyAdmin)\n', (7980, 8001), False, 'from django.contrib import admin\n'), ((8002, 8054), 'django.contrib.admin.site.register', 'admin.site.register', (['BusinessUnit', 'BusinessUnitAdmin'], {}), '(... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | [
"logging.getLogger",
"json.loads",
"unittest2.main",
"keystone.controllers.version.VersionController",
"lxml.etree.fromstring",
"webob.Request.blank"
] | [((804, 831), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (821, 831), False, 'import logging\n'), ((4972, 4987), 'unittest2.main', 'unittest.main', ([], {}), '()\n', (4985, 4987), True, 'import unittest2 as unittest\n'), ((929, 948), 'keystone.controllers.version.VersionController', 'V... |
import click
from ...library.commands.publish import publish
EXCEPTIONS_EXPECTED = (
NotADirectoryError,
AssertionError,
RuntimeError,
AttributeError,
FileNotFoundError,
)
@click.command(name="publish")
@click.option(
"--access", "-a", default="public", required=False, help="The access level... | [
"click.option",
"click.command",
"click.secho"
] | [((197, 226), 'click.command', 'click.command', ([], {'name': '"""publish"""'}), "(name='publish')\n", (210, 226), False, 'import click\n'), ((228, 331), 'click.option', 'click.option', (['"""--access"""', '"""-a"""'], {'default': '"""public"""', 'required': '(False)', 'help': '"""The access level for NPM."""'}), "('--... |
# Copyright (C) July 2018: TF TECH NV in Belgium see https://www.threefold.tech/
# In case TF TECH NV ceases to exist (e.g. because of bankruptcy)
# then Incubaid NV also in Belgium will get the Copyright & Authorship for all changes made since July 2018
# and the license will automatically become Apache v2 for al... | [
"Jumpscale.j.data.bcdb._get_vfs",
"unittest.TestCase",
"Jumpscale.j.data.bcdb.new",
"Jumpscale.j.data.serializers.json.loads"
] | [((1616, 1653), 'Jumpscale.j.data.bcdb.new', 'j.data.bcdb.new', (['testname'], {'reset': '(True)'}), '(testname, reset=True)\n', (1631, 1653), False, 'from Jumpscale import j\n'), ((1665, 1687), 'Jumpscale.j.data.bcdb._get_vfs', 'j.data.bcdb._get_vfs', ([], {}), '()\n', (1685, 1687), False, 'from Jumpscale import j\n')... |
##################################################
## M5Hamote - A HomeAssistant remote on M5Paper
##################################################
## Author: @paeber
## Github: https://github.com/paeber/m5paper-homeassistant-remote
## Copyright: Copyright 2021, PaEber Electronics
## Version: 0.0.1
## Status: alpha
#... | [
"M5PaperUI.Light",
"wifiCfg.doConnect",
"HomeAssistant.HomeAssistant",
"M5PaperUI.MediaPlayer",
"m5mqtt.M5mqtt",
"wifiCfg.wlan_sta.isconnected",
"m5stack.touch.read"
] | [((1354, 1429), 'wifiCfg.doConnect', 'wifiCfg.doConnect', (["HamoteConfig['wifi']['ssid']", "HamoteConfig['wifi']['pw']"], {}), "(HamoteConfig['wifi']['ssid'], HamoteConfig['wifi']['pw'])\n", (1371, 1429), False, 'import wifiCfg\n'), ((1555, 1632), 'HomeAssistant.HomeAssistant', 'HomeAssistant', (["HamoteConfig['hassio... |
# Copyright (c) 2015, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import absolute_... | [
"mcrouter.test.MCProcess.Memcached"
] | [((827, 838), 'mcrouter.test.MCProcess.Memcached', 'Memcached', ([], {}), '()\n', (836, 838), False, 'from mcrouter.test.MCProcess import Memcached\n'), ((870, 881), 'mcrouter.test.MCProcess.Memcached', 'Memcached', ([], {}), '()\n', (879, 881), False, 'from mcrouter.test.MCProcess import Memcached\n')] |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: delf/protos/delf_config.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import refl... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor"
] | [((453, 479), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (477, 479), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((2604, 2947), 'google.protobuf.descriptor.FieldDescriptor', '_descriptor.FieldDescriptor', ([], {'name': '"""pca_dim"""', 'full_... |
#!/usr/bin/env python
import argparse
import logging
import sys
from os.path import join
from pathlib import Path
from stravaviz import drawer, track_loader, grid_drawer, heatmap_drawer, elevations_drawer
from stravaviz.exceptions import ParameterError, DrawerError
def main() -> None:
d = drawer.Drawer()
a... | [
"logging.getLogger",
"stravaviz.elevations_drawer.ElevationsDrawer",
"sys.exit",
"stravaviz.heatmap_drawer.HeatmapDrawer",
"argparse.ArgumentParser",
"pathlib.Path",
"stravaviz.exceptions.ParameterError",
"os.path.join",
"stravaviz.grid_drawer.GridDrawer",
"stravaviz.track_loader.TrackLoader",
"... | [((298, 313), 'stravaviz.drawer.Drawer', 'drawer.Drawer', ([], {}), '()\n', (311, 313), False, 'from stravaviz import drawer, track_loader, grid_drawer, heatmap_drawer, elevations_drawer\n'), ((333, 374), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""stravaviz"""'}), "(prog='stravaviz')\n", (3... |
# Copyright (c) 2020 KU Leuven
import setuptools
exec(open("sparsechem/version.py").read())
setuptools.setup(
name="sparsechem",
version=__version__,
author="<NAME>",
author_email="<EMAIL>",
description="SparseChem package",
long_description="Fast and accurate machine learning models for biolo... | [
"setuptools.find_packages"
] | [((424, 450), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (448, 450), False, 'import setuptools\n')] |
"""Implementation of a CNN for classfication with VGG Encoder."""
import torch
import torchvision.models as models
from torch.nn import CrossEntropyLoss, Linear, Module
from src.utils.mapper import configmapper
STR_MODEL_MAPPING = {
"11": models.vgg11,
"13": models.vgg13,
"16": models.vgg16,
"19": m... | [
"src.utils.mapper.configmapper.map",
"torch.nn.CrossEntropyLoss",
"torch.nn.Linear"
] | [((458, 491), 'src.utils.mapper.configmapper.map', 'configmapper.map', (['"""models"""', '"""vgg"""'], {}), "('models', 'vgg')\n", (474, 491), False, 'from src.utils.mapper import configmapper\n'), ((2313, 2356), 'torch.nn.Linear', 'Linear', (['in_features_dim', 'config.num_classes'], {}), '(in_features_dim, config.num... |
import os
from twilio.rest import Client
from authy.api import AuthyApiClient
client = Client(
os.environ["TWILIO_ACCOUNT_SID"],
os.environ["TWILIO_AUTH_TOKEN"]
)
authy_api = AuthyApiClient(os.environ["PUSH_DEMO_AUTHY_API_KEY"])
| [
"twilio.rest.Client",
"authy.api.AuthyApiClient"
] | [((88, 161), 'twilio.rest.Client', 'Client', (["os.environ['TWILIO_ACCOUNT_SID']", "os.environ['TWILIO_AUTH_TOKEN']"], {}), "(os.environ['TWILIO_ACCOUNT_SID'], os.environ['TWILIO_AUTH_TOKEN'])\n", (94, 161), False, 'from twilio.rest import Client\n'), ((185, 238), 'authy.api.AuthyApiClient', 'AuthyApiClient', (["os.env... |
import os
from unittest import mock
import idelib
import numpy as np
import pandas as pd
import pytest
import hypothesis as hyp
import hypothesis.strategies as hyp_st
import hypothesis.extra.numpy as hyp_np
import endaq.batch.analyzer
from endaq.calc.stats import rms, L2_norm
np.random.seed(0)
@pytest.fixture()
d... | [
"pandas.Series",
"pytest.approx",
"numpy.mean",
"unittest.mock.Mock",
"unittest.mock.create_autospec",
"numpy.random.random",
"endaq.calc.stats.rms",
"os.path.join",
"hypothesis.strategies.floats",
"numpy.timedelta64",
"numpy.random.seed",
"pytest.fixture",
"pandas.testing.assert_frame_equal... | [((281, 298), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (295, 298), True, 'import numpy as np\n'), ((302, 318), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (316, 318), False, 'import pytest\n'), ((443, 459), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (457, 459), False, 'import ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Sanic-CookieSession documentation build configuration file, created by
import os
import sys
PROJECT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))
sys.path.insert(0, PROJECT_DIR)
import sanic_cookiesession # noqa
extensions = [
'sphinx.ext... | [
"os.path.dirname",
"sys.path.insert"
] | [((222, 253), 'sys.path.insert', 'sys.path.insert', (['(0)', 'PROJECT_DIR'], {}), '(0, PROJECT_DIR)\n', (237, 253), False, 'import sys\n'), ((187, 212), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (202, 212), False, 'import os\n')] |
from faker import Faker
faker = Faker()
def factory_thanos():
return {
"name": faker.name(),
"aliases": "MM",
"age": 3000,
"team": "Ordem QA --- > Ninja",
"active": True
}
| [
"faker.Faker"
] | [((32, 39), 'faker.Faker', 'Faker', ([], {}), '()\n', (37, 39), False, 'from faker import Faker\n')] |
from __init__ import *
import sys
import subprocess
import numpy as np
from fractions import Fraction
import math
sys.path.insert(0, ROOT)
from compiler import *
from constructs import *
def maxfilter(pipe_data):
# Pipeline Variables
x = Variable(Int, "x")
y = Variable(Int, "y")
c = Variable(Int, "c")
t = Vari... | [
"sys.path.insert",
"math.log"
] | [((116, 140), 'sys.path.insert', 'sys.path.insert', (['(0)', 'ROOT'], {}), '(0, ROOT)\n', (131, 140), False, 'import sys\n'), ((599, 618), 'math.log', 'math.log', (['radius', '(2)'], {}), '(radius, 2)\n', (607, 618), False, 'import math\n')] |
import re
class Solution:
UK_POSTAL_CODE_PATTERN = r'^(((([A-Z]{1,2})[0-9])[A-Z])|(([A-Z])[0-9])|(([A-Z]{1,2})[0-9]{1,2})) ([0-9]([A-Z]{2}))$'
def parse_uk_postal_code(self, postal_code):
result = re.match(self.UK_POSTAL_CODE_PATTERN, postal_code)
if result is None:
return None
if result.grou... | [
"re.match"
] | [((208, 258), 're.match', 're.match', (['self.UK_POSTAL_CODE_PATTERN', 'postal_code'], {}), '(self.UK_POSTAL_CODE_PATTERN, postal_code)\n', (216, 258), False, 'import re\n')] |
import os,shutil
from ase import Atom,Atoms
from ase.lattice.cubic import FaceCenteredCubic
import ase.build.bulk
from pypospack.crystal import SimulationCell
from pypospack.io.vasp import Poscar
from pypospack.io.lammps import LammpsStructure
import pypospack.crystal as crystal
def make_Si_sc_bulk(name='Si'):
n... | [
"os.path.exists",
"collections.OrderedDict",
"ase.lattice.cubic.FaceCenteredCubic",
"os.path.join",
"shutil.rmtree",
"pypospack.io.vasp.Poscar",
"pypospack.io.lammps.LammpsStructure",
"os.mkdir",
"pypospack.crystal.SimulationCell",
"pypospack.crystal.make_super_cell"
] | [((620, 729), 'ase.lattice.cubic.FaceCenteredCubic', 'FaceCenteredCubic', ([], {'directions': '[direction_x, direction_y, direction_z]', 'size': 'size', 'symbol': 'symbol', 'pbc': 'pbc'}), '(directions=[direction_x, direction_y, direction_z], size=\n size, symbol=symbol, pbc=pbc)\n', (637, 729), False, 'from ase.lat... |
"""Rotary Encoder communication protocol"""
import logging
from typing import Optional, Tuple
import attr
# from ventserver.protocols import exceptions
from ventserver.protocols import events
from ventserver.protocols.protobuf import frontend_pb
from ventserver.sansio import channels, protocols
@attr.s
class Recei... | [
"ventserver.protocols.protobuf.frontend_pb.RotaryEncoder",
"attr.ib"
] | [((412, 433), 'attr.ib', 'attr.ib', ([], {'default': 'None'}), '(default=None)\n', (419, 433), False, 'import attr\n'), ((466, 487), 'attr.ib', 'attr.ib', ([], {'default': 'None'}), '(default=None)\n', (473, 487), False, 'import attr\n'), ((976, 1014), 'attr.ib', 'attr.ib', ([], {'factory': 'channels.DequeChannel'}), '... |
import pytest
from subtypes import Str
@pytest.fixture
def default_string():
return Str("Hello World!")
@pytest.fixture
def casing_test_string():
return Str("| HiThis_is a CASINGTest-case &")
class TestCase:
pass
class TestReprMixin:
pass
class TestRegexAccessor:
class TestSettings:
... | [
"pytest.mark.parametrize",
"pytest.raises",
"subtypes.Str"
] | [((91, 110), 'subtypes.Str', 'Str', (['"""Hello World!"""'], {}), "('Hello World!')\n", (94, 110), False, 'from subtypes import Str\n'), ((166, 204), 'subtypes.Str', 'Str', (['"""| HiThis_is a CASINGTest-case &"""'], {}), "('| HiThis_is a CASINGTest-case &')\n", (169, 204), False, 'from subtypes import Str\n'), ((3362,... |
'''
AES in ECB mode
The Base64-encoded content in this file has been encrypted via AES-128 in ECB mode under the key
"YELLOW SUBMARINE".
(case-sensitive, without the quotes; exactly 16 characters; I like "YELLOW SUBMARINE" because it's exactly 16 bytes long, and now you do too).
Decrypt it. You know the key, after al... | [
"PKCS7_padding.unpadtext",
"PKCS7_padding.padtext",
"Crypto.Cipher.AES.new",
"Convert_hex_to_base64._64tohex"
] | [((951, 980), 'Crypto.Cipher.AES.new', 'AES.new', (['AESkey', 'AES.MODE_ECB'], {}), '(AESkey, AES.MODE_ECB)\n', (958, 980), False, 'from Crypto.Cipher import AES\n'), ((1743, 1772), 'Crypto.Cipher.AES.new', 'AES.new', (['AESkey', 'AES.MODE_ECB'], {}), '(AESkey, AES.MODE_ECB)\n', (1750, 1772), False, 'from Crypto.Cipher... |
from django.http import Http404
from django.shortcuts import render
from .models import Pet
def home(request):
pets = Pet.objects.all()
return render(request, 'home.html', {
'pets': pets
})
def pet_detail(request, pet_id):
try:
pet = Pet.objects.get(id=pet_id)
except Pet.DoesNot... | [
"django.shortcuts.render",
"django.http.Http404"
] | [((154, 198), 'django.shortcuts.render', 'render', (['request', '"""home.html"""', "{'pets': pets}"], {}), "(request, 'home.html', {'pets': pets})\n", (160, 198), False, 'from django.shortcuts import render\n'), ((396, 444), 'django.shortcuts.render', 'render', (['request', '"""pet_detail.html"""', "{'pet': pet}"], {})... |
import pytest
from eth_utils import to_checksum_address
from relay.constants import NULL_ADDRESS
from relay.exchange.order import Order, SignableOrder
@pytest.fixture()
def invalid_signature_order(addresses):
A, B, C, D = addresses
return Order(
exchange_address=A,
maker_address=B,
ta... | [
"pytest.fixture",
"eth_utils.to_checksum_address"
] | [((155, 171), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (169, 171), False, 'import pytest\n'), ((710, 726), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (724, 726), False, 'import pytest\n'), ((1338, 1354), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1352, 1354), False, 'import pytest\n'... |
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from api import create_app, db
""" STEP-BY-STEP
1. Initializes migration support for the application.
- python3 manage.py db init
2. The migration script is populated with changes detected automatically.
- python3 manage.py db migrate... | [
"api.create_app",
"flask_migrate.Migrate",
"flask_script.Manager"
] | [((390, 402), 'api.create_app', 'create_app', ([], {}), '()\n', (400, 402), False, 'from api import create_app, db\n'), ((457, 473), 'flask_migrate.Migrate', 'Migrate', (['app', 'db'], {}), '(app, db)\n', (464, 473), False, 'from flask_migrate import Migrate, MigrateCommand\n'), ((484, 496), 'flask_script.Manager', 'Ma... |
import time
import random
import mysql.connector
from optionstrader.customlogging import CustomLog
from optionstrader.config import Config
class Account:
def __init__(self):
self.log = CustomLog()
self.config = Config()
try:
# Using loopback for testing purposes. Might use s... | [
"optionstrader.customlogging.CustomLog",
"optionstrader.config.Config"
] | [((200, 211), 'optionstrader.customlogging.CustomLog', 'CustomLog', ([], {}), '()\n', (209, 211), False, 'from optionstrader.customlogging import CustomLog\n'), ((234, 242), 'optionstrader.config.Config', 'Config', ([], {}), '()\n', (240, 242), False, 'from optionstrader.config import Config\n')] |
import argparse
from baseline.utils import read_config_stream
from mead.utils import hash_config, convert_path
def main():
parser = argparse.ArgumentParser(description="Get the mead hash of a config.")
parser.add_argument('config', help='JSON/YML Configuration for an experiment: local file or remote URL', typ... | [
"mead.utils.hash_config",
"baseline.utils.read_config_stream",
"argparse.ArgumentParser"
] | [((138, 207), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Get the mead hash of a config."""'}), "(description='Get the mead hash of a config.')\n", (161, 207), False, 'import argparse\n'), ((405, 436), 'baseline.utils.read_config_stream', 'read_config_stream', (['args.config'], {}), '... |
import argparse
import helper.helper as hlp
import sample.sample as s
import prep.preprocessor as pre
def main(dir_train, dir_eval, clf_filepath, C_value, gamma_value):
hlp.setup_logging()
if C_value is not None and gamma_value is not None:
do_grid_search = False
else:
do_grid_search = T... | [
"argparse.ArgumentParser",
"sample.sample.get_evaluation_report",
"helper.helper.setup_logging",
"sample.sample.write_classifier",
"sample.sample.get_best_params",
"sample.sample.get_svclassifier",
"helper.helper.log",
"prep.preprocessor.get_multiple_data_and_targets"
] | [((176, 195), 'helper.helper.setup_logging', 'hlp.setup_logging', ([], {}), '()\n', (193, 195), True, 'import helper.helper as hlp\n'), ((336, 414), 'prep.preprocessor.get_multiple_data_and_targets', 'pre.get_multiple_data_and_targets', ([], {'dir_filepath': 'dir_train', 'do_subsampling': '(True)'}), '(dir_filepath=dir... |
import string
import random
def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for x in range(size))
class FixtureMixin(object):
def setUp(self):
super(FixtureMixin, self).setUp()
for i in xrange(0, 12):
message = self.cli... | [
"random.choice"
] | [((121, 141), 'random.choice', 'random.choice', (['chars'], {}), '(chars)\n', (134, 141), False, 'import random\n')] |
from numpy import array
def scigrid_2011_01_04_13():
ppc = {"version": '2'}
ppc["baseMVA"] = 100.0
ppc["bus"] = array([
[586, 3, 0, 0, 0, 0, 0, 1.0, 0, 220.0, 0, 1.1, 0.9 ],
[589, 2, 0, 0, 0, 0, 0, 1.0, 0, 380.0, 0, 1.1, 0.9 ],
[590, 2, 0, 0, 0, 0, 0, 1.0, 0, 380.0, 0, 1.1,... | [
"numpy.array"
] | [((115, 105634), 'numpy.array', 'array', (['[[586, 3, 0, 0, 0, 0, 0, 1.0, 0, 220.0, 0, 1.1, 0.9], [589, 2, 0, 0, 0, 0, \n 0, 1.0, 0, 380.0, 0, 1.1, 0.9], [590, 2, 0, 0, 0, 0, 0, 1.0, 0, 380.0, \n 0, 1.1, 0.9], [593, 2, 0, 0, 0, 0, 0, 1.0, 0, 380.0, 0, 1.1, 0.9], [594,\n 2, 0, 0, 0, 0, 0, 1.0, 0, 380.0, 0, 1.1,... |
#
# Wrapper of convenience functions for the WiFi control
# of an ESP8266 device
#
# Author: <NAME>
import network
def connect(ssid, password="", silent=True):
ap = network.WLAN(network.AP_IF)
ap.active(False)
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
if not wlan.isconnected():
... | [
"network.WLAN",
"esp.osdebug",
"time.sleep"
] | [((172, 199), 'network.WLAN', 'network.WLAN', (['network.AP_IF'], {}), '(network.AP_IF)\n', (184, 199), False, 'import network\n'), ((237, 265), 'network.WLAN', 'network.WLAN', (['network.STA_IF'], {}), '(network.STA_IF)\n', (249, 265), False, 'import network\n'), ((591, 619), 'network.WLAN', 'network.WLAN', (['network... |
""" check the export list to ensure only the public API is exported by pgpy.__init__
"""
import pytest
import importlib
import inspect
modules = ['pgpy.constants',
'pgpy.decorators',
'pgpy.errors',
'pgpy.pgp',
'pgpy.symenc',
'pgpy.types',
'pgpy.packet... | [
"inspect.getmodule",
"pytest.mark.parametrize",
"inspect.getmembers",
"importlib.import_module"
] | [((1188, 1231), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""modname"""', 'modules'], {}), "('modname', modules)\n", (1211, 1231), False, 'import pytest\n'), ((1272, 1304), 'importlib.import_module', 'importlib.import_module', (['modname'], {}), '(modname)\n', (1295, 1304), False, 'import importlib\n'), ... |
"""
This file contains functions related to survey search time calculations
"""
import pandas as _pd
#######################################################################################################################
def clean_datetimes(df, dt_col='DataDate'):
"""Filter datetimes and correct for timezone ... | [
"math.sqrt",
"pandas.DateOffset",
"warnings.warn",
"pandas.Timestamp",
"pandas.concat"
] | [((4622, 4635), 'pandas.concat', '_pd.concat', (['s'], {}), '(s)\n', (4632, 4635), True, 'import pandas as _pd\n'), ((3294, 3487), 'warnings.warn', 'warnings.warn', (['"""FYI: Search times calculated in a naive way (e.g., including unrealistic values and NaN values).Consider further filtering before using `search_time`... |
import numpy as np
import matplotlib.pyplot as plt
import ReinforcedPy as rp
import matplotlib.patches as mpatches
concreto28 = rp.Concreto()
acero420 = rp.AceroRefuerzo()
viga=rp.Elemento(0.3,0.6,[concreto28,acero420],6)
viga.generarDesdeCarga(50)
viga._test_secciones()
print(viga.secciones[0].momentoNominal())
pr... | [
"ReinforcedPy.Concreto",
"ReinforcedPy.Elemento",
"ReinforcedPy.AceroRefuerzo"
] | [((131, 144), 'ReinforcedPy.Concreto', 'rp.Concreto', ([], {}), '()\n', (142, 144), True, 'import ReinforcedPy as rp\n'), ((156, 174), 'ReinforcedPy.AceroRefuerzo', 'rp.AceroRefuerzo', ([], {}), '()\n', (172, 174), True, 'import ReinforcedPy as rp\n'), ((181, 229), 'ReinforcedPy.Elemento', 'rp.Elemento', (['(0.3)', '(0... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Copyright 2020 THG / The Hut Group
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
Unles... | [
"StringIO.StringIO",
"time.ctime",
"json.loads",
"json.dumps",
"time.time"
] | [((2850, 2872), 'json.dumps', 'json.dumps', (['stat_array'], {}), '(stat_array)\n', (2860, 2872), False, 'import json\n'), ((4598, 4620), 'time.ctime', 'time.ctime', (['start_time'], {}), '(start_time)\n', (4608, 4620), False, 'import time\n'), ((4645, 4665), 'time.ctime', 'time.ctime', (['end_time'], {}), '(end_time)\... |
import RPi.GPIO as GPIO
import time
try:
# GPIO.setmode(GPIO.BOARD)
# ButtonPin = 7
# LedPin = 8
GPIO.setmode(GPIO.BCM)
ButtonPin = 4
LedPin = 14
GPIO.setup(ButtonPin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(LedPin, GPIO.OUT)
for i in range(0,4):
state = GPIO.input(ButtonPin)
print(state)
if... | [
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"RPi.GPIO.output",
"time.sleep",
"RPi.GPIO.input",
"RPi.GPIO.setmode"
] | [((104, 126), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (116, 126), True, 'import RPi.GPIO as GPIO\n'), ((157, 215), 'RPi.GPIO.setup', 'GPIO.setup', (['ButtonPin', 'GPIO.IN'], {'pull_up_down': 'GPIO.PUD_DOWN'}), '(ButtonPin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)\n', (167, 215), True, 'impor... |
"""Inserts dOxygen documentation into python docstrings. This is done using
the xml export capabilities of dOxygen. The docstrings are inserted into
the desc dictionary for each function/class and will then be merged with
standard auto-docstrings as well as any user input from sidecar files.
This module is available a... | [
"re.compile",
"textwrap.TextWrapper",
"os.path.join",
"elementtree.ElementTree.parse",
"subprocess.call"
] | [((4506, 4526), 're.compile', 're.compile', (['"""^\\\\d+$"""'], {}), "('^\\\\d+$')\n", (4516, 4526), False, 'import re\n'), ((4949, 5021), 'textwrap.TextWrapper', 'TextWrapper', ([], {'width': '(68)', 'initial_indent': "(' ' * 0)", 'subsequent_indent': "(' ' * 0)"}), "(width=68, initial_indent=' ' * 0, subsequent_inde... |
import torch
import torch.nn as nn
from pysot.utils.latency import predict_latency,compute_latency
table = []
class ReLUConvBN(nn.Module):
"""
Stack of relu-conv-bn
"""
def __init__(self, C_in, C_out, kernel_size, stride, padding, affine=True):
"""
:param C_in:
:param C_out:
:param kernel_si... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"pysot.utils.latency.compute_latency",
"torch.nn.AvgPool2d",
"pysot.utils.latency.predict_latency"
] | [((1079, 1100), 'pysot.utils.latency.predict_latency', 'predict_latency', (['name'], {}), '(name)\n', (1094, 1100), False, 'from pysot.utils.latency import predict_latency, compute_latency\n'), ((1405, 1444), 'pysot.utils.latency.compute_latency', 'compute_latency', (['layer', '(1, C_in, H, W)'], {}), '(layer, (1, C_in... |