code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
class DistributedPlantBaseAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedPlantBaseAI')
| [
"direct.directnotify.DirectNotifyGlobal.directNotify.newCategory"
] | [((187, 256), 'direct.directnotify.DirectNotifyGlobal.directNotify.newCategory', 'DirectNotifyGlobal.directNotify.newCategory', (['"""DistributedPlantBaseAI"""'], {}), "('DistributedPlantBaseAI')\n", (230, 256), False, 'from direct.directnotify import DirectNotifyGlobal\n')] |
from setuptools import setup
from pathlib import Path
from typing import Dict
HERE = Path(__file__).parent
version: Dict[str, str] = {}
version_file = HERE / "src" / "thermostate" / "_version.py"
exec(version_file.read_text(), version)
setup(version=version["__version__"], package_dir={"": "src"})
| [
"setuptools.setup",
"pathlib.Path"
] | [((239, 301), 'setuptools.setup', 'setup', ([], {'version': "version['__version__']", 'package_dir': "{'': 'src'}"}), "(version=version['__version__'], package_dir={'': 'src'})\n", (244, 301), False, 'from setuptools import setup\n'), ((86, 100), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (90, 100), Fa... |
# (c) 2018, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
from __future__ import (absolute_import, division, p... | [
"ansible.module_utils.six.iteritems"
] | [((2284, 2296), 'ansible.module_utils.six.iteritems', 'iteritems', (['u'], {}), '(u)\n', (2293, 2296), False, 'from ansible.module_utils.six import iteritems, string_types\n'), ((937, 952), 'ansible.module_utils.six.iteritems', 'iteritems', (['data'], {}), '(data)\n', (946, 952), False, 'from ansible.module_utils.six i... |
from Redy.Opt import feature, constexpr
import timeit
class Closure(tuple):
def __call__(self, a):
c, f = self
return f(c, a)
def f1(x):
def g(y):
return x + y
return g
def fc(c, y):
return c + y
@feature(constexpr)
def f2(x):
return constexpr[Closure]((x, constexpr[... | [
"Redy.Opt.feature"
] | [((246, 264), 'Redy.Opt.feature', 'feature', (['constexpr'], {}), '(constexpr)\n', (253, 264), False, 'from Redy.Opt import feature, constexpr\n')] |
"""AI is creating summary for
"""
from frontend import main_window
from PyQt5 import QtWidgets
from frontend import input_system
from PyQt5.QtWidgets import QInputDialog, qApp
from qt_material import apply_stylesheet
style_sheets = ['dark_amber.xml',
'dark_blue.xml',
'dark_cyan.xml',
... | [
"qt_material.apply_stylesheet",
"PyQt5.QtWidgets.QMainWindow",
"frontend.main_window.Ui_MainWindow",
"frontend.input_system.Ui_input_system"
] | [((1257, 1284), 'frontend.main_window.Ui_MainWindow', 'main_window.Ui_MainWindow', ([], {}), '()\n', (1282, 1284), False, 'from frontend import main_window\n'), ((3756, 3779), 'PyQt5.QtWidgets.QMainWindow', 'QtWidgets.QMainWindow', ([], {}), '()\n', (3777, 3779), False, 'from PyQt5 import QtWidgets\n'), ((3798, 3828), ... |
import mss
import numpy as np
from PIL import Image
from config import BOARD_HEIGHT, BOARD_WIDTH
CELL_SIZE = 22
BOARD_X = 14
BOARD_Y = 111
COLOR_CODES = {
(0, 0, 255): 1,
(0, 123, 0): 2,
(255, 0, 0): 3,
(0, 0, 123): 4,
(123, 0, 0): 5,
(0, 123, 123): 6,
(0, 0, 0): 7,
(123, 123, 123): 8,
(189, 189, 189): 0 #uno... | [
"numpy.insert",
"numpy.reshape",
"mss.mss",
"numpy.full",
"PIL.Image.frombytes"
] | [((1163, 1209), 'numpy.reshape', 'np.reshape', (['cells', '(BOARD_HEIGHT, BOARD_WIDTH)'], {}), '(cells, (BOARD_HEIGHT, BOARD_WIDTH))\n', (1173, 1209), True, 'import numpy as np\n'), ((617, 626), 'mss.mss', 'mss.mss', ([], {}), '()\n', (624, 626), False, 'import mss\n'), ((684, 755), 'PIL.Image.frombytes', 'Image.fromby... |
from django.apps import AppConfig
from django.db.models.signals import post_migrate
from django.utils.translation import gettext_lazy as _
class SitesConfig(AppConfig):
name = 'src.base'
verbose_name = _("Modulo de Frontend")
| [
"django.utils.translation.gettext_lazy"
] | [((212, 235), 'django.utils.translation.gettext_lazy', '_', (['"""Modulo de Frontend"""'], {}), "('Modulo de Frontend')\n", (213, 235), True, 'from django.utils.translation import gettext_lazy as _\n')] |
from sqlalchemy import MetaData, Table, Index, Column, Integer
meta = MetaData()
def upgrade(migrate_engine):
meta = MetaData(bind=migrate_engine)
upload = Table("upload", meta, autoload=True)
uploader_id = Column("uploader_id", Integer)
uploader_id.create(upload)
idx_upload_uploader_id = Index... | [
"sqlalchemy.MetaData",
"sqlalchemy.Column",
"sqlalchemy.Table",
"sqlalchemy.Index"
] | [((71, 81), 'sqlalchemy.MetaData', 'MetaData', ([], {}), '()\n', (79, 81), False, 'from sqlalchemy import MetaData, Table, Index, Column, Integer\n'), ((124, 153), 'sqlalchemy.MetaData', 'MetaData', ([], {'bind': 'migrate_engine'}), '(bind=migrate_engine)\n', (132, 153), False, 'from sqlalchemy import MetaData, Table, ... |
#!/usr/bin/env python
"""
Subrequests to do things like range requests, content negotiation checks,
and validation.
This is the base class for all subrequests.
"""
from abc import ABCMeta, abstractmethod
from configparser import SectionProxy
from typing import List, Tuple, Type, Union, TYPE_CHECKING
from redbot.res... | [
"redbot.resource.fetch.RedFetcher.check",
"redbot.resource.fetch.RedFetcher.__init__",
"redbot.resource.fetch.RedFetcher.set_request"
] | [((1004, 1037), 'redbot.resource.fetch.RedFetcher.__init__', 'RedFetcher.__init__', (['self', 'config'], {}), '(self, config)\n', (1023, 1037), False, 'from redbot.resource.fetch import RedFetcher\n'), ((1549, 1676), 'redbot.resource.fetch.RedFetcher.set_request', 'RedFetcher.set_request', (['self', 'self.base.request.... |
import numpy
N,M,P = map(int,input().split())
p_cols1 =numpy.array([input().split() for _ in range(N)],int)
p_cols1.shape = (N,P)
p_cols2 =numpy.array([input().split() for _ in range(M)],int)
p_cols2.shape = (M,P)
concatenated = numpy.concatenate((p_cols1, p_cols2), axis = 0)
print(concatenated)
| [
"numpy.concatenate"
] | [((232, 277), 'numpy.concatenate', 'numpy.concatenate', (['(p_cols1, p_cols2)'], {'axis': '(0)'}), '((p_cols1, p_cols2), axis=0)\n', (249, 277), False, 'import numpy\n')] |
# GCT634 (2018) HW1
#
# Mar-18-2018: initial version
#
# <NAME>
#
import sys
import os
import numpy as np
import matplotlib.pyplot as plt
data_path = './dataset/'
mfcc_path = './mfcc/'
MFCC_DIM = 20
def mean_mfcc(dataset='train'):
f = open(data_path + dataset + '_list.txt','r')
if dataset == 'train'... | [
"matplotlib.pyplot.imshow",
"numpy.mean",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.figure",
"numpy.zeros",
"numpy.load",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show"
] | [((941, 954), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {}), '(1)\n', (951, 954), True, 'import matplotlib.pyplot as plt\n'), ((959, 979), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(2)', '(1)', '(1)'], {}), '(2, 1, 1)\n', (970, 979), True, 'import matplotlib.pyplot as plt\n'), ((982, 1060), 'matplotlib.p... |
"""
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 use this ... | [
"yarn.yarn",
"service.service"
] | [((1069, 1097), 'yarn.yarn', 'yarn', ([], {'name': '"""resourcemanager"""'}), "(name='resourcemanager')\n", (1073, 1097), False, 'from yarn import yarn\n'), ((1212, 1254), 'service.service', 'service', (['"""resourcemanager"""'], {'action': '"""start"""'}), "('resourcemanager', action='start')\n", (1219, 1254), False, ... |
# 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 under the Li... | [
"mock.Mock",
"manilaclient.common.httpclient.HTTPClient",
"manilaclient.tests.unit.utils.TestResponse",
"mock.patch.object"
] | [((754, 821), 'manilaclient.tests.unit.utils.TestResponse', 'utils.TestResponse', (['{\'status_code\': 200, \'text\': \'{"hi": "there"}\'}'], {}), '({\'status_code\': 200, \'text\': \'{"hi": "there"}\'})\n', (772, 821), False, 'from manilaclient.tests.unit import utils\n'), ((848, 885), 'mock.Mock', 'mock.Mock', ([], {... |
import picamera
from time import sleep
IMG_WIDTH = 800
IMG_HEIGHT = 600
IMAGE_DIR = "/home/pi/Desktop/"
IMG = "snap.jpg"
def vid():
camera = picamera.PiCamera()
camera.vflip = True
camera.hflip = True
camera.brightness = 60
#camera.resolution = (IMG_WIDTH, IMG_HEIGHT)
camera.start_prev... | [
"picamera.PiCamera",
"time.sleep"
] | [((150, 169), 'picamera.PiCamera', 'picamera.PiCamera', ([], {}), '()\n', (167, 169), False, 'import picamera\n'), ((445, 453), 'time.sleep', 'sleep', (['(5)'], {}), '(5)\n', (450, 453), False, 'from time import sleep\n')] |
#!/usr/bin/env python
# Copyright 2017 ARC Centre of Excellence for Climate Systems Science
# author: <NAME> <<EMAIL>>
#
# 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.apa... | [
"os.stat",
"os.path.splitext",
"os.path.isfile",
"datetime.datetime.now",
"os.path.basename",
"os.path.abspath",
"flask_sqlalchemy.SQLAlchemy"
] | [((792, 804), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (802, 804), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((1617, 1642), 'os.path.abspath', 'os.path.abspath', (['filename'], {}), '(filename)\n', (1632, 1642), False, 'import os\n'), ((1725, 1742), 'os.stat', 'os.stat', (['filename'], ... |
from src.books.models import Book
from src.books.schema import BookOut
from ninja import Router
router = Router()
@router.get("/", response=list[BookOut])
def get_books(request):
return Book.objects.all()
| [
"ninja.Router",
"src.books.models.Book.objects.all"
] | [((107, 115), 'ninja.Router', 'Router', ([], {}), '()\n', (113, 115), False, 'from ninja import Router\n'), ((194, 212), 'src.books.models.Book.objects.all', 'Book.objects.all', ([], {}), '()\n', (210, 212), False, 'from src.books.models import Book\n')] |
# generated by datamodel-codegen:
# filename: Organization.schema.json
# timestamp: 1985-10-26T08:21:00+00:00
from __future__ import annotations
from pydantic import BaseModel, Field
class Schema(BaseModel):
__root__: str = Field(..., description='Identifier string of this object.')
| [
"pydantic.Field"
] | [((237, 296), 'pydantic.Field', 'Field', (['...'], {'description': '"""Identifier string of this object."""'}), "(..., description='Identifier string of this object.')\n", (242, 296), False, 'from pydantic import BaseModel, Field\n')] |
import json
from typing import Union, Optional, Tuple, List
import numpy as np
from sklearn.feature_extraction import DictVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer, TfidfTransformer
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import Stan... | [
"sklearn.feature_extraction.text.TfidfTransformer",
"json.loads",
"sklearn.feature_extraction.DictVectorizer",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.StandardScaler",
"numpy.array"
] | [((870, 886), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (884, 886), False, 'from sklearn.preprocessing import StandardScaler\n'), ((3031, 3104), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'train_size': 'split_1', 'random_state': 'self.random_seed'}), ... |
#!/usr/bin/python
#Sorts based on top 50 CMetric, all callPaths - CMetric
#, all call paths - call path count and all samples
from __future__ import print_function
from bcc import BPF, PerfType, PerfSWConfig
from bcc import BPF
import sys
import ctypes as ct # For mapping the 'C' structure to Python
import argparse #... | [
"subprocess.check_output",
"ctypes.POINTER",
"argparse.ArgumentParser",
"argparse.ArgumentTypeError",
"datetime.datetime.now",
"os.path.basename",
"sys.exit",
"bcc.BPF"
] | [((845, 938), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generates stack traces for critical code sections"""'}), "(description=\n 'Generates stack traces for critical code sections')\n", (868, 938), False, 'import argparse\n'), ((15910, 15928), 'bcc.BPF', 'BPF', ([], {'text': 'bp... |
# -*- coding: utf-8 -*-
import random
import numpy as np
import scipy
import pandas as pd
import pandas
import numpy
import json
def resizeFeature(inputData,newSize):
# inputX: (temporal_length,feature_dimension) #
originalSize=len(inputData)
#print originalSize
if originalSize==1:
inputData=... | [
"numpy.mean",
"numpy.reshape",
"random.shuffle",
"pandas.read_csv",
"scipy.interpolate.interp1d",
"json.load",
"numpy.stack",
"numpy.zeros",
"numpy.max",
"numpy.concatenate",
"pandas.DataFrame",
"json.dump"
] | [((3780, 3809), 'random.shuffle', 'random.shuffle', (['videoNameList'], {}), '(videoNameList)\n', (3794, 3809), False, 'import random\n'), ((4440, 4469), 'json.dump', 'json.dump', (['videoDict', 'outfile'], {}), '(videoDict, outfile)\n', (4449, 4469), False, 'import json\n'), ((437, 485), 'scipy.interpolate.interp1d', ... |
import atexit
import sqlite3
import traceback
#################
import sys
sys.path.append('/app')
from helper import *
settings_dict = load_yaml_dict(read_file("/Settings.yaml"))
conn = sqlite3.connect(f"/database/{settings_dict['db_name']}", isolation_level=None, detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_C... | [
"traceback.format_exc",
"sys.path.append",
"sqlite3.connect",
"atexit.register"
] | [((75, 98), 'sys.path.append', 'sys.path.append', (['"""/app"""'], {}), "('/app')\n", (90, 98), False, 'import sys\n'), ((189, 335), 'sqlite3.connect', 'sqlite3.connect', (['f"""/database/{settings_dict[\'db_name\']}"""'], {'isolation_level': 'None', 'detect_types': '(sqlite3.PARSE_DECLTYPES | sqlite3.PARSE_COLNAMES)'}... |
#!/usr/bin/env python3
"""
example.py
Example of using pypahdb to decompose an astronomical PAH spectrum.
"""
import pkg_resources
from pypahdb.decomposer import Decomposer
from pypahdb.observation import Observation
if __name__ == '__main__':
# The sample data (IPAC table).
file_path = 'resources/sample_... | [
"pypahdb.observation.Observation",
"pypahdb.decomposer.Decomposer",
"pkg_resources.resource_filename"
] | [((354, 407), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""pypahdb"""', 'file_path'], {}), "('pypahdb', file_path)\n", (385, 407), False, 'import pkg_resources\n'), ((458, 480), 'pypahdb.observation.Observation', 'Observation', (['data_file'], {}), '(data_file)\n', (469, 480), False, 'fro... |
#!/usr/bin/env python3
# Copyright (c) 2021 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the -uaclientname and -uaclientversion option."""
import re
from test_framework.test_framework import Bitc... | [
"re.escape"
] | [((3606, 3629), 're.escape', 're.escape', (['invalid_char'], {}), '(invalid_char)\n', (3615, 3629), False, 'import re\n'), ((3938, 3961), 're.escape', 're.escape', (['invalid_char'], {}), '(invalid_char)\n', (3947, 3961), False, 'import re\n'), ((4260, 4283), 're.escape', 're.escape', (['invalid_char'], {}), '(invalid_... |
# Copyright (c) 2017 Fujitsu Limited
# 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 requi... | [
"mock.patch",
"mock.Mock",
"neutron.services.logapi.rpc.server.LoggingApiNotification",
"neutron.services.logapi.rpc.server.LoggingApiSkeleton",
"oslo_messaging.Target"
] | [((1316, 1393), 'mock.patch', 'mock.patch', (['"""neutron.api.rpc.handlers.resources_rpc.ResourcesPushRpcApi.push"""'], {}), "('neutron.api.rpc.handlers.resources_rpc.ResourcesPushRpcApi.push')\n", (1326, 1393), False, 'import mock\n'), ((1715, 1792), 'mock.patch', 'mock.patch', (['"""neutron.api.rpc.handlers.resources... |
""" Unit Tests for Service Patch
"""
# Copyright (c) 2021 ipyradiant contributors.
# Distributed under the terms of the Modified BSD License.
import ipyradiant
import rdflib
LINKEDDATA_QUERY = """
SELECT DISTINCT ?s ?p ?o
WHERE {
SERVICE <http://linkeddata.uriburner.com/sparql>
{
... | [
"ipyradiant.service_patch_rdflib"
] | [((699, 748), 'ipyradiant.service_patch_rdflib', 'ipyradiant.service_patch_rdflib', (['LINKEDDATA_QUERY'], {}), '(LINKEDDATA_QUERY)\n', (730, 748), False, 'import ipyradiant\n')] |
# Created by Kelvin_Clark on 3/5/2022, 6:37 PM
from typing import Optional
from src.models.entities.user import User
from src import database as db
class UserDao:
@staticmethod
def get_user_by_email(email: str) -> Optional[User]:
return User.query.filter_by(email=email).first()
@staticmethod
... | [
"src.database.session.refresh",
"src.database.session.add",
"src.models.entities.user.User.query.filter_by",
"src.database.session.commit"
] | [((635, 655), 'src.database.session.add', 'db.session.add', (['user'], {}), '(user)\n', (649, 655), True, 'from src import database as db\n'), ((664, 683), 'src.database.session.commit', 'db.session.commit', ([], {}), '()\n', (681, 683), True, 'from src import database as db\n'), ((692, 716), 'src.database.session.refr... |
from rdflib import Graph
import json
import glob
books = {}
rdf_files = glob.glob("gutindex/cache/epub/*/*.rdf")
i = 1
for rdf_file in rdf_files:
g = Graph()
g.parse(rdf_file)
for s,p,o in g:
if 'title' in p:
books[str(o)] = str(s)
print(i, str(o))
i+=1
with open("g... | [
"rdflib.Graph",
"json.dump",
"glob.glob"
] | [((74, 114), 'glob.glob', 'glob.glob', (['"""gutindex/cache/epub/*/*.rdf"""'], {}), "('gutindex/cache/epub/*/*.rdf')\n", (83, 114), False, 'import glob\n'), ((156, 163), 'rdflib.Graph', 'Graph', ([], {}), '()\n', (161, 163), False, 'from rdflib import Graph\n'), ((357, 376), 'json.dump', 'json.dump', (['books', 'f'], {... |
"""
This tool compares measured data (observed) with model outputs (predicted), used in procedures of calibration and validation
"""
from __future__ import division
from __future__ import print_function
import os
from math import sqrt
import pandas as pd
from sklearn.metrics import mean_squared_error as calc_mean_squar... | [
"os.path.exists",
"math.sqrt",
"sklearn.metrics.mean_squared_error",
"os.path.basename",
"pandas.DataFrame",
"pandas.to_datetime"
] | [((7356, 7442), 'sklearn.metrics.mean_squared_error', 'calc_mean_squared_error', (["monthly_data['measurements']", "monthly_data[load + '_kWh']"], {}), "(monthly_data['measurements'], monthly_data[load +\n '_kWh'])\n", (7379, 7442), True, 'from sklearn.metrics import mean_squared_error as calc_mean_squared_error\n')... |
#! /usr/bin/env python
from __future__ import absolute_import
import os
import sys
PROJECT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.append(PROJECT_DIR)
sys.path.append(os.path.abspath(os.path.join(PROJECT_DIR, "app")))
if __name__ == "__main__":
from app.main import Mai... | [
"os.path.join",
"os.path.dirname",
"sys.path.append",
"app.main.Main"
] | [((168, 196), 'sys.path.append', 'sys.path.append', (['PROJECT_DIR'], {}), '(PROJECT_DIR)\n', (183, 196), False, 'import sys\n'), ((129, 154), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (144, 154), False, 'import os\n'), ((229, 261), 'os.path.join', 'os.path.join', (['PROJECT_DIR', '"""ap... |
import click
from kryptos.scripts import build_strategy, stress_worker, kill_strat
@click.group(name="strat")
def cli():
pass
cli.add_command(build_strategy.run, "build")
cli.add_command(stress_worker.run, "stress")
cli.add_command(kill_strat.run, "kill")
| [
"click.group"
] | [((86, 111), 'click.group', 'click.group', ([], {'name': '"""strat"""'}), "(name='strat')\n", (97, 111), False, 'import click\n')] |
#!/usr/bin/env python3
"""Radio scheduling program.
Usage:
album_times.py [--host=HOST] PORT
Options:
--host=HOST Hostname of MPD [default: localhost]
-h --help Show this text
Prints out the last scheduling time of every album.
"""
from datetime import datetime
from docopt import docopt
from mpd import M... | [
"datetime.datetime.utcfromtimestamp",
"docopt.docopt",
"mpd.MPDClient"
] | [((1971, 1986), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (1977, 1986), False, 'from docopt import docopt\n'), ((1758, 1799), 'datetime.datetime.utcfromtimestamp', 'datetime.utcfromtimestamp', (['last_scheduled'], {}), '(last_scheduled)\n', (1783, 1799), False, 'from datetime import datetime\n'), ((2... |
import argparse
from cartografo import DEFAULT_OBJECT, DEFAULT_TARGET
def __get_argparser():
__parser.add_argument('--k8s-object', help='Output Kubernetes objet: secrets or configmap')
__parser.add_argument('--target', help='Target file. If it exists, it will be modified')
__parser.add_argument('files_fo... | [
"argparse.ArgumentParser"
] | [((382, 407), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (405, 407), False, 'import argparse\n')] |
#!/usr/bin/env python
# This is not an officially supported Google product, though support
# will be provided on a best-effort basis.
# Copyright 2018 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License"); you
# may not use this file except in compliance with the License.
# You may obtain a co... | [
"ujson.dumps",
"utilities.dbExecution",
"webapp2.WSGIApplication"
] | [((1434, 1495), 'webapp2.WSGIApplication', 'webapp2.WSGIApplication', (["[('/toggleIndex', main)]"], {'debug': '(True)'}), "([('/toggleIndex', main)], debug=True)\n", (1457, 1495), False, 'import webapp2\n'), ((1221, 1259), 'utilities.dbExecution', 'utilities.dbExecution', (['sqlCmd', 'sqlData'], {}), '(sqlCmd, sqlData... |
import os
from bs4 import BeautifulSoup
import html2text
import pandas
data_dir = 'co2-coalition'
data_text_dir = os.path.join(data_dir, 'text')
data_file_name = 'co2-coalition.csv'
def make_file_name(index):
return f'{index:02d}'
def save_text(data_dir, file_path, content):
f = open(os.path.join(data_dir, file... | [
"bs4.BeautifulSoup",
"html2text.HTML2Text",
"os.path.join",
"pandas.DataFrame"
] | [((116, 146), 'os.path.join', 'os.path.join', (['data_dir', '"""text"""'], {}), "(data_dir, 'text')\n", (128, 146), False, 'import os\n'), ((557, 578), 'html2text.HTML2Text', 'html2text.HTML2Text', ([], {}), '()\n', (576, 578), False, 'import html2text\n'), ((719, 756), 'bs4.BeautifulSoup', 'BeautifulSoup', (['content'... |
"""Test functions for FOOOF analysis."""
import numpy as np
from fooof.analysis import *
###################################################################################################
###################################################################################################
def test_get_band_peak_fm(t... | [
"numpy.array",
"numpy.empty",
"numpy.array_equal"
] | [((507, 564), 'numpy.array', 'np.array', (['[[10, 1, 1.8, 0], [13, 1, 2, 2], [14, 2, 4, 2]]'], {}), '([[10, 1, 1.8, 0], [13, 1, 2, 2], [14, 2, 4, 2]])\n', (515, 564), True, 'import numpy as np\n'), ((658, 698), 'numpy.array_equal', 'np.array_equal', (['out1[0, :]', '[10, 1, 1.8]'], {}), '(out1[0, :], [10, 1, 1.8])\n', ... |
import math
# The code is based on from http://www.cs.cmu.edu/~ckingsf/class/02713-s13/src/mst.py
# Heap item
class HeapItem(object):
"""Represents an item in the heap"""
def __init__(self, key, value):
self.key = key
self.pos = None
self.value = value
# d-ary Heap
cl... | [
"math.ceil"
] | [((2177, 2203), 'math.ceil', 'math.ceil', (['(pos / self.dary)'], {}), '(pos / self.dary)\n', (2186, 2203), False, 'import math\n')] |
#!/usr/bin/env python
# coding: utf-8
# In[5]:
import cv2
import numpy as np
imagen = cv2.imread('wheel.png')
gray = cv2.cvtColor(imagen,cv2.COLOR_BGR2GRAY)
_,th = cv2.threshold(gray,100,255,cv2.THRESH_BINARY)
#Para versiones OpenCV3:
img1,contornos1,hierarchy1 = cv2.findContours(th, cv2.RETR_EXTERNAL,cv2.CHAIN_AP... | [
"cv2.drawContours",
"cv2.threshold",
"cv2.imshow",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.cvtColor",
"cv2.findContours",
"cv2.imread"
] | [((90, 113), 'cv2.imread', 'cv2.imread', (['"""wheel.png"""'], {}), "('wheel.png')\n", (100, 113), False, 'import cv2\n'), ((121, 161), 'cv2.cvtColor', 'cv2.cvtColor', (['imagen', 'cv2.COLOR_BGR2GRAY'], {}), '(imagen, cv2.COLOR_BGR2GRAY)\n', (133, 161), False, 'import cv2\n'), ((168, 216), 'cv2.threshold', 'cv2.thresho... |
from django import forms
class URLForm(forms.Form):
siteUrl = forms.CharField(label='Website Address', max_length=100,required=True)
'''
javascriptChoices = ((2,"Keep Javascript",),(1,"Remove Some Javascript"),(0,"Remove All Javascript"))
keepJavascript = forms.ChoiceField(choices=javascriptChoices,label="... | [
"django.forms.CharField"
] | [((67, 138), 'django.forms.CharField', 'forms.CharField', ([], {'label': '"""Website Address"""', 'max_length': '(100)', 'required': '(True)'}), "(label='Website Address', max_length=100, required=True)\n", (82, 138), False, 'from django import forms\n')] |
from flexmeasures.app import create as create_app
application = create_app()
| [
"flexmeasures.app.create"
] | [((65, 77), 'flexmeasures.app.create', 'create_app', ([], {}), '()\n', (75, 77), True, 'from flexmeasures.app import create as create_app\n')] |
import numpy as np
import unittest
import coremltools.models.datatypes as datatypes
from coremltools.models import neural_network as neural_network
from coremltools.models import MLModel
from coremltools.models.neural_network.printer import print_network_spec
from coremltools.converters.nnssa.coreml.graph_pass.mlmodel_... | [
"coremltools.models.MLModel",
"coremltools.converters.nnssa.coreml.graph_pass.mlmodel_passes.transform_conv_crop",
"unittest.TestSuite",
"numpy.random.rand",
"numpy.ones",
"coremltools.converters.nnssa.coreml.graph_pass.mlmodel_passes.remove_disconnected_layers",
"numpy.testing.assert_almost_equal",
"... | [((462, 481), 'numpy.random.seed', 'np.random.seed', (['(100)'], {}), '(100)\n', (476, 481), True, 'import numpy as np\n'), ((691, 797), 'coremltools.models.neural_network.NeuralNetworkBuilder', 'neural_network.NeuralNetworkBuilder', (['input_features', 'output_features'], {'disable_rank5_shape_mapping': '(True)'}), '(... |
# Generated by Django 2.1.7 on 2019-04-03 11:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('accounting_tech', '0017_auto_20190403_1434'),
]
operations = [
migrations.AlterField(
model_nam... | [
"django.db.models.ForeignKey"
] | [((398, 565), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'db_column': '"""inventory_number"""', 'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'to': '"""accounting_tech.Equipment"""', 'verbose_name': '"""ИНВ №"""'}), "(db_column='inventory_number', null=True, on_delete=django\n .... |
from unittest import TestCase
from parameterized import parameterized
from scheduling.schedule_config import ScheduleConfig
from utils import date_utils
def to_datetime(short_datetime_string):
dt_string = short_datetime_string + ':0.000000Z'
return date_utils.parse_iso_datetime(dt_string.replace(' ', 'T'))
... | [
"parameterized.parameterized.expand"
] | [((360, 9252), 'parameterized.parameterized.expand', 'parameterized.expand', (["[('2020-03-19 11:30', '2020-03-15 16:13', 1, 'days', '2020-03-19 16:13'), (\n '2020-03-19 17:30', '2020-03-15 16:13', 1, 'days', '2020-03-20 16:13'),\n ('2020-03-15 11:30', '2020-03-15 16:13', 1, 'days', '2020-03-15 16:13'),\n ('20... |
from http import HTTPStatus
from unittest import TestCase, mock
import jwt
from fastapi.testclient import TestClient
from src.api.review_resource import REVIEWS
from src.config import config
from src.main import app
from src.models.article import Article
from src.models.review import Review
def _bearer(**payload):
... | [
"fastapi.testclient.TestClient",
"src.models.review.Review",
"src.models.article.Article",
"unittest.mock.patch",
"jwt.encode"
] | [((1747, 1838), 'src.models.article.Article', 'Article', ([], {'barcode': '"""8400000000017"""', 'description': '"""Mock most rated article"""', 'retailPrice': '(30)'}), "(barcode='8400000000017', description='Mock most rated article',\n retailPrice=30)\n", (1754, 1838), False, 'from src.models.article import Articl... |
import json
sequence_name_list = ['A','G','L','map2photo','S']
description_list = ['Viewpoint Appearance','Viewpoint','ViewPoint Lighting','Map to Photo','Modality']
label_list = [
['arch', 'obama', 'vprice0', 'vprice1', 'vprice2', 'yosemite'],
['adam', 'boat','ExtremeZoomA','face','fox','graf','mag','... | [
"json.dump"
] | [((2312, 2353), 'json.dump', 'json.dump', (['json_data', 'json_file'], {'indent': '(2)'}), '(json_data, json_file, indent=2)\n', (2321, 2353), False, 'import json\n')] |
"""Module which implements various types of projections."""
from typing import List, Callable
import tensorflow as tf
from neuralmonkey.nn.utils import dropout
def maxout(inputs: tf.Tensor,
size: int,
scope: str = "MaxoutProjection") -> tf.Tensor:
"""Apply a maxout operation.
Implementa... | [
"tensorflow.nn.max_pool",
"tensorflow.variable_scope",
"tensorflow.reshape",
"tensorflow.layers.dense",
"neuralmonkey.nn.utils.dropout"
] | [((801, 825), 'tensorflow.variable_scope', 'tf.variable_scope', (['scope'], {}), '(scope)\n', (818, 825), True, 'import tensorflow as tf\n'), ((847, 892), 'tensorflow.layers.dense', 'tf.layers.dense', (['inputs', '(size * 2)'], {'name': 'scope'}), '(inputs, size * 2, name=scope)\n', (862, 892), True, 'import tensorflow... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-06-16 15:12
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('photos', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_... | [
"django.db.migrations.DeleteModel",
"django.db.migrations.RemoveField"
] | [((278, 343), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""image"""', 'name': '"""image_category"""'}), "(model_name='image', name='image_category')\n", (300, 343), False, 'from django.db import migrations\n'), ((388, 453), 'django.db.migrations.RemoveField', 'migrations.RemoveF... |
import time, datetime, argparse
import os, sys
import numpy as np
np.set_printoptions(precision=2)
import matplotlib.pyplot as plt
import copy as cp
import pickle
PROJECT_PATH = '/home/nbuckman/Dropbox (MIT)/DRL/2020_01_cooperative_mpc/mpc-multiple-vehicles/'
sys.path.append(PROJECT_PATH)
import casadi as cas
import ... | [
"src.IterativeBestResponseMPCMultiple.save_state",
"matplotlib.pyplot.ylabel",
"src.TrafficWorld.TrafficWorld",
"numpy.array",
"copy.deepcopy",
"sys.path.append",
"src.IterativeBestResponseMPCMultiple.IterativeBestResponseMPCMultiple",
"matplotlib.pyplot.plot",
"numpy.random.seed",
"src.MPC_Casadi... | [((66, 98), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(2)'}), '(precision=2)\n', (85, 98), True, 'import numpy as np\n'), ((261, 290), 'sys.path.append', 'sys.path.append', (['PROJECT_PATH'], {}), '(PROJECT_PATH)\n', (276, 290), False, 'import os, sys\n'), ((1477, 1504), 'src.TrafficWorld.Tra... |
import math
from functools import lru_cache
class Polygon:
def __init__(self, n, R):
if n < 3:
raise ValueError('Polygon must have at least 3 vertices.')
self._n = n
self._R = R
def __repr__(self):
return f'Polygon(n={self._n}, R={self._R})'
@property
def c... | [
"math.cos",
"math.sin"
] | [((656, 683), 'math.sin', 'math.sin', (['(math.pi / self._n)'], {}), '(math.pi / self._n)\n', (664, 683), False, 'import math\n'), ((747, 774), 'math.cos', 'math.cos', (['(math.pi / self._n)'], {}), '(math.pi / self._n)\n', (755, 774), False, 'import math\n')] |
import numpy as np
# softmax function
def softmax(a):
exp_a = np.exp(a)
sum_a = np.sum(exp_a)
return exp_a / sum_a
# modified softmax function
def modified_softmax(a):
maxA = np.max(a)
exp_a = np.exp(a - maxA)
sum_a = np.sum(exp_a)
return exp_a / sum_a
| [
"numpy.exp",
"numpy.sum",
"numpy.max"
] | [((68, 77), 'numpy.exp', 'np.exp', (['a'], {}), '(a)\n', (74, 77), True, 'import numpy as np\n'), ((90, 103), 'numpy.sum', 'np.sum', (['exp_a'], {}), '(exp_a)\n', (96, 103), True, 'import numpy as np\n'), ((195, 204), 'numpy.max', 'np.max', (['a'], {}), '(a)\n', (201, 204), True, 'import numpy as np\n'), ((218, 234), '... |
# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | [
"re.match"
] | [((2048, 2076), 're.match', 're.match', (['"""\\\\d+[.]\\\\d+"""', 'typ'], {}), "('\\\\d+[.]\\\\d+', typ)\n", (2056, 2076), False, 'import re\n')] |
"""
PGN Scraper is a small program which downloads each of a user's archived games from chess.com and stores them in a pgn file.
When running the user is asked for the account name which shall be scraped and for game types.
The scraper only downloads games of the correct type.
Supported types are: bullet, rapid, blitz... | [
"datetime.datetime.now",
"os.getcwd"
] | [((3969, 3983), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (3981, 3983), False, 'from datetime import datetime\n'), ((706, 717), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (715, 717), False, 'import os\n')] |
import sqlite3
import codecs # for using '한글'
import os
# 타이틀 정보 읽어오기
f = codecs.open("jjd_info_title.txt", "r")
title_list = []
while True:
line = f.readline() # 한 줄씩 읽
if not line: break # break the loop when it's End Of File
title_list.append(line) # split the line and append it to... | [
"codecs.open",
"sqlite3.connect"
] | [((75, 113), 'codecs.open', 'codecs.open', (['"""jjd_info_title.txt"""', '"""r"""'], {}), "('jjd_info_title.txt', 'r')\n", (86, 113), False, 'import codecs\n'), ((354, 391), 'codecs.open', 'codecs.open', (['"""jjd_info_date.txt"""', '"""r"""'], {}), "('jjd_info_date.txt', 'r')\n", (365, 391), False, 'import codecs\n'),... |
from opt_utils import *
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-s", "--skip_compilation", action='store_true', help="skip compilation")
args = parser.parse_args()
if not args.skip_compilation:
compile_all_opt_examples()
for example in all_examples:
args = []
output = run_example(ex... | [
"argparse.ArgumentParser"
] | [((49, 74), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (72, 74), False, 'import argparse\n')] |
import unittest
from unittest.mock import Mock
import mock
import peerfinder.peerfinder as peerfinder
import requests
from ipaddress import IPv6Address, IPv4Address
class testPeerFinder(unittest.TestCase):
def setUp(self):
self.netixlan_set = {
"id": 1,
"ix_id": 2,
"nam... | [
"ipaddress.IPv4Address",
"unittest.main",
"peerfinder.peerfinder.pdb_to_peer",
"peerfinder.peerfinder.getPeeringDB",
"peerfinder.peerfinder.pdb_to_fac",
"peerfinder.peerfinder.fetch_common_facilities",
"peerfinder.peerfinder.Peer",
"peerfinder.peerfinder.fetch_different_ixps",
"peerfinder.peerfinder... | [((3453, 3502), 'mock.patch.object', 'mock.patch.object', (['requests', '"""get"""'], {'autospec': '(True)'}), "(requests, 'get', autospec=True)\n", (3470, 3502), False, 'import mock\n'), ((6661, 6676), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6674, 6676), False, 'import unittest\n'), ((1444, 1484), 'peerfi... |
# -*- encoding: utf-8 -*-
#
# Copyright © 2012 New Dream Network, LLC (DreamHost)
#
# Author: <NAME> <<EMAIL>>
#
# 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/l... | [
"oslo.config.cfg.StrOpt",
"ceilometer.sample.Sample.from_notification",
"ceilometer.openstack.common.gettextutils._",
"ceilometer.openstack.common.log.getLogger",
"oslo.config.cfg.CONF.register_opts"
] | [((1160, 1188), 'oslo.config.cfg.CONF.register_opts', 'cfg.CONF.register_opts', (['OPTS'], {}), '(OPTS)\n', (1182, 1188), False, 'from oslo.config import cfg\n'), ((1196, 1219), 'ceilometer.openstack.common.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (1209, 1219), False, 'from ceilometer.openst... |
from itertools import product
import struct
import pickle
import numpy as np
from scipy import sparse
from scipy import isnan as scipy_isnan
import numpy.matlib
ASCII_FACET = """facet normal 0 0 0
outer loop
vertex {face[0][0]:.4f} {face[0][1]:.4f} {face[0][2]:.4f}
vertex {face[1][0]:.4f} {face[1][1]:.4f} {face[1][2]... | [
"scipy.sparse.linalg.lsmr",
"numpy.abs",
"numpy.roll",
"numpy.cross",
"numpy.amin",
"numpy.hstack",
"numpy.where",
"scipy.sparse.dia_matrix",
"pickle.load",
"struct.pack",
"numpy.indices",
"numpy.array",
"numpy.zeros",
"numpy.isnan",
"numpy.linalg.norm",
"scipy.sparse.vstack",
"numpy... | [((2702, 2716), 'numpy.cross', 'np.cross', (['n', 'C'], {}), '(n, C)\n', (2710, 2716), True, 'import numpy as np\n'), ((2771, 2790), 'numpy.cross', 'np.cross', (['n', 'ortho1'], {}), '(n, ortho1)\n', (2779, 2790), True, 'import numpy as np\n'), ((3564, 3619), 'scipy.sparse.dia_matrix', 'sparse.dia_matrix', (['(2 * w * ... |
'''
This is a python script that requires you have python installed, or in a cloud environment.
This script scrapes the CVS website looking for vaccine appointments in the cities you list.
To update for your area, update the locations commented below.
If you receive an error that says something is not installed, type... | [
"smtplib.SMTP",
"requests.get",
"time.sleep",
"datetime.datetime.now",
"email.mime.multipart.MIMEMultipart",
"datetime.timedelta",
"email.mime.text.MIMEText"
] | [((1676, 1704), 'email.mime.multipart.MIMEMultipart', 'MIMEMultipart', (['"""alternative"""'], {}), "('alternative')\n", (1689, 1704), False, 'from email.mime.multipart import MIMEMultipart\n'), ((1796, 1832), 'email.mime.text.MIMEText', 'MIMEText', (['msg_body', '"""plain"""', '"""UTF-8"""'], {}), "(msg_body, 'plain',... |
''' Controller para fornecer dados da CEE '''
from flask_restful import Resource
from service.qry_options_builder import QueryOptionsBuilder
from model.thematic import Thematic
class BaseResource(Resource):
''' Classe de base de resource '''
DEFAULT_SWAGGER_PARAMS = [
{"name": "valor", "required": Fals... | [
"service.qry_options_builder.QueryOptionsBuilder.build_options",
"model.thematic.Thematic",
"service.qry_options_builder.QueryOptionsBuilder.build_person_options"
] | [((5847, 5895), 'service.qry_options_builder.QueryOptionsBuilder.build_options', 'QueryOptionsBuilder.build_options', (['r_args', 'rules'], {}), '(r_args, rules)\n', (5880, 5895), False, 'from service.qry_options_builder import QueryOptionsBuilder\n'), ((6030, 6083), 'service.qry_options_builder.QueryOptionsBuilder.bui... |
import json
import os
def calculo(self):
meta = float(input('valor da meta: ')) # 1000000
valorinicial = float(input('valor inicial: ')) # 5637.99
valormensal = float(input('investimento mensal: ')) # 150
dividendos = float(input('dividendos: ')) # 16.86
meta = meta - valorinicial - valormensal - d... | [
"json.load",
"os.path.exists",
"json.dump"
] | [((1715, 1738), 'os.path.exists', 'os.path.exists', (['arquivo'], {}), '(arquivo)\n', (1729, 1738), False, 'import os\n'), ((1974, 2005), 'json.dump', 'json.dump', (['dicionario', 'arq_json'], {}), '(dicionario, arq_json)\n', (1983, 2005), False, 'import json\n'), ((1808, 1827), 'json.load', 'json.load', (['arq_json'],... |
# this version is adapted from http://wiki.ipython.org/Old_Embedding/GTK
"""
Backend to the console plugin.
@author: <NAME>
@organization: IBM Corporation
@copyright: Copyright (c) 2007 IBM Corporation
@license: BSD
All rights reserved. This program and the accompanying materials are made
available under the term... | [
"IPython.Shell.make_IPython",
"re.compile",
"functools.reduce",
"os.popen4",
"IPython.genutils.IOTerm",
"gi.repository.Pango.FontDescription",
"io.StringIO",
"gi.repository.Gtk.TextView.__init__"
] | [((1979, 2033), 'IPython.genutils.IOTerm', 'IPython.genutils.IOTerm', ([], {'cin': 'cin', 'cout': 'cout', 'cerr': 'cerr'}), '(cin=cin, cout=cout, cerr=cerr)\n', (2002, 2033), False, 'import IPython\n'), ((2113, 2257), 'IPython.Shell.make_IPython', 'IPython.Shell.make_IPython', (['argv'], {'user_ns': 'user_ns', 'user_gl... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^get', views.index, name='index'),
url(r'^details/(?P<id>\w)/$', views.details, name='details'),
url(r'^add', views.add, name='add'),
url(r'^delete', views.delete, name='delete'),
... | [
"django.conf.urls.url"
] | [((75, 111), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.index'], {'name': '"""index"""'}), "('^$', views.index, name='index')\n", (78, 111), False, 'from django.conf.urls import url\n'), ((118, 156), 'django.conf.urls.url', 'url', (['"""^get"""', 'views.index'], {'name': '"""index"""'}), "('^get', views.index,... |
import cv2
import numpy as np
import matplotlib.pyplot as plt
#from matplotlib import pyplot as plt
from tkinter import filedialog
from tkinter import *
root = Tk()
root.withdraw()
root.filename = filedialog.askopenfilename(initialdir = "/",title = "Select file",filetypes = (("all files",".*"),("jpg files","... | [
"numpy.absolute",
"cv2.medianBlur",
"cv2.HoughCircles",
"cv2.imshow",
"cv2.ellipse",
"cv2.circle",
"cv2.waitKey",
"numpy.around",
"cv2.cvtColor",
"cv2.CascadeClassifier",
"cv2.imread",
"tkinter.filedialog.askopenfilename"
] | [((208, 332), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {'initialdir': '"""/"""', 'title': '"""Select file"""', 'filetypes': "(('all files', '.*'), ('jpg files', '.jpg'))"}), "(initialdir='/', title='Select file', filetypes=(\n ('all files', '.*'), ('jpg files', '.jpg')))\n", (234, 332... |
"""
MIT License
Copyright (c) 2020 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... | [
"re.compile"
] | [((1097, 1312), 're.compile', 're.compile', (['"""^(?:http)s?://(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\\\.)+(?:[A-Z]{2,6}\\\\.?|[A-Z0-9-]{2,}\\\\.?)|localhost|\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3})(?::\\\\d+)?(?:/?|[/?]\\\\S+)$"""', 're.IGNORECASE'], {}), "(\n '^(?:http)s?://(?:(?:[A-Z0-9](?:[... |
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import qtawesome
import matplotlib.pyplot as plt
import csv
import numpy as np
import datetime
import os
class Stack:
def __init__(self):
self.items=[]
def isEmpty(self):
return self.i... | [
"matplotlib.pyplot.ylabel",
"datetime.timedelta",
"os.remove",
"numpy.mean",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.max",
"matplotlib.pyplot.close",
"numpy.min",
"csv.reader",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.gcf",
"numpy.floor",
"matplotlib.pyplot.titl... | [((55610, 55629), 'csv.reader', 'csv.reader', (['csvFile'], {}), '(csvFile)\n', (55620, 55629), False, 'import csv\n'), ((40154, 40180), 'os.remove', 'os.remove', (['figure_1_delete'], {}), '(figure_1_delete)\n', (40163, 40180), False, 'import os\n'), ((40190, 40216), 'os.remove', 'os.remove', (['figure_2_delete'], {})... |
from datetime import datetime
from django.db import connection
from posthog.models import Person
from posthog.test.base import BaseTest
# How we expect this function to behave:
# | call | value exists | call TS is ___ existing TS | previous fn | write/override
# 1| set | no | N/A ... | [
"datetime.datetime",
"django.db.connection.cursor",
"posthog.models.Person.objects.create",
"posthog.models.Person.objects.get"
] | [((1405, 1434), 'datetime.datetime', 'datetime', (['(2050)', '(1)', '(1)', '(1)', '(1)', '(1)'], {}), '(2050, 1, 1, 1, 1, 1)\n', (1413, 1434), False, 'from datetime import datetime\n'), ((1464, 1493), 'datetime.datetime', 'datetime', (['(2000)', '(1)', '(1)', '(1)', '(1)', '(1)'], {}), '(2000, 1, 1, 1, 1, 1)\n', (1472,... |
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(name='aif360',
version='0.1.0',
description='IBM AI Fairness 360',
author='aif360 developers',
author_email='<EMAIL>',
url='https://github.com/IBM/AIF360',
long_des... | [
"setuptools.find_packages"
] | [((451, 466), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (464, 466), False, 'from setuptools import setup, find_packages\n')] |
from __future__ import annotations
import lzma, pickle
from typing import TYPE_CHECKING
from numpy import e
from tcod.console import Console
from tcod.map import compute_fov
import exceptions, render_functions
from message_log import MessageLog
if TYPE_CHECKING:
from entity import Actor
from game_map import... | [
"render_functions.render_bar",
"pickle.dumps",
"tcod.map.compute_fov",
"render_functions.render_level",
"message_log.MessageLog",
"render_functions.render_name_at_location"
] | [((471, 483), 'message_log.MessageLog', 'MessageLog', ([], {}), '()\n', (481, 483), False, 'from message_log import MessageLog\n'), ((894, 988), 'tcod.map.compute_fov', 'compute_fov', (["self.game_map.tiles['transparent']", '(self.player.x, self.player.y)'], {'radius': '(8)'}), "(self.game_map.tiles['transparent'], (se... |
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Dense
from activations.activations import tan_sigmoid, exponential, ReLU
class FFNN(Model):
""" Creates a generic Feedforward neural network.
"""
def __init__(self):
super(FFNN, self).__init__()
... | [
"tensorflow.reduce_sum",
"tensorflow.keras.layers.Dense"
] | [((379, 424), 'tensorflow.keras.layers.Dense', 'Dense', ([], {'units': 'input_shape[-1]', 'activation': 'ReLU'}), '(units=input_shape[-1], activation=ReLU)\n', (384, 424), False, 'from tensorflow.keras.layers import Dense\n'), ((453, 491), 'tensorflow.keras.layers.Dense', 'Dense', ([], {'units': '(1)', 'activation': 'e... |
# VOC分割训练集和测试集
import os
import random
import shutil
trainval_percent = 0.1
train_percent = 0.9
imgfilepath = '../myData/JPEGImages' #原数据存放地
total_img = os.listdir(imgfilepath)
sample_num = len(total_img)
trains = random.sample(total_img,int(sample_num*train_percent))
for file in total_img:
if file in trains... | [
"os.listdir",
"os.path.join"
] | [((157, 180), 'os.listdir', 'os.listdir', (['imgfilepath'], {}), '(imgfilepath)\n', (167, 180), False, 'import os\n'), ((342, 373), 'os.path.join', 'os.path.join', (['imgfilepath', 'file'], {}), '(imgfilepath, file)\n', (354, 373), False, 'import os\n'), ((439, 470), 'os.path.join', 'os.path.join', (['imgfilepath', 'fi... |
"""Example SciUnit model classes."""
import random
from sciunit.models import Model
from sciunit.capabilities import ProducesNumber
from sciunit.utils import class_intern, method_cache
from sciunit.utils import method_memoize # Decorator for caching of capability method results.
from typing import Union
class ConstM... | [
"random.random",
"random.uniform",
"sciunit.utils.method_cache"
] | [((2810, 2851), 'sciunit.utils.method_cache', 'method_cache', ([], {'by': '"""instance"""', 'method': '"""run"""'}), "(by='instance', method='run')\n", (2822, 2851), False, 'from sciunit.utils import class_intern, method_cache\n'), ((3003, 3041), 'sciunit.utils.method_cache', 'method_cache', ([], {'by': '"""value"""', ... |
from sentence_transformers import SentenceTransformer
from semantic.config import CONFIG
model = SentenceTransformer(CONFIG["model_name"])
| [
"sentence_transformers.SentenceTransformer"
] | [((98, 139), 'sentence_transformers.SentenceTransformer', 'SentenceTransformer', (["CONFIG['model_name']"], {}), "(CONFIG['model_name'])\n", (117, 139), False, 'from sentence_transformers import SentenceTransformer\n')] |
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Dense, Flatten, Dropout, Input
from tensorflow.keras.layers import MaxPooling1D, Conv1D
from tensorflow.keras.layers import LSTM, Bidirectional
from tensorflow.keras.layers import BatchNormalization, GlobalAveragePooling1D, Permute, concatena... | [
"tensorflow.keras.layers.Input",
"tensorflow.keras.layers.Permute",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.layers.add",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.concatenate",
"tensorflow.keras.layers.LSTM",
"tensorflow.keras.layers.MaxPooling1D",
"tensorfl... | [((1491, 1515), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': 'input_shape'}), '(shape=input_shape)\n', (1496, 1515), False, 'from tensorflow.keras.layers import Dense, Flatten, Dropout, Input\n'), ((1874, 1892), 'tensorflow.keras.models.Model', 'Model', (['[ip]', '[out]'], {}), '([ip], [out])\n', (1879, 189... |
#! /usr/bin/python
# encoding=utf-8
import os
import datetime,time
from selenium import webdriver
import config
import threading
import numpy as np
def writelog(msg,log):
nt=datetime.datetime.now().strftime('%Y-%m-%d %H-%M-%S')
text="[%s] %s " % (nt,msg)
os.system("echo %s >> %s" % (text.encode('utf8'),l... | [
"selenium.webdriver.ChromeOptions",
"selenium.webdriver.Chrome",
"time.sleep",
"datetime.datetime.now",
"numpy.random.uniform",
"threading.Thread"
] | [((355, 380), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (378, 380), False, 'from selenium import webdriver\n'), ((464, 500), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'chrome_options': 'ops'}), '(chrome_options=ops)\n', (480, 500), False, 'from selenium import webdriv... |
import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
from sklearn import datasets, linear_model
from difflib import SequenceMatcher
import seaborn as sns
from statistics import mean
from ast import literal_eval
from scipy import stats
from sklearn.linear_model import LinearRegression
from s... | [
"matplotlib.pyplot.ylabel",
"numpy.array",
"pandas.read_excel",
"matplotlib.lines.Line2D",
"numpy.divide",
"numpy.mean",
"seaborn.regplot",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"pandas.DataFrame",
"seaborn.swarmplot",
"matplotlib.pyplot.savefig",
... | [((1115, 1131), 'os.scandir', 'os.scandir', (['path'], {}), '(path)\n', (1125, 1131), False, 'import os\n'), ((3840, 3892), 'pandas.to_numeric', 'pd.to_numeric', (['telo_data.iloc[:, 0]'], {'errors': '"""coerce"""'}), "(telo_data.iloc[:, 0], errors='coerce')\n", (3853, 3892), True, 'import pandas as pd\n'), ((4083, 411... |
import json
import os
import sys
from collections import OrderedDict
import iotbx.phil
import xia2.Handlers.Streams
from dials.util.options import OptionParser
from jinja2 import ChoiceLoader, Environment, PackageLoader
from xia2.Modules.Report import Report
from xia2.XIA2Version import Version
phil_scope = iotbx.phi... | [
"collections.OrderedDict",
"jinja2.Environment",
"xia2.Modules.Report.Report.from_unmerged_mtz",
"jinja2.PackageLoader",
"os.path.abspath",
"dials.util.options.OptionParser",
"json.dump"
] | [((684, 772), 'dials.util.options.OptionParser', 'OptionParser', ([], {'usage': 'usage', 'phil': 'phil_scope', 'check_format': '(False)', 'epilog': 'help_message'}), '(usage=usage, phil=phil_scope, check_format=False, epilog=\n help_message)\n', (696, 772), False, 'from dials.util.options import OptionParser\n'), ((... |
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
from django.views.generic import TemplateView
from . import views
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patt... | [
"django.views.generic.TemplateView.as_view",
"django.conf.urls.include",
"django.conf.urls.url",
"django.contrib.admin.autodiscover"
] | [((280, 300), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (298, 300), False, 'from django.contrib import admin\n'), ((462, 549), 'django.conf.urls.url', 'url', (['"""^login/$"""', '"""django.contrib.auth.views.login"""', "{'template_name': 'login.html'}"], {}), "('^login/$', 'django.con... |
import os
import datetime
from pathlib import Path
import pandas as pd
import luigi
PROCESSED_DIR = 'processed'
ROLLUP_DIR = 'rollups'
class PrepareDataTask(luigi.Task):
def __init__(self):
super().__init__()
self.last_processed_id = 0
if os.path.exists('last_processed_id.txt'):
... | [
"luigi.run",
"os.path.exists",
"pandas.read_parquet",
"os.makedirs",
"pathlib.Path",
"datetime.date.today",
"luigi.LocalTarget",
"pandas.read_json"
] | [((1671, 1687), 'pathlib.Path', 'Path', (['ROLLUP_DIR'], {}), '(ROLLUP_DIR)\n', (1675, 1687), False, 'from pathlib import Path\n'), ((2395, 2406), 'luigi.run', 'luigi.run', ([], {}), '()\n', (2404, 2406), False, 'import luigi\n'), ((270, 309), 'os.path.exists', 'os.path.exists', (['"""last_processed_id.txt"""'], {}), "... |
import time
from datetime import datetime
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.dates import epoch2num
import device_factory
if __name__ == '__main__':
amount = 50
devices = []
for i in range(amount):
device = device_factory.ecopower_4(i, i)
... | [
"datetime.datetime",
"numpy.mean",
"device_factory.ecopower_4",
"numpy.abs",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.twinx",
"numpy.sum",
"numpy.zeros",
"matplotlib.pyplot.subplot",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((1207, 1227), 'numpy.zeros', 'np.zeros', (['sample_dur'], {}), '(sample_dur)\n', (1215, 1227), True, 'import numpy as np\n'), ((2003, 2020), 'numpy.sum', 'np.sum', (['P'], {'axis': '(0)'}), '(P, axis=0)\n', (2009, 2020), True, 'import numpy as np\n'), ((2031, 2049), 'numpy.sum', 'np.sum', (['Th'], {'axis': '(0)'}), '... |
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
import boto3
import copy
import unittest
from botocore.stub import ANY
from cfn_policy_validator.tests import account_config, offline_only, only_run_for_end_to_end
from cfn_policy_validator.tests.boto_mocks impor... | [
"cfn_policy_validator.parsers.output.Resource",
"boto3.Session",
"cfn_policy_validator.tests.validation_tests.MockValidateResourcePolicyFinding",
"cfn_policy_validator.tests.validation_tests.MockInvalidConfiguration",
"cfn_policy_validator.validation.validator.Validator",
"cfn_policy_validator.tests.boto_... | [((20256, 20301), 'unittest.skip', 'unittest.skip', (['"""Skip until this is supported"""'], {}), "('Skip until this is supported')\n", (20269, 20301), False, 'import unittest\n'), ((1502, 1524), 'cfn_policy_validator.parsers.output.Output', 'Output', (['account_config'], {}), '(account_config)\n', (1508, 1524), False,... |
"""
Tests for the h5py.Datatype class.
"""
from __future__ import absolute_import
from itertools import count
import numpy as np
import h5py
from ..common import ut, TestCase
class TestVlen(TestCase):
"""
Check that storage of vlen strings is carried out correctly.
"""
def assertVlenArrayEq... | [
"h5py.check_dtype",
"numpy.random.rand",
"numpy.random.random_integers",
"h5py.File",
"h5py.h5t.py_create",
"numpy.array",
"itertools.count",
"numpy.empty",
"numpy.random.randint",
"h5py.special_dtype",
"numpy.dtype"
] | [((806, 822), 'numpy.dtype', 'np.dtype', (['fields'], {}), '(fields)\n', (814, 822), True, 'import numpy as np\n'), ((850, 862), 'numpy.dtype', 'np.dtype', (['dt'], {}), '(dt)\n', (858, 862), True, 'import numpy as np\n'), ((1040, 1073), 'h5py.special_dtype', 'h5py.special_dtype', ([], {'vlen': 'np.uint8'}), '(vlen=np.... |
import requests
from bs4 import BeautifulSoup
from prettytable import PrettyTable
# html = requests.get(
# 'http://jwzx.cqu.pt/student/xkxfTj.php',
# cookies={'PHPSESSID': 'o2r2fpddrj892dp1ntqddcp2hv'}).text
# soup = BeautifulSoup(html, 'html.parser')
# for tr in soup.find('table', {'id': 'AxfTjTable'}).find... | [
"prettytable.PrettyTable"
] | [((396, 423), 'prettytable.PrettyTable', 'PrettyTable', (["['aaa', 'bbb']"], {}), "(['aaa', 'bbb'])\n", (407, 423), False, 'from prettytable import PrettyTable\n')] |
import os
import itertools as it
import pandas as pd
def compute_jaccard(v1, v2):
v1, v2 = set(v1), set(v2)
intersection = v1.intersection(v2)
union = v1.union(v2)
return ((len(intersection) / len(union) if len(union) != 0 else 0),
len(intersection),
len(union))
def get_inter_m... | [
"itertools.combinations"
] | [((1330, 1355), 'itertools.combinations', 'it.combinations', (['folds', '(2)'], {}), '(folds, 2)\n', (1345, 1355), True, 'import itertools as it\n')] |
import csv
from core.exceptions import InvalidFileException
def load_so_item_from_file(path, db_service):
with open(path) as csv_file:
csv_reader = csv.reader(csv_file)
error_msg = 'Missing required header: {}'
for i, row in enumerate(csv_reader, 1):
data = {
... | [
"csv.reader"
] | [((163, 183), 'csv.reader', 'csv.reader', (['csv_file'], {}), '(csv_file)\n', (173, 183), False, 'import csv\n'), ((4451, 4471), 'csv.reader', 'csv.reader', (['csv_file'], {}), '(csv_file)\n', (4461, 4471), False, 'import csv\n'), ((6134, 6154), 'csv.reader', 'csv.reader', (['csv_file'], {}), '(csv_file)\n', (6144, 615... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import log... | [
"logging.basicConfig",
"azure.iot.device.iothub.sync_handler_manager.SyncHandlerManager",
"pytest.mark.describe",
"azure.iot.device.iothub.client_event.ClientEvent",
"azure.iot.device.iothub.inbox_manager.InboxManager",
"threading.Lock",
"time.sleep",
"pytest.mark.parametrize",
"pytest.fixture",
"... | [((787, 827), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (806, 827), False, 'import logging\n'), ((2815, 2873), 'pytest.mark.describe', 'pytest.mark.describe', (['"""SyncHandlerManager - Instantiation"""'], {}), "('SyncHandlerManager - Instantiation')\n", ... |
import json
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import dash_table
def get_comps_data(bd, projverurl):
print('Getting components ...')
# path = projverurl + "/components?limit=5000"
#
# custom_headers = {'Acc... | [
"dash_bootstrap_components.Toast",
"dash_bootstrap_components.Button",
"json.loads",
"pandas.json_normalize",
"json.dumps",
"dash_html_components.H5",
"dash_core_components.Dropdown",
"dash_html_components.H2"
] | [((682, 729), 'pandas.json_normalize', 'pd.json_normalize', (['comps'], {'record_path': "['items']"}), "(comps, record_path=['items'])\n", (699, 729), True, 'import pandas as pd\n'), ((7373, 7553), 'dash_bootstrap_components.Toast', 'dbc.Toast', (['message'], {'id': "{'type': 'toast', 'id': 'toast_comp'}", 'key': '"""t... |
# Copyright 2016 Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | [
"osprofiler.drivers.ceilometer.Ceilometer",
"mock.MagicMock"
] | [((879, 934), 'osprofiler.drivers.ceilometer.Ceilometer', 'Ceilometer', (['"""ceilometer://"""'], {'ceilometer_api_version': '"""2"""'}), "('ceilometer://', ceilometer_api_version='2')\n", (889, 934), False, 'from osprofiler.drivers.ceilometer import Ceilometer\n'), ((3321, 3337), 'mock.MagicMock', 'mock.MagicMock', ([... |
from pathlib import Path
import numpy as np
import pickle
import argparse
import errno
import sys
def file_exists(path):
return Path(path).is_file()
def dir_exists(path):
return Path(path).is_dir()
def remove_extension(x): return x.split('.')[0]
def print_error(type, file):
print(FileNotFoundError(e... | [
"pickle.dump",
"argparse.ArgumentParser",
"pathlib.Path",
"numpy.where",
"numpy.asarray",
"sys.exit"
] | [((1358, 1499), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Filter Unicode characters based on a given threshold between 0 and 1 and a similarity matrix"""'}), "(description=\n 'Filter Unicode characters based on a given threshold between 0 and 1 and a similarity matrix'\n )\n",... |
#!/usr/bin/python
from aos.util.trapezoid_profile import TrapezoidProfile
from frc971.control_loops.python import control_loop
from frc971.control_loops.python import angular_system
from frc971.control_loops.python import controls
import copy
import numpy
import sys
from matplotlib import pylab
import gflags
import gl... | [
"frc971.control_loops.python.control_loop.BAG",
"gflags.DEFINE_bool",
"frc971.control_loops.python.angular_system.PlotKick",
"glog.fatal",
"frc971.control_loops.python.angular_system.PlotMotion",
"copy.copy",
"numpy.matrix",
"glog.init",
"frc971.control_loops.python.angular_system.WriteAngularSystem... | [((852, 869), 'copy.copy', 'copy.copy', (['kWrist'], {}), '(kWrist)\n', (861, 869), False, 'import copy\n'), ((954, 971), 'copy.copy', 'copy.copy', (['kWrist'], {}), '(kWrist)\n', (963, 971), False, 'import copy\n'), ((1009, 1026), 'copy.copy', 'copy.copy', (['kWrist'], {}), '(kWrist)\n', (1018, 1026), False, 'import c... |
import pytest
from pandas.errors import NullFrequencyError
import pandas as pd
from pandas import TimedeltaIndex
import pandas._testing as tm
class TestTimedeltaIndexShift:
# -------------------------------------------------------------
# TimedeltaIndex.shift is used by __add__/__sub__
def test_tdi_sh... | [
"pandas._testing.assert_index_equal",
"pandas.TimedeltaIndex",
"pytest.raises",
"pandas.offsets.Hour"
] | [((369, 402), 'pandas.TimedeltaIndex', 'pd.TimedeltaIndex', (['[]'], {'name': '"""xxx"""'}), "([], name='xxx')\n", (386, 402), True, 'import pandas as pd\n'), ((590, 654), 'pandas.TimedeltaIndex', 'pd.TimedeltaIndex', (["['5 hours', '6 hours', '9 hours']"], {'name': '"""xxx"""'}), "(['5 hours', '6 hours', '9 hours'], n... |
import os
from subprocess import check_output, CalledProcessError
from nose import tools as nt
from stolos import queue_backend as qb
from stolos.testing_tools import (
with_setup, validate_zero_queued_task, validate_one_queued_task,
validate_n_queued_task
)
def run(cmd, tasks_json_tmpfile, **kwargs):
cm... | [
"subprocess.check_output",
"stolos.testing_tools.validate_one_queued_task",
"stolos.testing_tools.validate_n_queued_task",
"nose.tools.assert_raises",
"stolos.queue_backend.set_state",
"stolos.testing_tools.validate_zero_queued_task"
] | [((471, 535), 'subprocess.check_output', 'check_output', (['cmd'], {'shell': '(True)', 'executable': '"""bash"""', 'env': 'os.environ'}), "(cmd, shell=True, executable='bash', env=os.environ)\n", (483, 535), False, 'from subprocess import check_output, CalledProcessError\n'), ((726, 757), 'stolos.testing_tools.validate... |
# 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 unde... | [
"mock.Mock",
"mock.patch.object",
"senlin.tests.unit.common.utils.dummy_context",
"senlin.engine.actions.cluster_action.ClusterAction",
"mock.call"
] | [((1024, 1061), 'mock.patch.object', 'mock.patch.object', (['cm.Cluster', '"""load"""'], {}), "(cm.Cluster, 'load')\n", (1041, 1061), False, 'import mock\n'), ((1224, 1262), 'mock.patch.object', 'mock.patch.object', (['ao.Action', '"""update"""'], {}), "(ao.Action, 'update')\n", (1241, 1262), False, 'import mock\n'), (... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2021, earthobservations developers.
# Distributed under the MIT License. See LICENSE for more info.
import pytest
from wetterdienst import Wetterdienst
@pytest.mark.remote
@pytest.mark.parametrize(
"provider,kind,kwargs",
[
# German Weather Service (DWD)
... | [
"wetterdienst.Wetterdienst",
"pytest.mark.parametrize"
] | [((221, 512), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""provider,kind,kwargs"""', "[('dwd', 'observation', {'parameter': 'kl', 'resolution': 'daily', 'period':\n 'recent'}), ('dwd', 'forecast', {'parameter': 'large', 'mosmix_type':\n 'large'}), ('eccc', 'observation', {'parameter': 'daily', 'res... |
#! -*- coding:utf-8 -*-
# 语义相似度任务-无监督:训练集为网上pretrain数据, dev集为sts-b
from bert4torch.tokenizers import Tokenizer
from bert4torch.models import build_transformer_model, BaseModel
from bert4torch.snippets import sequence_padding, Callback, ListDataset
import torch.nn as nn
import torch
import torch.optim as optim
from to... | [
"torch.ones_like",
"torch.nn.CrossEntropyLoss",
"sklearn.metrics.pairwise.paired_cosine_distances",
"numpy.random.rand",
"numpy.random.choice",
"torch.max",
"random.seed",
"bert4torch.tokenizers.Tokenizer",
"bert4torch.snippets.sequence_padding",
"torch.cuda.is_available",
"torch.no_grad",
"nu... | [((503, 520), 'random.seed', 'random.seed', (['(2022)'], {}), '(2022)\n', (514, 520), False, 'import random\n'), ((521, 541), 'numpy.random.seed', 'np.random.seed', (['(2002)'], {}), '(2002)\n', (535, 541), True, 'import numpy as np\n'), ((963, 1003), 'bert4torch.tokenizers.Tokenizer', 'Tokenizer', (['dict_path'], {'do... |
from pathlib import Path
from .anki_exporter import AnkiJsonExporter
from ..anki.adapters.anki_deck import AnkiDeck
from ..config.config_settings import ConfigSettings
from ..utils import constants
from ..utils.notifier import AnkiModalNotifier, Notifier
from ..utils.disambiguate_uuids import disambiguate_note_model_u... | [
"pathlib.Path"
] | [((2165, 2185), 'pathlib.Path', 'Path', (['directory_path'], {}), '(directory_path)\n', (2169, 2185), False, 'from pathlib import Path\n')] |
from functools import lru_cache
from typing import Optional
import requests
from .patches import Patches
class Item:
"""
Manipulation of static item data
"""
ITEM_URL = f"http://ddragon.leagueoflegends.com/cdn/{Patches.get_current_patch()}/data/en_US/item.json"
items = requests.get(ITEM_URL).js... | [
"functools.lru_cache",
"requests.get"
] | [((348, 359), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (357, 359), False, 'from functools import lru_cache\n'), ((732, 743), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (741, 743), False, 'from functools import lru_cache\n'), ((295, 317), 'requests.get', 'requests.get', (['ITEM_URL'], {}), '(ITEM... |
# @Time : 2020/10/6
# @Author : <NAME>
# @Email : <EMAIL>
"""
recbole.quick_start
########################
"""
import logging
from logging import getLogger
from recbole.config import Config
from recbole.data import create_dataset, data_preparation
from recbole.utils import init_logger, get_model, get_trainer, init... | [
"logging.getLogger",
"recbole.utils.init_seed",
"recbole.config.Config",
"numpy.save",
"seaborn.set",
"scipy.linalg.svdvals",
"matplotlib.pyplot.plot",
"recbole.utils.init_logger",
"numpy.dot",
"matplotlib.pyplot.scatter",
"recbole.utils.get_trainer",
"matplotlib.pyplot.ylim",
"matplotlib.py... | [((944, 1044), 'recbole.config.Config', 'Config', ([], {'model': 'model', 'dataset': 'dataset', 'config_file_list': 'config_file_list', 'config_dict': 'config_dict'}), '(model=model, dataset=dataset, config_file_list=config_file_list,\n config_dict=config_dict)\n', (950, 1044), False, 'from recbole.config import Con... |
import os
import urllib
from google.appengine.api import users
from google.appengine.ext import ndb
import jinja2
import webapp2
from sys import argv
import datetime
import pickle
import sys
sys.path.insert(0, 'libs')
import BeautifulSoup
from bs4 import BeautifulSoup
import requests
import json
JINJA_ENVIRONM... | [
"sys.path.insert",
"requests.Session",
"bs4.BeautifulSoup",
"os.path.dirname",
"webapp2.WSGIApplication",
"datetime.date.today",
"google.appengine.ext.ndb.DateTimeProperty",
"google.appengine.ext.ndb.StringProperty"
] | [((197, 223), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""libs"""'], {}), "(0, 'libs')\n", (212, 223), False, 'import sys\n'), ((694, 715), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (713, 715), False, 'import datetime\n'), ((5391, 5503), 'webapp2.WSGIApplication', 'webapp2.WSGIApplication',... |
import json
from django.utils.encoding import force_text
from germanium.tools import assert_true, assert_not_equal
from germanium.test_cases.client import ClientTestCase
from germanium.decorators import login
from germanium.crawler import Crawler, LinkExtractor, HtmlLinkExtractor as OriginalHtmlLinkExtractor
def fl... | [
"django.utils.encoding.force_text",
"germanium.tools.assert_not_equal",
"json.loads",
"germanium.decorators.login"
] | [((2752, 2786), 'germanium.decorators.login', 'login', ([], {'users_generator': '"""get_users"""'}), "(users_generator='get_users')\n", (2757, 2786), False, 'from germanium.decorators import login\n'), ((1738, 1757), 'json.loads', 'json.loads', (['content'], {}), '(content)\n', (1748, 1757), False, 'import json\n'), ((... |
##############################################################################
#
# Copyright (c) 2009 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | [
"data.File",
"zope.interface.implementer",
"data.Image",
"zope.component.adapter"
] | [((799, 823), 'zope.component.adapter', 'component.adapter', (['IFile'], {}), '(IFile)\n', (816, 823), False, 'from zope import component, interface\n'), ((825, 857), 'zope.interface.implementer', 'interface.implementer', (['ICopyHook'], {}), '(ICopyHook)\n', (846, 857), False, 'from zope import component, interface\n'... |
import sys
verbose = False
def set_v(v):
global verbose
verbose = v
def print_v(s):
if verbose:
print(s)
def write_v(s):
if verbose:
sys.stdout.write(s)
| [
"sys.stdout.write"
] | [((172, 191), 'sys.stdout.write', 'sys.stdout.write', (['s'], {}), '(s)\n', (188, 191), False, 'import sys\n')] |