code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Generated by Django 3.1 on 2020-09-01 21:58
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('users', '0003_auto_20200830_2005'),
]
operations = [
... | [
"django.db.migrations.RenameModel",
"django.db.migrations.swappable_dependency"
] | [((184, 241), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (215, 241), False, 'from django.db import migrations\n'), ((323, 386), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""Pro... |
from argparse import ArgumentParser
from diary.database import connect
from diary.presenter import display_entries
from diary.utils import custom_date
from diary.generator import generate_command
import logging
import re
import os
__version__ = '2.2.0'
try:
# Strip non- word or dash characters from device name
... | [
"argparse.ArgumentParser",
"os.path.expandvars",
"diary.presenter.display_entries",
"diary.database.connect",
"os.uname"
] | [((507, 592), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""A program for writing and viewing a personal diary"""'}), "(description='A program for writing and viewing a personal diary'\n )\n", (521, 592), False, 'from argparse import ArgumentParser\n'), ((3336, 3383), 'diary.presenter.display... |
from copy import deepcopy
from logics.utils.parsers import parser_utils
from logics.classes.exceptions import NotWellFormed
from logics.classes.predicate import PredicateFormula
from logics.utils.parsers.standard_parser import StandardParser
class PredicateParser(StandardParser):
"""Parser for predicate language... | [
"logics.utils.parsers.parser_utils.get_closing_parenthesis",
"logics.classes.exceptions.NotWellFormed",
"logics.classes.predicate.PredicateFormula",
"logics.utils.parsers.parser_utils.get_main_constant",
"logics.utils.parsers.parser_utils.separate_arguments",
"logics.utils.parsers.parser_utils.get_last_op... | [((19659, 19701), 'copy.deepcopy', 'deepcopy', (['classical_parse_replacement_dict'], {}), '(classical_parse_replacement_dict)\n', (19667, 19701), False, 'from copy import deepcopy\n'), ((20793, 20835), 'copy.deepcopy', 'deepcopy', (['classical_parse_replacement_dict'], {}), '(classical_parse_replacement_dict)\n', (208... |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# 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 ... | [
"autobahn.twisted.util.sleep",
"twisted.internet.endpoints.SSL4ClientEndpoint",
"twisted.internet.task.react",
"twisted.internet.interfaces.IStreamClientEndpoint.providedBy",
"twisted.internet.endpoints.UNIXClientEndpoint",
"autobahn.twisted.rawsocket.WampRawSocketClientFactory",
"twisted.internet.inter... | [((5685, 5734), 'twisted.internet.interfaces.IStreamClientEndpoint.providedBy', 'IStreamClientEndpoint.providedBy', (['endpoint_config'], {}), '(endpoint_config)\n', (5717, 5734), False, 'from twisted.internet.interfaces import IStreamClientEndpoint\n'), ((8681, 8700), 'txaio.make_logger', 'txaio.make_logger', ([], {})... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-05-09 17:24
from __future__ import unicode_literals
import Curriculums.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Curriculums', '0015_remove_flyers_nombrearchivo'),
]
operat... | [
"django.db.models.ImageField",
"django.db.models.CharField"
] | [((439, 534), 'django.db.models.ImageField', 'models.ImageField', ([], {'blank': '(True)', 'null': '(True)', 'upload_to': 'Curriculums.models.generate_path_flyer'}), '(blank=True, null=True, upload_to=Curriculums.models.\n generate_path_flyer)\n', (456, 534), False, 'from django.db import migrations, models\n'), ((6... |
#! /usr/bin/env python3
import nba, os
for netdev in nba.get_netdevices():
print(netdev)
for coproc in nba.get_coprocessors():
print(coproc)
node_cpus = nba.get_cpu_node_mapping()
for node_id, cpus in enumerate(node_cpus):
print('Cores in NUMA node {0}: [{1}]'.format(node_id, ', '.join(map(str, cpus))))
#... | [
"nba.Queue",
"nba.get_coprocessors",
"nba.get_netdevices",
"nba.CompThread",
"nba.CoprocThread",
"os.environ.get",
"nba.IOThread",
"nba.LoadBalancer",
"nba.get_cpu_node_mapping"
] | [((54, 74), 'nba.get_netdevices', 'nba.get_netdevices', ([], {}), '()\n', (72, 74), False, 'import nba, os\n'), ((108, 130), 'nba.get_coprocessors', 'nba.get_coprocessors', ([], {}), '()\n', (128, 130), False, 'import nba, os\n'), ((162, 188), 'nba.get_cpu_node_mapping', 'nba.get_cpu_node_mapping', ([], {}), '()\n', (1... |
#import conf.bootstrap as config
#import conf.datakey as datakey
from .hashicorp_base import ConnBase
import consul
import os
import json
from ..utils.io import convert_yaml
from ..utils.logger import Logger
class ConsulCon(ConnBase):
"""Class to construct the dict properties for the app from Consul and Vault
... | [
"consul.Consul"
] | [((890, 920), 'consul.Consul', 'consul.Consul', ([], {}), '(**consul_params)\n', (903, 920), False, 'import consul\n')] |
import tclab
import time
import numpy as np
import sys
import first_principles_model as fp
def doublet_test(data_file='step_test.csv', show_plot=True):
'''doublet test the system and save data to given file path'''
import Adafruit_DHT # Only importable on the Pi itself
tc1 = tclab.TCLab()
tc1.LED(100... | [
"tclab.TCLab",
"numpy.ones",
"Adafruit_DHT.read_retry",
"numpy.zeros",
"numpy.vstack",
"numpy.savetxt",
"time.time"
] | [((291, 304), 'tclab.TCLab', 'tclab.TCLab', ([], {}), '()\n', (302, 304), False, 'import tclab\n'), ((588, 599), 'time.time', 'time.time', ([], {}), '()\n', (597, 599), False, 'import time\n'), ((2418, 2431), 'tclab.TCLab', 'tclab.TCLab', ([], {}), '()\n', (2429, 2431), False, 'import tclab\n'), ((2730, 2741), 'time.ti... |
import os
from requests.models import HTTPError
from server.client.client_utils import ClientUtils
import json
CLIENT_DIRECTORY = "./"
CLIENT_KEYWORD = "client"
class Client:
def __init__(self, args):
# If vID exists, read it
if os.path.isfile('vID'):
with open('vID') as f:
... | [
"json.loads",
"os.listdir",
"os.path.join",
"os.path.isfile",
"server.client.client_utils.ClientUtils"
] | [((253, 274), 'os.path.isfile', 'os.path.isfile', (['"""vID"""'], {}), "('vID')\n", (267, 274), False, 'import os\n'), ((369, 390), 'server.client.client_utils.ClientUtils', 'ClientUtils', (['args.csv'], {}), '(args.csv)\n', (380, 390), False, 'from server.client.client_utils import ClientUtils\n'), ((2495, 2516), 'os.... |
# This program kills instances of Chrome that may have been left over
# by crashes of the main script
import os
import signal
import subprocess
def kill_chrome_instances():
p = subprocess.Popen(['ps', '-A'], stdout = subprocess.PIPE)
out, err = p.communicate()
if err == None:
for line in out.spli... | [
"subprocess.Popen",
"os.kill"
] | [((183, 237), 'subprocess.Popen', 'subprocess.Popen', (["['ps', '-A']"], {'stdout': 'subprocess.PIPE'}), "(['ps', '-A'], stdout=subprocess.PIPE)\n", (199, 237), False, 'import subprocess\n'), ((461, 489), 'os.kill', 'os.kill', (['pid', 'signal.SIGKILL'], {}), '(pid, signal.SIGKILL)\n', (468, 489), False, 'import os\n')... |
#
# Generated with ExternalWrappingTypeBlueprint
from dmt.blueprint import Blueprint
from dmt.dimension import Dimension
from dmt.attribute import Attribute
from dmt.enum_attribute import EnumAttribute
from dmt.blueprint_attribute import BlueprintAttribute
from sima.sima.blueprints.namedobject import NamedObjectBluepr... | [
"dmt.dimension.Dimension",
"dmt.attribute.Attribute"
] | [((580, 623), 'dmt.attribute.Attribute', 'Attribute', (['"""name"""', '"""string"""', '""""""'], {'default': '""""""'}), "('name', 'string', '', default='')\n", (589, 623), False, 'from dmt.attribute import Attribute\n'), ((653, 703), 'dmt.attribute.Attribute', 'Attribute', (['"""description"""', '"""string"""', '"""""... |
import torpy.http.requests
from torrent_crawler.sources.tmdb import Tmdb
from torrent_crawler.trackers.rutor import Rutor
class TorrentCrawler:
def search(self, text: str):
with torpy.http.requests.tor_requests_session() as session:
result = []
for source in self.sources:
... | [
"torrent_crawler.sources.tmdb.Tmdb",
"torrent_crawler.trackers.rutor.Rutor"
] | [((414, 420), 'torrent_crawler.sources.tmdb.Tmdb', 'Tmdb', ([], {}), '()\n', (418, 420), False, 'from torrent_crawler.sources.tmdb import Tmdb\n'), ((438, 445), 'torrent_crawler.trackers.rutor.Rutor', 'Rutor', ([], {}), '()\n', (443, 445), False, 'from torrent_crawler.trackers.rutor import Rutor\n')] |
# coding: utf-8
"""
cifrum API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 0.1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re ... | [
"swagger_client.api_client.ApiClient",
"six.iteritems"
] | [((3730, 3761), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (3743, 3761), False, 'import six\n'), ((755, 766), 'swagger_client.api_client.ApiClient', 'ApiClient', ([], {}), '()\n', (764, 766), False, 'from swagger_client.api_client import ApiClient\n')] |
import os
import io
import discord
import time
import matplotlib.font_manager
from tle import constants
from matplotlib import pyplot as plt
from matplotlib import rcParams
fontprop = matplotlib.font_manager.FontProperties(
fname=constants.NOTO_SANS_CJK_REGULAR_FONT_PATH
)
# String wrapper to avoid the undersco... | [
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.axhspan",
"matplotlib.pyplot.ylim",
"time.time",
"matplotlib.pyplot.axvline",
"os.remove"
] | [((1056, 1075), 'os.remove', 'os.remove', (['filename'], {}), '(filename)\n', (1065, 1075), False, 'import os\n'), ((1447, 1459), 'matplotlib.pyplot.xticks', 'plt.xticks', ([], {}), '()\n', (1457, 1459), True, 'from matplotlib import pyplot as plt\n'), ((1540, 1560), 'matplotlib.pyplot.ylim', 'plt.ylim', (['ymin', 'yma... |
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import QTimer, Qt
from PyQt5.QtGui import QIcon, QPalette, QColor
s=m=h=0
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.setWindowTitle('Timer --Arvind')
Form.setWindowIcon(QIcon('Images/Timer.png... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QTextBrowser",
"PyQt5.QtGui.QPalette",
"PyQt5.QtGui.QIcon",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtCore.QTimer",
"PyQt5.QtGui.QColor",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidget... | [((3980, 4012), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (4002, 4012), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((4055, 4065), 'PyQt5.QtGui.QPalette', 'QPalette', ([], {}), '()\n', (4063, 4065), False, 'from PyQt5.QtGui import QIcon, QPalette, QColor\n... |
import hashlib
import os
import pickle
from zoltpy.quantile_io import json_io_dict_from_quantile_csv_file
from zoltpy import util
from zoltpy.connection import ZoltarConnection
from zoltpy.covid19 import COVID_TARGETS, covid19_row_validator, validate_quantile_csv_file
import glob
import json
import sys
UPDATE = False
... | [
"zoltpy.covid19.validate_quantile_csv_file",
"json.dump",
"os.listdir",
"glob.glob"
] | [((928, 959), 'os.listdir', 'os.listdir', (['"""./data-processed/"""'], {}), "('./data-processed/')\n", (938, 959), False, 'import os\n'), ((1162, 1187), 'glob.glob', 'glob.glob', (["(path + '*.csv')"], {}), "(path + '*.csv')\n", (1171, 1187), False, 'import glob\n'), ((869, 898), 'json.dump', 'json.dump', (['g_db', 'f... |
def test_simple():
import pyglobal
import settings
assert pyglobal.get('abc') == 123
assert pyglobal.get('qwerty') == ''
assert pyglobal.get('Hello') == 'World!'
assert pyglobal.get('SECRET_KEY') == '!!!CHANGE!!!'
def test_hack():
import pyglobal
pyglobal.set('SECRET_KEY', '*******... | [
"pyglobal.set",
"pyglobal.default",
"pyglobal.get"
] | [((285, 322), 'pyglobal.set', 'pyglobal.set', (['"""SECRET_KEY"""', '"""*******"""'], {}), "('SECRET_KEY', '*******')\n", (297, 322), False, 'import pyglobal\n'), ((665, 697), 'pyglobal.get', 'pyglobal.get', (['"""SECRET_KEY"""', 'None'], {}), "('SECRET_KEY', None)\n", (677, 697), False, 'import pyglobal\n'), ((72, 91)... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
####################
def ld_to_dl(ld):
dl = {}
for i, d in enumerate(ld):
for key in d.keys():
value = d[key]
if i == 0:
dl[key] = [value]
else:
dl[key].append(v... | [
"numpy.load",
"pandas.DataFrame.from_dict"
] | [((374, 415), 'numpy.load', 'np.load', (['"""results.npy"""'], {'allow_pickle': '(True)'}), "('results.npy', allow_pickle=True)\n", (381, 415), True, 'import numpy as np\n'), ((449, 480), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['results'], {}), '(results)\n', (471, 480), True, 'import pandas as pd\n')... |
# Copyright (c) 2013, omar and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from typing import Dict
import frappe
# import frappe
def execute(filters=None):
columns = get_columns()
data = get_data(filters)
return columns, data
def get_columns():
return... | [
"frappe.db.sql",
"frappe.db.get_value"
] | [((1410, 1475), 'frappe.db.get_value', 'frappe.db.get_value', (['"""Bank Currency"""', 'currency', "['currency_code']"], {}), "('Bank Currency', currency, ['currency_code'])\n", (1429, 1475), False, 'import frappe\n'), ((1489, 2084), 'frappe.db.sql', 'frappe.db.sql', (['"""\n SELECT c.system_code as bank, sum(... |
# -*- coding: utf-8 -*-
"""
Test module imports
===================
"""
import sys
def test_module_imports():
try:
import ahrs
except:
sys.exit("[ERROR] Package AHRS not found. Go to root directory of package and type:\n\n\tpip install .\n")
try:
import numpy, scipy, matplotlib
... | [
"sys.exit"
] | [((162, 278), 'sys.exit', 'sys.exit', (['"""[ERROR] Package AHRS not found. Go to root directory of package and type:\n\n\tpip install .\n"""'], {}), '(\n """[ERROR] Package AHRS not found. Go to root directory of package and type:\n\n\tpip install .\n"""\n )\n', (170, 278), False, 'import sys\n'), ((358, 455), '... |
import json
from unittest import mock
from unittest.mock import patch, call, sentinel, mock_open, Mock
import pytest
from truffshuff import parse_args, input_bar_specifier, DEFAULT_PLATES, accept_inventory_file, read_inventory, GymStock, \
parse_cmd_line_args
MOCK_JSON = '''
{
"barbells": "1*350", "dumbbells... | [
"json.loads",
"unittest.mock.Mock",
"truffshuff.parse_args",
"unittest.mock.create_autospec",
"unittest.mock.mock_open",
"truffshuff.input_bar_specifier",
"truffshuff.parse_cmd_line_args",
"pytest.raises",
"truffshuff.accept_inventory_file",
"unittest.mock.patch",
"truffshuff.read_inventory"
] | [((526, 569), 'unittest.mock.patch', 'patch', (['"""truffshuff.GymStock"""'], {'autospec': '(True)'}), "('truffshuff.GymStock', autospec=True)\n", (531, 569), False, 'from unittest.mock import patch, call, sentinel, mock_open, Mock\n'), ((1141, 1217), 'unittest.mock.patch', 'patch', (['"""truffshuff.read_inventory"""']... |
import MetaTrader5 as _mt5
from collections import namedtuple
from typing import Callable
from typing import Iterable
from typing import Tuple
from typing import Union
from typing import Any
from typing import Optional
from typing import Type
# custom namedtuples
CopyRate = namedtuple("CopyRate", "time, open, high, l... | [
"collections.namedtuple"
] | [((277, 369), 'collections.namedtuple', 'namedtuple', (['"""CopyRate"""', '"""time, open, high, low, close, tick_volume, spread, real_volume"""'], {}), "('CopyRate',\n 'time, open, high, low, close, tick_volume, spread, real_volume')\n", (287, 369), False, 'from collections import namedtuple\n'), ((377, 465), 'colle... |
import datetime
import os
import pickle
from decimal import Decimal
from decimal import ROUND_HALF_UP
from functools import total_ordering
import utils
from enums import OrderMode
from error import StopValueError
from submodule.Xu3.utils import getLogger
# total_ordering: 使得我可以只定義 __eq__ 和 __gt__ 就可進行完整的比較
# https:/... | [
"os.path.exists",
"pickle.dump",
"data.StockCategory.isEtf",
"utils.betaCost",
"utils.globals_variable.initialize",
"pickle.load",
"error.StopValueError",
"datetime.datetime.now",
"utils.alphaCost",
"submodule.Xu3.utils.getLogger",
"decimal.Decimal"
] | [((19141, 19156), 'utils.globals_variable.initialize', 'gv.initialize', ([], {}), '()\n', (19154, 19156), True, 'import utils.globals_variable as gv\n'), ((719, 731), 'decimal.Decimal', 'Decimal', (['"""1"""'], {}), "('1')\n", (726, 731), False, 'from decimal import Decimal\n'), ((855, 867), 'decimal.Decimal', 'Decimal... |
import torch
from torch.nn.functional import leaky_relu
from rational.torch import Rational
import numpy as np
t = torch.tensor([-2., -1, 0., 1., 2.])
expected_res = np.array(leaky_relu(t))
inp = torch.from_numpy(np.array(t)).reshape(-1)
cuda_inp = torch.tensor(np.array(t), dtype=torch.float, device="cuda").reshape(-... | [
"torch.nn.functional.leaky_relu",
"numpy.isclose",
"torch.tensor",
"numpy.array",
"rational.torch.Rational"
] | [((117, 156), 'torch.tensor', 'torch.tensor', (['[-2.0, -1, 0.0, 1.0, 2.0]'], {}), '([-2.0, -1, 0.0, 1.0, 2.0])\n', (129, 156), False, 'import torch\n'), ((177, 190), 'torch.nn.functional.leaky_relu', 'leaky_relu', (['t'], {}), '(t)\n', (187, 190), False, 'from torch.nn.functional import leaky_relu\n'), ((793, 849), 'n... |
# Copyright Contributors to the Testing Farm project.
# SPDX-License-Identifier: Apache-2.0
import os
from datetime import datetime
import gluetool
from gluetool import Failure
from gluetool import GlueCommandError
from gluetool import GlueError
from gluetool.utils import Command
from typing import AnyStr, List, Opt... | [
"datetime.datetime.now",
"gluetool.utils.Command",
"os.path.join",
"typing.cast"
] | [((3933, 3964), 'typing.cast', 'cast', (['str', 'artifact_folder_name'], {}), '(str, artifact_folder_name)\n', (3937, 3964), False, 'from typing import AnyStr, List, Optional, Dict, Any, cast\n'), ((8964, 9010), 'os.path.join', 'os.path.join', (['target_url', 'destination_sub_path'], {}), '(target_url, destination_sub_... |
import random as random_lib
import copy
from opsbro.evaluater import export_evaluater_function
FUNCTION_GROUP = 'random'
@export_evaluater_function(function_group=FUNCTION_GROUP)
def random():
"""**random()** -> Returns a random float between 0 and 1
<code>
Example:
random()
Returns:
... | [
"random.shuffle",
"opsbro.evaluater.export_evaluater_function",
"copy.copy",
"random.random",
"random.randint"
] | [((126, 182), 'opsbro.evaluater.export_evaluater_function', 'export_evaluater_function', ([], {'function_group': 'FUNCTION_GROUP'}), '(function_group=FUNCTION_GROUP)\n', (151, 182), False, 'from opsbro.evaluater import export_evaluater_function\n'), ((392, 448), 'opsbro.evaluater.export_evaluater_function', 'export_eva... |
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
import songs.routing
application = ProtocolTypeRouter({
'websocket': AuthMiddlewareStack(URLRouter(songs.routing.websocket_urlpatterns))
}) | [
"channels.routing.URLRouter"
] | [((199, 245), 'channels.routing.URLRouter', 'URLRouter', (['songs.routing.websocket_urlpatterns'], {}), '(songs.routing.websocket_urlpatterns)\n', (208, 245), False, 'from channels.routing import ProtocolTypeRouter, URLRouter\n')] |
import locale
locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
import tornado.httpserver
import tornado.ioloop
import tornado.web
import os
import tornado.options
import json
import ipaddress
import functools
import subprocess
import user_agents
from collections import namedtuple
import models
import dispatch
import en... | [
"locale.setlocale",
"os.urandom",
"models.TranslationEngine",
"os.environ.get",
"os.path.realpath",
"starlight.init",
"ipaddress.ip_address",
"user_agents.parse",
"analytics.Analytics"
] | [((14, 60), 'locale.setlocale', 'locale.setlocale', (['locale.LC_ALL', '"""en_US.UTF-8"""'], {}), "(locale.LC_ALL, 'en_US.UTF-8')\n", (30, 60), False, 'import locale\n'), ((2398, 2414), 'starlight.init', 'starlight.init', ([], {}), '()\n', (2412, 2414), False, 'import starlight\n'), ((2450, 2471), 'os.environ.get', 'os... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"aliyunsdkmarket.endpoint.endpoint_data.getEndpointMap",
"aliyunsdkmarket.endpoint.endpoint_data.getEndpointRegional",
"aliyunsdkcore.request.RpcRequest.__init__"
] | [((959, 1048), 'aliyunsdkcore.request.RpcRequest.__init__', 'RpcRequest.__init__', (['self', '"""Market"""', '"""2015-11-01"""', '"""DescribeCommodities"""', '"""yunmarket"""'], {}), "(self, 'Market', '2015-11-01', 'DescribeCommodities',\n 'yunmarket')\n", (978, 1048), False, 'from aliyunsdkcore.request import RpcRe... |
# Starter code for Kaggle - Don't Overfit! II dataset.
#
# Objective: make predictions on a dataset after only having trained a model on ~10% of it. Don't overfit.
#
# By <NAME>
import os
import re
import scipy as sp
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from s... | [
"sklearn.svm.SVC",
"matplotlib.pyplot.show",
"os.path.join",
"sklearn.preprocessing.StandardScaler",
"scipy.stats.normaltest",
"pandas.DataFrame",
"pandas.concat",
"scipy.stats.shapiro"
] | [((1435, 1445), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1443, 1445), True, 'import matplotlib.pyplot as plt\n'), ((1656, 1666), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1664, 1666), True, 'import matplotlib.pyplot as plt\n'), ((1881, 1891), 'matplotlib.pyplot.show', 'plt.show', ([], {})... |
import keyword
key = "elif"
s="vinit"
if keyword.iskeyword(key):
print(key," is keyword")
else:
print(key," is not keyword")
if keyword.iskeyword(s):
print(s," is keyword")
else:
print(s," is not keyword")
#This method is use to print the set of keywords present in python
print(keyword.kwlist) | [
"keyword.iskeyword"
] | [((42, 64), 'keyword.iskeyword', 'keyword.iskeyword', (['key'], {}), '(key)\n', (59, 64), False, 'import keyword\n'), ((131, 151), 'keyword.iskeyword', 'keyword.iskeyword', (['s'], {}), '(s)\n', (148, 151), False, 'import keyword\n')] |
from boxes import Actor, Room, EndActor
class Level(object):
"""Instantiates all the rooms and actors for the game.
Must have an EndActor in a reachable Room, with a proper and acquirable item_trigger to win the game
After Rooms have been instantiated, 'doors' must be created by using room.add_destination... | [
"boxes.EndActor",
"boxes.Room",
"boxes.Actor"
] | [((549, 870), 'boxes.Actor', 'Actor', ([], {'dialog': '"""Hello frined!"""', 'name': '"""A weird guy that I don\'t know. He looks friendly."""', 'description': '"""Talk to the friendly weird guy I don\'t know"""', 'item': '"""Botato"""', 'item_dialog': '"""Take this botato, use is wisely!\n\nReceived 1 Holy Botato!"""'... |
#!/usr/bin/env python
import sys
sys.path.append("..")
from game.base.signal import Signal
def test_signal():
s = Signal()
hello = s.connect(lambda: print("hello ", end=""), weak=False)
s.connect(lambda: print("world"), weak=False)
assert len(s) == 2
s() # 'hello world'
assert s.disconnec... | [
"sys.path.append",
"game.base.signal.Signal"
] | [((34, 55), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (49, 55), False, 'import sys\n'), ((123, 131), 'game.base.signal.Signal', 'Signal', ([], {}), '()\n', (129, 131), False, 'from game.base.signal import Signal\n'), ((469, 477), 'game.base.signal.Signal', 'Signal', ([], {}), '()\n', (475, 4... |
import requests
import json
from requests import Response
from datetime import datetime
class LoggingResult:
'''
A logging result class. Works out whether the log has been successful, and
if not, contains the response from the logging request.
Note: I've designed this this way because there's a myria... | [
"datetime.datetime.now",
"json.dumps"
] | [((3041, 3055), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (3053, 3055), False, 'from datetime import datetime\n'), ((3550, 3565), 'json.dumps', 'json.dumps', (['log'], {}), '(log)\n', (3560, 3565), False, 'import json\n')] |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
=====================
SBPy Vega Core Module
=====================
"""
import os
import astropy.units as u
from astropy.utils.state import ScienceState
from ..core import SpectralStandard
from . import sources
__doctest_requires__ = {'Sun': 'synphot'}... | [
"os.path.dirname",
"os.sep.join",
"astropy.utils.data._is_url"
] | [((2011, 2042), 'astropy.utils.data._is_url', '_is_url', (["parameters['filename']"], {}), "(parameters['filename'])\n", (2018, 2042), False, 'from astropy.utils.data import _is_url\n'), ((2115, 2140), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (2130, 2140), False, 'import os\n'), ((2182,... |
#!env python3
import argparse
import csv
import re
if __name__ == '__main__':
PARSER = argparse.ArgumentParser(description="Converts a word into an FST")
PARSER.add_argument("-s", dest="symbols", default=None, help="file containing the symbols")
PARSER.add_argument('word', help='a word')
args = PARSER.... | [
"argparse.ArgumentParser",
"re.compile"
] | [((92, 158), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Converts a word into an FST"""'}), "(description='Converts a word into an FST')\n", (115, 158), False, 'import argparse\n'), ((833, 848), 're.compile', 're.compile', (['tmp'], {}), '(tmp)\n', (843, 848), False, 'import re\n')] |
from django.shortcuts import render
from django.http import HttpResponse
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
# Create your views here.
def index(request):
tmp = []
liuyanList = [['/static/Semantic-UI-master/examples/assets/images/avatar/tom.jpg', '邢卫', '教师', '垃圾网站',
... | [
"django.shortcuts.render",
"django.core.paginator.Paginator"
] | [((2120, 2145), 'django.core.paginator.Paginator', 'Paginator', (['liuyanList', '(10)'], {}), '(liuyanList, 10)\n', (2129, 2145), False, 'from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger\n'), ((3697, 3723), 'django.core.paginator.Paginator', 'Paginator', (['CoursesList', '(10)'], {}), '(CoursesL... |
"""
The :mod:`sportsbed.datasets._soccer` includes functions
to fetch soccer historical and fixtures data.
"""
import numpy as np
HOME_WIN = lambda outputs, col1, col2, offset: outputs[col1] - outputs[col2] > offset
AWAY_WIN = lambda outputs, col1, col2, offset: outputs[col1] - outputs[col2] < -offset
DRAW = lambda o... | [
"numpy.abs"
] | [((348, 385), 'numpy.abs', 'np.abs', (['(outputs[col1] - outputs[col2])'], {}), '(outputs[col1] - outputs[col2])\n', (354, 385), True, 'import numpy as np\n')] |
from base_client import BaseClient, format_query
class BattleClient(BaseClient):
retries = 3
def do_battle(self, ident):
return self._send_request(format_query("BATTLE", ident))
| [
"base_client.format_query"
] | [((167, 196), 'base_client.format_query', 'format_query', (['"""BATTLE"""', 'ident'], {}), "('BATTLE', ident)\n", (179, 196), False, 'from base_client import BaseClient, format_query\n')] |
from django.db import models
from Modulos.Base.models import ModeloBase
from Modulos.Puestos.models import Puestos
class Candidatos(ModeloBase):
id_puesto = models.ForeignKey(Puestos,on_delete=models.CASCADE)
nombre = models.CharField('Nombre del candidato', max_length = 50, null = False, blank = False)
ap... | [
"django.db.models.EmailField",
"django.db.models.Manager",
"django.db.models.ForeignKey",
"django.db.models.FileField",
"django.db.models.CharField"
] | [((162, 214), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Puestos'], {'on_delete': 'models.CASCADE'}), '(Puestos, on_delete=models.CASCADE)\n', (179, 214), False, 'from django.db import models\n'), ((227, 312), 'django.db.models.CharField', 'models.CharField', (['"""Nombre del candidato"""'], {'max_length': ... |
# -*- coding: utf-8 -*-
import requests
from proxy_validator import config
Default_UA = config['CLIENT_UA']
Default_Timeout = config['CLIENT_TIMEOUT']
class Client(object):
def __init__(self, headers=None, proxies=None):
self.headers = headers if headers is not None else {}
self.headers['User-Age... | [
"requests.Session"
] | [((423, 441), 'requests.Session', 'requests.Session', ([], {}), '()\n', (439, 441), False, 'import requests\n')] |
from django.db import models
from django.utils import timezone
from django.utils.text import slugify
class CommentManager(models.Manager):
def create_comment(self, party, author, **kwargs):
if not party:
raise ValueError('파티는 필수입니다.')
if not author:
raise ValueError('작성자는 필... | [
"django.utils.text.slugify",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.utils.timezone.now",
"django.db.models.SlugField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((1061, 1153), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""parties.Party"""'], {'on_delete': 'models.PROTECT', 'verbose_name': '"""댓글이 향하는 파티"""'}), "('parties.Party', on_delete=models.PROTECT, verbose_name=\n '댓글이 향하는 파티')\n", (1078, 1153), False, 'from django.db import models\n'), ((1192, 1282), 'dj... |
import uuid
from django.conf import settings
from django.db import models
from django.utils import timezone
class AbstractBase(models.Model):
id = models.UUIDField(
primary_key=True,
default=uuid.uuid4,
editable=False
)
created_at = models.DateTimeField(default=timezone.now)
u... | [
"django.db.models.DateTimeField",
"django.db.models.UUIDField",
"django.db.models.ForeignKey"
] | [((154, 224), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'primary_key': '(True)', 'default': 'uuid.uuid4', 'editable': '(False)'}), '(primary_key=True, default=uuid.uuid4, editable=False)\n', (170, 224), False, 'from django.db import models\n'), ((272, 314), 'django.db.models.DateTimeField', 'models.DateTi... |
import unittest
from problems.problem33 import solution
class Test(unittest.TestCase):
def test(self):
self.assertEqual(solution([100, 4, 200, 1, 3, 2]), 4)
| [
"problems.problem33.solution"
] | [((125, 157), 'problems.problem33.solution', 'solution', (['[100, 4, 200, 1, 3, 2]'], {}), '([100, 4, 200, 1, 3, 2])\n', (133, 157), False, 'from problems.problem33 import solution\n')] |
# Copyright 2010 New Relic, Inc.
#
# 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 writ... | [
"newrelic.common.object_wrapper.wrap_function_wrapper"
] | [((4766, 4829), 'newrelic.common.object_wrapper.wrap_function_wrapper', 'wrap_function_wrapper', (['module', '"""Client.send"""', 'sync_send_wrapper'], {}), "(module, 'Client.send', sync_send_wrapper)\n", (4787, 4829), False, 'from newrelic.common.object_wrapper import wrap_function_wrapper\n'), ((4834, 4903), 'newreli... |
import face_recognition
import cv2
import numpy as np
# getMouthImage (from TLR Teeth Appearance Calculation.ipynb)
def getMouthImage(faceImage,margin=0):
# face_locations = face_recognition.face_locations(faceImage)
face_landmarks_list = face_recognition.face_landmarks(faceImage)
if len(face_landmarks_list) == ... | [
"numpy.copy",
"cv2.polylines",
"face_recognition.face_landmarks",
"numpy.array",
"cv2.cvtColor",
"numpy.concatenate"
] | [((244, 286), 'face_recognition.face_landmarks', 'face_recognition.face_landmarks', (['faceImage'], {}), '(faceImage)\n', (275, 286), False, 'import face_recognition\n'), ((1845, 1898), 'numpy.concatenate', 'np.concatenate', (['(top_lip[6:], bottom_lip[6:])'], {'axis': '(0)'}), '((top_lip[6:], bottom_lip[6:]), axis=0)\... |
import math
pi = math.pi
cos = lambda x : math.cos(x * pi/180)
sin = lambda x : math.sin(x * pi/180)
circles = []
vertices = []
vert_norm_tex = []
faces = []
# Generate coordinates
factor = 5 # 1,3,5,9,15
circles.append(([(0.,-1.,0.,0.,1.)], 0))
for theta in range(-87, 90, factor):
if abs(theta) >= 82:... | [
"math.cos",
"math.sin"
] | [((44, 66), 'math.cos', 'math.cos', (['(x * pi / 180)'], {}), '(x * pi / 180)\n', (52, 66), False, 'import math\n'), ((82, 104), 'math.sin', 'math.sin', (['(x * pi / 180)'], {}), '(x * pi / 180)\n', (90, 104), False, 'import math\n')] |
import contextlib
import traceback
from cube2protocol.cube_data_stream import CubeDataStream
from cipolla.protocol import swh
from cipolla.game.client.client import Client
from cipolla.game.player.player import Player
from cipolla.game.room.client_collection import ClientCollection
from cipolla.game.room.player_coll... | [
"cipolla.protocol.swh.put_jumppad",
"cipolla.protocol.swh.put_sound",
"cipolla.protocol.swh.put_servmsg",
"cipolla.protocol.swh.put_timeup",
"cipolla.protocol.swh.put_cdis",
"cipolla.protocol.swh.put_explodefx",
"cipolla.protocol.swh.put_resume",
"cipolla.protocol.swh.put_pausegame",
"cipolla.protoc... | [((1088, 1113), 'cipolla.protocol.swh.put_pausegame', 'swh.put_pausegame', (['cds', '(0)'], {}), '(cds, 0)\n', (1105, 1113), False, 'from cipolla.protocol import swh\n'), ((1199, 1224), 'cipolla.protocol.swh.put_pausegame', 'swh.put_pausegame', (['cds', '(1)'], {}), '(cds, 1)\n', (1216, 1224), False, 'from cipolla.prot... |
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
import time
import json
import sentiment_mod as s
#consumer key, consumer secret, access token, access secret.
ckey="<KEY>"
csecret="<KEY>"
atoken="<KEY>"
asecret="<KEY>"
class listener(StreamListener):
def on_d... | [
"json.loads",
"sentiment_mod.sentiment",
"time.sleep",
"tweepy.OAuthHandler"
] | [((856, 883), 'tweepy.OAuthHandler', 'OAuthHandler', (['ckey', 'csecret'], {}), '(ckey, csecret)\n', (868, 883), False, 'from tweepy import OAuthHandler\n'), ((374, 390), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (384, 390), False, 'import json\n'), ((463, 481), 'sentiment_mod.sentiment', 's.sentiment', (... |
#!/usr/bin/env python
# encoding: utf-8
from Alfred import Tools
import HTMLParser
import os
import re
import urllib2
class Markdown(object):
PANDOC = '/usr/local/bin/pandoc -f html-native_divs-native_spans -t gfm --strip-comments --atx-headers '
def __init__(self, url):
self.url = url
self.... | [
"Alfred.Tools.getTodayDate",
"urllib2.urlopen",
"HTMLParser.HTMLParser",
"os.popen",
"re.findall",
"urllib2.unquote"
] | [((990, 1013), 'urllib2.unquote', 'urllib2.unquote', (['string'], {}), '(string)\n', (1005, 1013), False, 'import urllib2\n'), ((1798, 1885), 're.findall', 're.findall', (['"""<title>[\\\\n\\\\t\\\\s]*(.+)[\\\\n\\\\t\\\\s]*</title>"""', 'self.html', 're.MULTILINE'], {}), "('<title>[\\\\n\\\\t\\\\s]*(.+)[\\\\n\\\\t\\\\s... |
import click
import os
import yaml
from panoptes_client import Panoptes
@click.version_option(prog_name='Panoptes CLI')
@click.group()
@click.option(
'--endpoint',
'-e',
help="Overides the default API endpoint",
type=str,
)
@click.option(
'--admin',
'-a',
help=(
"Enables admin mode... | [
"yaml.full_load",
"click.group",
"click.option",
"os.path.join",
"panoptes_client.Panoptes.connect",
"click.version_option",
"os.path.expanduser"
] | [((75, 121), 'click.version_option', 'click.version_option', ([], {'prog_name': '"""Panoptes CLI"""'}), "(prog_name='Panoptes CLI')\n", (95, 121), False, 'import click\n'), ((123, 136), 'click.group', 'click.group', ([], {}), '()\n', (134, 136), False, 'import click\n'), ((138, 226), 'click.option', 'click.option', (['... |
import math
from twitter import tweet
class Rectangle(object):
def __init__(self, width, height, *args, **kwargs):
super().__init__(*args, **kwargs)
self.width = width
self.height = height
def area(self):
return self.width * self.height
def broadcast(self):
mess... | [
"twitter.tweet"
] | [((393, 407), 'twitter.tweet', 'tweet', (['message'], {}), '(message)\n', (398, 407), False, 'from twitter import tweet\n')] |
#!/usr/bin/env python
import json
from jconfigure import configure
if __name__ == "__main__":
print(json.dumps(configure(), indent=2))
| [
"jconfigure.configure"
] | [((117, 128), 'jconfigure.configure', 'configure', ([], {}), '()\n', (126, 128), False, 'from jconfigure import configure\n')] |
#!/usr/bin/env/python3.9
#
# Made by EtcAug10
import requests as req, os, re
banner = """
----------------- -- --- |
------------ -----------|
--- SQLi CMS Lokomedia - |
------- by EtcAug10 -----|
--- -------------------|
"""
admin = [
'adm/',
'_adm_/',
'_admin_/',
'_administrator_/',
'operator/',
... | [
"os.system",
"re.findall",
"requests.get"
] | [((7872, 7890), 'os.system', 'os.system', (['"""clear"""'], {}), "('clear')\n", (7881, 7890), False, 'import requests as req, os, re\n'), ((6202, 6212), 'requests.get', 'req.get', (['t'], {}), '(t)\n', (6209, 6212), True, 'import requests as req, os, re\n'), ((6337, 6360), 'os.system', 'os.system', (['"""sleep 0.5s"""'... |
from urllib import urlencode
from flask import url_for, request
from flask.ext.utils.serialization import jsonify
from nomenklatura.views.common import get_limit, get_offset
SKIP_ARGS = ['limit', 'offset', '_']
def args(limit, offset):
_args = [('limit', limit), ('offset', offset)]
for k, v in request.arg... | [
"flask.ext.utils.serialization.jsonify",
"nomenklatura.views.common.get_limit",
"flask.request.args.items",
"nomenklatura.views.common.get_offset",
"flask.url_for",
"urllib.urlencode"
] | [((309, 329), 'flask.request.args.items', 'request.args.items', ([], {}), '()\n', (327, 329), False, 'from flask import url_for, request\n'), ((813, 824), 'nomenklatura.views.common.get_limit', 'get_limit', ([], {}), '()\n', (822, 824), False, 'from nomenklatura.views.common import get_limit, get_offset\n'), ((838, 850... |
import logging
from smtplib import SMTPException
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
logger = logging.getLogger(__name__)
def sendmail(title, body, to_email, email_template=None):
context = body
html_text = ... | [
"logging.getLogger",
"django.core.mail.EmailMultiAlternatives",
"django.template.loader.render_to_string"
] | [((197, 224), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (214, 224), False, 'import logging\n'), ((320, 361), 'django.template.loader.render_to_string', 'render_to_string', (['email_template', 'context'], {}), '(email_template, context)\n', (336, 361), False, 'from django.template.loa... |
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 9 03:14:54 2017
@author: kogito
"""
from Gui import MainWindow
def main():
MainWindow('Texhide')
if __name__ == '__main__':
main()
| [
"Gui.MainWindow"
] | [((129, 150), 'Gui.MainWindow', 'MainWindow', (['"""Texhide"""'], {}), "('Texhide')\n", (139, 150), False, 'from Gui import MainWindow\n')] |
"Testcases for Rule.check property"
from .. import Case
from bobot.Rule import Rule
checkTrue = Case.Case([
Rule({
'check': lambda x: True,
'match': 'checkTrue',
'response': 'checkTrue'
})
], [
{
'expected': [Case.Expectation('checkTrue').value()],
'message': Case.M... | [
"bobot.Rule.Rule"
] | [((114, 192), 'bobot.Rule.Rule', 'Rule', (["{'check': lambda x: True, 'match': 'checkTrue', 'response': 'checkTrue'}"], {}), "({'check': lambda x: True, 'match': 'checkTrue', 'response': 'checkTrue'})\n", (118, 192), False, 'from bobot.Rule import Rule\n'), ((382, 457), 'bobot.Rule.Rule', 'Rule', (["{'check': lambda x:... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 08 21:24:18 2014
@author: Derrick
Module containing import detex classes
"""
# python 2 and 3 compatibility imports
from __future__ import print_function, absolute_import, unicode_literals, division
import json
import numbers
import os
import matplotlib as mpl
import ma... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.hist",
"numpy.random.rand",
"obspy.core.Stream",
"matplotlib.pyplot.ylabel",
"pandas.read_csv",
"detex.construct.fast_normcorr",
"obspy.core.UTCDateTime",
"numpy.array",
"detex.util.saveSQLite",
"copy.deepcopy",
"numpy.linalg.norm",
"scipy.dot",
... | [((10480, 10528), 'detex.log', 'detex.log', (['__name__', 'msg'], {'level': '"""info"""', 'pri': '(True)'}), "(__name__, msg, level='info', pri=True)\n", (10489, 10528), False, 'import detex\n'), ((13698, 13746), 'detex.log', 'detex.log', (['__name__', 'msg'], {'level': '"""info"""', 'pri': '(True)'}), "(__name__, msg,... |
#!/usr/bin/env python
r"""Aggregate, create, and save 1D and 2D plots.
"""
import pdb # noqa: F401
from matplotlib import pyplot as plt
from . import base
class Scatter(base.PlotWithZdata, base.CbarMaker):
r"""Create a scatter plot.
Properties
----------
Methods
-------
Abstract Propert... | [
"matplotlib.pyplot.subplots"
] | [((2109, 2123), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (2121, 2123), True, 'from matplotlib import pyplot as plt\n')] |
from torchvision import models
import numpy as np
import torch
import os
from moviepy.editor import VideoFileClip
SKIP_FRAME_RATE = 10
MINIMAX_FRAME = 4
# 함수에서 documentaiton 읽기
model = models.detection.fasterrcnn_resnet50_fpn(pretrained=True)
model.eval()
os.environ['KMP_DUPLICATE_LIB_OK']='True'
def extract_boxes(re... | [
"numpy.float",
"torch.from_numpy",
"numpy.max",
"numpy.array",
"torchvision.models.detection.fasterrcnn_resnet50_fpn",
"numpy.transpose"
] | [((186, 243), 'torchvision.models.detection.fasterrcnn_resnet50_fpn', 'models.detection.fasterrcnn_resnet50_fpn', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (226, 243), False, 'from torchvision import models\n'), ((3155, 3170), 'numpy.float', 'np.float', (['"""Inf"""'], {}), "('Inf')\n", (3163, 3170), True,... |
import numpy
#Variables
PLAYERS= 2
boardW = 5
boardH = 5
board = numpy.zeros((boardW,boardH))
step = 0
winLength = 3
#Functions
def drawBoard():
global step
print("\n Step:", step, "\n")
for i in range(0,len(board)):
for j in numpy.flipud(board)[i]:
print('{:>4}'.format(getSym(j)), end... | [
"numpy.full",
"numpy.zeros",
"numpy.diagonal",
"numpy.flipud"
] | [((66, 95), 'numpy.zeros', 'numpy.zeros', (['(boardW, boardH)'], {}), '((boardW, boardH))\n', (77, 95), False, 'import numpy\n'), ((2058, 2077), 'numpy.zeros', 'numpy.zeros', (['(5, 5)'], {}), '((5, 5))\n', (2069, 2077), False, 'import numpy\n'), ((2313, 2342), 'numpy.zeros', 'numpy.zeros', (['(boardW, boardH)'], {}), ... |
import json
import os
import random
import bottle
import platform
from api import ping_response, start_response, move_response, end_response
lastMove = ''
@bottle.route('/')
def index():
return '''
Battlesnake documentation can be found at
<a href="https://docs.battlesnake.com">https://docs.battlesnak... | [
"bottle.static_file",
"api.move_response",
"os.getenv",
"bottle.post",
"api.end_response",
"json.dumps",
"bottle.route",
"api.start_response",
"platform.system",
"api.ping_response",
"bottle.default_app"
] | [((159, 176), 'bottle.route', 'bottle.route', (['"""/"""'], {}), "('/')\n", (171, 176), False, 'import bottle\n'), ((342, 377), 'bottle.route', 'bottle.route', (['"""/static/<path:path>"""'], {}), "('/static/<path:path>')\n", (354, 377), False, 'import bottle\n'), ((622, 642), 'bottle.post', 'bottle.post', (['"""/ping"... |
import os
import pytest
from zscli.cli import API
DEBUG = True
TEST_LIMIT = 10
TEST_PAGE = 1
VERBOSE = False
@pytest.fixture()
def api_key():
return os.environ["ZEROSSL_API_KEY"]
@pytest.fixture()
def test_api(api_key):
return API(DEBUG, api_key, TEST_LIMIT, TEST_PAGE, VERBOSE)
| [
"pytest.fixture",
"zscli.cli.API"
] | [((115, 131), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (129, 131), False, 'import pytest\n'), ((191, 207), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (205, 207), False, 'import pytest\n'), ((242, 293), 'zscli.cli.API', 'API', (['DEBUG', 'api_key', 'TEST_LIMIT', 'TEST_PAGE', 'VERBOSE'], {}), '(DE... |
from common.BaseCommand import BaseCommand
from common.ResultAndData import *
from models.CalEvent import CalEvent
import argparse
from argparse import Namespace
from msgraph import helpers
from tabulate import tabulate
import datetime
import os
class WeekCommand(BaseCommand):
def add_parser(self, sub... | [
"msgraph.helpers.list_events_in_time_range",
"tabulate.tabulate",
"datetime.datetime.min.time",
"datetime.timedelta",
"datetime.date.today",
"datetime.datetime.max.time",
"models.CalEvent.CalEvent.from_json"
] | [((869, 890), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (888, 890), False, 'import datetime\n'), ((1188, 1254), 'msgraph.helpers.list_events_in_time_range', 'helpers.list_events_in_time_range', (['graph'], {'start': 'startdt', 'end': 'enddt'}), '(graph, start=startdt, end=enddt)\n', (1221, 1254), ... |
import traceback
import copy
from cloud_console_common.utils import *
from cloud_console_common import log
class ExtractLogic:
"""Implementation of ExtractLogic that will extract the data from a remote API call
"""
def __init__(self):
pass
def extract(self, raw_data)->dict:
"""Receiv... | [
"cloud_console_common.log.error",
"cloud_console_common.log.warning"
] | [((791, 900), 'cloud_console_common.log.warning', 'log.warning', ([], {'message': '"""This method is a dummy method with no implementation logic - create your own"""'}), "(message=\n 'This method is a dummy method with no implementation logic - create your own'\n )\n", (802, 900), False, 'from cloud_console_commo... |
from fastapi.routing import APIRouter
from lnbits.db import Database
db = Database("database")
core_app: APIRouter = APIRouter()
from .views.api import * # noqa
from .views.generic import * # noqa
from .views.public_api import * # noqa
| [
"fastapi.routing.APIRouter",
"lnbits.db.Database"
] | [((76, 96), 'lnbits.db.Database', 'Database', (['"""database"""'], {}), "('database')\n", (84, 96), False, 'from lnbits.db import Database\n'), ((120, 131), 'fastapi.routing.APIRouter', 'APIRouter', ([], {}), '()\n', (129, 131), False, 'from fastapi.routing import APIRouter\n')] |
import sys
import click
from api.google import GoogleTranslator
from api.weblio import WeblioTranslator
_translators = {
'google': GoogleTranslator,
'weblio': WeblioTranslator,
}
@click.command()
@click.option('--text')
@click.option('--from', 'source')
@click.option('--to', 'target')
@click.option('--api... | [
"click.option",
"click.command",
"sys.exit"
] | [((194, 209), 'click.command', 'click.command', ([], {}), '()\n', (207, 209), False, 'import click\n'), ((211, 233), 'click.option', 'click.option', (['"""--text"""'], {}), "('--text')\n", (223, 233), False, 'import click\n'), ((235, 267), 'click.option', 'click.option', (['"""--from"""', '"""source"""'], {}), "('--fro... |
"""
Author: <NAME>
Created: 3/11/2020 9:04 AM
"""
from Climate_Shocks.vcsn_pull import vcsn_pull_single_site
from Climate_Shocks.note_worthy_events.simple_soil_moisture_pet import calc_sma_smd_historical, calc_smd_monthly
from Climate_Shocks.get_past_record import get_restriction_record, get_vcsn_record
from Pastur... | [
"Climate_Shocks.get_past_record.get_restriction_record",
"pandas.to_datetime",
"os.path.exists",
"Climate_Shocks.get_past_record.get_vcsn_record",
"pandas.MultiIndex.from_product",
"itertools.product",
"pandas.DataFrame",
"Climate_Shocks.note_worthy_events.simple_soil_moisture_pet.calc_sma_smd_histori... | [((844, 873), 'os.path.exists', 'os.path.exists', (['event_def_dir'], {}), '(event_def_dir)\n', (858, 873), False, 'import os\n'), ((879, 905), 'os.makedirs', 'os.makedirs', (['event_def_dir'], {}), '(event_def_dir)\n', (890, 905), False, 'import os\n'), ((1731, 1828), 'pandas.merge', 'pd.merge', (['irr_temp2', 'dry_te... |
'''
'''
import sys
import json
import argparse
import eosfactory.core.utils as utils
import eosfactory.core.config as config
IS_ERROR = 2
IS_WARNING = 1
class Checklist():
def __init__(self, is_html=False, error_codes=""):
self.is_html = is_html
self.html_text = ""
self.is_error = False
... | [
"eosfactory.core.config.current_config",
"termcolor.colored",
"eosfactory.core.config.eosio_cdt_version",
"eosfactory.core.utils.os_version",
"argparse.ArgumentParser",
"eosfactory.core.utils.spawn",
"sys.exit",
"eosfactory.core.config.wsl_root",
"eosfactory.core.config.config",
"eosfactory.core.c... | [((13839, 13949), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""\n Check whether installation conditions are fulfilled.\n """'}), '(description=\n """\n Check whether installation conditions are fulfilled.\n """)\n', (13862, 13949), False, 'import argparse\n'), ((377, 402... |
"""Tests for the match format model and schema."""
import pytest
from marshmallow import ValidationError
from sqlalchemy.exc import IntegrityError
from scorecard.models.match_format import MatchFormat, MatchFormatSchema
class TestMatchFormat:
@pytest.fixture
def match_format(self):
return MatchForma... | [
"pytest.fixture",
"scorecard.models.match_format.MatchFormatSchema",
"scorecard.models.match_format.MatchFormat",
"pytest.raises"
] | [((1417, 1446), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""'}), "(scope='class')\n", (1431, 1446), False, 'import pytest\n'), ((310, 346), 'scorecard.models.match_format.MatchFormat', 'MatchFormat', (['"""format"""', '"""description"""'], {}), "('format', 'description')\n", (321, 346), False, 'from ... |
import argparse
import numpy as np
import numpy_net as npn
parser = argparse.ArgumentParser()
parser.add_argument('--lr', type=float, help='Learning rate', default=0.1)
parser.add_argument('--epochs', type=int, help='Number of epochs', default=10)
parser.add_argument('--batch-size', type=int, help='Batch size', defaul... | [
"numpy.mean",
"numpy.eye",
"argparse.ArgumentParser",
"numpy_net.load_mnist",
"numpy_net.CrossEntropy",
"numpy.random.shuffle"
] | [((69, 94), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (92, 94), False, 'import argparse\n'), ((927, 943), 'numpy_net.load_mnist', 'npn.load_mnist', ([], {}), '()\n', (941, 943), True, 'import numpy_net as npn\n'), ((1552, 1572), 'numpy.random.shuffle', 'np.random.shuffle', (['i'], {}), '(i... |
import sys
import time
import pygame
from pygame.image import load
from pipeline import Pipeline
from bird import Bird
from menu import GameMenu
class game(object):
def __init__(self):
pygame.init() # 初始化pygame
pygame.font.init() # 初始化字体
self.font = pygame.font.... | [
"sys.exit",
"pygame.init",
"pygame.event.get",
"bird.Bird",
"pygame.display.set_mode",
"pygame.display.flip",
"menu.GameMenu",
"pygame.key.get_pressed",
"pygame.font.init",
"pygame.time.Clock",
"pygame.image.load",
"pygame.display.update",
"pipeline.Pipeline",
"pygame.font.SysFont"
] | [((190, 203), 'pygame.init', 'pygame.init', ([], {}), '()\n', (201, 203), False, 'import pygame\n'), ((245, 263), 'pygame.font.init', 'pygame.font.init', ([], {}), '()\n', (261, 263), False, 'import pygame\n'), ((308, 340), 'pygame.font.SysFont', 'pygame.font.SysFont', (['"""Arial"""', '(50)'], {}), "('Arial', 50)\n", ... |
from .environ import env
from .helpers import os_shutdown
from .mlogging import mlogging
import traceback
import winsound
class ExceptiontContainer(object):
def __init__(self, log_name='exception.log', log_prefix=None, use_console=True,
to_raise=False, beep=True, shutdown=False, hibernate=Fals... | [
"traceback.format_exc",
"winsound.Beep"
] | [((829, 872), 'winsound.Beep', 'winsound.Beep', ([], {'frequency': '(522)', 'duration': '(2020)'}), '(frequency=522, duration=2020)\n', (842, 872), False, 'import winsound\n'), ((761, 783), 'traceback.format_exc', 'traceback.format_exc', ([], {}), '()\n', (781, 783), False, 'import traceback\n')] |
import json
import os
import matplotlib.pyplot as plt
import mmcv
import pandas as pd
import seaborn as sns
prefix = '/home/tml/Nutstore Files/ubuntu/paper/data/iou'
if __name__ == '__main__':
work_dirs = os.listdir('work_dirs')
results = []
best_f1 = []
for i, work_dir in enumerate(work_dirs):
... | [
"os.listdir",
"pandas.DataFrame.from_dict",
"seaborn.lineplot",
"mmcv.load",
"json.dump",
"matplotlib.pyplot.show"
] | [((2109, 2144), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['intput_data'], {}), '(intput_data)\n', (2131, 2144), True, 'import pandas as pd\n'), ((2215, 2323), 'seaborn.lineplot', 'sns.lineplot', ([], {'x': '"""epoch"""', 'y': '"""bbox_mAP"""', 'data': 'df', 'hue': '"""config"""', 'style': '"""config"""'... |
# Copyright 2020 <NAME>, <NAME>, and <NAME>. 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 app... | [
"traceback.format_exc",
"os.path.join",
"importlib.import_module"
] | [((2953, 2971), 'importlib.import_module', 'import_module', (['mod'], {}), '(mod)\n', (2966, 2971), False, 'from importlib import import_module\n'), ((5038, 5100), 'os.path.join', 'os.path.join', (['run_output_dir', 'remote_store.checkpoint_filename'], {}), '(run_output_dir, remote_store.checkpoint_filename)\n', (5050,... |
#%%
#==============================================================================#
# #
# Title: Make PostCodes Dataset #
# Purpose: To download and process the data for the App ... | [
"logging.getLogger",
"logging.basicConfig",
"dotenv.find_dotenv",
"pathlib.Path",
"os.path.join",
"src.utils.get_DataLabels",
"pandas.DataFrame",
"os.path.abspath",
"src.utils.get_RawData"
] | [((3719, 3737), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {}), '(data)\n', (3731, 3737), True, 'import pandas as pd\n'), ((6887, 6928), 'src.utils.get_RawData', 'utils.get_RawData', (['sources.PostalAreaCode'], {}), '(sources.PostalAreaCode)\n', (6904, 6928), False, 'from src import utils\n'), ((7487, 7514), 'logg... |
import os
def configuration(parent_package="", top_path=None):
import numpy
from numpy.distutils.misc_util import Configuration
config = Configuration("simulator", parent_package, top_path)
libraries = []
if os.name == "posix":
libraries.append("m")
# cpp_args = ['-stdlib=libc++', '... | [
"numpy.distutils.misc_util.Configuration",
"numpy.get_include"
] | [((152, 204), 'numpy.distutils.misc_util.Configuration', 'Configuration', (['"""simulator"""', 'parent_package', 'top_path'], {}), "('simulator', parent_package, top_path)\n", (165, 204), False, 'from numpy.distutils.misc_util import Configuration\n'), ((473, 492), 'numpy.get_include', 'numpy.get_include', ([], {}), '(... |
#!/usr/bin/env python
# Copyright 2011 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | [
"os.path.dirname"
] | [((737, 762), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (752, 762), False, 'import os\n')] |
"""
Defines the blueprint for the users
"""
from flask import Blueprint
from flask_restful import Api
from resources import LoginResource, RegisterResource
USER_BLUEPRINT = Blueprint("user", __name__)
Api(USER_BLUEPRINT).add_resource(
LoginResource, "/login"
)
Api(USER_BLUEPRINT).add_resource(
RegisterResour... | [
"flask.Blueprint",
"flask_restful.Api"
] | [((175, 202), 'flask.Blueprint', 'Blueprint', (['"""user"""', '__name__'], {}), "('user', __name__)\n", (184, 202), False, 'from flask import Blueprint\n'), ((203, 222), 'flask_restful.Api', 'Api', (['USER_BLUEPRINT'], {}), '(USER_BLUEPRINT)\n', (206, 222), False, 'from flask_restful import Api\n'), ((268, 287), 'flask... |
import sys
# 1. Express a solution mathematically: Let's be a Matrix M of (n+1) x (m+1):
# For 0 <= r <= n and 0 <= c <= m, M[r,c] contains the longest path from the source (0, 0) to (r, c)
# M[0 , 0] = 0
# M[0 , c] = M[0 , c - 1] + right[0, c] for 1 <= c <= m
# M[r , 0] = M[r - 1 , 0] + down[r , 0] f... | [
"sys.stdin.readline"
] | [((2060, 2080), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (2078, 2080), False, 'import sys\n'), ((1922, 1942), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (1940, 1942), False, 'import sys\n'), ((1986, 2006), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (2004, 2006)... |
import datetime
import random
from .helpers import answer, question
from .quotes import quotes
def launch():
return question("Was möchtest Du über <NAME> wissen?")
def quote_intent():
quote = random.choice(quotes)
return answer(quote["content"])
def who_intent():
return answer(
"<NAME> is... | [
"datetime.date.today",
"random.choice",
"datetime.date"
] | [((205, 226), 'random.choice', 'random.choice', (['quotes'], {}), '(quotes)\n', (218, 226), False, 'import random\n'), ((902, 923), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (921, 923), False, 'import datetime\n'), ((2047, 2068), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (206... |
import numpy as np
import pandas as pd
import skfuzzy as fuzz
from skfuzzy import control as ctrl
x = ctrl.Antecedent(np.arange(0.0, 2.0), "X")
y = ctrl.Consequent(np.arange(0.0, 2), "Y")
x.automf(names=["pequeno", "médio", "grande"])
y.automf(names=["baixo", "alto"])
regra_1 = ctrl.Rule(antecedent=x["pequeno"], con... | [
"skfuzzy.control.ControlSystemSimulation",
"numpy.random.random",
"skfuzzy.control.ControlSystem",
"skfuzzy.control.Rule",
"numpy.arange"
] | [((282, 356), 'skfuzzy.control.Rule', 'ctrl.Rule', ([], {'antecedent': "x['pequeno']", 'consequent': "y['baixo']", 'label': '"""regra_1"""'}), "(antecedent=x['pequeno'], consequent=y['baixo'], label='regra_1')\n", (291, 356), True, 'from skfuzzy import control as ctrl\n'), ((367, 439), 'skfuzzy.control.Rule', 'ctrl.Rul... |
# Copyright Contributors to the Testing Farm project.
# SPDX-License-Identifier: Apache-2.0
import logging
import re
import six
import bugzilla
import pytest
from mock import MagicMock
import gluetool
from gluetool.utils import load_yaml
from gluetool.log import format_dict
import gluetool_modules_framework.infrast... | [
"bugzilla.execute",
"pytest.mark.parametrize",
"pytest.raises",
"pytest.fixture",
"six.iteritems",
"gluetool.log.format_dict"
] | [((399, 430), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""bugzilla"""'}), "(name='bugzilla')\n", (413, 430), False, 'import pytest\n'), ((1862, 1891), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""module"""'}), "(name='module')\n", (1876, 1891), False, 'import pytest\n'), ((2157, 2202), 'pytest.mark.p... |
"""Test the JupyterClient."""
from __future__ import annotations
from typing import TYPE_CHECKING
import httpx
import pytest
import respx
import structlog
from noteburst.jupyterclient.jupyterlab import (
JupyterClient,
JupyterConfig,
JupyterImageSelector,
)
from noteburst.jupyterclient.user import User
... | [
"structlog.get_logger",
"noteburst.jupyterclient.user.User",
"tests.support.gafaelfawr.mock_gafaelfawr",
"noteburst.jupyterclient.jupyterlab.JupyterConfig",
"httpx.AsyncClient",
"noteburst.jupyterclient.jupyterlab.JupyterClient"
] | [((669, 706), 'noteburst.jupyterclient.user.User', 'User', ([], {'username': '"""someuser"""', 'uid': '"""1234"""'}), "(username='someuser', uid='1234')\n", (673, 706), False, 'from noteburst.jupyterclient.user import User\n'), ((711, 787), 'tests.support.gafaelfawr.mock_gafaelfawr', 'mock_gafaelfawr', ([], {'respx_moc... |
import glob, os
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
def quick_plot(results_file, gauss_width, start, stop, step):
with open(results_file, "r") as results:
results = results.read().split('\n')
results = [float(res) for res in results[:-1]]
eigenenergies = results
gau... | [
"matplotlib.pyplot.grid",
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.fill_between",
"numpy.arange",
"seaborn.set",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.exp",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.ylim",
"glob.glob"... | [((360, 388), 'numpy.arange', 'np.arange', (['start', 'stop', 'step'], {}), '(start, stop, step)\n', (369, 388), True, 'import numpy as np\n'), ((640, 673), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(13.66, 7.68)'}), '(figsize=(13.66, 7.68))\n', (650, 673), True, 'import matplotlib.pyplot as plt\n'), ... |
from flask import Flask
from flask.ext.socketio import SocketIO
from flask.ext.login import LoginManager
from flask.ext.sqlalchemy import SQLAlchemy
import redis
app = Flask(__name__, static_url_path='/static')
app.config.from_pyfile('./config.py')
from config import REDIS_SERVER, REDIS_PORT, REDIS_DB
redis_db = red... | [
"flask.ext.login.LoginManager",
"flask.Flask",
"flask.ext.socketio.SocketIO",
"flask.ext.sqlalchemy.SQLAlchemy",
"redis.StrictRedis"
] | [((169, 211), 'flask.Flask', 'Flask', (['__name__'], {'static_url_path': '"""/static"""'}), "(__name__, static_url_path='/static')\n", (174, 211), False, 'from flask import Flask\n'), ((317, 383), 'redis.StrictRedis', 'redis.StrictRedis', ([], {'host': 'REDIS_SERVER', 'port': 'REDIS_PORT', 'db': 'REDIS_DB'}), '(host=RE... |
from ..tweet_sentiment_classifier import Classifier, tokenizer_filter
import pickle as pkl
import numpy as np
import json
import os
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
from sklearn.model_selection i... | [
"pickle.dump",
"os.makedirs",
"numpy.hstack",
"sklearn.model_selection.train_test_split",
"sklearn.linear_model.LogisticRegression",
"sklearn.feature_extraction.text.TfidfVectorizer",
"sklearn.utils.resample",
"json.dump"
] | [((2678, 2743), 'sklearn.feature_extraction.text.TfidfVectorizer', 'TfidfVectorizer', ([], {'analyzer': 'str.split', 'max_features': 'self.vocab_size'}), '(analyzer=str.split, max_features=self.vocab_size)\n', (2693, 2743), False, 'from sklearn.feature_extraction.text import TfidfVectorizer\n'), ((2908, 2975), 'sklearn... |
import os
import server
import unittest
import tempfile
class FlaskrTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, server.app.config['DATABASE'] = tempfile.mkstemp()
server.app.config['TESTING'] = True
self.app = server.app.test_client()
server.init_db()
def tearDo... | [
"server.init_db",
"server.app.test_client",
"os.close",
"os.unlink",
"unittest.main",
"tempfile.mkstemp"
] | [((603, 618), 'unittest.main', 'unittest.main', ([], {}), '()\n', (616, 618), False, 'import unittest\n'), ((173, 191), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {}), '()\n', (189, 191), False, 'import tempfile\n'), ((255, 279), 'server.app.test_client', 'server.app.test_client', ([], {}), '()\n', (277, 279), False,... |
# Owen's experiment to convert a CSDS to the HF data structure
import datasets
import numpy as np
from transformers import AutoModelForSequenceClassification, AutoTokenizer, Trainer, TrainingArguments
from datasets import Dataset, DatasetDict, ClassLabel, load_metric
# create a CSDS as dict
# First create a mapping ... | [
"datasets.load_metric",
"transformers.TrainingArguments",
"datasets.Dataset.from_dict",
"numpy.argmax",
"transformers.AutoModelForSequenceClassification.from_pretrained",
"datasets.DatasetDict",
"datasets.ClassLabel",
"transformers.AutoTokenizer.from_pretrained",
"transformers.Trainer"
] | [((357, 409), 'datasets.ClassLabel', 'ClassLabel', ([], {'num_classes': '(3)', 'names': "['CB', 'NCB', 'NA']"}), "(num_classes=3, names=['CB', 'NCB', 'NA'])\n", (367, 409), False, 'from datasets import Dataset, DatasetDict, ClassLabel, load_metric\n'), ((3639, 3673), 'datasets.Dataset.from_dict', 'Dataset.from_dict', (... |
import logging
import time
from main.handlers import create_graph_from_path
from main.models import Graph
log = logging.getLogger(__name__)
def create_graph_from_filename(filename):
graph = create_graph_from_path(filename)
state = Graph.State.INITIALIZING
log.info('Initializing graph %d', graph.id)
... | [
"logging.getLogger",
"main.models.Graph.objects.get",
"time.sleep",
"main.handlers.create_graph_from_path",
"main.models.Graph.objects.filter"
] | [((114, 141), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (131, 141), False, 'import logging\n'), ((198, 230), 'main.handlers.create_graph_from_path', 'create_graph_from_path', (['filename'], {}), '(filename)\n', (220, 230), False, 'from main.handlers import create_graph_from_path\n'),... |
from math import floor
class Nullablefloat(float):
def __new__(cls, val, *, is_null=False):
return super().__new__(cls, val)
def __init__(self, val, *, is_null=False):
self.is_null = is_null
def __repr__(self):
return 'null' if self.is_null else super().__repr__()
def neg(se... | [
"math.floor"
] | [((515, 526), 'math.floor', 'floor', (['self'], {}), '(self)\n', (520, 526), False, 'from math import floor\n')] |
"""
Test integrators with simple ODE
dx/dy = 3x^2y given x0 = 1, y0 = 2
ANALYTIC SOLUTION:
y = e^{x^3 + c}, c = ln(2) - 1
y(1,1.1,1.2,1.3,1.4) = [2,2.78471958461639,4.141869187709196,6.6203429951303265,11.440356871885081]
"""
# Import package, test suite, and other packages as needed
import numpy as np
from pycc.rt i... | [
"numpy.array",
"numpy.allclose"
] | [((611, 641), 'numpy.array', 'np.array', (['[y0, y1, y2, y3, y4]'], {}), '([y0, y1, y2, y3, y4])\n', (619, 641), True, 'import numpy as np\n'), ((730, 826), 'numpy.array', 'np.array', (['[2, 2.7846419118859376, 4.141490537335979, 6.618844434974082, \n 11.434686303979237]'], {}), '([2, 2.7846419118859376, 4.141490537... |
# Copyright 2015 OpenStack Foundation
# 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 requ... | [
"nuage_tempest_plugin.lib.topology.Topology.get_conf",
"tempest.test.decorators.attr",
"testtools.matchers.Equals",
"uuid.uuid1",
"netaddr.IPAddress",
"tempest.common.utils.net_utils.get_unused_ip_addresses",
"tempest.lib.common.utils.data_utils.rand_name",
"nuage_tempest_plugin.services.nuage_client.... | [((1270, 1289), 'nuage_tempest_plugin.lib.topology.Topology.get_conf', 'Topology.get_conf', ([], {}), '()\n', (1287, 1289), False, 'from nuage_tempest_plugin.lib.topology import Topology\n'), ((3961, 3990), 'tempest.test.decorators.attr', 'decorators.attr', ([], {'type': '"""smoke"""'}), "(type='smoke')\n", (3976, 3990... |
from typing import Optional
from pisat.util.platform import is_raspberry_pi
from pisat.handler.digital_input_handler_base import DigitalInputHandlerBase
if is_raspberry_pi():
import pigpio
class PigpioDigitalInputHandler(DigitalInputHandlerBase):
def __init__(self,
pi,
... | [
"pisat.util.platform.is_raspberry_pi"
] | [((159, 176), 'pisat.util.platform.is_raspberry_pi', 'is_raspberry_pi', ([], {}), '()\n', (174, 176), False, 'from pisat.util.platform import is_raspberry_pi\n')] |
# system
import os
from enum import Enum
# lib
import numpy as np
class GloVeSize(Enum):
tiny = 50
small = 100
medium = 200
large = 300
__DEFAULT_SIZE = GloVeSize.small
def get_pretrained_embedding_matrix(word_to_index,
vocab_size=10000,
... | [
"numpy.random.normal",
"os.path.exists",
"os.makedirs",
"os.path.join",
"numpy.asarray",
"os.path.isfile",
"numpy.load",
"numpy.save"
] | [((1503, 1572), 'os.path.join', 'os.path.join', (['cache_dir', "('glove_%d_embedding_matrix.npy' % size.value)"], {}), "(cache_dir, 'glove_%d_embedding_matrix.npy' % size.value)\n", (1515, 1572), False, 'import os\n'), ((1427, 1452), 'os.path.exists', 'os.path.exists', (['cache_dir'], {}), '(cache_dir)\n', (1441, 1452)... |
import numpy as np
arr = np.array([[2, 5], [1, 3]])
arr_inv = np.linalg.inv(arr)
print(arr_inv)
# [[ 3. -5.]
# [-1. 2.]]
mat = np.matrix([[2, 5], [1, 3]])
mat_inv = np.linalg.inv(mat)
print(mat_inv)
# [[ 3. -5.]
# [-1. 2.]]
mat_inv = mat**-1
print(mat_inv)
# [[ 3. -5.]
# [-1. 2.]]
mat_inv = mat.I
print(mat_... | [
"numpy.mat",
"numpy.linalg.pinv",
"numpy.array",
"numpy.linalg.inv",
"numpy.matrix"
] | [((26, 52), 'numpy.array', 'np.array', (['[[2, 5], [1, 3]]'], {}), '([[2, 5], [1, 3]])\n', (34, 52), True, 'import numpy as np\n'), ((64, 82), 'numpy.linalg.inv', 'np.linalg.inv', (['arr'], {}), '(arr)\n', (77, 82), True, 'import numpy as np\n'), ((132, 159), 'numpy.matrix', 'np.matrix', (['[[2, 5], [1, 3]]'], {}), '([... |
# *****************************************************************************
#
# 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
#
# ... | [
"jpype.JImplementationFor",
"common.JPypeTestCase.setUp",
"jpype.JClass",
"jpype.JOverride"
] | [((987, 1019), 'common.JPypeTestCase.setUp', 'common.JPypeTestCase.setUp', (['self'], {}), '(self)\n', (1013, 1019), False, 'import common\n'), ((1112, 1156), 'jpype.JImplementationFor', 'jpype.JImplementationFor', (['"""jpype.override.A"""'], {}), "('jpype.override.A')\n", (1136, 1156), False, 'import jpype\n'), ((130... |
import os
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import logging
class Email(object):
def __init__(self):
self.user = os.getenv('SMTP_USER')
self.password = os.getenv('SMTP_PWD')
self.host = os.getenv('SMTP_HOST') or 'smtp.%s' % se... | [
"smtplib.SMTP",
"os.getenv",
"smtplib.SMTP_SSL",
"logging.exception",
"os.path.isfile",
"email.mime.multipart.MIMEMultipart",
"os.path.basename",
"email.mime.text.MIMEText"
] | [((191, 213), 'os.getenv', 'os.getenv', (['"""SMTP_USER"""'], {}), "('SMTP_USER')\n", (200, 213), False, 'import os\n'), ((238, 259), 'os.getenv', 'os.getenv', (['"""SMTP_PWD"""'], {}), "('SMTP_PWD')\n", (247, 259), False, 'import os\n'), ((363, 385), 'os.getenv', 'os.getenv', (['"""SMTP_PORT"""'], {}), "('SMTP_PORT')\... |
from flask import render_template, flash, redirect, url_for, request
from flask_login import login_user, logout_user, current_user, login_required
from werkzeug.urls import url_parse
from app import app, db
from app.models import User
from app.util import get_movie_info_min, get_movie_info, predict, set_preferences, ge... | [
"flask.render_template",
"flask.request.args.get",
"app.db.session.commit",
"app.models.User",
"app.util.get_preferences",
"app.db.session.add",
"pandas.read_sql_query",
"flask.flash",
"app.app.route",
"random.randint",
"app.util.get_movie_info",
"app.forms.RegistrationForm",
"random.sample"... | [((513, 527), 'app.app.route', 'app.route', (['"""/"""'], {}), "('/')\n", (522, 527), False, 'from app import app, db\n'), ((783, 819), 'app.app.route', 'app.route', (['"""/movie"""'], {'methods': "['GET']"}), "('/movie', methods=['GET'])\n", (792, 819), False, 'from app import app, db\n'), ((1142, 1162), 'app.app.rout... |