code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- encoding: utf-8 -*-
# Importação das bibliotecas necessárias.
import mysql.connector
import datetime
# Configuração da conexão.
connection = mysql.connector.connect(
host="localhost",
user="root",
password="",
database="teste"
)
# Variável que executará as operações.
cursor = connection.cursor(... | [
"datetime.datetime.today"
] | [((463, 488), 'datetime.datetime.today', 'datetime.datetime.today', ([], {}), '()\n', (486, 488), False, 'import datetime\n')] |
# Unit Tests for the Enum Combo Box
import pytest
from logging import ERROR
from qtpy.QtCore import Slot, Qt
from ...widgets.enum_combo_box import PyDMEnumComboBox
from ... import data_plugins
# --------------------
# POSITIVE TEST CASES
# --------------------
def test_construct(qtbot):
"""
Test the const... | [
"pytest.mark.parametrize"
] | [((801, 878), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""enums"""', "[('spam', 'eggs', 'ham'), ('spam',), ('',)]"], {}), "('enums', [('spam', 'eggs', 'ham'), ('spam',), ('',)])\n", (824, 878), False, 'import pytest\n'), ((1754, 2315), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""connecte... |
import os
import random
import argparse
import multiprocessing
import numpy as np
import torch
from torchvision import models, transforms
from torch.utils.data import DataLoader, Dataset
from pathlib import Path
from PIL import Image
from utils import Bar, config, mkdir_p, AverageMeter
from datetime import datetime
fro... | [
"utils.mkdir_p",
"torchvision.models.resnet18",
"multiprocessing.cpu_count",
"torchvision.transforms.ColorJitter",
"torch.cuda.is_available",
"argparse.ArgumentParser",
"pathlib.Path",
"os.path.isdir",
"numpy.random.seed",
"torchvision.transforms.ToTensor",
"random.randint",
"torchvision.model... | [((409, 467), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""byol-lightning-test"""'}), "(description='byol-lightning-test')\n", (432, 467), False, 'import argparse\n'), ((1935, 1960), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1958, 1960), False, 'import to... |
from sys import stdin
a,b = [int(x) for x in stdin.readline().split(' ')]
diff = abs(a-b) +1
a = min(a,b) +1
print(a)
for x in range(1,diff):
print(a+x)
| [
"sys.stdin.readline"
] | [((46, 62), 'sys.stdin.readline', 'stdin.readline', ([], {}), '()\n', (60, 62), False, 'from sys import stdin\n')] |
import os
class Cajero:
def __init__(self):
self.continuar = True
self.monto = 5000
self.menu()
def contraseña(self):
contador = 1
while contador <= 3:
x = int(input("ingrese su contraseña:" ))
if x == 5467:
print("Contraseña ... | [
"os.system"
] | [((651, 667), 'os.system', 'os.system', (['"""cls"""'], {}), "('cls')\n", (660, 667), False, 'import os\n'), ((783, 799), 'os.system', 'os.system', (['"""cls"""'], {}), "('cls')\n", (792, 799), False, 'import os\n')] |
from threading import Thread, enumerate
from random import choice
from time import sleep as slp
from time import time as tiime
from os import mkdir, getcwd, path as pth
from subprocess import run as run_
from math import ceil
from traceback import format_exc
from sys import exit
import logging, json, ctypes
from ppadb... | [
"time.sleep",
"langdetect.detect",
"fuzzywuzzy.process.extractOne",
"sys.exit",
"logging.info",
"os.path.exists",
"logging.warn",
"subprocess.run",
"logging.FileHandler",
"os.mkdir",
"ppadb.client.Client",
"random.choice",
"requests.get",
"time.time",
"traceback.format_exc",
"PIL.Image... | [((1112, 1156), 'PIL.Image.open', 'Image.open', (['"""./base/login/update_notice.png"""'], {}), "('./base/login/update_notice.png')\n", (1122, 1156), False, 'from PIL import Image, UnidentifiedImageError, ImageFile\n'), ((1173, 1216), 'PIL.Image.open', 'Image.open', (['"""./base/login/introduction.png"""'], {}), "('./b... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | [
"heat.engine.components.Components",
"heat.engine.components.Component"
] | [((830, 841), 'heat.engine.components.Component', 'Component', ([], {}), '()\n', (839, 841), False, 'from heat.engine.components import Component\n'), ((1297, 1314), 'heat.engine.components.Component', 'Component', (['schema'], {}), '(schema)\n', (1306, 1314), False, 'from heat.engine.components import Component\n'), (... |
"""pycstruct definitions
Copyright 2021 by <NAME>.
All rights reserved.
This file is part of the pycstruct python library and is
released under the "MIT License Agreement". Please see the LICENSE
file that should have been included as part of this package.
"""
# pylint: disable=too-many-lines, protected-access
impor... | [
"collections.OrderedDict",
"math.ceil",
"struct.pack_into",
"pycstruct.instance._InstanceList",
"pycstruct.instance.Instance",
"struct.unpack_from"
] | [((5305, 5355), 'struct.pack_into', 'struct.pack_into', (['dataformat', 'buffer', 'offset', 'data'], {}), '(dataformat, buffer, offset, data)\n', (5321, 5355), False, 'import struct\n'), ((12221, 12263), 'pycstruct.instance._InstanceList', '_InstanceList', (['self', 'buffer', 'buffer_offset'], {}), '(self, buffer, buff... |
import huckelpy
from huckelpy import file_io
class ExtendedHuckel:
def __init__(self, geometry, charge=0):
self._EH = huckelpy.ExtendedHuckel(geometry.get_positions(), geometry.get_symbols(), charge=charge)
self._alpha_electrons = None
self._beta_electrons = None
self._total_elect... | [
"huckelpy.file_io.build_fchk"
] | [((1024, 1052), 'huckelpy.file_io.build_fchk', 'file_io.build_fchk', (['self._EH'], {}), '(self._EH)\n', (1042, 1052), False, 'from huckelpy import file_io\n')] |
# SPDX-License-Identifier: BSD-2-Clause-Patent
# SPDX-FileCopyrightText: 2020 the prplMesh contributors (see AUTHORS.md)
# This code is subject to the terms of the BSD+Patent license.
# See LICENSE file for more details.
from .prplmesh_base_test import PrplMeshBaseTest
from boardfarm.exceptions import SkipTest
from ca... | [
"capi.tlv",
"boardfarm.exceptions.SkipTest"
] | [((1342, 1427), 'capi.tlv', 'tlv', (["self.ieee1905['eTlvType']['TLV_AL_MAC_ADDRESS']", "('{' + controller.mac + '}')"], {}), "(self.ieee1905['eTlvType']['TLV_AL_MAC_ADDRESS'], '{' + controller.mac + '}'\n )\n", (1345, 1427), False, 'from capi import tlv\n'), ((1494, 1631), 'capi.tlv', 'tlv', (["self.ieee1905['eTlvT... |
import cv2
import pickle
import numpy as np
from flag import Flag
flag = Flag()
with open('assets/colors.h5', 'rb') as f:
colors = pickle.loads(f.read())
with open('label.txt', 'r') as f:
classes = f.readlines()
def detector(image, label):
image = np.asarray(image * 255., np.uint8)
image = cv2.cvtCo... | [
"numpy.ones",
"numpy.where",
"numpy.asarray",
"cv2.filter2D",
"cv2.imshow",
"numpy.max",
"cv2.cvtColor",
"cv2.findContours",
"numpy.load",
"cv2.waitKey",
"flag.Flag"
] | [((74, 80), 'flag.Flag', 'Flag', ([], {}), '()\n', (78, 80), False, 'from flag import Flag\n'), ((264, 299), 'numpy.asarray', 'np.asarray', (['(image * 255.0)', 'np.uint8'], {}), '(image * 255.0, np.uint8)\n', (274, 299), True, 'import numpy as np\n'), ((311, 349), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_... |
import retrieve
import validation
from time_functions import time_delay
from selenium.webdriver import ActionChains
def like_pic(browser):
heart = retrieve.like_button(browser)
time_delay()
if validation.already_liked(heart):
heart.click()
def like_pic_in_feed(browser, number = 1):
loop = 1
wh... | [
"time_functions.time_delay",
"retrieve.like_button",
"validation.already_liked",
"retrieve.feed_like_buttons",
"selenium.webdriver.ActionChains"
] | [((153, 182), 'retrieve.like_button', 'retrieve.like_button', (['browser'], {}), '(browser)\n', (173, 182), False, 'import retrieve\n'), ((187, 199), 'time_functions.time_delay', 'time_delay', ([], {}), '()\n', (197, 199), False, 'from time_functions import time_delay\n'), ((207, 238), 'validation.already_liked', 'vali... |
from context import ascii_magic
try:
output = ascii_magic.from_url('https://wow.zamimg.com/uploads/blog/images/20516-afterlives-ardenweald-4k-desktop-wallpapers.jpg')
ascii_magic.to_terminal(output)
except OSError as e:
print(f'Could not load the image, server said: {e.code} {e.msg}') | [
"context.ascii_magic.to_terminal",
"context.ascii_magic.from_url"
] | [((48, 178), 'context.ascii_magic.from_url', 'ascii_magic.from_url', (['"""https://wow.zamimg.com/uploads/blog/images/20516-afterlives-ardenweald-4k-desktop-wallpapers.jpg"""'], {}), "(\n 'https://wow.zamimg.com/uploads/blog/images/20516-afterlives-ardenweald-4k-desktop-wallpapers.jpg'\n )\n", (68, 178), False, '... |
#!/usr/bin/env python3
"""
Apple EFI Package
Apple EFI Package Extractor
Copyright (C) 2019-2021 <NAME>
"""
print('Apple EFI Package Extractor v2.0_Linux_a1')
import os
import sys
import zlib
import shutil
import subprocess
if len(sys.argv) >= 2 :
pkg = sys.argv[1:]
else :
pkg = []
in_path = input('\nEnter the f... | [
"os.path.exists",
"os.makedirs",
"subprocess.run",
"os.path.join",
"os.path.splitext",
"os.getcwd",
"os.replace",
"os.path.dirname",
"shutil.copytree",
"os.path.basename",
"shutil.rmtree",
"os.path.abspath",
"os.system",
"shutil.unpack_archive",
"os.walk",
"os.remove"
] | [((527, 553), 'os.path.exists', 'os.path.exists', (['final_path'], {}), '(final_path)\n', (541, 553), False, 'import os\n'), ((389, 405), 'os.walk', 'os.walk', (['in_path'], {}), '(in_path)\n', (396, 405), False, 'import os\n'), ((499, 510), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (508, 510), False, 'import os\n'),... |
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that... | [
"os.path.exists",
"os.makedirs",
"os.path.join",
"os.path.dirname",
"os.path.abspath"
] | [((804, 819), 'os.path.dirname', 'p.dirname', (['here'], {}), '(here)\n', (813, 819), True, 'from os import path as p\n'), ((836, 874), 'os.path.join', 'p.join', (['here', '"""Fonts"""', '"""SourceCodePro"""'], {}), "(here, 'Fonts', 'SourceCodePro')\n", (842, 874), True, 'from os import path as p\n'), ((1476, 1509), 'o... |
# script for daily update
from bs4 import BeautifulSoup
# from urllib.request import urlopen
import requests
import csv
import time
from datetime import datetime, timedelta
import os
from pathlib import Path
from dashboard.models import Case, Country, District, State, Zone
def run():
scrapeStateStats()
def scrapeC... | [
"dashboard.models.Case.objects.get",
"pathlib.Path",
"datetime.datetime.strptime",
"time.strftime",
"os.path.join",
"csv.writer",
"requests.get",
"bs4.BeautifulSoup",
"dashboard.models.State.objects.get",
"dashboard.models.Zone",
"datetime.timedelta",
"csv.reader"
] | [((536, 561), 'requests.get', 'requests.get', (['country_url'], {}), '(country_url)\n', (548, 561), False, 'import requests\n'), ((578, 628), 'bs4.BeautifulSoup', 'BeautifulSoup', (['country_page.content', '"""html.parser"""'], {}), "(country_page.content, 'html.parser')\n", (591, 628), False, 'from bs4 import Beautifu... |
from django.urls import path
#from api.views import company_list, company_details, company_vacancies, vacancies_list, vacancy_detail
from api.views import company_list, company_details
urlpatterns = [
path('companies/', company_list),
path('companies/<int:company_id>/', company_details),
#path('companies/<... | [
"django.urls.path"
] | [((206, 238), 'django.urls.path', 'path', (['"""companies/"""', 'company_list'], {}), "('companies/', company_list)\n", (210, 238), False, 'from django.urls import path\n'), ((244, 296), 'django.urls.path', 'path', (['"""companies/<int:company_id>/"""', 'company_details'], {}), "('companies/<int:company_id>/', company_... |
from logging import getLogger
from lottery_config import LotteryConfig
from main import draw_lottery
logger = getLogger()
def test_draw_lottery():
for test_count in range(10000):
draw_results = draw_lottery()
logger.info(f'Test #{str(test_count).ljust(4)} Draw Results : {draw_results}')
... | [
"logging.getLogger",
"main.draw_lottery"
] | [((112, 123), 'logging.getLogger', 'getLogger', ([], {}), '()\n', (121, 123), False, 'from logging import getLogger\n'), ((210, 224), 'main.draw_lottery', 'draw_lottery', ([], {}), '()\n', (222, 224), False, 'from main import draw_lottery\n')] |
import requests
import io
import dask
from bs4 import BeautifulSoup as BS
import nltk
import pandas
import numpy as np
def News(ticker):
B = BS(requests.get(f"https://www.wsj.com/market-data/quotes/{ticker}", headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) ... | [
"requests.get",
"numpy.asarray",
"nltk.word_tokenize",
"pandas.read_csv"
] | [((504, 525), 'nltk.word_tokenize', 'nltk.word_tokenize', (['h'], {}), '(h)\n', (522, 525), False, 'import nltk\n'), ((578, 594), 'numpy.asarray', 'np.asarray', (['News'], {}), '(News)\n', (588, 594), True, 'import numpy as np\n'), ((150, 370), 'requests.get', 'requests.get', (['f"""https://www.wsj.com/market-data/quot... |
from pytest import raises
from glom import glom, Path, S, T, A, PathAccessError, GlomError, BadSpec
def test_list_path_access():
assert glom(list(range(10)), Path(1)) == 1
def test_path():
_obj = object()
target = {'a': {'b.b': [None, {_obj: [None, None, 'd']}]}}
assert glom(target, Path('a', 'b.b... | [
"glom.glom",
"glom.T.a",
"glom.A",
"pickle.dumps",
"glom.Path.from_text",
"glom.T.__",
"glom.T.func",
"glom.Path",
"glom.T.c",
"pytest.raises",
"glom.T",
"glom.T.copy",
"glom.T.attribute.method"
] | [((4219, 4232), 'glom.Path', 'Path', (['T.a.b.c'], {}), '(T.a.b.c)\n', (4223, 4232), False, 'from glom import glom, Path, S, T, A, PathAccessError, GlomError, BadSpec\n'), ((6223, 6234), 'glom.Path', 'Path', (['T.a.b'], {}), '(T.a.b)\n', (6227, 6234), False, 'from glom import glom, Path, S, T, A, PathAccessError, GlomE... |
from pygame import *
from random import randint
import json
#fonts and captions
font.init()
font1 = font.SysFont('Comic Sans', 60)
win = font1.render('Dam you actually poggers', True, (255, 255, 255))
lose = font1.render('Yeah you suck, you lost', True, (180, 0, 0))
font2 = font.SysFont('Comic Sans', 36)
ammo_lose ... | [
"json.load",
"random.randint",
"json.dump"
] | [((3315, 3327), 'json.load', 'json.load', (['f'], {}), '(f)\n', (3324, 3327), False, 'import json\n'), ((2939, 2966), 'random.randint', 'randint', (['(80)', '(win_width - 80)'], {}), '(80, win_width - 80)\n', (2946, 2966), False, 'from random import randint\n'), ((2981, 2994), 'random.randint', 'randint', (['(1)', '(5)... |
# Copyright (c) 2013 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to t... | [
"tank.platform.qt.QtCore.QUrl",
"tank.platform.restart",
"tank.platform.qt.QtGui.QWidget.__init__",
"os.system",
"tank.platform.qt.QtGui.QMessageBox.critical"
] | [((708, 736), 'tank.platform.qt.QtGui.QWidget.__init__', 'QtGui.QWidget.__init__', (['self'], {}), '(self)\n', (730, 736), False, 'from tank.platform.qt import QtCore, QtGui\n'), ((3428, 3437), 'tank.platform.restart', 'restart', ([], {}), '()\n', (3435, 3437), False, 'from tank.platform import restart\n'), ((3273, 332... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import re
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup, find_packages
# Backwards compatibility for Python 2.x
try:
from itertools import ifilter
filter = ifilter
except Impor... | [
"re.compile",
"os.path.join",
"distutils.core.find_packages",
"sys.exit",
"os.system"
] | [((563, 632), 're.compile', 're.compile', (['"""__version__\\\\s+=\\\\s+[\'\\\\"](\\\\d+.\\\\d+.\\\\d+\\\\w*)[\'\\\\"]$"""'], {}), '(\'__version__\\\\s+=\\\\s+[\\\'\\\\"](\\\\d+.\\\\d+.\\\\d+\\\\w*)[\\\'\\\\"]$\')\n', (573, 632), False, 'import re\n'), ((1100, 1141), 'os.system', 'os.system', (['"""python setup.py sdis... |
import os
from django.test import TransactionTestCase
from django.contrib.auth.models import Group
from django.conf import settings
from hs_core import hydroshare
from hs_core.models import BaseResource
from hs_core.hydroshare.utils import resource_file_add_process, resource_file_add_pre_process
from hs_core.views.ut... | [
"hs_file_types.models.GenericLogicalFile.set_file_type",
"hs_core.views.utils.create_folder",
"os.path.join",
"django.contrib.auth.models.Group.objects.get_or_create",
"hs_file_types.models.GenericLogicalFile.objects.count",
"hs_core.models.BaseResource.objects.count",
"hs_core.hydroshare.create_resourc... | [((703, 756), 'django.contrib.auth.models.Group.objects.get_or_create', 'Group.objects.get_or_create', ([], {'name': '"""Hydroshare Author"""'}), "(name='Hydroshare Author')\n", (730, 756), False, 'from django.contrib.auth.models import Group\n'), ((777, 940), 'hs_core.hydroshare.create_account', 'hydroshare.create_acc... |
# conftest.py
import pytest
import os
from myapp import create_app, create_contentful
from dotenv import load_dotenv
load_dotenv()
SPACE_ID = os.getenv("SPACE_ID")
DELIVERY_API_KEY = os.getenv("DELIVERY_API_KEY")
TESTING_ENV = "circle_testing"
@pytest.fixture
def app():
app = create_app(SPACE_ID, DELIVERY_API_K... | [
"myapp.create_app",
"myapp.create_contentful",
"os.getenv",
"dotenv.load_dotenv"
] | [((118, 131), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (129, 131), False, 'from dotenv import load_dotenv\n'), ((144, 165), 'os.getenv', 'os.getenv', (['"""SPACE_ID"""'], {}), "('SPACE_ID')\n", (153, 165), False, 'import os\n'), ((185, 214), 'os.getenv', 'os.getenv', (['"""DELIVERY_API_KEY"""'], {}), "('D... |
#!/usr/bin/python3.6
import sqlite3
def make_connect():
conn = sqlite3.connect("bot.db")
cursor = conn.cursor()
return conn, cursor
def create_tables():
conn, cursor = make_connect()
try:
cursor.execute("CREATE TABLE users(user_id INTEGER, bal FLOAT, count_games INTEGER, sum_games FLOAT, ref... | [
"sqlite3.connect"
] | [((67, 92), 'sqlite3.connect', 'sqlite3.connect', (['"""bot.db"""'], {}), "('bot.db')\n", (82, 92), False, 'import sqlite3\n')] |
# -*- coding: utf-8 -*-
"""
:copyright: Copyright 2020-2022 Sphinx Confluence Builder Contributors (AUTHORS)
:license: BSD-2-Clause (LICENSE)
"""
from tests.lib.testcase import ConfluenceTestCase
from tests.lib.testcase import setup_builder
from tests.lib import parse
import os
class TestConfluenceRstLists(Confluenc... | [
"os.path.join",
"tests.lib.parse",
"tests.lib.testcase.setup_builder"
] | [((553, 580), 'tests.lib.testcase.setup_builder', 'setup_builder', (['"""confluence"""'], {}), "('confluence')\n", (566, 580), False, 'from tests.lib.testcase import setup_builder\n'), ((453, 489), 'os.path.join', 'os.path.join', (['cls.datasets', '"""common"""'], {}), "(cls.datasets, 'common')\n", (465, 489), False, '... |
import os
os.system("pip install tqsdk -i https://pypi.tuna.tsinghua.edu.cn/simple")
os.system("pip install numba -i https://pypi.tuna.tsinghua.edu.cn/simple")
os.system("pip install janus -i https://pypi.tuna.tsinghua.edu.cn/simple")
os.system("pip install redis -i https://pypi.tuna.tsinghua.edu.cn/simple")
os... | [
"os.system"
] | [((14, 88), 'os.system', 'os.system', (['"""pip install tqsdk -i https://pypi.tuna.tsinghua.edu.cn/simple"""'], {}), "('pip install tqsdk -i https://pypi.tuna.tsinghua.edu.cn/simple')\n", (23, 88), False, 'import os\n'), ((90, 164), 'os.system', 'os.system', (['"""pip install numba -i https://pypi.tuna.tsinghua.edu.cn/... |
from __future__ import absolute_import, print_function, unicode_literals
import unittest
from doozerlib import distgit
class TestDistgitConvertSourceURLToHTTPS(unittest.TestCase):
def test_conversion_from_ssh_source(self):
source = "git@github.com:myorg/myproject.git"
actual = distgit.convert_so... | [
"unittest.main",
"doozerlib.distgit.convert_source_url_to_https"
] | [((1338, 1353), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1351, 1353), False, 'import unittest\n'), ((302, 345), 'doozerlib.distgit.convert_source_url_to_https', 'distgit.convert_source_url_to_https', (['source'], {}), '(source)\n', (337, 345), False, 'from doozerlib import distgit\n'), ((576, 619), 'doozerl... |
import requests
import ssl
from requests.adapters import HTTPAdapter, PoolManager
class MyAdapter(HTTPAdapter):
def init_poolmanager(self, connections, maxsize):
super(MyAdapter, self).__init__()
self.poolmanager = PoolManager(num_pools=connections, maxsize=maxsize, ssl_version=ssl.PROTOCOL_SSLv3)... | [
"requests.adapters.PoolManager",
"requests.Session"
] | [((327, 345), 'requests.Session', 'requests.Session', ([], {}), '()\n', (343, 345), False, 'import requests\n'), ((237, 325), 'requests.adapters.PoolManager', 'PoolManager', ([], {'num_pools': 'connections', 'maxsize': 'maxsize', 'ssl_version': 'ssl.PROTOCOL_SSLv3'}), '(num_pools=connections, maxsize=maxsize, ssl_versi... |
# Generated by Django 3.0.2 on 2020-04-29 20:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assessment', '0009_auto_20200426_1103'),
]
operations = [
migrations.AddField(
model_name='assessment',
name='open_s... | [
"django.db.models.BooleanField"
] | [((346, 407), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(True)', 'verbose_name': '"""open status"""'}), "(default=True, verbose_name='open status')\n", (365, 407), False, 'from django.db import migrations, models\n')] |
# -*- coding: utf-8 -*-
import json
import math
import random
import argparse
import networkx as nx
class Node:
def __init__ (self, nodeNumber, nodeType):
self.nodeNumber = nodeNumber
self.nodeType = nodeType
def add_vm (self, vm):
if not hasattr(self,'vms'):
self.vms = []
self.vms.append(vm)
class VM:... | [
"random.choice",
"argparse.ArgumentParser",
"networkx.is_connected",
"math.sqrt",
"networkx.get_node_attributes",
"networkx.waxman_graph",
"networkx.number_of_nodes",
"random.randint",
"json.dump"
] | [((2993, 3018), 'networkx.number_of_nodes', 'nx.number_of_nodes', (['graph'], {}), '(graph)\n', (3011, 3018), True, 'import networkx as nx\n'), ((4359, 4395), 'networkx.get_node_attributes', 'nx.get_node_attributes', (['graph', '"""pos"""'], {}), "(graph, 'pos')\n", (4381, 4395), True, 'import networkx as nx\n'), ((485... |
"""Simple Bot to reply to Telegram messages.
This is built on the API wrapper, see echobot2.py to see the same example built
on the telegram.ext bot framework.
This program is dedicated to the public domain under the CC0 license.
"""
import logging
import telegram
import requests, json
import traceback
from time import... | [
"logging.basicConfig",
"traceback.format_exc",
"data.enc_processing",
"tensorflow.estimator.Estimator",
"telegram.Bot",
"time.sleep",
"data.dec_target_processing",
"datetime.datetime.now",
"data.pred2string",
"data.eval_input_fn",
"data.load_vocabulary"
] | [((551, 571), 'telegram.Bot', 'telegram.Bot', (['"""auth"""'], {}), "('auth')\n", (563, 571), False, 'import telegram\n'), ((751, 771), 'telegram.Bot', 'telegram.Bot', (['"""auth"""'], {}), "('auth')\n", (763, 771), False, 'import telegram\n'), ((948, 971), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '(... |
"""
This module exports a Log class that wraps the logging python package
Uses the standard python logging utilities, just provides
nice formatting out of the box.
Usage:
from apertools.log import get_log
logger = get_log()
logger.info("Something happened")
logger.warning("Something concerning happe... | [
"logging.getLogger",
"logging.StreamHandler",
"logging.Formatter",
"functools.wraps",
"logging.addLevelName",
"time.time",
"colorlog.ColoredFormatter"
] | [((1136, 1159), 'logging.getLogger', 'logging.getLogger', (['name'], {}), '(name)\n', (1153, 1159), False, 'import logging\n'), ((1999, 2022), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (2020, 2022), False, 'import logging\n'), ((2116, 2164), 'logging.addLevelName', 'logging.addLevelName', (['l... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed u... | [
"unittest.mock.patch",
"django.urls.reverse"
] | [((717, 756), 'django.urls.reverse', 'reverse', (["(constants.URL_PREFIX + 'index')"], {}), "(constants.URL_PREFIX + 'index')\n", (724, 756), False, 'from django.urls import reverse\n'), ((775, 828), 'django.urls.reverse', 'reverse', (["(constants.URL_PREFIX + 'notification_create')"], {}), "(constants.URL_PREFIX + 'no... |
# Copyright (c) 2014 Evalf
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, s... | [
"ctypes.byref",
"ctypes.c_int32",
"treelog.info",
"treelog.withcontext",
"ctypes.c_void_p",
"ctypes.c_int"
] | [((6603, 6625), 'treelog.withcontext', 'log.withcontext', (['solve'], {}), '(solve)\n', (6618, 6625), True, 'import abc, sys, ctypes, treelog as log\n'), ((6521, 6580), 'treelog.info', 'log.info', (['"""skipping solver because initial vector is exact"""'], {}), "('skipping solver because initial vector is exact')\n", (... |
"""Plaza
Items (in particular, Things and Rooms) representing the setting of Lost One."""
__author__ = '<NAME>'
__copyright__ = 'Copyright 2011 <NAME>'
__license__ = 'ISC'
__version__ = '0.5.0.0'
__status__ = 'Development'
from item_model import Room, Thing
items = [
Room('@plaza_center',
article='the'... | [
"item_model.Thing",
"item_model.Room"
] | [((277, 1126), 'item_model.Room', 'Room', (['"""@plaza_center"""'], {'article': '"""the"""', 'called': '"""center of the plaza"""', 'referring': '"""center broad plaza of | plaza americas center middle"""', 'sight': '"""\n\n [*\'s] senses [hum/ing/2/v] as [*/s] [view/v] [@plaza_center/o]\n\n the morning [... |
from pathlib import Path
from typing import List
FILE_DIR = Path(__file__).parent
def create_boards(boards: List[str]) -> List[str]:
defined_boards = []
for board in boards:
b = board.split('\n')
d_board = [db.split() for db in b]
defined_boards.append(d_board)
return defined_boar... | [
"pathlib.Path"
] | [((61, 75), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (65, 75), False, 'from pathlib import Path\n')] |
from flask import Flask, render_template, jsonify
import random as r
import csv
app = Flask(__name__)
# define global words dictionary
words = {}
words["easy"] = []
words["medium"] = []
words["hard"] = []
# load words (russian and english)
with open('words.csv', newline='\n', encoding="UTF8") as csvfile:
wordrea... | [
"flask.render_template",
"random.shuffle",
"flask.Flask",
"csv.reader",
"flask.jsonify"
] | [((87, 102), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (92, 102), False, 'from flask import Flask, render_template, jsonify\n'), ((326, 360), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': '""";"""'}), "(csvfile, delimiter=';')\n", (336, 360), False, 'import csv\n'), ((1122, 1166), 'flask.ren... |
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='cexpay',
version='2.0.4',
description="A support bot for CEX Pay's products. See more https://developers.cexpay.io/.",
long_description=long_description,
long_description_co... | [
"setuptools.find_packages"
] | [((495, 528), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['*test*']"}), "(exclude=['*test*'])\n", (508, 528), False, 'from setuptools import setup, find_packages\n')] |
# -*- coding:utf-8 -*-
# --------------------------------------------------------
# Copyright (C), 2016-2020, lizhe, All rights reserved
# --------------------------------------------------------
# @Name: serial_actions.py
# @Author: lizhe
# @Created: 2021/5/2 - 0:02
# ----------------------------------... | [
"automotive.utils.serial_utils.SerialUtils",
"automotive.logger.logger.logger.warning",
"automotive.logger.logger.logger.debug",
"automotive.logger.logger.logger.info"
] | [((730, 743), 'automotive.utils.serial_utils.SerialUtils', 'SerialUtils', ([], {}), '()\n', (741, 743), False, 'from automotive.utils.serial_utils import SerialUtils\n'), ((954, 974), 'automotive.logger.logger.logger.info', 'logger.info', (['"""初始化串口"""'], {}), "('初始化串口')\n", (965, 974), False, 'from automotive.logger.... |
import xml.etree.ElementTree as ElementTree
import os
class CARISObject:
"""A generic CARIS object with a name"""
def __init__(self):
"""Initialize with empty name"""
self.name = ''
def __init__(self, name):
"""Initialize with a name provided"""
self.name = name
def ... | [
"xml.etree.ElementTree.parse"
] | [((4451, 4478), 'xml.etree.ElementTree.parse', 'ElementTree.parse', (['log_path'], {}), '(log_path)\n', (4468, 4478), True, 'import xml.etree.ElementTree as ElementTree\n')] |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404
from .models import BlogPost
from .forms import BlogPostModelForm
# render intial html page of list of published blogs
def blog_post_list_view(request):
qs = BlogPost.objects.all().published() # queryse... | [
"django.shortcuts.render",
"django.shortcuts.get_object_or_404"
] | [((526, 568), 'django.shortcuts.render', 'render', (['request', '"""blog/list.html"""', 'context'], {}), "(request, 'blog/list.html', context)\n", (532, 568), False, 'from django.shortcuts import render, get_object_or_404\n'), ((906, 948), 'django.shortcuts.render', 'render', (['request', '"""blog/form.html"""', 'conte... |
from PyQt5.QtCore import QTimer, QTime
from PyQt5 import QtGui, QtWidgets
import time
import random
import os
import datetime
import requests
import sqlite3 as sql
import database_impl as db
from date_tools import dt
def datetime_diff(old_datetime, new_datetime, dates_are_strings=True):
"""
String dates shoul... | [
"requests.post",
"PyQt5.QtGui.QIcon",
"sqlite3.connect",
"database_impl.select_stop_session_status",
"datetime.datetime.strptime",
"PyQt5.QtCore.QTime.currentTime",
"database_impl.drop_table",
"PyQt5.QtCore.QTimer",
"database_impl.insert_timestamp_livetrade",
"database_impl.get_timestamps_from_liv... | [((441, 502), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['old_datetime', '"""%Y-%m-%d %H:%M:%S"""'], {}), "(old_datetime, '%Y-%m-%d %H:%M:%S')\n", (467, 502), False, 'import datetime\n'), ((516, 577), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['new_datetime', '"""%Y-%m-%d %H:%M:%S"... |
from abc import ABCMeta, abstractmethod
from functools import partial
from typing import Tuple, Union
import numexpr
import numpy as np
from scipy import sparse, special
from tabmat import MatrixBase, StandardizedMatrix
from ._functions import (
binomial_logit_eta_mu_deviance,
binomial_logit_rowwise_gradient_... | [
"numpy.clip",
"scipy.special.xlogy",
"numpy.less_equal",
"numpy.log",
"numpy.asanyarray",
"numpy.array",
"numpy.isfinite",
"numpy.greater_equal",
"numpy.multiply",
"numpy.less",
"numpy.greater",
"numpy.isscalar",
"numpy.exp",
"numpy.dot",
"numpy.maximum",
"numpy.arctan",
"numpy.abs",... | [((34790, 34826), 'numpy.average', 'np.average', (['y'], {'weights': 'sample_weight'}), '(y, weights=sample_weight)\n', (34800, 34826), True, 'import numpy as np\n'), ((10487, 10509), 'numpy.empty_like', 'np.empty_like', (['cur_eta'], {}), '(cur_eta)\n', (10500, 10509), True, 'import numpy as np\n'), ((10527, 10549), '... |
import math
import pandas as pd
data = pd.read_csv("works.csv").dropna()
count_people = 0
for (jobTitle, qualification) in zip(data['jobTitle'], data['qualification']):
if jobTitle != qualification:
count_people += 1
print(f"У {count_people} человек профессия и должность не совпадают")
meneger... | [
"pandas.read_csv"
] | [((43, 67), 'pandas.read_csv', 'pd.read_csv', (['"""works.csv"""'], {}), "('works.csv')\n", (54, 67), True, 'import pandas as pd\n')] |
from decimal import Decimal
from unittest.mock import patch
from django.test import TestCase
from django.urls import reverse
from django.contrib import auth
from main.models import Product, User, Address
from main.forms import UserCreationForm
class TestPage(TestCase):
def test_home_page_works(self):
re... | [
"django.contrib.auth.get_user",
"main.models.Address.objects.create",
"django.urls.reverse",
"main.models.User.objects.create_user",
"main.models.User.objects.filter",
"main.models.Address.objects.filter",
"main.models.Product.objects.active",
"unittest.mock.patch.object",
"decimal.Decimal"
] | [((3529, 3576), 'main.models.User.objects.create_user', 'User.objects.create_user', (['"""user1"""', '"""<PASSWORD>"""'], {}), "('user1', '<PASSWORD>')\n", (3553, 3576), False, 'from main.models import Product, User, Address\n'), ((3593, 3640), 'main.models.User.objects.create_user', 'User.objects.create_user', (['"""u... |
# coding=utf-8
"""
Django settings for reservas project.
Generated by 'django-admin startproject' using Django 1.8.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
... | [
"os.path.join",
"random.SystemRandom",
"os.environ.get",
"os.path.abspath"
] | [((3227, 3266), 'os.environ.get', 'os.environ.get', (['"""DJANGO_URL_PREFIX"""', '""""""'], {}), "('DJANGO_URL_PREFIX', '')\n", (3241, 3266), False, 'import os\n'), ((3753, 3790), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""staticfiles"""'], {}), "(BASE_DIR, 'staticfiles')\n", (3765, 3790), False, 'import os\n'),... |
#!/usr/bin/env python
import collections
# import itertools
import numpy as np
# from sklearn import linear_model as linear # for VAR
# from .utils import sliding_window as window
# from .utils.distance import kmeans, dists_sq
# from .utils import distance as dist
# from python import compress
# ===============... | [
"numpy.mean",
"numpy.median",
"numpy.argmax",
"numpy.argsort",
"numpy.array",
"numpy.zeros",
"collections.Counter",
"numpy.empty",
"numpy.sum",
"numpy.sign"
] | [((3011, 3025), 'numpy.array', 'np.array', (['keys'], {}), '(keys)\n', (3019, 3025), True, 'import numpy as np\n'), ((3039, 3055), 'numpy.array', 'np.array', (['coeffs'], {}), '(coeffs)\n', (3047, 3055), True, 'import numpy as np\n'), ((3068, 3086), 'numpy.argsort', 'np.argsort', (['coeffs'], {}), '(coeffs)\n', (3078, ... |
from app.factory import create_app, celery_app
app = create_app(config_name="DEVELOPMENT")
app.app_context().push()
if __name__ == "__main__":
app.run()
| [
"app.factory.create_app"
] | [((54, 91), 'app.factory.create_app', 'create_app', ([], {'config_name': '"""DEVELOPMENT"""'}), "(config_name='DEVELOPMENT')\n", (64, 91), False, 'from app.factory import create_app, celery_app\n')] |
'''
pyburstlib
:author: drownedcoast
:date: 4-26-2018
'''
import pytest
from pyburstlib.wallet_api.models.mining import *
from tests.base import BaseTest
from tests.config import PyBurstLibConfig
@pytest.mark.api
class TestMiningApi(BaseTest):
def setup(self):
self.TEST_ACCOUNT_NUMERIC = PyBurstLibConfig.... | [
"tests.config.PyBurstLibConfig.get"
] | [((303, 337), 'tests.config.PyBurstLibConfig.get', 'PyBurstLibConfig.get', (['"""account_id"""'], {}), "('account_id')\n", (323, 337), False, 'from tests.config import PyBurstLibConfig\n'), ((374, 413), 'tests.config.PyBurstLibConfig.get', 'PyBurstLibConfig.get', (['"""account_address"""'], {}), "('account_address')\n"... |
# This process handles all the requests in the queue task_queue and updates database
import json, pika, sys, time
from database_management import manage_database, submission_management
class core():
data_changed_flags = ''
task_queue = ''
channel = ''
file_password = ''
unicast_exchange = 'connection_manager'
... | [
"json.loads",
"database_management.manage_database.initialize_database",
"time.sleep",
"sys.exc_info",
"database_management.manage_database.close_db",
"sys.exit",
"database_management.submission_management.update_record",
"database_management.submission_management.get_count",
"database_management.su... | [((600, 637), 'database_management.manage_database.initialize_database', 'manage_database.initialize_database', ([], {}), '()\n', (635, 637), False, 'from database_management import manage_database, submission_management\n'), ((1135, 1161), 'database_management.manage_database.close_db', 'manage_database.close_db', ([]... |
''' buildings and built environment '''
from datetime import datetime
import random
import tracery
from utilities import format_text, get_latin
def eatery(name, dish, category, data):
''' a charming stone hut where they serve tea '''
earliest = data['founded'] if data['founded'] > 1700 else 1700
founding =... | [
"utilities.get_latin",
"random.choice",
"utilities.format_text",
"datetime.datetime.now",
"tracery.Grammar"
] | [((5854, 5876), 'tracery.Grammar', 'tracery.Grammar', (['rules'], {}), '(rules)\n', (5869, 5876), False, 'import tracery\n'), ((5931, 5952), 'utilities.format_text', 'format_text', (['sentence'], {}), '(sentence)\n', (5942, 5952), False, 'from utilities import format_text, get_latin\n'), ((3606, 3651), 'utilities.get_l... |
import os
import tarfile
import textwrap
from pathlib import Path
import setuptools
from wheel.wheelfile import WheelFile
from setuptools_build_subpackage import Distribution
ROOT = Path(__file__).parent.parent
def build_dist(folder, command, output, *args):
args = [
'--subpackage-folder',
fold... | [
"textwrap.dedent",
"tarfile.open",
"pathlib.Path",
"setuptools.setup",
"os.getcwd",
"os.chdir",
"wheel.wheelfile.WheelFile"
] | [((444, 455), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (453, 455), False, 'import os\n'), ((460, 479), 'os.chdir', 'os.chdir', (['"""example"""'], {}), "('example')\n", (468, 479), False, 'import os\n'), ((185, 199), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (189, 199), False, 'from pathlib import ... |
import matplotlib.pyplot as plt
import matplotlib.gridspec as gs
import numpy as np
import pandas as pd
import csv
from matplotlib.lines import Line2D
epsilon = pd.read_pickle('epsilon.pkl')
def plots_with_sizes(result_folder, query, attribute):
if attribute == 'age':
d = 1
if attribute == '... | [
"pandas.read_pickle",
"matplotlib.pyplot.gcf",
"matplotlib.gridspec.GridSpec",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show"
] | [((161, 190), 'pandas.read_pickle', 'pd.read_pickle', (['"""epsilon.pkl"""'], {}), "('epsilon.pkl')\n", (175, 190), True, 'import pandas as pd\n'), ((2777, 2806), 'matplotlib.gridspec.GridSpec', 'gs.GridSpec', ([], {'nrows': '(1)', 'ncols': '(2)'}), '(nrows=1, ncols=2)\n', (2788, 2806), True, 'import matplotlib.gridspe... |
from django.db import models
from ozpcenter.utils import get_now_utc
from .import_task import ImportTask
class ImportTaskResultManager(models.Manager):
def get_queryset(self):
return super().get_queryset()
def find_all(self):
return self.all()
def find_by_id(self, id):
return s... | [
"django.db.models.DateTimeField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((1123, 1176), 'django.db.models.ForeignKey', 'models.ForeignKey', (['ImportTask'], {'related_name': '"""results"""'}), "(ImportTask, related_name='results')\n", (1140, 1176), False, 'from django.db import models\n'), ((1192, 1233), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'default': 'get_now_ut... |
"""
Loading utilities for computational experiments.
"""
import os
import pandas as pd
DATA_DIR = os.path.dirname(os.path.abspath(__file__))
def load_zT(all_data=False):
"""
Thermoelectric figures of merit for 165 experimentally measured compounds.
Obtained from the Citrination database maintained by C... | [
"os.path.abspath",
"os.path.join",
"pandas.read_csv"
] | [((116, 141), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (131, 141), False, 'import os\n'), ((1137, 1185), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""zT-citrination-165.csv"""'], {}), "(DATA_DIR, 'zT-citrination-165.csv')\n", (1149, 1185), False, 'import os\n'), ((1195, 1228), 'pan... |
import json
def get_qtypes(dataset_name, part):
"""Return list of question-types for a particular TriviaQA-CP dataset"""
if dataset_name not in {"location", "person"}:
raise ValueError("Unknown dataset %s" % dataset_name)
if part not in {"train", "dev", "test"}:
raise ValueError("Unknown part %s" % par... | [
"json.load"
] | [((1317, 1329), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1326, 1329), False, 'import json\n')] |
import datetime
import pytz
from tws_async import *
stocks = [
Stock('TSLA'),
Stock('AAPL'),
Stock('GOOG'),
Stock('INTC', primaryExchange='NASDAQ')
]
forexs = [
Forex('EURUSD'),
Forex('GBPUSD'),
Forex('USDJPY')
]
endDate = datetime.date.today()
startDate = endDate - datetime.timedelta(day... | [
"datetime.date.today",
"datetime.timedelta"
] | [((254, 275), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (273, 275), False, 'import datetime\n'), ((298, 324), 'datetime.timedelta', 'datetime.timedelta', ([], {'days': '(7)'}), '(days=7)\n', (316, 324), False, 'import datetime\n')] |
"""cff2Lib_test.py -- unit test for Adobe CFF fonts."""
from fontTools.ttLib import TTFont
from io import StringIO
import re
import os
import unittest
CURR_DIR = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
DATA_DIR = os.path.join(CURR_DIR, 'data')
CFF_TTX = os.path.join(DATA_DIR, "C_F_F__2.ttx")
CF... | [
"os.path.join",
"os.path.realpath",
"unittest.main",
"re.sub",
"io.StringIO",
"fontTools.ttLib.TTFont"
] | [((237, 267), 'os.path.join', 'os.path.join', (['CURR_DIR', '"""data"""'], {}), "(CURR_DIR, 'data')\n", (249, 267), False, 'import os\n'), ((279, 317), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""C_F_F__2.ttx"""'], {}), "(DATA_DIR, 'C_F_F__2.ttx')\n", (291, 317), False, 'import os\n'), ((328, 366), 'os.path.join'... |
import logging
import threading
import time
from pajbot.managers.db import DBManager
from pajbot.managers.schedule import ScheduleManager
from pajbot.models.songrequest import SongrequestQueue, SongrequestHistory, SongRequestSongInfo
from pajbot.models.user import User
log = logging.getLogger("pajbot")
WIDGET_ID = ... | [
"logging.getLogger",
"pajbot.models.songrequest.SongrequestQueue._get_current_song",
"pajbot.models.songrequest.SongrequestHistory._get_history",
"pajbot.models.songrequest.SongrequestHistory._insert_previous",
"pajbot.models.songrequest.SongrequestQueue._get_next_queue",
"pajbot.managers.db.DBManager.cre... | [((279, 306), 'logging.getLogger', 'logging.getLogger', (['"""pajbot"""'], {}), "('pajbot')\n", (296, 306), False, 'import logging\n'), ((1216, 1275), 'threading.Thread', 'threading.Thread', ([], {'target': 'self.inc_current_song', 'daemon': '(True)'}), '(target=self.inc_current_song, daemon=True)\n', (1232, 1275), Fal... |
import numpy as np
def mean_or_nan(xs):
"""Return its mean a non-empty sequence, numpy.nan for a empty one."""
return np.mean(xs) if xs else np.nan | [
"numpy.mean"
] | [((128, 139), 'numpy.mean', 'np.mean', (['xs'], {}), '(xs)\n', (135, 139), True, 'import numpy as np\n')] |
import time
import unittest
import unittest.mock
from smac.configspace import ConfigurationSpace
from smac.runhistory.runhistory import RunInfo, RunValue
from smac.scenario.scenario import Scenario
from smac.stats.stats import Stats
from smac.tae import StatusType
from smac.tae.execute_func import ExecuteTAFuncDict
fr... | [
"smac.stats.stats.Stats",
"smac.configspace.ConfigurationSpace",
"smac.runhistory.runhistory.RunInfo",
"smac.tae.execute_func.ExecuteTAFuncDict",
"time.sleep",
"smac.scenario.scenario.Scenario",
"unittest.main",
"time.time"
] | [((499, 512), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (509, 512), False, 'import time\n'), ((3049, 3064), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3062, 3064), False, 'import unittest\n'), ((653, 673), 'smac.configspace.ConfigurationSpace', 'ConfigurationSpace', ([], {}), '()\n', (671, 673), Fal... |
"""Tests rest of functions in manubot.cite, not covered by test_citekey_api.py."""
import pytest
from manubot.cite.citekey import (
citekey_pattern,
shorten_citekey,
infer_citekey_prefix,
inspect_citekey,
)
@pytest.mark.parametrize("citation_string", [
('@doi:10.5061/dryad.q447c/1'),
('@arxi... | [
"manubot.cite.citekey.infer_citekey_prefix",
"manubot.cite.citekey.citekey_pattern.fullmatch",
"pytest.mark.parametrize",
"manubot.cite.citekey.inspect_citekey",
"manubot.cite.citekey.shorten_citekey"
] | [((228, 515), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""citation_string"""', "['@doi:10.5061/dryad.q447c/1', '@arxiv:1407.3561v1',\n '@doi:10.1007/978-94-015-6859-3_4', '@tag:tag_with_underscores',\n '@tag:tag-with-hyphens',\n '@url:https://greenelab.github.io/manubot-rootstock/', '@tag:abc12... |
import pytest
from playwright.sync_api import Page
from pages.main_page.main_page import MainPage
from test.test_base import *
import logging
import re
logger = logging.getLogger("test")
@pytest.mark.only_browser("chromium")
def test_find_element_list(page: Page):
main_page = MainPage(base_url, page)
main_pa... | [
"logging.getLogger",
"pytest.mark.only_browser",
"pages.main_page.main_page.MainPage",
"re.compile"
] | [((162, 187), 'logging.getLogger', 'logging.getLogger', (['"""test"""'], {}), "('test')\n", (179, 187), False, 'import logging\n'), ((191, 227), 'pytest.mark.only_browser', 'pytest.mark.only_browser', (['"""chromium"""'], {}), "('chromium')\n", (215, 227), False, 'import pytest\n'), ((284, 308), 'pages.main_page.main_p... |
### based on https://github.com/kylemcdonald/Parametric-t-SNE/blob/master/Parametric%20t-SNE%20(Keras).ipynb
import numpy as np
from tensorflow.keras import backend as K
from tensorflow.keras.losses import categorical_crossentropy
from tqdm.autonotebook import tqdm
import tensorflow as tf
def Hbeta(D, beta):
""... | [
"tensorflow.math.pow",
"numpy.sqrt",
"tensorflow.transpose",
"tensorflow.math.log",
"numpy.log",
"numpy.arange",
"numpy.multiply",
"numpy.exp",
"numpy.isinf",
"numpy.eye",
"numpy.ones",
"tensorflow.keras.backend.reshape",
"numpy.square",
"tensorflow.math.maximum",
"numpy.isnan",
"numpy... | [((532, 549), 'numpy.exp', 'np.exp', (['(-D * beta)'], {}), '(-D * beta)\n', (538, 549), True, 'import numpy as np\n'), ((561, 570), 'numpy.sum', 'np.sum', (['P'], {}), '(P)\n', (567, 570), True, 'import numpy as np\n'), ((1437, 1453), 'numpy.zeros', 'np.zeros', (['(n, n)'], {}), '((n, n))\n', (1445, 1453), True, 'impo... |
import random
import string
def test_append(lst):
ret_val = []
for w in lst:
ret_val.append(w.lower( ))
return ret_val
def test_map(lst):
ret_val = map(str.lower, lst)
return ret_val
def run_tests(n):
for i in range(n):
tst = ''.join(random.choices(string.ascii_uppercase + str... | [
"random.choices"
] | [((277, 339), 'random.choices', 'random.choices', (['(string.ascii_uppercase + string.digits)'], {'k': '(1000)'}), '(string.ascii_uppercase + string.digits, k=1000)\n', (291, 339), False, 'import random\n')] |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 26 20:17:06 2014
@author: stuart
"""
import os
import tempfile
import datetime
import astropy.table
import astropy.time
import astropy.units as u
import pytest
from sunpy.time import parse_time
from sunpy.net.jsoc import JSOCClient, JSOCResponse
from sunpy.net.vso.vso im... | [
"datetime.datetime",
"sunpy.net.jsoc.attrs.Series",
"sunpy.net.jsoc.attrs.Notify",
"pytest.mark.online",
"sunpy.net.jsoc.attrs.Sample",
"tempfile.mkdtemp",
"pytest.raises",
"os.path.basename",
"sunpy.time.parse_time",
"sunpy.net.jsoc.attrs.Wavelength",
"sunpy.net.jsoc.JSOCClient",
"sunpy.net.j... | [((380, 392), 'sunpy.net.jsoc.JSOCClient', 'JSOCClient', ([], {}), '()\n', (390, 392), False, 'from sunpy.net.jsoc import JSOCClient, JSOCResponse\n'), ((5848, 5868), 'pytest.mark.online', 'pytest.mark.online', ([], {}), '()\n', (5866, 5868), False, 'import pytest\n'), ((807, 831), 'sunpy.net.jsoc.JSOCResponse', 'JSOCR... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Compare to numpy data"""
import sys
import numpy as np
import multipletau
from test_correlate import get_sample_arrays_cplx
def test_corresponds_ac():
myframe = sys._getframe()
myname = myframe.f_code.co_name
print("running ", myname)
a = np.concatenate... | [
"multipletau.correlate_numpy",
"numpy.allclose",
"numpy.average",
"numpy.where",
"sys._getframe",
"numpy.array",
"multipletau.correlate",
"numpy.concatenate",
"test_correlate.get_sample_arrays_cplx",
"multipletau.autocorrelate"
] | [((215, 230), 'sys._getframe', 'sys._getframe', ([], {}), '()\n', (228, 230), False, 'import sys\n'), ((377, 465), 'multipletau.autocorrelate', 'multipletau.autocorrelate', ([], {'a': '(1 * a)', 'm': 'm', 'copy': '(True)', 'normalize': '(True)', 'dtype': 'np.float_'}), '(a=1 * a, m=m, copy=True, normalize=True, dtype=n... |
# Copyright 2020 The FedLearner Authors. 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 applica... | [
"logging.getLogger",
"data.data_block_queue.DataBlockQueue",
"argparse.ArgumentParser",
"data.data_source_reader.DataSourceReader"
] | [((1680, 1733), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""leader trainer master cmd."""'], {}), "('leader trainer master cmd.')\n", (1703, 1733), False, 'import argparse\n'), ((2416, 2483), 'data.data_source_reader.DataSourceReader', 'DataSourceReader', (['FLAGS.data_path', 'FLAGS.start_date', 'FLAGS.... |
from pathlib import Path
from typing import Optional
import numpy as np
import pandas as pd
from nilearn.datasets.utils import _fetch_files
from scipy import sparse
class StudyID(str):
pass
class TfIDf(float):
pass
NS_DATA_URL = "https://github.com/neurosynth/neurosynth-data/raw/master/"
def fetch_stud... | [
"numpy.hstack",
"scipy.sparse.load_npz",
"numpy.array",
"pandas.concat",
"nilearn.datasets.utils._fetch_files",
"pandas.read_table",
"numpy.genfromtxt"
] | [((1891, 1919), 'pandas.read_table', 'pd.read_table', (['metadata_file'], {}), '(metadata_file)\n', (1904, 1919), True, 'import pandas as pd\n'), ((3386, 3480), 'nilearn.datasets.utils._fetch_files', '_fetch_files', (['data_dir', '[(fn, NS_DATA_URL + fn, {}) for fn in file_names]'], {'verbose': 'verbose'}), '(data_dir,... |
from typing import Any
from typing import Generic
from typing import overload
from typing import Type
from typing import TypeVar
from . import compat
if compat.py38:
from typing import Literal
from typing import Protocol
from typing import TypedDict
else:
from typing_extensions import Literal # noqa
... | [
"typing.TypeVar"
] | [((552, 565), 'typing.TypeVar', 'TypeVar', (['"""_T"""'], {}), "('_T')\n", (559, 565), False, 'from typing import TypeVar\n')] |
# Created by <NAME>.
import sys
import numpy as np
sys.path.append('../')
from envs import GridWorld
from itertools import product
from utils import print_episode, eps_greedy_policy, test_policy
'''
n-step Tree Backup used to estimate the optimal policy for
the gridworld environment defined on page 48 of
"Reinforcemen... | [
"utils.test_policy",
"utils.print_episode",
"numpy.argmax",
"envs.GridWorld",
"numpy.zeros",
"sys.path.append",
"utils.eps_greedy_policy"
] | [((51, 73), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (66, 73), False, 'import sys\n'), ((1122, 1133), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (1130, 1133), True, 'import numpy as np\n'), ((1148, 1159), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (1156, 1159), True, 'import n... |
#!/usr/bin/env python3
import functools
#https://stackoverflow.com/questions/3888158
def optional_arg_decorator(fn):
@functools.wraps(fn)
def wrapped_decorator(*args, **kwargs):
# is_bound_method = hasattr(args[0], fn.__name__) if args else False
# if is_bound_method:
# klass = args[... | [
"functools.wraps"
] | [((124, 143), 'functools.wraps', 'functools.wraps', (['fn'], {}), '(fn)\n', (139, 143), False, 'import functools\n')] |
from setuptools import setup
from homeassistant_api import __version__
with open("README.md", "r") as f:
read = f.read()
setup(
name="HomeAssistant API",
url="https://github.com/GrandMoff100/HomeassistantAPI",
description="Python Wrapper for Homeassistant's REST API",
version=__version__,
keyw... | [
"setuptools.setup"
] | [((127, 1396), 'setuptools.setup', 'setup', ([], {'name': '"""HomeAssistant API"""', 'url': '"""https://github.com/GrandMoff100/HomeassistantAPI"""', 'description': '"""Python Wrapper for Homeassistant\'s REST API"""', 'version': '__version__', 'keywords': "['homeassistant', 'api', 'wrapper', 'client']", 'author': '"""... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 14 13:33:17 2020
@Author: <NAME>, <NAME>
@Institution: CBDD Group, Xiangya School of Pharmaceutical Science, CSU, China
@Homepage: http://www.scbdd.com
@Mail: <EMAIL>; <EMAIL>
@Blog: https://blog.iamkotori.com
♥I love Princess Zelda forever♥
"""
from multiprocessing imp... | [
"json.loads",
"requests.Session",
"pandas.read_csv",
"os.chdir",
"lxml.etree.HTML",
"multiprocessing.Pool",
"xml.etree.ElementTree.fromstring"
] | [((439, 451), 'os.chdir', 'os.chdir', (['""""""'], {}), "('')\n", (447, 451), False, 'import os\n'), ((4520, 4547), 'pandas.read_csv', 'pd.read_csv', (['"""pro_info.csv"""'], {}), "('pro_info.csv')\n", (4531, 4547), True, 'import pandas as pd\n'), ((4592, 4598), 'multiprocessing.Pool', 'Pool', ([], {}), '()\n', (4596, ... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# It's written by https://github.com/yumatsuoka
from __future__ import print_function
import math
from torch.optim.lr_scheduler import _LRScheduler
class FlatplusAnneal(_LRScheduler):
def __init__(self, optimizer, max_iter, step_size=0.7, eta_min=0, last_epoch=-1):... | [
"math.cos",
"torch.nn.Linear"
] | [((1711, 1733), 'torch.nn.Linear', 'torch.nn.Linear', (['(10)', '(2)'], {}), '(10, 2)\n', (1726, 1733), False, 'import torch\n'), ((828, 871), 'math.cos', 'math.cos', (['(math.pi * (cr_epoch / self.T_max))'], {}), '(math.pi * (cr_epoch / self.T_max))\n', (836, 871), False, 'import math\n')] |
"""Git helper functions.
Everything in here should be project agnostic, shouldn't rely on project's structure,
and make any assumptions about the passed arguments or calls outcomes.
"""
import subprocess
def apply(repo, patch_path, reverse=False):
args = ['git', 'apply',
'--directory', repo,
'... | [
"subprocess.call"
] | [((507, 528), 'subprocess.call', 'subprocess.call', (['args'], {}), '(args)\n', (522, 528), False, 'import subprocess\n')] |
import sys
import os
import timeit
# use local python package rather than the system install
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../python"))
from bitboost import BitBoostRegressor
import numpy as np
import sklearn.metrics
nfeatures = 5
nexamples = 10000
data = np.random.choice(np.array([0.0,... | [
"os.path.dirname",
"numpy.array",
"bitboost.BitBoostRegressor"
] | [((719, 738), 'bitboost.BitBoostRegressor', 'BitBoostRegressor', ([], {}), '()\n', (736, 738), False, 'from bitboost import BitBoostRegressor\n'), ((306, 361), 'numpy.array', 'np.array', (['[0.0, 1.0, 2.0]'], {'dtype': 'BitBoostRegressor.numt'}), '([0.0, 1.0, 2.0], dtype=BitBoostRegressor.numt)\n', (314, 361), True, 'i... |
import unittest
import os
import logging
import time
import re
import splunklib.client as client
import splunklib.results as results
from splunklib.binding import HTTPError
from . import dltk_api
from . import splunk_api
from . import dltk_environment
level_prog = re.compile(r'level=\"([^\"]*)\"')
msg_prog = re.comp... | [
"logging.warning",
"logging.info",
"logging.error",
"re.compile"
] | [((268, 303), 're.compile', 're.compile', (['"""level=\\\\"([^\\\\"]*)\\\\\\""""'], {}), '(\'level=\\\\"([^\\\\"]*)\\\\"\')\n', (278, 303), False, 'import re\n'), ((313, 349), 're.compile', 're.compile', (['"""msg=\\\\"((?:\\\\n|.)*)\\\\\\""""'], {}), '(\'msg=\\\\"((?:\\\\n|.)*)\\\\"\')\n', (323, 349), False, 'import r... |
from pydc import DC
def main():
dc = DC("example_dc.pl", 200) #default is 0 sample (will produce nan if later on no n_samples provided)
prob1 = dc.query("drawn(1)~=1")
print(prob1)
prob2 = dc.query("drawn(1)~=1", n_samples=2000)
print(prob2)
if __name__ == "__main__":
main()
| [
"pydc.DC"
] | [((42, 66), 'pydc.DC', 'DC', (['"""example_dc.pl"""', '(200)'], {}), "('example_dc.pl', 200)\n", (44, 66), False, 'from pydc import DC\n')] |
from pymongo import MongoClient
def path():
client = MongoClient('mongodb://localhost:27017/')
db = client['UserBook']
return db
| [
"pymongo.MongoClient"
] | [((59, 100), 'pymongo.MongoClient', 'MongoClient', (['"""mongodb://localhost:27017/"""'], {}), "('mongodb://localhost:27017/')\n", (70, 100), False, 'from pymongo import MongoClient\n')] |
import os
from ..utils.log import log
from ..utils.yaml import read_yaml, write_yaml
class BaseSpec:
COMPONENTS = 'components'
REF_FIELD = '$ref'
def __init__(self, path,
read_func=read_yaml, write_func=write_yaml):
self.path = path
self.path_dir = os.path.dirname(path... | [
"os.path.dirname",
"os.path.join",
"os.path.basename"
] | [((300, 321), 'os.path.dirname', 'os.path.dirname', (['path'], {}), '(path)\n', (315, 321), False, 'import os\n'), ((2198, 2235), 'os.path.join', 'os.path.join', (['self.path_dir', 'filename'], {}), '(self.path_dir, filename)\n', (2210, 2235), False, 'import os\n'), ((1264, 1291), 'os.path.basename', 'os.path.basename'... |
import os
import numpy as np
from six.moves import cPickle
from tensorflow import keras
from tensorflow import keras
import helper
from tfomics import utils, metrics, explain
#------------------------------------------------------------------------
model_names = ['residualbind']
activations = ['exponential', 'relu']... | [
"helper.get_callbacks",
"helper.load_data",
"numpy.where",
"six.moves.cPickle.dump",
"os.path.join",
"helper.load_model",
"tfomics.explain.saliency",
"helper.compile_model",
"tensorflow.keras.backend.clear_session",
"tfomics.utils.make_directory",
"tfomics.metrics.calculate_metrics"
] | [((338, 381), 'tfomics.utils.make_directory', 'utils.make_directory', (['"""../results"""', '"""task6"""'], {}), "('../results', 'task6')\n", (358, 381), False, 'from tfomics import utils, metrics, explain\n'), ((396, 446), 'tfomics.utils.make_directory', 'utils.make_directory', (['results_path', '"""model_params"""'],... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 21 14:15:38 2019
@author: Satish
"""
# doing the ortho-correction on the processed data from matchedFilter
import os
import numpy as np
import spectral as spy
import spectral.io.envi as envi
import spectral.algorithms as algo
from spectral.algorith... | [
"logging.getLogger",
"spectral.io.envi.read_envi_header",
"spectral.io.envi.gen_params",
"numpy.save",
"os.path.exists",
"os.listdir",
"os.path.isdir",
"numpy.vstack",
"os.mkdir",
"spectral.io.bipfile.BipFile",
"logging.basicConfig",
"coloredlogs.install",
"numpy.absolute",
"os.path.join",... | [((467, 506), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (486, 506), False, 'import logging\n'), ((516, 555), 'logging.getLogger', 'logging.getLogger', (['"""aviris_data_loader"""'], {}), "('aviris_data_loader')\n", (533, 555), False, 'import logging\n'), ((... |
# -*- coding: utf-8 -*-
import numpy as np
import csv
import tensorflow as tf
from config import Config
from DataFeeder import DataFeeder,TestData
from model import DKT
from sklearn.metrics import f1_score,precision_score,recall_score
indices = [precision_score,recall_score,f1_score]
def make_prediction(... | [
"tensorflow.reset_default_graph",
"model.DKT",
"tensorflow.Session",
"config.Config",
"csv.writer",
"DataFeeder.TestData",
"DataFeeder.DataFeeder",
"tensorflow.global_variables_initializer",
"numpy.concatenate",
"numpy.arange"
] | [((388, 412), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (410, 412), True, 'import tensorflow as tf\n'), ((424, 471), 'config.Config', 'Config', ([], {'dataFile': "('%s/Training.csv' % folderName)"}), "(dataFile='%s/Training.csv' % folderName)\n", (430, 471), False, 'from config impor... |
# Generated by Django 2.2.10 on 2020-06-16 17:08
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reo', '0063_auto_20200521_1528'),
]
operations = [
migrations.AddField(
model_name='profi... | [
"django.db.models.FloatField",
"django.db.models.TextField"
] | [((401, 441), 'django.db.models.FloatField', 'models.FloatField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (418, 441), False, 'from django.db import migrations, models\n'), ((597, 637), 'django.db.models.FloatField', 'models.FloatField', ([], {'blank': '(True)', 'null': '(True)'}), '(bl... |
# Generated by Django 2.2 on 2019-06-08 10:32
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Adult_Products',
fields=[
('id', models.AutoF... | [
"django.db.models.IntegerField",
"django.db.models.SlugField",
"django.db.models.AutoField",
"django.db.models.ImageField",
"django.db.models.CharField"
] | [((308, 401), '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", (324, 401), False, 'from django.db import migrations, models\... |
#!/usr/bin/env python
"""This module remains for backwards compatibility reasons and will be
removed in PyDy 0.4.0."""
import warnings
from .ode_function_generators import generate_ode_function as new_gen_ode_func
with warnings.catch_warnings():
warnings.simplefilter('once')
warnings.warn("This module, 'pyd... | [
"warnings.simplefilter",
"warnings.warn",
"warnings.catch_warnings"
] | [((223, 248), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (246, 248), False, 'import warnings\n'), ((254, 283), 'warnings.simplefilter', 'warnings.simplefilter', (['"""once"""'], {}), "('once')\n", (275, 283), False, 'import warnings\n'), ((288, 583), 'warnings.warn', 'warnings.warn', (['"""... |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from azure.identity.aio._credentials.managed_identity import ImdsCredential
import pytest
from helpers_async import AsyncMockTransport
@pytest.mark.asyncio
async def ... | [
"azure.identity.aio._credentials.managed_identity.ImdsCredential",
"helpers_async.AsyncMockTransport"
] | [((355, 375), 'helpers_async.AsyncMockTransport', 'AsyncMockTransport', ([], {}), '()\n', (373, 375), False, 'from helpers_async import AsyncMockTransport\n'), ((394, 429), 'azure.identity.aio._credentials.managed_identity.ImdsCredential', 'ImdsCredential', ([], {'transport': 'transport'}), '(transport=transport)\n', (... |
from django.http import HttpResponse
from django.shortcuts import render, redirect
from django.contrib.auth import login, logout, authenticate
from django.contrib.auth.forms import AuthenticationForm
from web3 import Web3
from .forms import SignupForm
from Key.models import Key
#The views and templates in this app a... | [
"django.shortcuts.render",
"django.contrib.auth.authenticate",
"Key.models.Key.objects.filter",
"django.contrib.auth.login",
"web3.Web3",
"django.contrib.auth.forms.AuthenticationForm",
"django.shortcuts.redirect",
"django.contrib.auth.logout",
"web3.Web3.HTTPProvider"
] | [((449, 492), 'web3.Web3.HTTPProvider', 'Web3.HTTPProvider', (['"""http://127.0.0.1:8545/"""'], {}), "('http://127.0.0.1:8545/')\n", (466, 492), False, 'from web3 import Web3\n'), ((500, 514), 'web3.Web3', 'Web3', (['provider'], {}), '(provider)\n', (504, 514), False, 'from web3 import Web3\n'), ((1753, 1797), 'django.... |
from flask import Flask, Blueprint
from flask_jwt_extended import JWTManager
def create_app(config):
app = Flask(__name__)
from instance.config import app_config
app.config.from_object(app_config[config])
app.config['JWT_SECRET_KEY'] = 'jwt-secret-string'
from .api.V1 import productsale_api as p... | [
"flask_jwt_extended.JWTManager",
"flask.Flask"
] | [((113, 128), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (118, 128), False, 'from flask import Flask, Blueprint\n'), ((366, 381), 'flask_jwt_extended.JWTManager', 'JWTManager', (['app'], {}), '(app)\n', (376, 381), False, 'from flask_jwt_extended import JWTManager\n')] |
"""
preprocess MSP IMPROV csv
run after MSP_IMPROV.py
"""
import os, torch, soundfile
from pathlib import Path
import librosa
import pandas as pd
ID2LABEL = {
0: "neu", 1: "sad", 2: "ang", 3: "hap"
}
pwd = Path(__file__).parent
csv_dir = pwd / "../data/datasets/MSP-IMPROV"
out_dir = pwd / "../data/datasets/MSP-IMP... | [
"pathlib.Path",
"os.makedirs",
"pandas.read_csv"
] | [((332, 367), 'os.makedirs', 'os.makedirs', (['out_dir'], {'exist_ok': '(True)'}), '(out_dir, exist_ok=True)\n', (343, 367), False, 'import os, torch, soundfile\n'), ((447, 468), 'pandas.read_csv', 'pd.read_csv', (['csv_path'], {}), '(csv_path)\n', (458, 468), True, 'import pandas as pd\n'), ((211, 225), 'pathlib.Path'... |
from django import template
from django.template.loader import render_to_string
register = template.Library()
@register.simple_tag
def richcomments_static():
return render_to_string('richcomments/templatetags/richcomments_static.html')
| [
"django.template.loader.render_to_string",
"django.template.Library"
] | [((92, 110), 'django.template.Library', 'template.Library', ([], {}), '()\n', (108, 110), False, 'from django import template\n'), ((171, 241), 'django.template.loader.render_to_string', 'render_to_string', (['"""richcomments/templatetags/richcomments_static.html"""'], {}), "('richcomments/templatetags/richcomments_sta... |
from logging import getLogger
from openrazer.client import DeviceManager, constants as razer_constants
from i3razer import config_contants as conf
from i3razer.config_parser import ConfigParser
from i3razer.layout import layouts
from i3razer.pyxhook import HookManager
ERR_DAEMON_OFF = -2 # openrazer is not running
... | [
"logging.getLogger",
"i3razer.pyxhook.HookManager",
"i3razer.config_parser.ConfigParser",
"openrazer.client.DeviceManager"
] | [((11075, 11088), 'i3razer.pyxhook.HookManager', 'HookManager', ([], {}), '()\n', (11086, 11088), False, 'from i3razer.pyxhook import HookManager\n'), ((11310, 11349), 'i3razer.config_parser.ConfigParser', 'ConfigParser', (['config_file', 'self._logger'], {}), '(config_file, self._logger)\n', (11322, 11349), False, 'fr... |
#!/usr/bin/env python
# coding: utf-8
import logging
import asyncio
import xumm
class StorageExample:
def __init__(self):
logging.debug('')
self.sdk = xumm.XummSdk('API_KEY', 'API_SECRET')
self.logger = logging.getLogger(self.__module__)
self.logger.setLevel(level=logging.DEBUG)
... | [
"xumm.XummSdk",
"asyncio.get_event_loop",
"logging.getLogger",
"logging.debug"
] | [((1402, 1426), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (1424, 1426), False, 'import asyncio\n'), ((137, 154), 'logging.debug', 'logging.debug', (['""""""'], {}), "('')\n", (150, 154), False, 'import logging\n'), ((174, 211), 'xumm.XummSdk', 'xumm.XummSdk', (['"""API_KEY"""', '"""API_SECRE... |
"""
dns_cache.py
Copyright 2006 <NAME>
This file is part of w3af, http://w3af.org/ .
w3af is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
w3af is distributed in the hope that it will b... | [
"socket._getaddrinfo",
"w3af.core.controllers.output_manager.out.debug",
"darts.lib.utils.lru.SynchronizedLRUDict"
] | [((1464, 1501), 'w3af.core.controllers.output_manager.out.debug', 'om.out.debug', (['"""Enabling _dns_cache()"""'], {}), "('Enabling _dns_cache()')\n", (1476, 1501), True, 'import w3af.core.controllers.output_manager as om\n'), ((1620, 1644), 'darts.lib.utils.lru.SynchronizedLRUDict', 'SynchronizedLRUDict', (['(200)'],... |
from factory import Faker
from .network_node import NetworkNodeFactory
from ..constants.network import ACCOUNT_FILE_HASH_LENGTH, BLOCK_IDENTIFIER_LENGTH, MAX_POINT_VALUE, MIN_POINT_VALUE
from ..models.network_validator import NetworkValidator
class NetworkValidatorFactory(NetworkNodeFactory):
daily_confirmation_... | [
"factory.Faker"
] | [((327, 395), 'factory.Faker', 'Faker', (['"""pyint"""'], {'max_value': 'MAX_POINT_VALUE', 'min_value': 'MIN_POINT_VALUE'}), "('pyint', max_value=MAX_POINT_VALUE, min_value=MIN_POINT_VALUE)\n", (332, 395), False, 'from factory import Faker\n'), ((420, 432), 'factory.Faker', 'Faker', (['"""url"""'], {}), "('url')\n", (4... |
from menu.models import Menu
from products.models import Product, Category
def get_dashboard_data_summary():
cardapios = Menu.objects.all()
produtos = Product.objects.all()
categorias = Category.objects.all()
return {'total_cardapios': len(cardapios),
'total_produtos': len(produtos),
... | [
"products.models.Category.objects.all",
"products.models.Product.objects.all",
"menu.models.Menu.objects.all"
] | [((127, 145), 'menu.models.Menu.objects.all', 'Menu.objects.all', ([], {}), '()\n', (143, 145), False, 'from menu.models import Menu\n'), ((161, 182), 'products.models.Product.objects.all', 'Product.objects.all', ([], {}), '()\n', (180, 182), False, 'from products.models import Product, Category\n'), ((200, 222), 'prod... |
# -*- coding: utf-8 -*-
# flake8: noqa
# -------------- Add path of _k2.so into sys.path --------------
import os as _os
import sys as _sys
_current_module = _sys.modules[__name__]
_k2_dir = _os.path.dirname(_current_module.__file__)
if not hasattr(_current_module, "__path__"):
__path__ = [_k2_dir]
elif _k2_dir... | [
"os.path.dirname",
"sys.path.append"
] | [((194, 236), 'os.path.dirname', '_os.path.dirname', (['_current_module.__file__'], {}), '(_current_module.__file__)\n', (210, 236), True, 'import os as _os\n'), ((367, 393), 'sys.path.append', '_sys.path.append', (['__path__'], {}), '(__path__)\n', (383, 393), True, 'import sys as _sys\n')] |