code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import random
from data import participants
from whatsapp_selenium import send_messages
import time
Host_Name = 'Dorcy'
def generate_text(santa, santee, age):
return f"""Dear {santa},\
\nThis year you are {santee}'s Secret Santa!. Ho Ho Ho!\
\nThis message was automagically generated from a computer by {Host_Nam... | [
"time.sleep",
"whatsapp_selenium.send_messages"
] | [((1271, 1284), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (1281, 1284), False, 'import time\n'), ((1315, 1348), 'whatsapp_selenium.send_messages', 'send_messages', (['santa[0]', 'santa[1]'], {}), '(santa[0], santa[1])\n', (1328, 1348), False, 'from whatsapp_selenium import send_messages\n')] |
from urllib.request import urlopen
from bs4 import BeautifulSoup
from htmlparser import MainParser
from routetablecreator import RouteTableCreator
import controls
import containers
from seleniumtemplatecreator import SeleniumTemplateCreator
url = 'http://tutorialspoint.com/python/python_overview.htm'
# Fetch the htm... | [
"controls.Button",
"controls.Input",
"controls.Label",
"containers.Div",
"bs4.BeautifulSoup",
"containers.HTML",
"htmlparser.MainParser",
"seleniumtemplatecreator.SeleniumTemplateCreator",
"urllib.request.urlopen"
] | [((338, 350), 'urllib.request.urlopen', 'urlopen', (['url'], {}), '(url)\n', (345, 350), False, 'from urllib.request import urlopen\n'), ((408, 446), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html_doc', '"""html.parser"""'], {}), "(html_doc, 'html.parser')\n", (421, 446), False, 'from bs4 import BeautifulSoup\n'), ((517... |
#!/usr/bin/env python
from pynput.keyboard import Key, Listener
def on_press(key):
if key == Key.enter:
return False
with Listener(on_press=on_press) as listener:
listener.join()
| [
"pynput.keyboard.Listener"
] | [((137, 164), 'pynput.keyboard.Listener', 'Listener', ([], {'on_press': 'on_press'}), '(on_press=on_press)\n', (145, 164), False, 'from pynput.keyboard import Key, Listener\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 <NAME> <<EMAIL>>
__version__ = '0.2.5a'
__date__ = '2014-09-27'
__author__ = '<NAME> <<EMAIL>>'
__license__ = 'MIT'
from hornet import *
from hornet.symbols import (
fizzbuzz, word, show, divisible, W, Ws, N, N1, Max, D, R, S,
)
def main():... | [
"hornet.symbols.divisible",
"hornet.symbols.fizzbuzz",
"hornet.symbols.word",
"hornet.symbols.show"
] | [((524, 541), 'hornet.symbols.fizzbuzz', 'fizzbuzz', (['N1', 'Max'], {}), '(N1, Max)\n', (532, 541), False, 'from hornet.symbols import fizzbuzz, word, show, divisible, W, Ws, N, N1, Max, D, R, S\n'), ((552, 567), 'hornet.symbols.word', 'word', (['"""fizz"""', 'N'], {}), "('fizz', N)\n", (556, 567), False, 'from hornet... |
"""This module contains functions dispatch analysis jobs.
Eventually it should be able to handle jobs by:
1) Running them on the same cpu as the parent job
2) Running them on a multiprocees pool
3) Running them on a batch farm
"""
from __future__ import with_statement
import os
import sys
from lsst.eo_utils.base... | [
"os.system",
"lsst.eo_utils.base.file_utils.makedir_safe",
"os.path.join",
"sys.stdout.write"
] | [((1148, 1171), 'lsst.eo_utils.base.file_utils.makedir_safe', 'makedir_safe', (['batchfile'], {}), '(batchfile)\n', (1160, 1171), False, 'from lsst.eo_utils.base.file_utils import makedir_safe\n'), ((1431, 1462), 'os.path.join', 'os.path.join', (['"""sbatch"""', 'logfile'], {}), "('sbatch', logfile)\n", (1443, 1462), F... |
#!/usr/bin/env python3
from flask import request, Response
import flask
from hashlib import sha1
import json
import os
import sys
import logging
# Map of all the gateways & devices for now
# Each gateway contains a dictionary of devices
# Likely migrate this to an actual database later
gateways = {}
# Create the fla... | [
"flask.request.args.get",
"logging.StreamHandler",
"flask.Flask",
"os.environ.get",
"flask.request.get_json",
"flask.Response",
"flask.make_response"
] | [((333, 354), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (344, 354), False, 'import flask\n'), ((378, 411), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (399, 411), False, 'import logging\n'), ((1552, 1580), 'flask.request.get_json', 'request.get_json'... |
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTests(TestCase):
def test_create_user_with_email_successful(self):
"""Test creating a new user with an email successful"""
email="<EMAIL>"
password="<PASSWORD>"
user=get_user_mod... | [
"django.contrib.auth.get_user_model"
] | [((308, 324), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (322, 324), False, 'from django.contrib.auth import get_user_model\n'), ((605, 621), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (619, 621), False, 'from django.contrib.auth import get_user_model\n'), (... |
import pandas as pd
service_worker = pd.read_json('./service_worker.json') # load the json file
print(serviceworker.head(4))
| [
"pandas.read_json"
] | [((37, 74), 'pandas.read_json', 'pd.read_json', (['"""./service_worker.json"""'], {}), "('./service_worker.json')\n", (49, 74), True, 'import pandas as pd\n')] |
import datetime as dt
import json
import logging
import os
import shutil
from typing import Any, Dict, List, Optional, Tuple, Union
import pandas as pd
from extra_model._adjectives import adjective_info
from extra_model._aspects import generate_aspects
from extra_model._filter import filter
from extra_model._summariz... | [
"logging.getLogger",
"extra_model._topics.get_topics",
"extra_model._summarize.link_aspects_to_texts",
"pandas.DataFrame",
"os.path.join",
"datetime.date.today",
"os.path.isfile",
"json.load",
"extra_model._summarize.link_aspects_to_topics",
"extra_model._filter.filter",
"extra_model._adjectives... | [((534, 561), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (551, 561), False, 'import logging\n'), ((883, 932), 'os.path.join', 'os.path.join', (['self.models_folder', '"""metadata.json"""'], {}), "(self.models_folder, 'metadata.json')\n", (895, 932), False, 'import os\n'), ((974, 999),... |
import numpy as np
def one_of_k_encoding(x, allowable_set):
if x not in allowable_set:
raise Exception("input {0} not in allowable set{1}:".format(
x, allowable_set))
return list(map(lambda s: x == s, allowable_set))
def one_of_k_encoding_unk(x, allowable_set):
"""Maps inputs not in t... | [
"numpy.array",
"numpy.zeros",
"numpy.sum"
] | [((524, 542), 'numpy.array', 'np.array', (['len_list'], {}), '(len_list)\n', (532, 542), True, 'import numpy as np\n'), ((559, 575), 'numpy.sum', 'np.sum', (['len_list'], {}), '(len_list)\n', (565, 575), True, 'import numpy as np\n'), ((776, 796), 'numpy.array', 'np.array', (['len_matrix'], {}), '(len_matrix)\n', (784,... |
import sys
from PyQt5.QtWidgets import (QApplication, QMainWindow, qApp, QAction)
from PyQt5.QtGui import QIcon
class MainWindow(QMainWindow):
def __init__(self, icons):
self.icons = icons
self.app = QApplication(sys.argv)
super().__init__()
self.init_ui()
def init_ui(self):
... | [
"PyQt5.QtGui.QIcon",
"PyQt5.QtWidgets.QApplication"
] | [((223, 245), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (235, 245), False, 'from PyQt5.QtWidgets import QApplication, QMainWindow, qApp, QAction\n'), ((423, 448), 'PyQt5.QtGui.QIcon', 'QIcon', (["self.icons['info']"], {}), "(self.icons['info'])\n", (428, 448), False, 'from PyQt... |
# validated: 2017-10-01 DS e4a8bff70e77 cpp/EntryNotifier.cpp cpp/EntryNotifier.h cpp/IEntryNotifier.h
"""----------------------------------------------------------------------------"""
""" Copyright (c) FIRST 2017. All Rights Reserved. """
""" Open Source Software - may be modified and shar... | [
"collections.namedtuple"
] | [((840, 934), 'collections.namedtuple', 'namedtuple', (['"""EntryListenerData"""', "['prefix', 'local_id', 'flags', 'callback', 'poller_uid']"], {}), "('EntryListenerData', ['prefix', 'local_id', 'flags', 'callback',\n 'poller_uid'])\n", (850, 934), False, 'from collections import namedtuple\n'), ((1060, 1131), 'col... |
"""
MIT License
Copyright (c) 2020 PyKOB - MorseKOB in Python
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, me... | [
"time.sleep",
"gpiozero.Button",
"pykob.log.log",
"gpiozero.LED",
"pykob.log.err",
"ctypes.windll.winmm.timeBeginPeriod",
"pykob.log.info",
"pykob.audio.play",
"threading.Thread",
"time.time"
] | [((1904, 1935), 'ctypes.windll.winmm.timeBeginPeriod', 'windll.winmm.timeBeginPeriod', (['(1)'], {}), '(1)\n', (1932, 1935), False, 'from ctypes import windll\n'), ((1555, 1596), 'pykob.log.log', 'log.log', (['"""gpiozero module not installed."""'], {}), "('gpiozero module not installed.')\n", (1562, 1596), False, 'fro... |
from IMLearn.learners import UnivariateGaussian, MultivariateGaussian
from IMLearn.learners.classifiers import GaussianNaiveBayes, LDA, Perceptron
import numpy as np
# Ex 1
# x = np.array([1, 5, 2, 3, 8, -4, -2, 5, 1, 10, -10, 4, 5, 2, 7, 1, 1, 3, 2, -1, -3, 1, -4, 1, 2, 1,
# -4, -4, 1, 3, 2, 6, -6... | [
"numpy.array",
"IMLearn.learners.classifiers.GaussianNaiveBayes"
] | [((588, 622), 'numpy.array', 'np.array', (['[0, 0, 1, 1, 1, 1, 2, 2]'], {}), '([0, 0, 1, 1, 1, 1, 2, 2])\n', (596, 622), True, 'import numpy as np\n'), ((634, 668), 'numpy.array', 'np.array', (['[0, 1, 2, 3, 4, 5, 6, 7]'], {}), '([0, 1, 2, 3, 4, 5, 6, 7])\n', (642, 668), True, 'import numpy as np\n'), ((680, 700), 'IML... |
import redis
import json
import yaml
import logging.config
from kafka import KafkaConsumer
from influxdb import InfluxDBClient
from utils import convert_byte_to_str, get_vdus_info, compose_redis_key
from exceptions import NsValueIsNotDict, NsUuidDoesNotExist
from settings import KAFKA_SERVER, KAFKA_CLIENT_ID, KAFKA_API... | [
"utils.get_vdus_info",
"influxdb.InfluxDBClient",
"utils.convert_byte_to_str",
"redis.Redis"
] | [((1050, 1309), 'influxdb.InfluxDBClient', 'InfluxDBClient', ([], {'host': "INFLUX_DATABASES['default']['HOST']", 'port': "INFLUX_DATABASES['default']['PORT']", 'username': "INFLUX_DATABASES['default']['USERNAME']", 'password': "INFLUX_DATABASES['default']['PASSWORD']", 'database': "INFLUX_DATABASES['default']['NAME']"... |
import os
import subprocess
import sys
from pathlib import Path
import julius
import torch as th
import torchaudio as ta
from demucs.audio import AudioFile, convert_audio_channels
from demucs.pretrained import load_pretrained
from demucs.utils import apply_model
from config import settings
track = Path("../data/tra... | [
"demucs.pretrained.load_pretrained",
"pathlib.Path",
"julius.resample_frac",
"os.path.join",
"demucs.audio.AudioFile",
"torch.hub.set_dir",
"torch.cuda.is_available",
"sys.exit",
"demucs.utils.apply_model",
"lameenc.Encoder",
"torchaudio.save",
"demucs.audio.convert_audio_channels"
] | [((303, 337), 'pathlib.Path', 'Path', (['"""../data/tracks/mixture.mp3"""'], {}), "('../data/tracks/mixture.mp3')\n", (307, 337), False, 'from pathlib import Path\n'), ((522, 553), 'torch.hub.set_dir', 'th.hub.set_dir', (['settings.models'], {}), '(settings.models)\n', (536, 553), True, 'import torch as th\n'), ((562, ... |
# -*- coding: utf-8 -*-
"""
doxieapi.__main__
~~~~~~~~~~~~~~~~~
Application that runs when executing the module with -m.
"""
import os
from .api import DoxieScanner
def main():
"""
Grab all available scan images and save them to the current working
directory.
"""
for doxie in DoxieScanner.disc... | [
"os.getcwd"
] | [((415, 426), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (424, 426), False, 'import os\n')] |
"""
models.py
定义数据库模型
- db.DateTime :在数据库模型中,有DateTime字段,该字段的值是Python 的datetime 类型。需要注意的是,我们在设置datetime时,
要做好时区的选择。
关于时间和日期的操作,请参考 iSurvey/test/time_oper.py
"""
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash, check_password_hash
db = SQLAl... | [
"flask_sqlalchemy.SQLAlchemy",
"werkzeug.security.generate_password_hash",
"werkzeug.security.check_password_hash"
] | [((315, 327), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (325, 327), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((718, 767), 'werkzeug.security.generate_password_hash', 'generate_password_hash', (['password'], {'method': '"""sha256"""'}), "(password, method='sha256')\n", (740, 767), False,... |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import subprocess
import sys
_updated = False
REQUIREMENTS_FILENAMES = {
"requirements.txt",
"requirements-test.txt",
"requirements-dev.txt",
}
def parse_args(args):
parser = argparse.ArgumentParser()
parse... | [
"subprocess.Popen",
"os.path.exists",
"os.system",
"argparse.ArgumentParser"
] | [((284, 309), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (307, 309), False, 'import argparse\n'), ((2168, 2257), 'subprocess.Popen', 'subprocess.Popen', (["['git', 'diff', '--cached', '--name-only']"], {'stdout': 'subprocess.PIPE'}), "(['git', 'diff', '--cached', '--name-only'], stdout=\n ... |
import geopandas as gpd
import pandas as pd
from ..utils import csv_string_to_df, get_api_response
class MergeBoundaryStats:
"""境界データと統計データをマージするためのクラス"""
def __init__(
self,
app_id,
stats_table_id,
boundary_gdf,
area,
class_code,
... | [
"pandas.merge"
] | [((1964, 2054), 'pandas.merge', 'pd.merge', (['self.boundary_gdf', 'self.stats_df'], {'left_on': '"""AREA_CODE"""', 'right_on': '"""area_code"""'}), "(self.boundary_gdf, self.stats_df, left_on='AREA_CODE', right_on=\n 'area_code')\n", (1972, 2054), True, 'import pandas as pd\n')] |
import unittest
from src.hanko_sdk.models.core import User
class UserTypeEnforcementTest(unittest.TestCase):
def test_exception_is_thrown_if_user_properties_have_incompatible_type(self):
self.assertRaises(TypeError, lambda: User(1, 2, 3))
if __name__ == "__main__":
unittest.main()
| [
"unittest.main",
"src.hanko_sdk.models.core.User"
] | [((288, 303), 'unittest.main', 'unittest.main', ([], {}), '()\n', (301, 303), False, 'import unittest\n'), ((240, 253), 'src.hanko_sdk.models.core.User', 'User', (['(1)', '(2)', '(3)'], {}), '(1, 2, 3)\n', (244, 253), False, 'from src.hanko_sdk.models.core import User\n')] |
from pyparsing import (CaselessKeyword, Optional, Forward, Regex, operatorPrecedence, opAssoc, ParserElement)
from biothings.utils.common import is_str
import re
ParserElement.enablePackrat()
and_ = CaselessKeyword("AND")
or_ = CaselessKeyword("OR")
not_ = CaselessKeyword("NOT")
keyword = and_ | or_ | not_
expressio... | [
"pyparsing.CaselessKeyword",
"pyparsing.Optional",
"pyparsing.Regex",
"pyparsing.Forward",
"re.fullmatch",
"biothings.utils.common.is_str",
"pyparsing.ParserElement.enablePackrat"
] | [((163, 192), 'pyparsing.ParserElement.enablePackrat', 'ParserElement.enablePackrat', ([], {}), '()\n', (190, 192), False, 'from pyparsing import CaselessKeyword, Optional, Forward, Regex, operatorPrecedence, opAssoc, ParserElement\n'), ((201, 223), 'pyparsing.CaselessKeyword', 'CaselessKeyword', (['"""AND"""'], {}), "... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 25 17:04:02 2019
@author: jessi
Example of use:--input-file ./prueba1/teclado_ISSA_63_2019-04-25T08_33_54.975Z_sp.wav --xCoor 0.6052 --yCoor -0.5411 --zCoor 0.5828
"""
import os
import argparse
import numpy as np
from scipy.io import wavfile
from hmmlearn... | [
"hmmlearn.hmm.GaussianHMM",
"argparse.ArgumentParser",
"sklearn.externals.joblib.load",
"python_speech_features.mfcc",
"numpy.array",
"scipy.io.wavfile.read",
"numpy.linalg.norm",
"numpy.seterr"
] | [((489, 553), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Trains the HMM classifier"""'}), "(description='Trains the HMM classifier')\n", (512, 553), False, 'import argparse\n'), ((2076, 2131), 'sklearn.externals.joblib.load', 'joblib.load', (['"""./classifier/2019-Sonidos-Marcela-v1.... |
"""Generate rST reports."""
from typing import Any, List
from tabulate import tabulate
from .core import TestPackage
def gen_report(testers: List[TestPackage]) -> Any:
"""Generate a rST report.
Parameters
----------
testers : list
A list of ``TestPackage`` objects.
Returns
-------... | [
"tabulate.tabulate"
] | [((658, 705), 'tabulate.tabulate', 'tabulate', (['rows'], {'headers': 'headers', 'tablefmt': '"""rst"""'}), "(rows, headers=headers, tablefmt='rst')\n", (666, 705), False, 'from tabulate import tabulate\n')] |
from random import sample, randint, seed
from tabulate import tabulate
DIFFICULTY = 5 #From 1 to 10
def main():
#Build a board
solution = generate_board()
#Remove x amount of pieces randomly (based on DIFFICULTY)
board = gamify(solution)
#Build a solver
#guess ... | [
"tabulate.tabulate",
"random.randint"
] | [((2559, 2573), 'random.randint', 'randint', (['(0)', '(80)'], {}), '(0, 80)\n', (2566, 2573), False, 'from random import sample, randint, seed\n'), ((2756, 2771), 'tabulate.tabulate', 'tabulate', (['board'], {}), '(board)\n', (2764, 2771), False, 'from tabulate import tabulate\n')] |
# coding=utf-8
import indigo
from Shelly_EM_Meter import Shelly_EM_Meter
class Shelly_3EM_Meter(Shelly_EM_Meter):
"""
The Shelly 2.5 is a relay device that is pretty much two Shely 1PM's in the same enclosure.
The each channel is represented by a single Indigo device, so they share internal temperature
... | [
"Shelly_EM_Meter.Shelly_EM_Meter.handleMessage",
"Shelly_EM_Meter.Shelly_EM_Meter.handleAction",
"Shelly_EM_Meter.Shelly_EM_Meter.__init__",
"Shelly_EM_Meter.Shelly_EM_Meter.validateConfigUI"
] | [((394, 432), 'Shelly_EM_Meter.Shelly_EM_Meter.__init__', 'Shelly_EM_Meter.__init__', (['self', 'device'], {}), '(self, device)\n', (418, 432), False, 'from Shelly_EM_Meter import Shelly_EM_Meter\n'), ((2880, 2922), 'Shelly_EM_Meter.Shelly_EM_Meter.handleAction', 'Shelly_EM_Meter.handleAction', (['self', 'action'], {})... |
from modeltranslation.translator import translator, TranslationOptions
from .models import Platform
class PlatformTranslationOptions(TranslationOptions):
fields = ('name', 'provider')
translator.register(Platform, PlatformTranslationOptions)
| [
"modeltranslation.translator.translator.register"
] | [((192, 249), 'modeltranslation.translator.translator.register', 'translator.register', (['Platform', 'PlatformTranslationOptions'], {}), '(Platform, PlatformTranslationOptions)\n', (211, 249), False, 'from modeltranslation.translator import translator, TranslationOptions\n')] |
'''
Name: <NAME>
Synopsis: This program creates a card on the Trello Board. Labels and Comments can be added to the Card.
This program has 7 commands in order to perform the task namely
a) create-board b) create-list c)get-lists-from-board d) create-card
e) get-cards-from-list f) create-label-card g)add-comment.
'''
... | [
"click.argument",
"configparser.ConfigParser",
"click.group",
"requests.request",
"click.echo",
"click.command"
] | [((712, 725), 'click.group', 'click.group', ([], {}), '()\n', (723, 725), False, 'import click\n'), ((1527, 1542), 'click.command', 'click.command', ([], {}), '()\n', (1540, 1542), False, 'import click\n'), ((1544, 1572), 'click.argument', 'click.argument', (['"""board_name"""'], {}), "('board_name')\n", (1558, 1572), ... |
from .plotter import Plotter
from matplotlib import pyplot as plt
import pandas as pd
import logging
import numpy as np
import seaborn as sns
class LinePlotter(Plotter):
def plot_group(self, data, x, y, label, ax, xpid=None, read_every=1, smooth_window=10, align_x=1, alpha=0.4, linewidth=3):
color = next... | [
"seaborn.lineplot",
"numpy.argsort",
"logging.critical",
"pandas.DataFrame",
"numpy.take_along_axis",
"pandas.concat",
"matplotlib.pyplot.subplots"
] | [((1980, 1998), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {}), '(data)\n', (1992, 1998), True, 'import pandas as pd\n'), ((1091, 1110), 'pandas.concat', 'pd.concat', (['all_data'], {}), '(all_data)\n', (1100, 1110), True, 'import pandas as pd\n'), ((1356, 1460), 'seaborn.lineplot', 'sns.lineplot', ([], {'data': 'd... |
import sys
import argparse
sys.path.insert(0, "../")
from trex_nstf_lib.cap_handling import CPcapReader
def process_options():
parser = argparse.ArgumentParser(
description='',
usage="""
""",
epilog=" written by ibarnea")
parser.add_argument("-f", dest="in_file", required=Tru... | [
"trex_nstf_lib.cap_handling.CPcapReader",
"sys.path.insert",
"argparse.ArgumentParser"
] | [((27, 52), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../"""'], {}), "(0, '../')\n", (42, 52), False, 'import sys\n'), ((142, 236), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""""""', 'usage': '"""\n """', 'epilog': '""" written by ibarnea"""'}), "(description='', usage=... |
import asyncio
import functools
import glob
import logging
import os
from typing import List
import mutagen
from sqlalchemy import exists
from core.track import Track
from core import config
from core import db
from commands.decorator import command
from player_ui import PlayerUI
from ui.components.progress import Pr... | [
"logging.getLogger",
"mutagen.File",
"glob.iglob",
"sqlalchemy.exists",
"core.db.session.commit",
"core.db.session.add",
"commands.decorator.command",
"os.path.isdir",
"functools.partial",
"os.path.basename",
"asyncio.get_event_loop",
"ui.components.progress.ProgressComponent"
] | [((375, 408), 'logging.getLogger', 'logging.getLogger', (['"""plugins.scan"""'], {}), "('plugins.scan')\n", (392, 408), False, 'import logging\n'), ((412, 421), 'commands.decorator.command', 'command', ([], {}), '()\n', (419, 421), False, 'from commands.decorator import command\n'), ((583, 602), 'ui.components.progress... |
import logging
import signal
import time
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.options import define, parse_command_line, options
from .app import ShoestringApplication
define('debug', default=False, type=bool, help='Run in debug mode')
define('port', default=8080,... | [
"tornado.options.parse_command_line",
"tornado.ioloop.IOLoop.current",
"tornado.httpserver.HTTPServer",
"tornado.options.define",
"time.time",
"logging.info"
] | [((224, 291), 'tornado.options.define', 'define', (['"""debug"""'], {'default': '(False)', 'type': 'bool', 'help': '"""Run in debug mode"""'}), "('debug', default=False, type=bool, help='Run in debug mode')\n", (230, 291), False, 'from tornado.options import define, parse_command_line, options\n'), ((292, 350), 'tornad... |
# AUTHOR: 0-0
# DATE: 7/5/2019
# DESCRIPTION: Scans a website for open directories.
import requests
import re
# Checks For Open Directories.
# Precondition: A String.
# Postcondition: Saves Links to File.
def search(raw_url):
# Local Variable: User-agent
try:
user_agent = {"User-Agent":
... | [
"requests.get"
] | [((737, 786), 'requests.get', 'requests.get', (['(base_url + port)'], {'headers': 'user_agent'}), '(base_url + port, headers=user_agent)\n', (749, 786), False, 'import requests\n'), ((1339, 1380), 'requests.get', 'requests.get', (['request'], {'headers': 'user_agent'}), '(request, headers=user_agent)\n', (1351, 1380), ... |
from __future__ import absolute_import
from wrapanapi.containers import ContainersResourceBase
class Project(ContainersResourceBase):
RESOURCE_TYPE = 'namespace'
CREATABLE = True
VALID_NAME_PATTERN = r'^[a-z0-9][a-z0-9\-]+$'
def __init__(self, provider, name):
ContainersResourceBase.__init__(... | [
"wrapanapi.containers.ContainersResourceBase.__init__"
] | [((288, 347), 'wrapanapi.containers.ContainersResourceBase.__init__', 'ContainersResourceBase.__init__', (['self', 'provider', 'name', 'None'], {}), '(self, provider, name, None)\n', (319, 347), False, 'from wrapanapi.containers import ContainersResourceBase\n')] |
import matplotlib.pyplot as plt
import numpy as np
class utilsClass:
def pdfFunction():
sample = np.random.normal(size=1000)
plt.hist(sample, bins=20)
plt.show()
sample_mean = np.mean(sample)
sample_std = np.std(sample)
print(sample_mean)
print(sample_std)... | [
"numpy.random.normal",
"numpy.mean",
"matplotlib.pyplot.hist",
"numpy.power",
"numpy.linspace",
"numpy.std",
"matplotlib.pyplot.show"
] | [((111, 138), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(1000)'}), '(size=1000)\n', (127, 138), True, 'import numpy as np\n'), ((148, 173), 'matplotlib.pyplot.hist', 'plt.hist', (['sample'], {'bins': '(20)'}), '(sample, bins=20)\n', (156, 173), True, 'import matplotlib.pyplot as plt\n'), ((182, 192), 'm... |
import io
from tensorflow import keras
import tensorflow as tf
from typing import List
from PIL import Image
from fastapi.staticfiles import StaticFiles
from fastapi import FastAPI, UploadFile, Form
from consts import IMAGE_SIZE
from nn import create_model, create_augmentation
LABELS = [
("dark", "long"),
(... | [
"fastapi.FastAPI",
"fastapi.Form",
"nn.create_model",
"io.BytesIO",
"nn.create_augmentation",
"fastapi.staticfiles.StaticFiles",
"tensorflow.expand_dims",
"tensorflow.keras.preprocessing.image.img_to_array"
] | [((518, 539), 'nn.create_augmentation', 'create_augmentation', ([], {}), '()\n', (537, 539), False, 'from nn import create_model, create_augmentation\n'), ((548, 574), 'nn.create_model', 'create_model', (['augmentation'], {}), '(augmentation)\n', (560, 574), False, 'from nn import create_model, create_augmentation\n'),... |
import elasticsearch
import boto3
from elasticsearch import Elasticsearch, RequestsHttpConnection, helpers
from requests_aws4auth import AWS4Auth
import json
import glob
import os
INDEX = "toyo_images"
host = 'search-nakamura196-rgvfh3jsqpal3gntof6o7f3ch4.us-east-1.es.amazonaws.com'
profile_name = "default"
region =... | [
"requests_aws4auth.AWS4Auth",
"elasticsearch.Elasticsearch",
"boto3.Session",
"elasticsearch.helpers.streaming_bulk",
"json.load",
"glob.glob",
"os.remove"
] | [((344, 384), 'boto3.Session', 'boto3.Session', ([], {'profile_name': 'profile_name'}), '(profile_name=profile_name)\n', (357, 384), False, 'import boto3\n'), ((435, 542), 'requests_aws4auth.AWS4Auth', 'AWS4Auth', (['credentials.access_key', 'credentials.secret_key', 'region', '"""es"""'], {'session_token': 'credential... |
#!/usr/bin/env python3
#
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | [
"common.common.GetEnvVariableOrError",
"argparse.ArgumentParser",
"shlex.split",
"os.path.realpath",
"common.common.DeviceTestEnv",
"tempfile.NamedTemporaryFile",
"subprocess.call",
"sys.exit",
"common.common.HostTestEnv",
"re.findall",
"common.common.FatalError"
] | [((10670, 10805), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Tool for finding compiler bugs. Either --raw-cmd or both -cp and --class are required."""'}), "(description=\n 'Tool for finding compiler bugs. Either --raw-cmd or both -cp and --class are required.'\n )\n", (10693, 1... |
from sklearn.naive_bayes import BernoulliNB
from run_binary_classifier import run
param_grid = {
'bag_of_words__stop_words': ['english'],
'bag_of_words__ngram_range': [(1, 2)],
'bag_of_words__max_features': [500],
'dim_reduct__n_components': [300],
'normalizer__norm': ['l2'],
... | [
"run_binary_classifier.run",
"sklearn.naive_bayes.BernoulliNB"
] | [((401, 414), 'sklearn.naive_bayes.BernoulliNB', 'BernoulliNB', ([], {}), '()\n', (412, 414), False, 'from sklearn.naive_bayes import BernoulliNB\n'), ((416, 436), 'run_binary_classifier.run', 'run', (['param_grid', 'clf'], {}), '(param_grid, clf)\n', (419, 436), False, 'from run_binary_classifier import run\n')] |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 19 16:52:59 2018
@author: <NAME>
"""
def ann_module(input_data,output_data,reckon,num_hidden,coef,nr_epochs,val_samples,test_samples,directory,columnst,col,row,flag_train):
import numpy as np
import math
import matplotlib
matplotlib.use('agg')
im... | [
"numpy.random.rand",
"matplotlib.pyplot.ylabel",
"math.floor",
"numpy.array",
"numpy.linalg.norm",
"numpy.nanmin",
"math.exp",
"numpy.arange",
"numpy.mean",
"numpy.reshape",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.asarray",
"numpy.empty",
"os.mkdir",
"numpy.concate... | [((292, 313), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (306, 313), False, 'import matplotlib\n'), ((404, 423), 'os.mkdir', 'os.mkdir', (['directory'], {}), '(directory)\n', (412, 423), False, 'import os\n'), ((478, 512), 'numpy.zeros', 'np.zeros', (['(1, input_data.shape[1])'], {}), '((1, i... |
"""Top-level package for molasses."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.2'
import logging
import requests
from random import random
import zlib
import json
import sseclient
import math
import threading
import time
import semver
from typing import Dict, Optional
from apscheduler.schedu... | [
"logging.getLogger",
"json.loads",
"requests.post",
"semver.Version.parse",
"json.dumps",
"sseclient.SSEClient",
"time.sleep",
"requests.get",
"threading.Thread",
"random.random",
"apscheduler.schedulers.background.BackgroundScheduler"
] | [((430, 457), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (447, 457), False, 'import logging\n'), ((899, 920), 'apscheduler.schedulers.background.BackgroundScheduler', 'BackgroundScheduler', ([], {}), '()\n', (918, 920), False, 'from apscheduler.schedulers.background import BackgroundS... |
import cjson
from django.template import Library, Node, Context, TemplateSyntaxError
from django.template.defaultfilters import stringfilter
register = Library()
@register.filter
def json(value):
return cjson.decode(value)
json = stringfilter(json)
@register.filter
def item(value, arg):
return value[unicode(... | [
"cjson.decode",
"django.template.TemplateSyntaxError",
"django.template.Library",
"django.template.Context",
"django.template.defaultfilters.stringfilter"
] | [((153, 162), 'django.template.Library', 'Library', ([], {}), '()\n', (160, 162), False, 'from django.template import Library, Node, Context, TemplateSyntaxError\n'), ((236, 254), 'django.template.defaultfilters.stringfilter', 'stringfilter', (['json'], {}), '(json)\n', (248, 254), False, 'from django.template.defaultf... |
from collections import OrderedDict
import gym
import torch
from stable_baselines3.common.monitor import Monitor
from stable_baselines3.common.vec_env import (DummyVecEnv, SubprocVecEnv,
VecEnvWrapper)
from stable_baselines3.common.vec_env.vec_normalize import \
VecNorm... | [
"torch.from_numpy",
"stable_baselines3.common.monitor.Monitor",
"stable_baselines3.common.vec_env.SubprocVecEnv",
"stable_baselines3.common.vec_env.DummyVecEnv",
"gym.make"
] | [((582, 598), 'gym.make', 'gym.make', (['env_id'], {}), '(env_id)\n', (590, 598), False, 'import gym\n'), ((1064, 1097), 'stable_baselines3.common.vec_env.SubprocVecEnv', 'SubprocVecEnv', (['envs', '"""forkserver"""'], {}), "(envs, 'forkserver')\n", (1077, 1097), False, 'from stable_baselines3.common.vec_env import Dum... |
# Generated by Django 2.2.12 on 2020-05-27 07:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('instances', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='PermissionSet',
fields=[
... | [
"django.db.models.AutoField"
] | [((329, 422), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (345, 422), False, 'from django.db import migrations, models\... |
import requests
class BATierCalculator(object):
def calculate(self, airline, passengerTier, fromLocation, toLocation, fareClass):
#establish cookies
sess = requests.Session()
sess.get("http://www.britishairways.com")
params = {
"eId":"199001",
"marketingAirline": airline,
"tier": passengerTier,
... | [
"requests.Session"
] | [((162, 180), 'requests.Session', 'requests.Session', ([], {}), '()\n', (178, 180), False, 'import requests\n')] |
import os
import numpy as np
import pickle
from sklearn.ensemble import RandomForestClassifier
from flask import url_for,request,Flask,redirect,render_template
from gevent.pywsgi import WSGIServer
from werkzeug.utils import secure_filename
# Define a Flask App
app = Flask(__name__)
# Define the type of cell you are... | [
"flask.render_template",
"flask.Flask"
] | [((270, 285), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (275, 285), False, 'from flask import url_for, request, Flask, redirect, render_template\n'), ((514, 545), 'flask.render_template', 'render_template', (['"""./index.html"""'], {}), "('./index.html')\n", (529, 545), False, 'from flask import url_f... |
"""Tests for wrapper submodule."""
import numpy as np
from pspca import PSPCA
def test_interface():
"""Test scikit-learn interface."""
points = np.array(
[
[np.sqrt(0.5), np.sqrt(0.5), 0],
[-np.sqrt(0.5), np.sqrt(0.5), 0],
]
)
dim = 3
reducer = PSPCA(dim)
... | [
"numpy.sqrt",
"numpy.eye",
"pspca.PSPCA"
] | [((309, 319), 'pspca.PSPCA', 'PSPCA', (['dim'], {}), '(dim)\n', (314, 319), False, 'from pspca import PSPCA\n'), ((387, 396), 'numpy.eye', 'np.eye', (['(3)'], {}), '(3)\n', (393, 396), True, 'import numpy as np\n'), ((188, 200), 'numpy.sqrt', 'np.sqrt', (['(0.5)'], {}), '(0.5)\n', (195, 200), True, 'import numpy as np\... |
# Copyright 2018--2022 Amazon.com, Inc. or its affiliates. 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. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fi... | [
"logging.getLogger",
"torch.jit.trace",
"math.ceil",
"torch.inference_mode",
"torch.zeros_like",
"time.time",
"torch.cat"
] | [((951, 978), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (968, 978), False, 'import logging\n'), ((6690, 6713), 'torch.inference_mode', 'pt.inference_mode', (['(True)'], {}), '(True)\n', (6707, 6713), True, 'import torch as pt\n'), ((3855, 3894), 'torch.cat', 'pt.cat', (['([scores] + ... |
#
# Copyright (c) 2020 Bitdefender
# SPDX-License-Identifier: Apache-2.0
#
import struct
import re
from abc import ABCMeta, abstractmethod
import excfg
import crc32
# Note: We cannot use os.path here since it's os specific and we must be able to run
# this both on windows & linux
DEFAULT_FLAGS = {
"SignatureFlag... | [
"struct.pack",
"crc32.crc32",
"excfg.get",
"re.sub",
"re.findall"
] | [((3299, 3327), 'crc32.crc32', 'crc32.crc32', (['name'], {'wide': 'wide'}), '(name, wide=wide)\n', (3310, 3327), False, 'import crc32\n'), ((3826, 3854), 'excfg.get', 'excfg.get', (['"""Flags"""', '"""common"""'], {}), "('Flags', 'common')\n", (3835, 3854), False, 'import excfg\n'), ((2786, 2824), 'excfg.get', 'excfg.g... |
import scrapy
# Se importan los items definidos
from formula1.items import Formula1FastestLapItem
class FormulaOneFastestLapsSpider(scrapy.Spider):
# Nombre del spider
name = 'formula-one-fastest-laps'
# Dominios permitidos
allowed_domains = ['https://www.formula1.com/en/results.html']
# URL por ... | [
"scrapy.Request",
"formula1.items.Formula1FastestLapItem"
] | [((931, 955), 'formula1.items.Formula1FastestLapItem', 'Formula1FastestLapItem', ([], {}), '()\n', (953, 955), False, 'from formula1.items import Formula1FastestLapItem\n'), ((731, 803), 'scrapy.Request', 'scrapy.Request', ([], {'url': '(url % year)', 'callback': 'self.parse', 'meta': "{'year': year}"}), "(url=url % ye... |
import numpy as np
lst = [[1, 3, 4], [2, 8, 9]]
a = np.size(lst)
a_ = np.array(lst).size
b = np.shape(lst)
b_ = np.array(lst).shape
c = np.ndim(lst)
c_ = np.array(lst).ndim
d = np.dtype(lst)
d_ = np.array(lst).dtype
# show_store()
| [
"numpy.shape",
"numpy.size",
"numpy.ndim",
"numpy.array",
"numpy.dtype"
] | [((53, 65), 'numpy.size', 'np.size', (['lst'], {}), '(lst)\n', (60, 65), True, 'import numpy as np\n'), ((94, 107), 'numpy.shape', 'np.shape', (['lst'], {}), '(lst)\n', (102, 107), True, 'import numpy as np\n'), ((137, 149), 'numpy.ndim', 'np.ndim', (['lst'], {}), '(lst)\n', (144, 149), True, 'import numpy as np\n'), (... |
##
# File: NeighborFiguresTests
# Author: jdw
# Date: 28-Dec-2020
# Version: 0.001
#
# Updates:
#
##
"""
Tests cases for selected category neighbor diagram figure generator.
"""
__docformat__ = "restructuredtext en"
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__license__ = "Apache 2,0"
import logging
import os... | [
"logging.basicConfig",
"unittest.TestSuite",
"logging.getLogger",
"time.localtime",
"os.getenv",
"mmcif.sitegen.dictionary.DictionaryItemCoverage.DictionaryItemCoverage",
"mmcif.sitegen.dictionary.DictionaryFileUtils.DictionaryFileUtils",
"os.access",
"os.path.join",
"os.path.isfile",
"os.path.d... | [((767, 886), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s [%(levelname)s]-%(module)s.%(funcName)s: %(message)s"""'}), "(level=logging.INFO, format=\n '%(asctime)s [%(levelname)s]-%(module)s.%(funcName)s: %(message)s')\n", (786, 886), False, 'import logging\n... |
#!/usr/bin/env python
# MIT License
#
# Copyright (c) 2019 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy... | [
"numpy.random.normal",
"numpy.array",
"numpy.zeros",
"numpy.random.randint",
"pandas.DataFrame",
"pyflux.VAR"
] | [((1774, 1809), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'columns': 'columns'}), '(data, columns=columns)\n', (1786, 1809), True, 'import pandas as pd\n'), ((1822, 1858), 'pyflux.VAR', 'pf.VAR', ([], {'data': 'data', 'lags': 'training_lag'}), '(data=data, lags=training_lag)\n', (1828, 1858), True, 'import pyflux... |
from unittest import TestCase
import numpy as np
import toolkit.metrics as metrics
class TestMotion(TestCase):
def test_true_positives(self):
y_true = np.array([[1, 1, 1, 1],
[1, 0, 1, 1],
[0, 0, 0, 1]])
y_pred = np.array([[0, 1, 1, 1],
... | [
"numpy.array",
"toolkit.metrics.multilabel_tp_fp_tn_fn_scores"
] | [((167, 219), 'numpy.array', 'np.array', (['[[1, 1, 1, 1], [1, 0, 1, 1], [0, 0, 0, 1]]'], {}), '([[1, 1, 1, 1], [1, 0, 1, 1], [0, 0, 0, 1]])\n', (175, 219), True, 'import numpy as np\n'), ((291, 343), 'numpy.array', 'np.array', (['[[0, 1, 1, 1], [0, 1, 1, 1], [0, 1, 0, 1]]'], {}), '([[0, 1, 1, 1], [0, 1, 1, 1], [0, 1, ... |
from django.contrib import admin
from .models import *
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_display = ['title', 'description', 'date_created']
@admin.register(Comment)
class CommentAdmin(admin.ModelAdmin):
list_display = ['post', 'text', 'username', 'verified', 'date_created']
@a... | [
"django.contrib.admin.register"
] | [((59, 79), 'django.contrib.admin.register', 'admin.register', (['Post'], {}), '(Post)\n', (73, 79), False, 'from django.contrib import admin\n'), ((178, 201), 'django.contrib.admin.register', 'admin.register', (['Comment'], {}), '(Comment)\n', (192, 201), False, 'from django.contrib import admin\n'), ((319, 343), 'dja... |
'''
Qt/Objects/Threads/background
_____________________________
Background thread definition, which periodically emits signals
during another thread's execution loop.
:copyright: (c) 2015 The Regents of the University of California.
:license: GNU GPL, see licenses/GNU GPLv3.txt for more detail... | [
"xldlib.utils.logger.init",
"xldlib.utils.logger.except_error",
"time.sleep",
"xldlib.utils.logger.call",
"PySide.QtCore.Signal"
] | [((551, 584), 'xldlib.utils.logger.init', 'logger.init', (['"""threading"""', '"""DEBUG"""'], {}), "('threading', 'DEBUG')\n", (562, 584), False, 'from xldlib.utils import logger\n'), ((925, 944), 'PySide.QtCore.Signal', 'QtCore.Signal', (['bool'], {}), '(bool)\n', (938, 944), False, 'from PySide import QtCore\n'), ((1... |
import os, sys
import unittest, psutil
current_path = os.path.dirname(os.path.realpath(__file__))
project_root = os.path.abspath(os.path.join(current_path, '..'))
sys.path.insert(0, project_root)
from steamworks import STEAMWORKS
_steam_running = False
for process in psutil.process_iter():
if process.name() == '... | [
"sys.path.insert",
"steamworks.STEAMWORKS",
"psutil.process_iter",
"os.path.join",
"os.path.realpath"
] | [((164, 196), 'sys.path.insert', 'sys.path.insert', (['(0)', 'project_root'], {}), '(0, project_root)\n', (179, 196), False, 'import os, sys\n'), ((271, 292), 'psutil.process_iter', 'psutil.process_iter', ([], {}), '()\n', (290, 292), False, 'import unittest, psutil\n'), ((71, 97), 'os.path.realpath', 'os.path.realpath... |
from observatory.lib.parse import STR_FALSY, STR_TRUTHY, parse_bool
STR_UNKNOWN = ('', '_', '🛒')
STR_WRONG = (23, None, Exception)
def test_simple():
for val in STR_TRUTHY:
assert parse_bool(val, warn=False) is True
for val in STR_FALSY:
assert parse_bool(val, warn=False) is False
def test... | [
"observatory.lib.parse.parse_bool"
] | [((926, 978), 'observatory.lib.parse.parse_bool', 'parse_bool', (['STR_WRONG[-1]'], {'fallback': '(True)', 'warn': '(False)'}), '(STR_WRONG[-1], fallback=True, warn=False)\n', (936, 978), False, 'from observatory.lib.parse import STR_FALSY, STR_TRUTHY, parse_bool\n'), ((1056, 1107), 'observatory.lib.parse.parse_bool', ... |
from unittest.mock import MagicMock, patch
from datetime import datetime
import pytest
from aturan_calendar_web.converters import DateConverter
def test_to_python_invalid():
dc = DateConverter(None)
dt = '10/30/2016'
with pytest.raises(ValueError):
rv = dc.to_python(dt)
def test_to_python_vali... | [
"datetime.datetime.now",
"pytest.raises",
"aturan_calendar_web.converters.DateConverter"
] | [((186, 205), 'aturan_calendar_web.converters.DateConverter', 'DateConverter', (['None'], {}), '(None)\n', (199, 205), False, 'from aturan_calendar_web.converters import DateConverter\n'), ((334, 353), 'aturan_calendar_web.converters.DateConverter', 'DateConverter', (['None'], {}), '(None)\n', (347, 353), False, 'from ... |
from django.contrib.auth.models import (
AbstractBaseUser,
PermissionsMixin,
BaseUserManager,
)
from django.db import models
class MyUserManager(BaseUserManager):
def create_user(self, email, password=None):
if not email:
raise ValueError('Users must have an email address')
... | [
"django.db.models.EmailField",
"website.models.User.load",
"django.db.models.BooleanField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((923, 999), 'django.db.models.EmailField', 'models.EmailField', ([], {'verbose_name': '"""email address"""', 'max_length': '(255)', 'unique': '(True)'}), "(verbose_name='email address', max_length=255, unique=True)\n", (940, 999), False, 'from django.db import models\n'), ((1049, 1093), 'django.db.models.CharField', ... |
from random import randint, choice
from discord.ext.commands import command, group
from names import get_full_name
from pony.orm import db_session, sql_debug
from .cog import Cog
from dicebag import Character, Race, Role
class DND(Cog):
@command()
async def characters(self):
"""Lists all of the creat... | [
"dicebag.Race.select",
"discord.ext.commands.group",
"dicebag.Character.select",
"dicebag.Role.select",
"discord.ext.commands.command",
"names.get_full_name"
] | [((245, 254), 'discord.ext.commands.command', 'command', ([], {}), '()\n', (252, 254), False, 'from discord.ext.commands import command, group\n'), ((485, 509), 'discord.ext.commands.group', 'group', ([], {'pass_context': '(True)'}), '(pass_context=True)\n', (490, 509), False, 'from discord.ext.commands import command,... |
import youtube_dl
import os
import argparse
parser = argparse.ArgumentParser(description="A simple tool to download videos and picture directly from Twitter, without an account.")
parser.add_argument("--path", "-p", dest="path", type=str, help="Specify the output path to download files", default="images")
parser.add_a... | [
"youtube_dl.YoutubeDL",
"os.path.exists",
"argparse.ArgumentParser"
] | [((54, 190), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""A simple tool to download videos and picture directly from Twitter, without an account."""'}), "(description=\n 'A simple tool to download videos and picture directly from Twitter, without an account.'\n )\n", (77, 190), F... |
# Developer: SpatialDev
# Company: Spatial Development International
# standard library
import os
import sys
from datetime import datetime, timedelta
# third-party
from arcpy.sa import *
import arcpy
class TRMMCustomRasterRequest:
""" encapsulates a request to the TRMMCustomRasterCreator to create a cust... | [
"arcpy.ListRasters",
"arcpy.SearchCursor",
"arcpy.GetMessages",
"arcpy.Extent",
"datetime.datetime.utcnow",
"arcpy.CheckOutExtension",
"arcpy.CheckInExtension",
"os.path.join",
"arcpy.RasterCatalogToRasterDataset_management",
"os.path.isdir",
"arcpy.Exists",
"os.path.basename",
"os.mkdir",
... | [((3850, 3972), 'arcpy.SearchCursor', 'arcpy.SearchCursor', (["self.input_raster_catalog_options['raster_catalog_fullpath']", 'where_clause', '""""""', 'raster_name_field'], {}), "(self.input_raster_catalog_options[\n 'raster_catalog_fullpath'], where_clause, '', raster_name_field)\n", (3868, 3972), False, 'import a... |
"""
domain2idna - The tool to convert a domain or a file with a list
of domain to the famous IDNA format.
This submodule provides everything related to the CLI.
Author:
<NAME>, @funilrys, contactTATAfunilrysTODTODcom
Contributors:
Let's contribute to domains2idna!!
Project link:
https://github.com/PyFun... | [
"argparse.ArgumentParser",
"colorama.init"
] | [((3684, 3717), 'colorama.init', 'initiate_colorama', ([], {'autoreset': '(True)'}), '(autoreset=True)\n', (3701, 3717), True, 'from colorama import init as initiate_colorama\n'), ((3736, 4033), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""domain2idna - The tool to convert a domain or ... |
# this is the api routing section
from modules import Blueprint, collection, cross_origin, request, dumps, ObjectId
from modules.api.search import Search
search_api = Search()
api_routes = Blueprint("api_routes", __name__)
@api_routes.route('/search', methods=['POST'])
@cross_origin()
def search():
reqd = request... | [
"modules.Blueprint",
"modules.cross_origin",
"modules.ObjectId.is_valid",
"modules.dumps",
"modules.api.search.Search",
"modules.ObjectId",
"modules.request.get_json",
"modules.collection.insert_one"
] | [((168, 176), 'modules.api.search.Search', 'Search', ([], {}), '()\n', (174, 176), False, 'from modules.api.search import Search\n'), ((190, 223), 'modules.Blueprint', 'Blueprint', (['"""api_routes"""', '__name__'], {}), "('api_routes', __name__)\n", (199, 223), False, 'from modules import Blueprint, collection, cross_... |
# Copyright 2018 BLEMUNDSBURY AI LIMITED
#
# 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 ... | [
"cape_webservices.app.app_settings.app_endpoints.route",
"cape_api_helpers.input.required_parameter",
"cape_userdb.base.DB.close",
"cape_responder.responder_core.Responder.get_answers_from_similar_questions",
"cape_userdb.base.DB.is_closed",
"cape_api_helpers.exceptions.UserException",
"cape_userdb.cove... | [((1440, 1498), 'cape_webservices.app.app_settings.app_endpoints.route', 'app_endpoints.route', (['(URL_BASE + x)'], {'methods': "['GET', 'POST']"}), "(URL_BASE + x, methods=['GET', 'POST'])\n", (1459, 1498), False, 'from cape_webservices.app.app_settings import app_endpoints\n'), ((1670, 1684), 'cape_userdb.base.DB.is... |
from flask import request
from flask_restful import Resource
from connection import connection
import utility
# noinspection SqlResolve
class GetRmodul(Resource):
@staticmethod
def get():
global cursor
try:
cursor = connection.cursor()
cursor.execute("""SELECT * FROM s... | [
"connection.connection.commit",
"connection.connection.cursor",
"utility.give_response"
] | [((255, 274), 'connection.connection.cursor', 'connection.cursor', ([], {}), '()\n', (272, 274), False, 'from connection import connection\n'), ((496, 515), 'connection.connection.commit', 'connection.commit', ([], {}), '()\n', (513, 515), False, 'from connection import connection\n'), ((535, 591), 'utility.give_respon... |
#!/usr/bin/env python
"""
A service like daemon for calculating components of the gradient
"""
# pylint: disable=invalid-name, unused-import, multiple-imports
import platform
import numpy as np
import uuid
import sys, time, os, atexit, json
from SparseSC.cli.daemon import Daemon
from yaml import load, dump
import tempf... | [
"os.path.exists",
"json.loads",
"os.listdir",
"os.join",
"yaml.dump",
"json.dumps",
"os.path.join",
"yaml.load",
"numpy.ix_",
"uuid.uuid4",
"numpy.zeros",
"os.mkfifo",
"sys.stdout.flush",
"atexit.register",
"os.remove"
] | [((1455, 1473), 'numpy.zeros', 'np.zeros', (['(N0, N1)'], {}), '((N0, N1))\n', (1463, 1473), True, 'import numpy as np\n'), ((9152, 9174), 'os.mkfifo', 'os.mkfifo', (['RETURN_FIFO'], {}), '(RETURN_FIFO)\n', (9161, 9174), False, 'import sys, time, os, atexit, json\n'), ((9260, 9284), 'atexit.register', 'atexit.register'... |
from django.contrib import admin
from .models import Time
# register models to show up on admin page
admin.site.register(Time) | [
"django.contrib.admin.site.register"
] | [((102, 127), 'django.contrib.admin.site.register', 'admin.site.register', (['Time'], {}), '(Time)\n', (121, 127), False, 'from django.contrib import admin\n')] |
import sys
import json
import syscalls
import os
from cfg import cached_results_folder
def filter_file(fname):
f = fname.replace("/", "_") + ".json"
if f[0] == ".":
f = f[1:]
return f
def main(fname):
used_syscalls = []
ffname = os.path.join(cached_results_folder, "syscalls_%s" % filter_fi... | [
"syscalls.get_blocked_syscalls",
"sys.exit"
] | [((616, 660), 'syscalls.get_blocked_syscalls', 'syscalls.get_blocked_syscalls', (['used_syscalls'], {}), '(used_syscalls)\n', (645, 660), False, 'import syscalls\n'), ((1294, 1305), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1302, 1305), False, 'import sys\n')] |
from PySide2.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QPlainTextEdit, QShortcut, QMessageBox, QGroupBox, \
QScrollArea, QCheckBox, QLabel
class CodeGenDialog(QDialog):
def __init__(self, modules: dict, parent=None):
super(CodeGenDialog, self).__init__(parent)
self.modules = mo... | [
"PySide2.QtWidgets.QPlainTextEdit",
"PySide2.QtWidgets.QDialogButtonBox",
"PySide2.QtWidgets.QCheckBox",
"PySide2.QtWidgets.QLabel",
"PySide2.QtWidgets.QScrollArea",
"PySide2.QtWidgets.QVBoxLayout",
"PySide2.QtWidgets.QGroupBox"
] | [((349, 362), 'PySide2.QtWidgets.QVBoxLayout', 'QVBoxLayout', ([], {}), '()\n', (360, 362), False, 'from PySide2.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QPlainTextEdit, QShortcut, QMessageBox, QGroupBox, QScrollArea, QCheckBox, QLabel\n'), ((392, 412), 'PySide2.QtWidgets.QGroupBox', 'QGroupBox', (['"""... |
import json
class WSParser:
bluenetInstance = None
def __init__(self):
pass
def connectToBluenet(self, bluenetInstance):
self.bluenetInstance = bluenetInstance
def receiveWebSocketCommand(self, stringifiedJson):
print("Raw Data", stringifiedJson)
... | [
"json.loads"
] | [((344, 371), 'json.loads', 'json.loads', (['stringifiedJson'], {}), '(stringifiedJson)\n', (354, 371), False, 'import json\n')] |
from PyQt5 import QtCore, QtWidgets
from pyqtgraph import PlotWidget
from vsn_server.common.utility import CameraStatisticsTuple, Config
from vsn_server.processing.cameras import VSNCameras
from vsn_server.ui.graph import VSNGraphController
class MainWindow(QtWidgets.QMainWindow):
def __init__(self):
sup... | [
"PyQt5.QtWidgets.QSpinBox",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QStatusBar",
"PyQt5.QtWidgets.QGroupBox",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QMenu",
"vsn_server.ui.graph.VSNGraphController.create_plot",
"PyQt5.QtWidgets.... | [((892, 933), 'PyQt5.QtWidgets.QHBoxLayout', 'QtWidgets.QHBoxLayout', (['self.centralwidget'], {}), '(self.centralwidget)\n', (913, 933), False, 'from PyQt5 import QtCore, QtWidgets\n'), ((966, 1006), 'PyQt5.QtWidgets.QTabWidget', 'QtWidgets.QTabWidget', (['self.centralwidget'], {}), '(self.centralwidget)\n', (986, 100... |
import os
import typing
from stringcase import camelcase, snakecase
import click
from dictdiffer import diff
from swagger_spec_validator import validator20, SwaggerValidationError
from .model import SpecDir, Path, Operation, Definition, create_spec_dict
from .utils import file_path_to_dict, str_to_dict
from .walker i... | [
"stringcase.camelcase",
"os.listdir",
"stringcase.snakecase",
"os.path.splitext",
"os.replace",
"os.path.isfile",
"click.echo",
"os.walk"
] | [((3640, 3660), 'os.path.isfile', 'os.path.isfile', (['item'], {}), '(item)\n', (3654, 3660), False, 'import os\n'), ((5864, 5893), 'os.walk', 'os.walk', (["(input_dir + '/paths')"], {}), "(input_dir + '/paths')\n", (5871, 5893), False, 'import os\n'), ((6405, 6443), 'os.listdir', 'os.listdir', (["(input_dir + '/defini... |
# Generated by Django 3.1.3 on 2021-03-16 02:00
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ahj_app', '0004_auto_20210312_2016'),
]
operations = [
migrations.CreateModel(
name='DocumentSu... | [
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((405, 500), 'django.db.models.AutoField', 'models.AutoField', ([], {'db_column': '"""DocumentSubmissionMethodID"""', 'primary_key': '(True)', 'serialize': '(False)'}), "(db_column='DocumentSubmissionMethodID', primary_key=True,\n serialize=False)\n", (421, 500), False, 'from django.db import migrations, models\n')... |
import re
from functools import cache
def lmap(f, it):
return list(map(f, it))
def ints(it):
return lmap(int, it)
@cache
def F(d, s):
reset_at = d - s - 1
if reset_at < 0:
return 1
return F(reset_at, 6) + F(reset_at, 8)
def solve(input):
return sum(F(256, x) for x in ints(re.find... | [
"re.findall"
] | [((313, 340), 're.findall', 're.findall', (['"""-?\\\\d+"""', 'input'], {}), "('-?\\\\d+', input)\n", (323, 340), False, 'import re\n')] |
from typing import Mapping
import meerkat as mk
from dcbench.common import Problem, Solution
from dcbench.common.artifact import (
DataPanelArtifact,
ModelArtifact,
VisionDatasetArtifact,
)
from dcbench.common.artifact_container import ArtifactSpec
from dcbench.common.table import AttributeSpec
class S... | [
"dcbench.common.table.AttributeSpec",
"dcbench.common.artifact_container.ArtifactSpec"
] | [((428, 573), 'dcbench.common.artifact_container.ArtifactSpec', 'ArtifactSpec', ([], {'artifact_type': 'DataPanelArtifact', 'description': '"""A DataPanel of predicted slice labels with columns `id` and `pred_slices`."""'}), "(artifact_type=DataPanelArtifact, description=\n 'A DataPanel of predicted slice labels wit... |
import os
from setuptools import setup
BASE_DIR = os.path.dirname(__file__)
with open(os.path.join(BASE_DIR, 'requirements.txt')) as requirements:
REQUIREMENTS = requirements.read().split('\n')
setup(
name='week_parser',
packages=['week_parser'],
include_package_data=True,
install_requires=REQ... | [
"os.path.join",
"os.path.dirname",
"setuptools.setup"
] | [((53, 78), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (68, 78), False, 'import os\n'), ((204, 460), 'setuptools.setup', 'setup', ([], {'name': '"""week_parser"""', 'packages': "['week_parser']", 'include_package_data': '(True)', 'install_requires': 'REQUIREMENTS', 'setup_requires': "['py... |
from distutils.core import setup, Extension
setup(name='pylfq', version='0.1.0', include_dirs = '../../src',
ext_modules=[Extension('pylfq', ['src/pylfq.c', '../../src/queue.c'])]) | [
"distutils.core.Extension"
] | [((129, 185), 'distutils.core.Extension', 'Extension', (['"""pylfq"""', "['src/pylfq.c', '../../src/queue.c']"], {}), "('pylfq', ['src/pylfq.c', '../../src/queue.c'])\n", (138, 185), False, 'from distutils.core import setup, Extension\n')] |
# Copyright (c) 2017, Barcelona Supercomputing Center
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of condit... | [
"collections.deque",
"utils.files.read_json"
] | [((2748, 2757), 'collections.deque', 'deque', (['[]'], {}), '([])\n', (2753, 2757), False, 'from collections import deque\n'), ((2785, 2794), 'collections.deque', 'deque', (['[]'], {}), '([])\n', (2790, 2794), False, 'from collections import deque\n'), ((3578, 3603), 'utils.files.read_json', 'read_json', (['json_file_p... |
from typing import Optional, List, Callable, Tuple
import torch
import random
import sys
import torch.nn.functional as F
import torch.multiprocessing as mp
import torch.nn.parallel as paralle
import unittest
import torchshard as ts
from testing import IdentityLayer
from testing import dist_worker, assertEqual, set_s... | [
"torch.multiprocessing.spawn",
"torch.LongTensor",
"torchshard.distributed.scatter",
"torchshard.nn.functional.parallel_cross_entropy",
"torch.cuda.device_count",
"torchshard.distributed.get_world_size",
"torch.cuda.is_available",
"testing.set_seed",
"testing.IdentityLayer",
"torch.nn.functional.c... | [((474, 488), 'testing.set_seed', 'set_seed', (['seed'], {}), '(seed)\n', (482, 488), False, 'from testing import dist_worker, assertEqual, set_seed\n'), ((1169, 1183), 'testing.set_seed', 'set_seed', (['seed'], {}), '(seed)\n', (1177, 1183), False, 'from testing import dist_worker, assertEqual, set_seed\n'), ((1558, 1... |
import requests
import sh
import datetime
import logging, logging.handlers
logger = logging.getLogger("agent")
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.handlers.RotatingFileHandler("agent.log"))
FORMAT = "[%(asctime)s] %(levelname)s [%(name)s.%(funcName)s:%(lineno)d] %(message)s"
logging.basicConfig(fo... | [
"logging.getLogger",
"logging.basicConfig",
"requests.post",
"sh.whoami",
"logging.handlers.RotatingFileHandler",
"sh.cat",
"datetime.datetime.now"
] | [((85, 111), 'logging.getLogger', 'logging.getLogger', (['"""agent"""'], {}), "('agent')\n", (102, 111), False, 'import logging, logging.handlers\n'), ((298, 332), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': 'FORMAT'}), '(format=FORMAT)\n', (317, 332), False, 'import logging, logging.handlers\n'), ((5... |
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import pytest
import numpy as np
import nilearn
from mne import Covariance
from mne.simulation import add_noise
from mne_nirs.experimental_design import make_first_level_design_matrix
from mne_nirs.statistics import run_GLM
from mne_nirs.simulation import simul... | [
"mne_nirs.simulation.simulate_nirs_raw",
"pytest.mark.filterwarnings",
"numpy.ones",
"mne.simulation.add_noise",
"mne_nirs.statistics.run_GLM",
"mne_nirs.experimental_design.make_first_level_design_matrix"
] | [((416, 492), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:.*nilearn.glm module is experimental.*:"""'], {}), "('ignore:.*nilearn.glm module is experimental.*:')\n", (442, 492), False, 'import pytest\n'), ((523, 567), 'mne_nirs.simulation.simulate_nirs_raw', 'simulate_nirs_raw', ([], {'sig_d... |
import pytesseract
import cv2
from pytesseract import Output
import numpy as np
import os
from tqdm import tqdm
CHAR_MAP = {
'"': (0, 255, 0),
'#': (0, 255, 0),
'%': (0, 255, 0),
'&': (0, 255, 0),
',': (0, 255, 0),
'.': (0, 255, 0),
'0': (0, 0, 255),
'1': (0, 0, 255),
'2': (0, 0, 255),
'3': (0, 0, 255),
'4'... | [
"pytesseract.image_to_boxes",
"cv2.rectangle",
"os.path.join",
"numpy.zeros",
"cv2.imread"
] | [((1076, 1097), 'cv2.imread', 'cv2.imread', (['input_dir'], {}), '(input_dir)\n', (1086, 1097), False, 'import cv2\n'), ((1167, 1205), 'numpy.zeros', 'np.zeros', (['(height, width, 3)', 'np.uint8'], {}), '((height, width, 3), np.uint8)\n', (1175, 1205), True, 'import numpy as np\n'), ((1222, 1278), 'pytesseract.image_t... |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 15 02:25:35 2018
@author: Amir
"""
from glob import glob
import os
dataset_dir = 'root/path/to/rsm/hallway/dataset/' #edit this line
path_ids = ['1'] #['1', '2','3','4','5','6','7','8','9','10']
hallway_list = ['C1'] # ['C1', 'C2', 'C3', 'C4', 'C5','C6']
with open('tes... | [
"os.path.isdir",
"os.path.join",
"glob.glob"
] | [((420, 457), 'os.path.join', 'os.path.join', (['dataset_dir', 'hallway_id'], {}), '(dataset_dir, hallway_id)\n', (432, 457), False, 'import os\n'), ((469, 493), 'os.path.isdir', 'os.path.isdir', (['drive_dir'], {}), '(drive_dir)\n', (482, 493), False, 'import os\n'), ((558, 613), 'os.path.join', 'os.path.join', (['dri... |
# Escrever um script em python que le
# uma tabela do excel
# e gera o código em assembly
# para gerar a imagem no LCD
import pandas as pd
import numpy as np
WIDTH = 320
HEIGHT = 240
SIZE = 16
START = 16_384
sheet = pd.read_excel("SW_LCD.xlsx")
ones = sheet == 1
pixels = np.where(ones)
memory = {}
for y, x in ... | [
"numpy.where",
"numpy.floor",
"pandas.read_excel"
] | [((223, 251), 'pandas.read_excel', 'pd.read_excel', (['"""SW_LCD.xlsx"""'], {}), "('SW_LCD.xlsx')\n", (236, 251), True, 'import pandas as pd\n'), ((279, 293), 'numpy.where', 'np.where', (['ones'], {}), '(ones)\n', (287, 293), True, 'import numpy as np\n'), ((354, 372), 'numpy.floor', 'np.floor', (['(x / SIZE)'], {}), '... |
# -*- coding: utf-8 -*-
# @File : decorator_pattern.py
# @Project : src
# @Time : 2018/10/29 22:50
# @Site : https://github.com/MaiXiaochai
# @Author : maixiaochai
from timeit import Timer
from functools import wraps
"""
修饰(装饰)器模式: 以透明的方式,动态地(运行时)扩展一个对象的功能
修饰器: 一个可调用函数对... | [
"functools.wraps"
] | [((2360, 2369), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (2365, 2369), False, 'from functools import wraps\n')] |
#!/usr/bin/python3
# -*- coding:utf-8 -*-
"""
Notification manager for PiHome
File: notify
Project: PiHome
File Created: Friday, 5th November 2021 7:59:03 pm
Author: <NAME>
-----
MIT License
Copyright (c) 2021 Your Company
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software a... | [
"logging.getLogger",
"logging.basicConfig",
"requests.post",
"os.getenv",
"pihome.db.DBMgr",
"dotenv.load_dotenv",
"datetime.datetime.now",
"socket.gethostname"
] | [((1442, 1469), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1459, 1469), False, 'import logging\n'), ((4852, 4921), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': '"""INFO"""', 'format': '"""%(asctime)s > %(message)s"""'}), "(level='INFO', format='%(asctime)s > %(message... |
from typing import Union, Tuple
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Add, Input, Lambda
from pyts.layers import (
DenseRadialFactory,
MolecularConvolution,
Preprocessing,
RadialFactory,
MolecularSelfInteraction,
MolecularActivation,
)
... | [
"tensorflow.keras.layers.Input",
"tensorflow.tile",
"tensorflow.keras.Model",
"pyts.layers.MolecularSelfInteraction",
"tensorflow.keras.layers.Add",
"pyts.layers.MolecularConvolution",
"pyts.layers.DenseRadialFactory",
"tensorflow.expand_dims",
"pyts.layers.MolecularActivation"
] | [((687, 707), 'pyts.layers.DenseRadialFactory', 'DenseRadialFactory', ([], {}), '()\n', (705, 707), False, 'from pyts.layers import DenseRadialFactory, MolecularConvolution, Preprocessing, RadialFactory, MolecularSelfInteraction, MolecularActivation\n'), ((3124, 3176), 'tensorflow.keras.Model', 'Model', ([], {'inputs':... |
import logging
import asyncio
import weakref
import functools
L = logging.getLogger(__name__)
class PubSub(object):
def __init__(self, app):
self.Subscribers = {}
self.Loop = app.Loop
def subscribe(self, message_type, callback):
"""
Subscribe a subscriber to the an message type.
It could be even pla... | [
"logging.getLogger",
"asyncio.iscoroutinefunction",
"weakref.WeakMethod",
"asyncio.Queue",
"functools.partial",
"weakref.ref"
] | [((68, 95), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (85, 95), False, 'import logging\n'), ((4441, 4456), 'asyncio.Queue', 'asyncio.Queue', ([], {}), '()\n', (4454, 4456), False, 'import asyncio\n'), ((632, 660), 'weakref.WeakMethod', 'weakref.WeakMethod', (['callback'], {}), '(call... |
import socket
import serial
import modbus_tk.defines as cst
from modbus_tk import modbus_rtu
from datetime import datetime
import pywinusb.hid as hid
from time import sleep
import time
serial = serial.Serial(
port='COM4',
baudrate=9600,
bytesize=8,
... | [
"socket.socket",
"modbus_tk.modbus_rtu.RtuMaster",
"time.sleep",
"serial.Serial",
"pywinusb.hid.HidDeviceFilter"
] | [((195, 288), 'serial.Serial', 'serial.Serial', ([], {'port': '"""COM4"""', 'baudrate': '(9600)', 'bytesize': '(8)', 'parity': '"""N"""', 'stopbits': '(1)', 'xonxoff': '(0)'}), "(port='COM4', baudrate=9600, bytesize=8, parity='N', stopbits=\n 1, xonxoff=0)\n", (208, 288), False, 'import serial\n'), ((456, 484), 'mod... |
import logging
import os
import poringworldbot
from poringworldbot.bot import bot
logging.basicConfig(
level=logging.WARNING,
handlers=[logging.StreamHandler()],
)
logging.getLogger(poringworldbot.__name__).setLevel(logging.INFO)
token = os.environ.get('DISCORD_TOKEN')
if not token:
print('Please set th... | [
"poringworldbot.bot.bot.run",
"logging.StreamHandler",
"os.environ.get",
"logging.getLogger"
] | [((249, 280), 'os.environ.get', 'os.environ.get', (['"""DISCORD_TOKEN"""'], {}), "('DISCORD_TOKEN')\n", (263, 280), False, 'import os\n'), ((373, 387), 'poringworldbot.bot.bot.run', 'bot.run', (['token'], {}), '(token)\n', (380, 387), False, 'from poringworldbot.bot import bot\n'), ((174, 216), 'logging.getLogger', 'lo... |
from cauldron.session import projects
from cauldron.session.writing.components import bokeh_component
from cauldron.session.writing.components import definitions
from cauldron.session.writing.components import plotly_component
from cauldron.session.writing.components import project_component
from cauldron.session.writi... | [
"cauldron.session.writing.components.project_component.create_many",
"cauldron.session.writing.components.plotly_component.create",
"cauldron.session.writing.components.bokeh_component.create",
"cauldron.session.writing.components.definitions.COMPONENT"
] | [((986, 1003), 'cauldron.session.writing.components.definitions.COMPONENT', 'COMPONENT', (['[]', '[]'], {}), '([], [])\n', (995, 1003), False, 'from cauldron.session.writing.components.definitions import COMPONENT\n'), ((558, 589), 'cauldron.session.writing.components.bokeh_component.create', 'bokeh_component.create', ... |
import os
from glob import glob
import numpy as np
import dlib
import cv2
from PIL import Image
def remove_undetected(directory ,detector ='hog'):
'''
Removes the undetected images in data
Args:
-----------------------------------------
directory: path to the data folder
detector: type o... | [
"PIL.Image.open",
"dlib.get_frontal_face_detector",
"numpy.zeros",
"dlib.cnn_face_detection_model_v1",
"cv2.resize",
"glob.glob",
"os.remove"
] | [((560, 583), 'glob.glob', 'glob', (['f"""{directory}*/*"""'], {}), "(f'{directory}*/*')\n", (564, 583), False, 'from glob import glob\n'), ((2901, 2960), 'numpy.zeros', 'np.zeros', (['(total_imgs, img_size, img_size, 3)'], {'dtype': 'np.int'}), '((total_imgs, img_size, img_size, 3), dtype=np.int)\n', (2909, 2960), Tru... |
# Copyright 2017 Google Inc. 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 by applicable law or... | [
"gcp_variant_transforms.beam_io.vcfio.Variant",
"apache_beam.transforms.Create",
"apache_beam.testing.test_pipeline.TestPipeline",
"gcp_variant_transforms.beam_io.vcfio.VariantCall",
"gcp_variant_transforms.transforms.densify_variants.DensifyVariants",
"gcp_variant_transforms.testing.testdata_util.hash_na... | [((1577, 1591), 'apache_beam.testing.test_pipeline.TestPipeline', 'TestPipeline', ([], {}), '()\n', (1589, 1591), False, 'from apache_beam.testing.test_pipeline import TestPipeline\n'), ((2338, 2352), 'apache_beam.testing.test_pipeline.TestPipeline', 'TestPipeline', ([], {}), '()\n', (2350, 2352), False, 'from apache_b... |
import numpy as np
from copy import copy
from complex_performance_metrics.models.plugin import MulticlassPluginClassifier
from complex_performance_metrics.utils import nae
"""
This module implements the COCO algorithm for:
minimizing the (multiclass) Q-mean loss subject to (multiclass) Normalized Absolute Error ... | [
"numpy.eye",
"numpy.sqrt",
"complex_performance_metrics.models.plugin.MulticlassPluginClassifier",
"numpy.zeros",
"numpy.min",
"copy.copy",
"complex_performance_metrics.utils.nae"
] | [((1155, 1177), 'numpy.zeros', 'np.zeros', (['(num_class,)'], {}), '((num_class,))\n', (1163, 1177), True, 'import numpy as np\n'), ((1277, 1305), 'numpy.eye', 'np.eye', (['num_class', 'num_class'], {}), '(num_class, num_class)\n', (1283, 1305), True, 'import numpy as np\n'), ((1465, 1523), 'complex_performance_metrics... |
import numpy as np
class MSE:
def __call__(self, y_pred, y):
return 0.5 * np.mean((y_pred - y)**2)
def derivative(self, y_pred, y):
return y_pred - y
class CrossEntropy:
def __call__(self, y_pred, y):
return -np.sum(y * np.log(y_pred))
def derivative(self, y_pred, y):
... | [
"numpy.mean",
"numpy.log",
"numpy.ones"
] | [((539, 570), 'numpy.ones', 'np.ones', (['(n_samples, n_targets)'], {}), '((n_samples, n_targets))\n', (546, 570), True, 'import numpy as np\n'), ((88, 114), 'numpy.mean', 'np.mean', (['((y_pred - y) ** 2)'], {}), '((y_pred - y) ** 2)\n', (95, 114), True, 'import numpy as np\n'), ((261, 275), 'numpy.log', 'np.log', (['... |
import math
line = str(input(""))
split = line.split(" ")
A = float(split[0])
B = float(split[1])
C = float(split[2])
try:
x1 = ((-B) + math.sqrt(math.pow(B, 2) - (4*A*C))) / (2*A)
x2 = ((-B) - math.sqrt(math.pow(B, 2) - (4*A*C))) / (2*A)
print("R1 = {0:.5f}".format(x1))
print("R2 = {0:.5f}".format(... | [
"math.pow"
] | [((153, 167), 'math.pow', 'math.pow', (['B', '(2)'], {}), '(B, 2)\n', (161, 167), False, 'import math\n'), ((215, 229), 'math.pow', 'math.pow', (['B', '(2)'], {}), '(B, 2)\n', (223, 229), False, 'import math\n')] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from lxml import etree
class PyXMLCast(object):
def __init__(self, xmlFile):
self.channel = etree.parse(xmlFile).find('channel')
def getChannelName(self):
return self.channel.find('title').text
def getChannelDescription(self):
return self... | [
"lxml.etree.parse"
] | [((148, 168), 'lxml.etree.parse', 'etree.parse', (['xmlFile'], {}), '(xmlFile)\n', (159, 168), False, 'from lxml import etree\n')] |
#!/usr/bin/env python3
#--------------------------------------------------------------------------#
# Name: <NAME> #
# Email: <EMAIL> #
# GitHub: https://github.com/Jankoziol/discrete-sample #
... | [
"matplotlib.pyplot.plot",
"pandas.read_csv",
"matplotlib.pyplot.show"
] | [((478, 514), 'pandas.read_csv', 'pd.read_csv', (['"""benchmark_sampler.txt"""'], {}), "('benchmark_sampler.txt')\n", (489, 514), True, 'import pandas as pd\n'), ((522, 584), 'matplotlib.pyplot.plot', 'plt.plot', (["d['configuration space size']", "d['time walker [ms]']"], {}), "(d['configuration space size'], d['time ... |