code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import argparse
import cv2
import json
import numpy as np
import os
import pickle
import torch
from argparse import Namespace
from scipy.special import softmax
from sklearn.externals import joblib
from pyquaternion import Quaternion
from tqdm import tqdm
from network import CameraBranch
class Camera_Branch_Inferenc... | [
"numpy.hstack",
"sklearn.externals.joblib.load",
"network.CameraBranch",
"torch.cuda.is_available",
"argparse.ArgumentParser",
"numpy.dot",
"numpy.argmax",
"cv2.resize",
"numpy.transpose",
"pyquaternion.Quaternion",
"cv2.imread",
"pickle.dump",
"os.makedirs",
"torch.load",
"tqdm.tqdm",
... | [((2453, 2474), 'pyquaternion.Quaternion', 'Quaternion', (['pose[3:7]'], {}), '(pose[3:7])\n', (2463, 2474), False, 'from pyquaternion import Quaternion\n'), ((2484, 2507), 'pyquaternion.Quaternion', 'Quaternion', (['pose[10:14]'], {}), '(pose[10:14])\n', (2494, 2507), False, 'from pyquaternion import Quaternion\n'), (... |
import os
import cv2
import albumentations as A
from tqdm import tqdm
def _read_filenames():
train_eye_pos = []
train_images_list = []
fh = open(os.path.join("dataset", "NewGazeData", "eye_train.txt"))
for f in fh.readlines():
eye_pos = []
f = f.strip('\n')
filenames = f.split(... | [
"tqdm.tqdm",
"os.path.join",
"cv2.imshow",
"albumentations.RGBShift",
"cv2.destroyAllWindows",
"cv2.waitKey"
] | [((1353, 1369), 'tqdm.tqdm', 'tqdm', (['image_list'], {}), '(image_list)\n', (1357, 1369), False, 'from tqdm import tqdm\n'), ((1150, 1173), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (1171, 1173), False, 'import cv2\n'), ((158, 213), 'os.path.join', 'os.path.join', (['"""dataset"""', '"""NewGa... |
#!/usr/bin/python
from flask import Flask, request, jsonify
import logging
from logging.handlers import RotatingFileHandler
# create our little application :)
app = Flask(__name__)
app.debug = True
app.config['SECRET_KEY'] = 'F34TF$($e34D';
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///phonebook_server.db'
from... | [
"flask.jsonify",
"flask.request.get_json",
"logging.handlers.RotatingFileHandler",
"flask.Flask"
] | [((166, 181), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (171, 181), False, 'from flask import Flask, request, jsonify\n'), ((473, 491), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (489, 491), False, 'from flask import Flask, request, jsonify\n'), ((721, 751), 'flask.jsonify', 'json... |
import django_filters
from graphene_django.filter import GlobalIDMultipleChoiceFilter
from ...page import models
from ..core.filters import MetadataFilterBase
from ..core.types import FilterInputObjectType
from ..utils import resolve_global_ids_to_primary_keys
from ..utils.filters import filter_by_query_param
from .ty... | [
"graphene_django.filter.GlobalIDMultipleChoiceFilter",
"django_filters.CharFilter"
] | [((879, 931), 'django_filters.CharFilter', 'django_filters.CharFilter', ([], {'method': 'filter_page_search'}), '(method=filter_page_search)\n', (904, 931), False, 'import django_filters\n'), ((949, 1001), 'graphene_django.filter.GlobalIDMultipleChoiceFilter', 'GlobalIDMultipleChoiceFilter', ([], {'field_name': '"""pag... |
import numpy as np
from torch import nn
from torch.nn import functional as F
import torch
from torchvision import models
import torchvision
__all__ = ['ResNet_IR']
class ResNet_IR(nn.Module):
def __init__(self, args):
super().__init__()
if args.backbone == 'resnet18':
self.backbone ... | [
"torch.nn.BatchNorm2d",
"torch.nn.Sequential",
"torch.nn.Dropout2d",
"torchvision.models.resnet101",
"torchvision.models.resnet18",
"torch.nn.BatchNorm1d",
"torchvision.models.resnet34",
"torchvision.models.resnet152",
"torch.nn.Linear",
"torchvision.models.resnet50"
] | [((959, 1129), 'torch.nn.Sequential', 'nn.Sequential', (['self.backbone.conv1', 'self.backbone.bn1', 'self.backbone.relu', 'self.backbone.layer1', 'self.backbone.layer2', 'self.backbone.layer3', 'self.backbone.layer4'], {}), '(self.backbone.conv1, self.backbone.bn1, self.backbone.relu,\n self.backbone.layer1, self.b... |
#!/usr/bin/python2
from Model import listOfnewsSources, news, localNewsRepository, localRedundantNewsRepository, assetRelatedNewsItems, assets, fg
from HelperMethods import doesItMatch, getRSSContent, freshNews
from TaskHelper import taskRun
import traceback
def updateNewsDB():
taskRun(getNewsOnline, listOfnews... | [
"Model.localRedundantNewsRepository.append",
"Model.assetRelatedNewsItems.append",
"Model.news",
"Model.localNewsRepository.append",
"HelperMethods.doesItMatch",
"HelperMethods.freshNews",
"traceback.print_exc",
"HelperMethods.getRSSContent"
] | [((756, 774), 'HelperMethods.getRSSContent', 'getRSSContent', (['url'], {}), '(url)\n', (769, 774), False, 'from HelperMethods import doesItMatch, getRSSContent, freshNews\n'), ((1198, 1227), 'HelperMethods.freshNews', 'freshNews', (['newsItem.published'], {}), '(newsItem.published)\n', (1207, 1227), False, 'from Helpe... |
import json
import os
from geojson import Polygon
from kuwala.modules.common import polyfill_polygon
# Get the aggregated number of a specific POI category per H3 index at a given resolution
def get_pois_by_category_in_h3(sp, category, resolution, polygon_coords):
polygon_cells = None
if polygon_coords:
... | [
"geojson.Polygon",
"json.loads",
"os.getenv",
"kuwala.modules.common.polyfill_polygon"
] | [((341, 367), 'json.loads', 'json.loads', (['polygon_coords'], {}), '(polygon_coords)\n', (351, 367), False, 'import json\n'), ((386, 409), 'geojson.Polygon', 'Polygon', (['polygon_coords'], {}), '(polygon_coords)\n', (393, 409), False, 'from geojson import Polygon\n'), ((1559, 1582), 'os.getenv', 'os.getenv', (['"""NE... |
from flask_wtf import FlaskForm
from flask_babel import lazy_gettext as _l
from flask_pagedown.fields import PageDownField
from wtforms.fields import StringField,TextAreaField,SubmitField, BooleanField
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.validators import DataRequired,Length, Email
f... | [
"wtforms.validators.Email",
"flask_babel.lazy_gettext",
"wtforms.fields.StringField",
"wtforms.validators.Length",
"wtforms.validators.DataRequired"
] | [((457, 475), 'wtforms.fields.StringField', 'StringField', (['u"""Id"""'], {}), "(u'Id')\n", (468, 475), False, 'from wtforms.fields import StringField, TextAreaField, SubmitField, BooleanField\n'), ((889, 907), 'wtforms.fields.StringField', 'StringField', (['u"""Id"""'], {}), "(u'Id')\n", (900, 907), False, 'from wtfo... |
from django.db import models
# Create your models here.
# ORM 对象关系映射
# - 对象 Message是一个类,msg = Message(name='gavin') 就是一个对象
# - 关系 实体和实体之间的关系
# - 映射
# : app_message表 和 Message类 是一一对应的
# : app_message表中每条记录 和 Message类创建的每个对象时一一对应的
class Message(models.Model):
name = models.CharField(max_length=30,ve... | [
"django.db.models.EmailField",
"django.db.models.CharField"
] | [((287, 337), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)', 'verbose_name': '"""姓名"""'}), "(max_length=30, verbose_name='姓名')\n", (303, 337), False, 'from django.db import models\n'), ((349, 400), 'django.db.models.EmailField', 'models.EmailField', ([], {'max_length': '(20)', 'verbose_na... |
#!/usr/bin/env python3
# -----------------------------------------------------------------------------
# Author : <NAME>, <NAME>
# Company: Mihaela Zavolan, Biozentrum, Basel
# This script is part of the Zavolan lab ZARP pipeline.
# In this script the config file used by multiqc
# (https://multiqc.info) is created.
# ... | [
"sys.stderr.write",
"argparse.ArgumentParser",
"sys.exit"
] | [((596, 669), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'RawTextHelpFormatter'}), '(description=__doc__, formatter_class=RawTextHelpFormatter)\n', (610, 669), False, 'from argparse import ArgumentParser, RawTextHelpFormatter\n'), ((2038, 2049), 'sys.exit', 'sys.exit... |
def getVoice(access_token, lang, gender, text, fn):
import urllib.parse
import http.client
import json
host = "tts.mimi.fd.ai"
path = "/speech_synthesis"
params = urllib.parse.urlencode({
"text": text,
"engine": "nict",
"lang": lang, # ja, en, zh, ko, id, vi, my, th
"gender": gender,
#"audio_format": ... | [
"playRaw.playRaw",
"getAccessToken.getAccessToken"
] | [((897, 952), 'getAccessToken.getAccessToken', 'getAccessToken.getAccessToken', (['client_id', 'client_secret'], {}), '(client_id, client_secret)\n', (926, 952), False, 'import getAccessToken\n'), ((1083, 1102), 'playRaw.playRaw', 'playRaw.playRaw', (['fn'], {}), '(fn)\n', (1098, 1102), False, 'import playRaw\n'), ((12... |
import cv2
import threading
import time
import logging
logger = logging.getLogger(__name__)
thread = None
class Camera:
def __init__(self,fps=20,video_source=0):
logger.info(f"Initializing camera class with {fps} fps and video_source={video_source}")
self.fps = fps
self.video_source = video_source
self.came... | [
"logging.getLogger",
"logging.debug",
"cv2.imencode",
"time.sleep",
"cv2.VideoCapture",
"threading.Thread"
] | [((65, 92), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (82, 92), False, 'import logging\n'), ((325, 360), 'cv2.VideoCapture', 'cv2.VideoCapture', (['self.video_source'], {}), '(self.video_source)\n', (341, 360), False, 'import cv2\n'), ((513, 546), 'logging.debug', 'logging.debug', ([... |
"""The module describes the ``cgroup`` job metrics plugin."""
import logging
from galaxy.util import asbool, nice_size
from ..instrumenters import InstrumentPlugin
from ...metrics import formatting
log = logging.getLogger(__name__)
TITLES = {
"memory.memsw.max_usage_in_bytes": "Max memory usage (MEM+SWP)",
"... | [
"logging.getLogger",
"galaxy.util.nice_size"
] | [((206, 233), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (223, 233), False, 'import logging\n'), ((1444, 1458), 'galaxy.util.nice_size', 'nice_size', (['key'], {}), '(key)\n', (1453, 1458), False, 'from galaxy.util import asbool, nice_size\n')] |
# Copyright 2019 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"tests.test_libs.test_utils.with_cloud_emulators",
"tests.test_libs.helpers.patch",
"bot.tasks.analyze_task._add_default_issue_metadata",
"tests.test_libs.test_utils.create_generic_testcase"
] | [((736, 780), 'tests.test_libs.test_utils.with_cloud_emulators', 'test_utils.with_cloud_emulators', (['"""datastore"""'], {}), "('datastore')\n", (767, 780), False, 'from tests.test_libs import test_utils\n'), ((901, 1064), 'tests.test_libs.helpers.patch', 'helpers.patch', (['self', "['bot.fuzzers.engine_common.get_all... |
#
# Created on 2020/08/25
#
import os
import yaml
from pathlib import Path
import argparse
import torch
import numpy as np
from utils.logger import get_logger
from trainers import get_trainer
def setup_seed():
# make the result reproducible
torch.manual_seed(3928)
torch.cuda.manual_s... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"trainers.get_trainer",
"argparse.ArgumentParser",
"pathlib.Path",
"yaml.load",
"numpy.random.seed"
] | [((272, 295), 'torch.manual_seed', 'torch.manual_seed', (['(3928)'], {}), '(3928)\n', (289, 295), False, 'import torch\n'), ((301, 333), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all', (['(2342)'], {}), '(2342)\n', (327, 333), False, 'import torch\n'), ((430, 450), 'numpy.random.seed', 'np.random.seed', (['... |
from bs4 import BeautifulSoup
import threading
import requests
import sys
import time
def get_restrictions(url):
robots_txt = url[:len(url)] + "robots.txt"
robots_page = requests.get(robots_txt)
parsed_robots_txt = BeautifulSoup(robots_page.content, 'html.parser')
string_parsed_robots_txt = parsed_robots... | [
"bs4.BeautifulSoup",
"time.sleep",
"requests.get"
] | [((181, 205), 'requests.get', 'requests.get', (['robots_txt'], {}), '(robots_txt)\n', (193, 205), False, 'import requests\n'), ((228, 277), 'bs4.BeautifulSoup', 'BeautifulSoup', (['robots_page.content', '"""html.parser"""'], {}), "(robots_page.content, 'html.parser')\n", (241, 277), False, 'from bs4 import BeautifulSou... |
from __future__ import annotations
import typing
from django.urls import path, include
from restdoctor.utils.api_prefix import get_api_path_prefixes
from tests.stubs.views import EmptyView
if typing.TYPE_CHECKING:
from restdoctor.django.custom_types import URLPatternList
api_prefixes = get_api_path_prefixes()
... | [
"restdoctor.utils.api_prefix.get_api_path_prefixes",
"django.urls.include",
"tests.stubs.views.EmptyView.as_view"
] | [((295, 318), 'restdoctor.utils.api_prefix.get_api_path_prefixes', 'get_api_path_prefixes', ([], {}), '()\n', (316, 318), False, 'from restdoctor.utils.api_prefix import get_api_path_prefixes\n'), ((369, 388), 'tests.stubs.views.EmptyView.as_view', 'EmptyView.as_view', ([], {}), '()\n', (386, 388), False, 'from tests.s... |
"""
Basic two sided matching markets.
"""
import numpy as np
from MatchingMarkets.util import InvalidPrefsError, InvalidCapsError, MaxHeap, \
generate_prefs_from_random_scores, generate_caps_given_sum, round_caps_to_meet_sum
from MatchingMarkets.matching_alg import deferred_acceptance
class ManyToOneMarket(objec... | [
"numpy.copy",
"numpy.random.default_rng",
"numpy.ones",
"MatchingMarkets.util.InvalidCapsError",
"MatchingMarkets.util.MaxHeap",
"MatchingMarkets.matching_alg.deferred_acceptance",
"MatchingMarkets.util.generate_prefs_from_random_scores",
"numpy.any",
"numpy.max",
"datetime.datetime.now",
"numpy... | [((23591, 23614), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (23612, 23614), False, 'import datetime\n'), ((23774, 23797), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (23795, 23797), False, 'import datetime\n'), ((2097, 2192), 'numpy.full', 'np.full', (['(self.num_doctor... |
# For more details, see
# http://docs.sqlalchemy.org/en/latest/orm/tutorial.html#declare-a-mapping
from anthill.framework.db import db
from anthill.framework.utils import timezone
from anthill.framework.utils.asynchronous import as_future, thread_pool_exec as future_exec
from anthill.framework.utils.translation import ... | [
"traceback.format_tb",
"anthill.framework.utils.asynchronous.thread_pool_exec",
"json.dumps",
"anthill.framework.db.db.Column",
"anthill.framework.utils.translation.translate_lazy",
"anthill.platform.auth.RemoteUser",
"anthill.framework.db.db.relationship",
"anthill.framework.utils.timezone.now",
"s... | [((1154, 1216), 'anthill.framework.db.db.relationship', 'db.relationship', (['"""Room"""'], {'backref': '"""app_version"""', 'lazy': '"""dynamic"""'}), "('Room', backref='app_version', lazy='dynamic')\n", (1169, 1216), False, 'from anthill.framework.db import db\n'), ((1297, 1336), 'anthill.framework.db.db.Column', 'db... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-13 21:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('draftin', '0004_draft_date_published'),
]
operations = [
migrations.AlterField... | [
"django.db.models.EmailField"
] | [((411, 444), 'django.db.models.EmailField', 'models.EmailField', ([], {'max_length': '(254)'}), '(max_length=254)\n', (428, 444), False, 'from django.db import migrations, models\n')] |
import logging
import os
import dpath.util
from checkov.common.output.record import Record
from checkov.common.output.report import Report
from checkov.terraform.checks.data.registry import data_registry
from checkov.terraform.checks.provider.registry import provider_registry
from checkov.terraform.checks.resource.re... | [
"logging.debug",
"checkov.common.output.record.Record",
"checkov.common.output.report.Report",
"checkov.terraform.evaluation.base_variable_evaluation.BaseVariableEvaluation.reduce_entity_evaluations",
"checkov.terraform.evaluation.evaluation_methods.const_variable_evaluation.ConstVariableEvaluation",
"che... | [((742, 750), 'checkov.terraform.parser.Parser', 'Parser', ([], {}), '()\n', (748, 750), False, 'from checkov.terraform.parser import Parser\n'), ((1015, 1038), 'checkov.common.output.report.Report', 'Report', (['self.check_type'], {}), '(self.check_type)\n', (1021, 1038), False, 'from checkov.common.output.report impo... |
# License: BSD 3 clause
# -*- coding: utf8 -*-
import unittest
from tick.base.build.base import standard_normal_cdf, \
standard_normal_inv_cdf
from scipy.stats import norm
import numpy as np
from numpy.random import normal, uniform
class Test(unittest.TestCase):
def setUp(self):
self.size = 10
... | [
"numpy.random.normal",
"tick.base.build.base.standard_normal_cdf",
"scipy.stats.norm.ppf",
"tick.base.build.base.standard_normal_inv_cdf",
"numpy.testing.assert_almost_equal",
"numpy.empty",
"numpy.random.uniform",
"scipy.stats.norm.cdf"
] | [((452, 474), 'numpy.random.normal', 'normal', ([], {'size': 'self.size'}), '(size=self.size)\n', (458, 474), False, 'from numpy.random import normal, uniform\n'), ((569, 592), 'scipy.stats.norm.cdf', 'norm.cdf', (['tested_sample'], {}), '(tested_sample)\n', (577, 592), False, 'from scipy.stats import norm\n'), ((602, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import NoReturn
import signal
import sys
import os
from dotenv import load_dotenv, find_dotenv
from psycopg.rows import dict_row
import psycopg
load_dotenv(find_dotenv('.env.sample'))
# If `.env` exists, let it override the sample env file.
load_dotenv(overr... | [
"signal.signal",
"dotenv.find_dotenv",
"os.getenv",
"os.path.join",
"psycopg.Connection.connect",
"dotenv.load_dotenv",
"sys.exit",
"os.path.abspath"
] | [((303, 329), 'dotenv.load_dotenv', 'load_dotenv', ([], {'override': '(True)'}), '(override=True)\n', (314, 329), False, 'from dotenv import load_dotenv, find_dotenv\n'), ((462, 520), 'psycopg.Connection.connect', 'psycopg.Connection.connect', (['PSQL_URL'], {'row_factory': 'dict_row'}), '(PSQL_URL, row_factory=dict_ro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Deals with kpoints.
"""
from typing import Union
import numpy as np
from twinpy.properties.hexagonal import check_hexagonal_lattice
from twinpy.structure.lattice import CrystalLattice
class Kpoints():
"""
This class deals with kpoints.
"""
def __ini... | [
"numpy.ceil",
"numpy.where",
"numpy.round",
"numpy.floor",
"numpy.array",
"twinpy.structure.lattice.CrystalLattice",
"twinpy.properties.hexagonal.check_hexagonal_lattice"
] | [((771, 808), 'twinpy.structure.lattice.CrystalLattice', 'CrystalLattice', ([], {'lattice': 'self._lattice'}), '(lattice=self._lattice)\n', (785, 808), False, 'from twinpy.structure.lattice import CrystalLattice\n'), ((895, 943), 'twinpy.structure.lattice.CrystalLattice', 'CrystalLattice', ([], {'lattice': 'self._recip... |
# 14.5 Case Study: Multiple Linear Regression with the California Housing Dataset
# 14.5.1 Loading the Dataset
# Loading the Data
from sklearn.datasets import fetch_california_housing
california = fetch_california_housing()
# Displaying the Dataset’s Description
print(california.DESCR)
california.data.shape
califo... | [
"pandas.Series",
"seaborn.set",
"sklearn.linear_model.ElasticNet",
"sklearn.linear_model.Lasso",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.plot",
"sklearn.linear_model.Ridge",
"pandas.set_option",
"seaborn.set_style",
"sklearn.metrics.mean_squared_error",
"matplotlib.pyplot.... | [((199, 225), 'sklearn.datasets.fetch_california_housing', 'fetch_california_housing', ([], {}), '()\n', (223, 225), False, 'from sklearn.datasets import fetch_california_housing\n'), ((426, 455), 'pandas.set_option', 'pd.set_option', (['"""precision"""', '(4)'], {}), "('precision', 4)\n", (439, 455), True, 'import pan... |
# -*- coding: utf-8 -*-
import datetime
import tempfile
import unittest
from pathlib import Path
import pytest
from _pytest.logging import caplog
from dsg_lib.logging_config import config_log
import logging
def some_func(var1, var2):
"""
some function to test logging
"""
if var1 < 1:
logging.w... | [
"pathlib.Path.cwd",
"dsg_lib.logging_config.config_log",
"logging.warning",
"pytest.raises"
] | [((513, 525), 'dsg_lib.logging_config.config_log', 'config_log', ([], {}), '()\n', (523, 525), False, 'from dsg_lib.logging_config import config_log\n'), ((1111, 1233), 'dsg_lib.logging_config.config_log', 'config_log', ([], {'log_name': 'f"""{log_name}.log"""', 'app_name': '"""123"""', 'service_id': '"""456"""', 'appe... |
import unittest
import types
import requests
from logz import log
from filez import file
from tmp.robots.utils import split_and_strip, parse_dollar, get_comparator
print = log.info
def extract(expr):
return expr
functions = dict(
log=log.info,
get=requests.get,
extract=extract
)
def parse_args(... | [
"unittest.defaultTestLoader.loadTestsFromTestCase",
"tmp.robots.utils.get_comparator",
"logz.log.debug",
"tmp.robots.utils.split_and_strip",
"unittest.SkipTest",
"tmp.robots.utils.parse_dollar",
"filez.file.load",
"unittest.TextTestRunner"
] | [((596, 616), 'tmp.robots.utils.get_comparator', 'get_comparator', (['text'], {}), '(text)\n', (610, 616), False, 'from tmp.robots.utils import split_and_strip, parse_dollar, get_comparator\n'), ((732, 759), 'tmp.robots.utils.parse_dollar', 'parse_dollar', (['context', 'text'], {}), '(context, text)\n', (744, 759), Fal... |
import numpy.testing as npt
import sys
from dipy.workflows.base import IntrospectiveArgumentParser
from dipy.workflows.flow_runner import run_flow
from dipy.workflows.tests.workflow_tests_utils import TestFlow, \
DummyCombinedWorkflow
def test_iap():
sys.argv = [sys.argv[0]]
pos_keys = ['positional_str',... | [
"dipy.workflows.base.IntrospectiveArgumentParser",
"numpy.testing.assert_equal",
"dipy.workflows.tests.workflow_tests_utils.TestFlow",
"dipy.workflows.tests.workflow_tests_utils.DummyCombinedWorkflow",
"sys.argv.extend",
"dipy.workflows.flow_runner.run_flow",
"numpy.testing.assert_array_equal"
] | [((711, 734), 'sys.argv.extend', 'sys.argv.extend', (['inputs'], {}), '(inputs)\n', (726, 734), False, 'import sys\n'), ((748, 777), 'dipy.workflows.base.IntrospectiveArgumentParser', 'IntrospectiveArgumentParser', ([], {}), '()\n', (775, 777), False, 'from dipy.workflows.base import IntrospectiveArgumentParser\n'), ((... |
# Listen, Attend and Spell model adapted from XenderLiu
# https://github.com/XenderLiu/Listen-Attend-and-Spell-Pytorch
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import onmt
from onmt.Models import EncoderBase
# BLSTM layer for pBLSTM
# ... | [
"torch.nn.ModuleList"
] | [((2402, 2424), 'torch.nn.ModuleList', 'nn.ModuleList', (['modules'], {}), '(modules)\n', (2415, 2424), True, 'import torch.nn as nn\n')] |
#!python3.8
from typing import Callable
from functools import partial
import pyads
import ctypes
from ctypes import sizeof
from ctypes import c_ubyte
from ctypes import Structure
import traceback
import sys
sys.tracebacklimit = 0
# TODO
# - call createroute when needed automatically
# - handle plc not found
cla... | [
"pyads.set_local_address",
"traceback.format_exc",
"pyads.Connection",
"pyads.open_port",
"functools.partial",
"ctypes.sizeof"
] | [((746, 805), 'pyads.Connection', 'pyads.Connection', (["self.params['net_id']", 'pyads.PORT_TC3PLC1'], {}), "(self.params['net_id'], pyads.PORT_TC3PLC1)\n", (762, 805), False, 'import pyads\n'), ((5661, 5678), 'pyads.open_port', 'pyads.open_port', ([], {}), '()\n', (5676, 5678), False, 'import pyads\n'), ((5687, 5740)... |
from skimage import io
import pyopencl as cl
import numpy as np
import sys
# VISIONGL IMPORTS
from vglShape import *
from vglStrEl import *
import vglConst as vc
"""
img:
is the input image
cl_shape:
3D Images:
The OpenCL's default is to be (img_width, img_height, img_depht)
2D Images:
The The OpenCL's ... | [
"pyopencl.enqueue_copy",
"vglConst.VGL_IMAGE_2D_IMAGE",
"skimage.io.imread",
"numpy.zeros",
"vglConst.VGL_IMAGE_3D_IMAGE",
"skimage.io.imsave",
"numpy.frombuffer",
"pyopencl.Image"
] | [((943, 966), 'vglConst.VGL_IMAGE_2D_IMAGE', 'vc.VGL_IMAGE_2D_IMAGE', ([], {}), '()\n', (964, 966), True, 'import vglConst as vc\n'), ((5103, 5209), 'pyopencl.enqueue_copy', 'cl.enqueue_copy', (['queue', 'self.img_device', 'self.img_host'], {'origin': 'origin', 'region': 'region', 'is_blocking': '(True)'}), '(queue, se... |
"""
Functional tests of operations implemented by :mod:`weaver.processes.wps_package`.
Validates that CWL package definitions are parsed and executes the process as intended.
Local test web application is employed to run operations by mocking external requests.
.. seealso::
- :mod:`tests.processes.wps_package`.
"... | [
"logging.getLogger",
"tests.utils.mocked_execute_process",
"boto3.client",
"weaver.wps.utils.map_wps_output_location",
"copy.deepcopy",
"tests.utils.mocked_file_server",
"weaver.formats.get_cwl_file_format",
"tests.utils.mocked_dismiss_process",
"json.dumps",
"os.path.split",
"tests.utils.mocked... | [((2921, 2948), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2938, 2948), False, 'import logging\n'), ((116987, 117029), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""not implemented"""'}), "(reason='not implemented')\n", (117003, 117029), False, 'import pytest\n'), ((138... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: Yizhong
# created_at: 10/27/2016 下午8:34
import numpy
class Performance(object):
def __init__(self, percision, recall, hit_num):
self.percision = percision
self.recall = recall
self.hit_num = hit_num
class Metrics(object):
def _... | [
"numpy.array"
] | [((4236, 4273), 'numpy.array', 'numpy.array', (['self.span_perf.percision'], {}), '(self.span_perf.percision)\n', (4247, 4273), False, 'import numpy\n'), ((4301, 4335), 'numpy.array', 'numpy.array', (['self.span_perf.recall'], {}), '(self.span_perf.recall)\n', (4312, 4335), False, 'import numpy\n'), ((4779, 4815), 'num... |
"""Algo class definition."""
import os
import sys
import logging
import argparse
import pandas as pd
from datetime import datetime
from aqtlib import utils, Broker, Porter
from aqtlib.objects import DataStore
from abc import abstractmethod
from .instrument import Instrument
__all__ = ['Algo']
class Algo(Broker):
... | [
"logging.getLogger",
"os.path.exists",
"aqtlib.objects.DataStore",
"aqtlib.utils.prepare_data",
"argparse.ArgumentParser",
"pandas.read_csv",
"datetime.datetime.now",
"aqtlib.Porter.drip",
"aqtlib.Porter.validate_csv",
"sys.exit",
"pandas.DataFrame",
"pandas.concat",
"nest_asyncio.apply",
... | [((1711, 1739), 'logging.getLogger', 'logging.getLogger', (['self.name'], {}), '(self.name)\n', (1728, 1739), False, 'import logging\n'), ((2157, 2171), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2169, 2171), True, 'import pandas as pd\n'), ((3608, 3724), 'argparse.ArgumentParser', 'argparse.ArgumentParser'... |
import tensorflow as tf
import numpy as np
import random
class GaussianNoise():
def __init__(self,action_dimension,epsilon_init = 0.7, epsilon_end = 0.3,mu=0, theta =0.15, sigma = 0.25):
self.action_dimension = action_dimension
self.mu = mu
self.theta = theta
self.sigma = sigma
... | [
"tensorflow.reduce_sum",
"tensorflow.reduce_mean",
"tensorflow.log",
"numpy.arange",
"tensorflow.placeholder",
"tensorflow.contrib.layers.fully_connected",
"tensorflow.concat",
"numpy.concatenate",
"tensorflow.trainable_variables",
"numpy.maximum",
"tensorflow.train.AdamOptimizer",
"numpy.rand... | [((591, 646), 'numpy.maximum', 'np.maximum', (['(self.epsilon - self.decay)', 'self.epsilon_end'], {}), '(self.epsilon - self.decay, self.epsilon_end)\n', (601, 646), True, 'import numpy as np\n'), ((5112, 5245), 'tensorflow.reshape', 'tf.reshape', (['(self.renew * (0.01 + 0.69 * (action + 1) / 2) + (1 - self.renew) * ... |
from stationdata import build_station_list, update_water_levels
from utils import sorted_by_key
def stations_level_over_threshold(stations,tol):
list_of_tup = []
for station in stations:
if station.typical_range_consistent() == True:
if station.latest_level != None and station.relative_... | [
"utils.sorted_by_key"
] | [((469, 504), 'utils.sorted_by_key', 'sorted_by_key', (['list_of_tup', '(1)', '(True)'], {}), '(list_of_tup, 1, True)\n', (482, 504), False, 'from utils import sorted_by_key\n'), ((847, 882), 'utils.sorted_by_key', 'sorted_by_key', (['list_of_tup', '(1)', '(True)'], {}), '(list_of_tup, 1, True)\n', (860, 882), False, '... |
import argparse, os, shutil, tempfile
from os.path import basename, exists, join
from ..common import PackageBuilder, ProfileManagement, RecipeCache, Utility
from .update import update
# The default username used when building packages
DEFAULT_USER = 'adamrehn'
def build(manager, argv):
# Our supported command-lin... | [
"tempfile.TemporaryDirectory",
"os.path.exists",
"argparse.ArgumentParser",
"os.path.join",
"os.getcwd"
] | [((342, 468), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""ue4 conan build"""', 'description': '"""Builds Conan packages that depend on conan-ue4cli wrappers"""'}), "(prog='ue4 conan build', description=\n 'Builds Conan packages that depend on conan-ue4cli wrappers')\n", (365, 468), False,... |
# in this module, inference on a single picture is performed
# this contains predictions with the model, and drawing the predicted vs. ground-truth boxes
# this code is literally a patchwork in the sense that it contains code copied from many locations
# (eg. from zold137/drone_demo/predictor
import cv2
import torc... | [
"torch.nonzero",
"torch.tensor",
"cv2.putText"
] | [((2220, 2273), 'torch.tensor', 'torch.tensor', (['[2 ** 25 - 1, 2 ** 15 - 1, 2 ** 21 - 1]'], {}), '([2 ** 25 - 1, 2 ** 15 - 1, 2 ** 21 - 1])\n', (2232, 2273), False, 'import torch\n'), ((1880, 1913), 'torch.nonzero', 'torch.nonzero', (['(scores > threshold)'], {}), '(scores > threshold)\n', (1893, 1913), False, 'impor... |
import multiprocessing
import os
import inspect
import json
import tempfile
import sys
from calamari_ocr.ocr import CrossFold
from calamari_ocr.utils.multiprocessing import prefix_run_command, run
# path to the dir of this script to automatically detect the training script
this_absdir = os.path.dirname(os.path.abspat... | [
"os.path.exists",
"os.makedirs",
"inspect.stack",
"os.path.join",
"tempfile.mkdtemp",
"multiprocessing.Pool",
"shutil.rmtree",
"calamari_ocr.ocr.CrossFold",
"os.path.abspath",
"json.dump"
] | [((4008, 4049), 'os.path.join', 'os.path.join', (['temporary_dir', '"""folds.json"""'], {}), "(temporary_dir, 'folds.json')\n", (4020, 4049), False, 'import os\n'), ((4071, 4188), 'calamari_ocr.ocr.CrossFold', 'CrossFold', ([], {'n_folds': 'self.n_folds', 'dataset': 'self.dataset', 'output_dir': 'temporary_dir', 'progr... |
from datetime import date
import os
from pathlib import Path
import pickle
from typing import Sequence, NamedTuple
from urllib.request import urlretrieve
TMP = Path(os.getenv("TMP", "/tmp"))
S3 = "https://bites-data.s3.us-east-2.amazonaws.com"
PICKLE_INFILE = TMP / 'input.pkl'
PICKLE_OUTFILE = TMP / 'output.pkl'
cla... | [
"pickle.load",
"pickle.dump",
"os.getenv",
"urllib.request.urlretrieve"
] | [((166, 190), 'os.getenv', 'os.getenv', (['"""TMP"""', '"""/tmp"""'], {}), "('TMP', '/tmp')\n", (175, 190), False, 'import os\n'), ((510, 557), 'urllib.request.urlretrieve', 'urlretrieve', (['f"""{S3}/bite317.pkl"""', 'PICKLE_INFILE'], {}), "(f'{S3}/bite317.pkl', PICKLE_INFILE)\n", (521, 557), False, 'from urllib.reque... |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import datetime
import json
import mock
import unittest
from mock import patch
from google.protobuf import duration_pb2
from google.protobuf import empty_pb... | [
"datetime.datetime",
"google.protobuf.duration_pb2.Duration",
"infra_libs.test.testmessage_pb2.RepeatedContainer",
"google.protobuf.struct_pb2.Struct",
"json.loads",
"mock.Mock",
"infra_libs.bqh.message_to_dict",
"google.protobuf.timestamp_pb2.Timestamp",
"infra_libs.bqh.send_rows",
"google.protob... | [((6561, 6576), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6574, 6576), False, 'import unittest\n'), ((606, 617), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (615, 617), False, 'import mock\n'), ((978, 1045), 'infra_libs.bqh.send_rows', 'bqh.send_rows', (['self.bq_client', 'self.dataset_id', 'self.table_id', ... |
"""
Welcome to your first Halite-II bot!
This bot's name is Settler. It's purpose is simple (don't expect it to win complex games :) ):
1. Initialize game
2. If a ship is not docked and there are unowned planets
2.a. Try to Dock in the planet if close enough
2.b If not, go towards the planet
Note: Please do not place... | [
"numpy.mean",
"numpy.sqrt",
"numpy.minimum",
"hlt.Game",
"math.radians",
"numpy.array",
"numpy.sum",
"hlt.entity.Position",
"numpy.min",
"numpy.argmin",
"numpy.maximum",
"time.time"
] | [((811, 830), 'hlt.Game', 'hlt.Game', (['"""MyBot16"""'], {}), "('MyBot16')\n", (819, 830), False, 'import hlt\n'), ((1017, 1046), 'numpy.sqrt', 'numpy.sqrt', (['(dx * dx + dy * dy)'], {}), '(dx * dx + dy * dy)\n', (1027, 1046), False, 'import numpy\n'), ((5262, 5333), 'hlt.entity.Position', 'hlt.entity.Position', (['(... |
from sumo.constants import RUN_DEFAULTS
from sumo.modes.run.run import SumoRun
from sumo.utils import save_arrays_to_npz
import numpy as np
import os
import pytest
def _get_args(infile: str, k: list, outdir: str):
args = RUN_DEFAULTS.copy()
args['outdir'] = outdir
args['k'] = k
args["infile"] = infile... | [
"sumo.constants.RUN_DEFAULTS.copy",
"numpy.random.random",
"os.path.join",
"sumo.modes.run.run.SumoRun",
"numpy.array",
"pytest.raises",
"sumo.utils.save_arrays_to_npz"
] | [((227, 246), 'sumo.constants.RUN_DEFAULTS.copy', 'RUN_DEFAULTS.copy', ([], {}), '()\n', (244, 246), False, 'from sumo.constants import RUN_DEFAULTS\n'), ((460, 492), 'os.path.join', 'os.path.join', (['tmpdir', '"""data.npz"""'], {}), "(tmpdir, 'data.npz')\n", (472, 492), False, 'import os\n'), ((506, 536), 'os.path.jo... |
from ImageEmbeddings import ImageEmbeddings
from celery import Task, Celery
from cairosvg import svg2png
from numpy import array
from PIL import Image
from pickle import load
from base64 import b64encode
from io import BytesIO
from tempfile import NamedTemporaryFile
def svg2array(bytestring=None, size=32, tran_color=... | [
"PIL.Image.fromarray",
"PIL.Image.open",
"cairosvg.svg2png",
"celery.Celery",
"base64.b64encode",
"io.BytesIO",
"tempfile.NamedTemporaryFile",
"ImageEmbeddings.ImageEmbeddings"
] | [((1513, 1604), 'celery.Celery', 'Celery', (['"""tasks"""'], {'broker': '"""redis://localhost:6379/0"""', 'backend': '"""redis://localhost:6379/0"""'}), "('tasks', broker='redis://localhost:6379/0', backend=\n 'redis://localhost:6379/0')\n", (1519, 1604), False, 'from celery import Task, Celery\n'), ((381, 401), 'te... |
# This file is part of Viper - https://github.com/viper-framework/viper
# See the file 'LICENSE' for copying permission.
import os
import glob
import atexit
import readline
import traceback
from viper.common.out import *
from viper.core.session import __sessions__
from viper.core.plugins import __modules__
from viper... | [
"readline.set_completer",
"os.path.exists",
"readline.set_completer_delims",
"readline.parse_and_bind",
"viper.core.session.__sessions__.is_set",
"readline.write_history_file",
"os.getenv",
"os.path.join",
"readline.read_history_file",
"glob.glob",
"viper.core.ui.commands.Commands",
"traceback... | [((852, 862), 'viper.core.database.Database', 'Database', ([], {}), '()\n', (860, 862), False, 'from viper.core.database import Database\n'), ((1315, 1325), 'viper.core.ui.commands.Commands', 'Commands', ([], {}), '()\n', (1323, 1325), False, 'from viper.core.ui.commands import Commands\n'), ((5033, 5072), 'readline.se... |
import json
import boto3
import os
import math
# Data search
def search_obj(bucketObj, searchList):
"""
Search function for s3 objects
input: s3 object in boto3, list of items
output: s3 object key list
"""
result=[]
for target in searchList:
for candidate in bucketObj.objects.all()... | [
"boto3.resource",
"json.dumps",
"os.path.basename",
"os.remove"
] | [((1261, 1280), 'os.remove', 'os.remove', (['datapath'], {}), '(datapath)\n', (1270, 1280), False, 'import os\n'), ((2170, 2190), 'boto3.resource', 'boto3.resource', (['"""s3"""'], {}), "('s3')\n", (2184, 2190), False, 'import boto3\n'), ((3285, 3306), 'json.dumps', 'json.dumps', (['"""Success"""'], {}), "('Success')\n... |
# Generated by Django 2.1.5 on 2019-02-06 14:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("wargame", "0016_auto_20190206_1544")]
operations = [migrations.AddField(model_name="submission", name="times", field=models.IntegerField(default=0))]
| [
"django.db.models.IntegerField"
] | [((276, 306), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)'}), '(default=0)\n', (295, 306), False, 'from django.db import migrations, models\n')] |
from typing import Optional, Dict
import requests
class TelegramBotApi:
def __init__(self, bot_token: str, bot_chat_id: Optional[str]) -> None:
self._bot_token = bot_token
self._bot_chat_id = bot_chat_id
self._base_url = 'https://api.telegram.org/bot' + bot_token
def send_message(se... | [
"requests.get"
] | [((497, 565), 'requests.get', 'requests.get', (["(self._base_url + '/sendMessage')"], {'data': 'data', 'timeout': '(10)'}), "(self._base_url + '/sendMessage', data=data, timeout=10)\n", (509, 565), False, 'import requests\n'), ((652, 708), 'requests.get', 'requests.get', (["(self._base_url + '/getUpdates')"], {'timeout... |
import time
import sys
from bs4 import BeautifulSoup
# from grubhub import Grubhub
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
fr... | [
"bs4.BeautifulSoup",
"selenium.webdriver.chrome.options.Options",
"selenium.webdriver.support.ui.WebDriverWait",
"selenium.webdriver.support.expected_conditions.presence_of_element_located"
] | [((743, 752), 'selenium.webdriver.chrome.options.Options', 'Options', ([], {}), '()\n', (750, 752), False, 'from selenium.webdriver.chrome.options import Options\n'), ((1151, 1176), 'selenium.webdriver.support.ui.WebDriverWait', 'WebDriverWait', (['driver', '(10)'], {}), '(driver, 10)\n', (1164, 1176), False, 'from sel... |
"""This module provides functions for easy editing of kopano config files
via environment variables"""
import re
import os
import os.path
def configkopano(configs):
""" Changes configuration files according to configs typically returned from parseenvironmentvariables(..)"""
for filename, config in configs.ite... | [
"os.environ.items",
"os.path.exists",
"re.escape",
"re.match"
] | [((1797, 1815), 'os.environ.items', 'os.environ.items', ([], {}), '()\n', (1813, 1815), False, 'import os\n'), ((1887, 1935), 're.match', 're.match', (['"""^KCCONF_([A-Z]+)_([A-Z0-9_]+)$"""', 'name'], {}), "('^KCCONF_([A-Z]+)_([A-Z0-9_]+)$', name)\n", (1895, 1935), False, 'import re\n'), ((2326, 2377), 're.match', 're.... |
# -*- coding: utf-8 -*-
#/usr/bin/python2
'''
Feb. 2019 by <NAME>.
<EMAIL>.
https://www.github.com/kyubyong/transformer
Inference
'''
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "-1" # 这一行注释掉就是使用cpu,不注释就是使用gpu
import tensorflow as tf
from data_load import get_batch
from model import Transformer
from hparams impo... | [
"logging.basicConfig",
"os.path.exists",
"os.makedirs",
"tensorflow.Session",
"tensorflow.train.Saver",
"os.path.join",
"model.Transformer",
"utils.get_hypotheses",
"hparams.Hparams",
"data_load.get_batch",
"utils.calc_bleu",
"utils.load_hparams",
"tensorflow.train.latest_checkpoint",
"ten... | [((418, 457), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (437, 457), False, 'import logging\n'), ((459, 484), 'logging.info', 'logging.info', (['"""# hparams"""'], {}), "('# hparams')\n", (471, 484), False, 'import logging\n'), ((495, 504), 'hparams.Hparams'... |
import sys
from itertools import islice
from .base_magics import DataMagic
from .. import seq
from ..functions import fn, to_callable
from ..typing import Seq
class L(DataMagic, type=list):
"""
Class for the L magic object.
"""
def __getitem__(self, item):
if isinstance(item, slice):
... | [
"itertools.islice"
] | [((982, 1018), 'itertools.islice', 'islice', (['obj', 's.start', 's.stop', 's.step'], {}), '(obj, s.start, s.stop, s.step)\n', (988, 1018), False, 'from itertools import islice\n'), ((867, 904), 'itertools.islice', 'islice', (['obj', 's.start', 's.stop', '(-s.step)'], {}), '(obj, s.start, s.stop, -s.step)\n', (873, 904... |
import argparse
import math
import os
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data as Data
from torch.autograd import Variable
from torch.utils.data import Dataset
import math
from model import HierachyVAE
from read_data import *
from util... | [
"numpy.clip",
"torch.nn.CrossEntropyLoss",
"numpy.random.rand",
"math.floor",
"torch.max",
"torch.cuda.device_count",
"torch.cuda.is_available",
"torch.sum",
"model.HierachyVAE",
"argparse.ArgumentParser",
"numpy.exp",
"torch.nn.functional.log_softmax",
"torch.save",
"torch.cat",
"torch.... | [((341, 392), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Hierachy VAE"""'}), "(description='Hierachy VAE')\n", (364, 392), False, 'import argparse\n'), ((2749, 2774), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (2772, 2774), False, 'import torch\n'), ((285... |
import argparse
import collections
import time
import numpy as np
import torch as th
import torch.nn.functional as F
import torch.nn.init as INIT
import torch.optim as optim
from torch.utils.data import DataLoader
from gene_dataset import Datagenerator
import torch
# from sklearn.decomposition import PCA
from sklearn.f... | [
"numpy.sqrt",
"math.sqrt",
"numpy.column_stack",
"dgl.data.tree.SST",
"torch.from_numpy",
"sklearn.feature_selection.SelectKBest",
"numpy.array",
"networkx.shortest_path",
"numpy.linalg.norm",
"operator.itemgetter",
"gene_dataset.Datagenerator",
"argparse.ArgumentParser",
"spacy.load",
"nu... | [((440, 456), 'spacy.load', 'spacy.load', (['"""en"""'], {}), "('en')\n", (450, 456), False, 'import spacy\n'), ((866, 884), 'numpy.square', 'np.square', (['(v1 - v2)'], {}), '(v1 - v2)\n', (875, 884), True, 'import numpy as np\n'), ((890, 900), 'numpy.sum', 'np.sum', (['sq'], {}), '(sq)\n', (896, 900), True, 'import n... |
"""Encode config.xml into config.bin"""
import argparse
import zcu
from zcu.xcryptors import Xcryptor, T4Xcryptor, DigiXcryptor
def main():
"""the main function"""
parser = argparse.ArgumentParser(description='Encode config.bin for ZTE Routers',
formatter_class=argparse.... | [
"argparse.FileType",
"argparse.ArgumentParser",
"zcu.zte.add_header",
"zcu.xcryptors.Xcryptor",
"zcu.xcryptors.DigiXcryptor",
"zcu.compression.compress",
"zcu.xcryptors.T4Xcryptor"
] | [((185, 315), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Encode config.bin for ZTE Routers"""', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), "(description='Encode config.bin for ZTE Routers',\n formatter_class=argparse.RawDescriptionHelpFormatter)\n", (208, 315), F... |
from GithubRep import GithubRep
import unittest
class GithubRepTests(unittest.TestCase):
def test_constructor_usual(self):
init_line = " - [Algorithms](https://github.com/tayllan/awesome-algorithms)"
github_rep = GithubRep(init_line)
self.assertEquals("https://github.com/tayllan/awesome-... | [
"GithubRep.GithubRep"
] | [((236, 256), 'GithubRep.GithubRep', 'GithubRep', (['init_line'], {}), '(init_line)\n', (245, 256), False, 'from GithubRep import GithubRep\n'), ((552, 572), 'GithubRep.GithubRep', 'GithubRep', (['init_line'], {}), '(init_line)\n', (561, 572), False, 'from GithubRep import GithubRep\n'), ((845, 865), 'GithubRep.GithubR... |
#!/usr/bin/env python3
"""Unittest for the usage module."""
import unittest
from usage import Usage
class TestUsageModule(unittest.TestCase):
"""Test cases."""
def setUp(self):
"""Setup each testcase."""
self.usage = Usage()
def test_silent_verbose(self):
"""Check options for s... | [
"unittest.main",
"usage.Usage"
] | [((1749, 1764), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1762, 1764), False, 'import unittest\n'), ((246, 253), 'usage.Usage', 'Usage', ([], {}), '()\n', (251, 253), False, 'from usage import Usage\n')] |
import os
from setuptools import setup, Extension
try:
from Cython.Build import cythonize
except ImportError:
cythonize = None
USE_CYTHON = bool(int(os.getenv("USE_CYTHON", 0))) and cythonize is not None
MODULES = (
{'mod': 'tkvdb.errors', 'files': ["errors"]},
{'mod': 'tkvdb.params', 'files': ["par... | [
"Cython.Build.cythonize",
"os.path.dirname",
"setuptools.Extension",
"os.getenv"
] | [((1063, 1088), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1078, 1088), False, 'import os\n'), ((895, 964), 'Cython.Build.cythonize', 'cythonize', (['extensions'], {'include_path': "['src/tkvdb']", 'language_level': '"""3"""'}), "(extensions, include_path=['src/tkvdb'], language_level='3... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Name: <NAME> & <NAME>
# Student ID: 2298930 & 1450263
# Email: <EMAIL> & <EMAIL>
# Course: CS510 Fall 2017
# Assignment: Classwork 3
###
from sequences import fibonacci
def main(local_argv):
#print("the arg is ", local_argv)
try:
local_argv = int(local_... | [
"sequences.fibonacci"
] | [((413, 434), 'sequences.fibonacci', 'fibonacci', (['local_argv'], {}), '(local_argv)\n', (422, 434), False, 'from sequences import fibonacci\n'), ((375, 396), 'sequences.fibonacci', 'fibonacci', (['local_argv'], {}), '(local_argv)\n', (384, 396), False, 'from sequences import fibonacci\n')] |
#! /usr/bin/env python
#
from __future__ import print_function
import time
import os
import numpy as np
import logging
import subprocess
# For some variations on this theme, e.g. time.time vs. time.clock, see
# http://stackoverflow.com/questions/7370801/measure-time-elapsed-in-python
ostype = None
class DtimeSi... | [
"logging.basicConfig",
"time.clock",
"numpy.append",
"numpy.array",
"os.getpid",
"time.time",
"logging.info",
"os.uname"
] | [((6345, 6384), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (6364, 6384), False, 'import logging\n'), ((2293, 2305), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (2301, 2305), True, 'import numpy as np\n'), ((6260, 6299), 'numpy.array', 'np.array', (["[... |
#! /usr/bin/env python
import sys
import getopt
import os.path
import logging
import random
# Intrapackage imports
libpath = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))
if os.path.isdir(libpath):
sys.path.insert(0, libpath)
import pyx12
import pyx12.x12file
import pyx12.x12context
import pyx... | [
"logging.getLogger",
"getopt.getopt",
"collections.namedtuple",
"sys.path.insert",
"logging.StreamHandler",
"pyx12.x12context.X12ContextReader",
"pyx12.x12file.X12Writer",
"logging.Formatter",
"pyx12.params.params",
"sys.stdout.write",
"random.randint",
"pyx12.error_handler.errh_null"
] | [((543, 562), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (560, 562), False, 'import logging\n'), ((591, 731), 'collections.namedtuple', 'namedtuple', (['"""Demographic"""', '"""primaryId, ssn, medicaidId, dob, dod, firstname, lastname, middlename, street, street2, county"""'], {}), "('Demograph... |
"""
atlas.code_operations
~~~~
Commands that run on servers to deploy code.
"""
import logging
import os
import shutil
import subprocess
import git
from atlas import utilities
from atlas.config import (ENVIRONMENT, CODE_ROOT, WEB_ROOT, DEFAULT_PROFILE)
from atlas.config_servers import (SERVERDEFS)
# Setup... | [
"logging.getLogger",
"os.path.exists",
"atlas.utilities.code_type_directory_name",
"os.makedirs",
"git.Repo.clone_from",
"atlas.utilities.get_eve",
"atlas.utilities.code_path",
"os.rmdir",
"os.path.isdir",
"os.unlink",
"atlas.utilities.sync",
"os.path.islink"
] | [((374, 416), 'logging.getLogger', 'logging.getLogger', (['"""atlas.code_operations"""'], {}), "('atlas.code_operations')\n", (391, 416), False, 'import logging\n'), ((650, 675), 'atlas.utilities.code_path', 'utilities.code_path', (['item'], {}), '(item)\n', (669, 675), False, 'from atlas import utilities\n'), ((700, 7... |
#########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... | [
"requests.get",
"cloudify.ctx.agent.init_script",
"cloudify.compute.create_multi_mimetype_userdata"
] | [((849, 872), 'cloudify.ctx.agent.init_script', 'ctx.agent.init_script', ([], {}), '()\n', (870, 872), False, 'from cloudify import ctx\n'), ((1474, 1561), 'cloudify.compute.create_multi_mimetype_userdata', 'compute.create_multi_mimetype_userdata', (['[existing_userdata, install_agent_userdata]'], {}), '([existing_user... |
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: <NAME>(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the ... | [
"odoo.fields.Text"
] | [((1282, 1323), 'odoo.fields.Text', 'fields.Text', (['"""Url"""'], {'compute': '"""get_favicon"""'}), "('Url', compute='get_favicon')\n", (1293, 1323), False, 'from odoo import models, fields, api, tools\n'), ((1351, 1397), 'odoo.fields.Text', 'fields.Text', (['"""Url"""'], {'compute': '"""get_company_logo"""'}), "('Ur... |
import sys
import textwrap
import types
import pandas as pd
import pytest
from toucan_data_sdk.utils.helpers import (
clean_cachedir_old_entries,
get_func_sourcecode,
get_param_value_from_func_call,
get_temp_column_name,
)
def test_get_temp_column_name():
df = pd.DataFrame({'__tmp__': ['a, b']})... | [
"textwrap.dedent",
"toucan_data_sdk.utils.helpers.clean_cachedir_old_entries",
"toucan_data_sdk.utils.helpers.get_param_value_from_func_call",
"types.ModuleType",
"toucan_data_sdk.utils.helpers.get_temp_column_name",
"pytest.raises",
"toucan_data_sdk.utils.helpers.get_func_sourcecode",
"pandas.DataFra... | [((285, 320), 'pandas.DataFrame', 'pd.DataFrame', (["{'__tmp__': ['a, b']}"], {}), "({'__tmp__': ['a, b']})\n", (297, 320), True, 'import pandas as pd\n'), ((1136, 1165), 'types.ModuleType', 'types.ModuleType', (['module_name'], {}), '(module_name)\n', (1152, 1165), False, 'import types\n'), ((1253, 1280), 'sys.path.ap... |
# 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 t... | [
"adcm_pytest_plugin.utils.random_special_chars",
"adcm_pytest_plugin.utils.random_string",
"tests.library.errorcodes.JSON_ERROR.equal",
"pytest.fixture",
"adcm_pytest_plugin.utils.get_random_service",
"tests.library.steps.delete_all_hosts",
"tests.library.errorcodes.HOST_NOT_FOUND.equal",
"adcm_pytest... | [((997, 1027), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (1011, 1027), False, 'import pytest\n'), ((1302, 1332), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (1316, 1332), False, 'import pytest\n'), ((892, 917), 'os.path.dirn... |
import pylab
inputDataFile = 'output.dat'
data = pylab.load(inputDataFile, comments='!', skiprows=0)
l = pylab.plot(data[:,1], 'r-', linewidth=1)
pylab.xlabel('Iteration')
pylab.ylabel('Mean Square Metric')
pylab.title('Registration')
pylab.grid(True)
pylab.savefig('outputMetric.png')
pylab.show()
l = pylab.plot(d... | [
"pylab.title",
"pylab.plot",
"pylab.savefig",
"pylab.xlabel",
"pylab.grid",
"pylab.load",
"pylab.ylabel",
"pylab.show"
] | [((50, 101), 'pylab.load', 'pylab.load', (['inputDataFile'], {'comments': '"""!"""', 'skiprows': '(0)'}), "(inputDataFile, comments='!', skiprows=0)\n", (60, 101), False, 'import pylab\n'), ((107, 148), 'pylab.plot', 'pylab.plot', (['data[:, 1]', '"""r-"""'], {'linewidth': '(1)'}), "(data[:, 1], 'r-', linewidth=1)\n", ... |
from . import config as config_lib
from . import handlers
from . import errors
from protorpc import remote
from webapp2_extras import auth as webapp2_auth
import Cookie
import os
import webapp2
__all__ = [
'Service',
]
class Service(remote.Service, handlers.BaseHandler):
"""Enables compatibility with handlers... | [
"webapp2_extras.auth.get_auth",
"webapp2.WSGIApplication"
] | [((455, 493), 'webapp2.WSGIApplication', 'webapp2.WSGIApplication', ([], {'config': 'config'}), '(config=config)\n', (478, 493), False, 'import webapp2\n'), ((702, 745), 'webapp2_extras.auth.get_auth', 'webapp2_auth.get_auth', ([], {'request': 'self.request'}), '(request=self.request)\n', (723, 745), True, 'from webapp... |
import re
from typing import Any, Dict, List
import graphene
from graphene import ObjectType, String, Field, Schema
from graphql.utils.schema_printer import _print_fields as print_fields
from graphene_federation.extend import get_extended_types
from graphene_federation.provides import get_provides_parent_types
fro... | [
"graphene.String",
"re.escape",
"graphene.Field",
"re.compile",
"graphene_federation.extend.get_extended_types",
"graphene_federation.provides.get_provides_parent_types",
"graphql.utils.schema_printer._print_fields"
] | [((2790, 2815), 'graphql.utils.schema_printer._print_fields', 'print_fields', (['entity_type'], {}), '(entity_type)\n', (2802, 2815), True, 'from graphql.utils.schema_printer import _print_fields as print_fields\n'), ((3324, 3341), 're.compile', 're.compile', (['regex'], {}), '(regex)\n', (3334, 3341), False, 'import r... |
import os
from os import path
from glob import glob
import json
import re
import pickle
import argparse
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from textwrap import wrap
from scipy import ndimage, misc
import config
from type import RecipeContainer, DataContainer
fro... | [
"scipy.ndimage.imread",
"numpy.array",
"textwrap.wrap",
"scipy.misc.imresize",
"os.walk",
"re.search",
"os.path.exists",
"argparse.ArgumentParser",
"numpy.random.random",
"type.DataContainer",
"matplotlib.use",
"numpy.fliplr",
"pickle.load",
"pickle.dump",
"os.path.join",
"utils.URL_to... | [((149, 163), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (156, 163), True, 'import matplotlib as mpl\n'), ((527, 550), 'numpy.random.shuffle', 'np.random.shuffle', (['keys'], {}), '(keys)\n', (544, 550), True, 'import numpy as np\n'), ((819, 859), 'numpy.array', 'np.array', (['[image_list[f] for f i... |
from typing import Dict, Optional
from pathlib import Path
from dotenv.main import dotenv_values
def _get_user_credentials(
api_key: Optional[str] = None,
full_name: Optional[str] = None,
affiliation: Optional[str] = None,
email: Optional[str] = None,
reason: Optional[str] = None,
mailing_list... | [
"dotenv.main.dotenv_values",
"pathlib.Path.home"
] | [((1167, 1178), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (1176, 1178), False, 'from pathlib import Path\n'), ((1369, 1395), 'dotenv.main.dotenv_values', 'dotenv_values', (['config_file'], {}), '(config_file)\n', (1382, 1395), False, 'from dotenv.main import dotenv_values\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""examples/tests for peakfit"""
# Fix Python 2.x
from __future__ import print_function
try:
input = raw_input
except NameError:
pass
import os, sys
import numpy as np
try:
from PyMca5.PyMcaIO import specfilewrapper as specfile
except Exception:
try:
... | [
"os.path.join",
"sloth.fit.peakfit.fit_splitpvoigt",
"os.path.realpath",
"PyMca.specfile.Specfile",
"numpy.linspace",
"PyMca.SpecfitFuns.splitpvoigt"
] | [((515, 541), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (531, 541), False, 'import os, sys\n'), ((743, 766), 'numpy.linspace', 'np.linspace', (['(0)', '(50)', '(200)'], {}), '(0, 50, 200)\n', (754, 766), True, 'import numpy as np\n'), ((940, 987), 'sloth.fit.peakfit.fit_splitpvoigt', '... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"onnxruntime.InferenceSession",
"onnxruntime.SessionOptions"
] | [((772, 792), 'onnxruntime.SessionOptions', 'ort.SessionOptions', ([], {}), '()\n', (790, 792), True, 'import onnxruntime as ort\n'), ((1346, 1431), 'onnxruntime.InferenceSession', 'ort.InferenceSession', (['model_path'], {'providers': 'providers', 'sess_options': 'sess_options'}), '(model_path, providers=providers, se... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import brew, core, workspace
from functools import reduce
from hypothesis import given
from operator import mul
import caffe2.python.hypothesis_test_ut... | [
"numpy.mean",
"caffe2.python.workspace.FeedBlob",
"numpy.reshape",
"caffe2.python.model_helper.ModelHelper",
"numpy.power",
"functools.reduce",
"caffe2.python.hypothesis_test_util.tensors",
"caffe2.python.workspace.RunNetOnce",
"numpy.sum",
"numpy.expand_dims",
"caffe2.python.core.CreateOperator... | [((712, 833), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""LayerNormGradient"""', "['gout', 'out', 'mean', 'stdev', 'in']", "['gin']"], {'axis': 'axis', 'epsilon': 'epsilon'}), "('LayerNormGradient', ['gout', 'out', 'mean', 'stdev',\n 'in'], ['gin'], axis=axis, epsilon=epsilon)\n", (731, 833), F... |
from datetime import date
from django.test import TransactionTestCase, Client
from content.models import SiteSettings
from .models import Banner, BannerClick
class AdClickTestCase(TransactionTestCase):
def setUp(self):
self.site_settings, unused = SiteSettings.get_or_create_dummy()
self.site = ... | [
"content.models.SiteSettings.get_or_create_dummy",
"datetime.date"
] | [((265, 299), 'content.models.SiteSettings.get_or_create_dummy', 'SiteSettings.get_or_create_dummy', ([], {}), '()\n', (297, 299), False, 'from content.models import SiteSettings\n'), ((515, 532), 'datetime.date', 'date', (['(2015)', '(8)', '(17)'], {}), '(2015, 8, 17)\n', (519, 532), False, 'from datetime import date\... |
# coding: utf8
"""
This software is licensed under the Apache 2 license, quoted below.
Copyright 2014 Crystalnix Limited
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/... | [
"logging.getLogger",
"django.core.mail.message.EmailMessage",
"omaha_server.celery.app.task",
"feedback.models.Feedback.objects.get",
"os.path.basename"
] | [((868, 895), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (885, 895), False, 'import logging\n'), ((1004, 1098), 'omaha_server.celery.app.task', 'app.task', ([], {'name': '"""tasks.send_email_feedback"""', 'ignore_result': '(True)', 'max_retries': '(12)', 'bind': '(True)'}), "(name='ta... |
from django.db import models
from people.models import Customer, InternalUser
from service_and_process.models import MasterService, MasterProduct, MasterProcess
class Order(models.Model):
amount = models.DecimalField(max_digits=7, decimal_places=2)
customer_id = models.ForeignKey(Customer)
expected_time... | [
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.DateTimeField",
"django.db.models.DecimalField"
] | [((205, 256), 'django.db.models.DecimalField', 'models.DecimalField', ([], {'max_digits': '(7)', 'decimal_places': '(2)'}), '(max_digits=7, decimal_places=2)\n', (224, 256), False, 'from django.db import models\n'), ((275, 302), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Customer'], {}), '(Customer)\n', (29... |
import math
class PointIterator:
def __init__(self, point):
self._point = point
self._index = 0
def __next__(self):
if self._index < 3:
if self._index == 0:
res = self._point.x
elif self._index == 1:
res = self._point.y
... | [
"math.degrees"
] | [((1542, 1561), 'math.degrees', 'math.degrees', (['angle'], {}), '(angle)\n', (1554, 1561), False, 'import math\n')] |
from brownie import accounts, web3, Wei, reverts
from brownie.network.transaction import TransactionReceipt
from brownie.convert import to_address
import pytest
from brownie import Contract
ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
# reset the chain after every test case
@pytest.fixture(autouse=Tru... | [
"pytest.fixture",
"brownie.reverts"
] | [((294, 322), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (308, 322), False, 'import pytest\n'), ((887, 896), 'brownie.reverts', 'reverts', ([], {}), '()\n', (894, 896), False, 'from brownie import accounts, web3, Wei, reverts\n'), ((1901, 1910), 'brownie.reverts', 'reverts', ([... |
from inspect import (
signature,
iscoroutinefunction as is_async_func
)
from functools import wraps
from .response import Response
from flask.globals import request
from flask.helpers import _prepare_send_file_kwargs
from werkzeug.exceptions import NotFound
from werkzeug.security import safe_join
from werk... | [
"werkzeug.utils.send_file",
"os.path.join",
"inspect.iscoroutinefunction",
"functools.wraps",
"flask.helpers._prepare_send_file_kwargs",
"os.path.isfile",
"inspect.signature",
"os.fspath",
"asgiref.sync.async_to_sync",
"werkzeug.exceptions.NotFound"
] | [((562, 589), 'asgiref.sync.async_to_sync', 'asgiref_async_to_sync', (['func'], {}), '(func)\n', (583, 589), True, 'from asgiref.sync import async_to_sync as asgiref_async_to_sync\n'), ((1171, 1190), 'inspect.iscoroutinefunction', 'is_async_func', (['func'], {}), '(func)\n', (1184, 1190), True, 'from inspect import sig... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: <NAME> (<EMAIL>)
# Class Definition for Single Shot Detector.
import os
import torch
import torch.nn.functional as F
from datasets.test.test_data_loader import TestDataLoader
from runner.tools.blob_helper import BlobHelper
from runner.tools.runner_helper import ... | [
"torch.nn.functional.softmax",
"tools.helper.image_helper.ImageHelper.read_image",
"runner.tools.runner_helper.RunnerHelper.load_net",
"datasets.test.test_data_loader.TestDataLoader",
"model.det.layers.fr_roi_generator.FRROIGenerator",
"model.det.layers.fr_roi_sampler.FRROISampler",
"tools.helper.dc_hel... | [((1083, 1103), 'runner.tools.blob_helper.BlobHelper', 'BlobHelper', (['configer'], {}), '(configer)\n', (1093, 1103), False, 'from runner.tools.blob_helper import BlobHelper\n'), ((1134, 1157), 'tools.vis.det_visualizer.DetVisualizer', 'DetVisualizer', (['configer'], {}), '(configer)\n', (1147, 1157), False, 'from too... |
# /usr/bin/env python
import errno
import re
import os
import pathlib
import zipfile
from xml.etree.cElementTree import XML
import fitz
BASE_DIR = pathlib.Path.cwd()
INPUT_PATH = BASE_DIR / 'input'
OUTPUT_PATH = BASE_DIR / 'output'
ARCHIVE_PATH = BASE_DIR / 'archive'
WORD_NAMESPACE = '{http://schemas.openxmlformats.... | [
"xml.etree.cElementTree.XML",
"pathlib.Path",
"pathlib.Path.cwd",
"fitz.open",
"os.strerror"
] | [((150, 168), 'pathlib.Path.cwd', 'pathlib.Path.cwd', ([], {}), '()\n', (166, 168), False, 'import pathlib\n'), ((1766, 1792), 'pathlib.Path', 'pathlib.Path', (['ARCHIVE_PATH'], {}), '(ARCHIVE_PATH)\n', (1778, 1792), False, 'import pathlib\n'), ((2128, 2153), 'pathlib.Path', 'pathlib.Path', (['OUTPUT_PATH'], {}), '(OUT... |
from fastapi import FastAPI
import uvicorn
import cogs.db as db
app = FastAPI()
@app.get("/")
async def read_root():
return {"Hello": "World"}
MyDB = db.Database()
MyDB.connect("./pru/database.sql")
MyDB.create_table_if_not_exists(table_name='publicchat', fields=['hash', 'content'])
MyDB.create_table_if_not_exi... | [
"cogs.db.Database",
"fastapi.FastAPI",
"os.walk"
] | [((71, 80), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (78, 80), False, 'from fastapi import FastAPI\n'), ((158, 171), 'cogs.db.Database', 'db.Database', ([], {}), '()\n', (169, 171), True, 'import cogs.db as db\n'), ((754, 771), 'os.walk', 'os.walk', (['"""./cogs"""'], {}), "('./cogs')\n", (761, 771), False, 'imp... |
# Header
# Use a header card to display a page #header.
# ---
from h2o_wave import site, ui
image = 'https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg?auto=compress&h=750&w=1260'
commands = [
ui.command(name='profile', label='Profile', icon='Contact'),
ui.command(name='preferences', label='Prefe... | [
"h2o_wave.ui.tab",
"h2o_wave.ui.nav_item",
"h2o_wave.ui.command",
"h2o_wave.ui.menu",
"h2o_wave.ui.textbox",
"h2o_wave.ui.button"
] | [((212, 271), 'h2o_wave.ui.command', 'ui.command', ([], {'name': '"""profile"""', 'label': '"""Profile"""', 'icon': '"""Contact"""'}), "(name='profile', label='Profile', icon='Contact')\n", (222, 271), False, 'from h2o_wave import site, ui\n'), ((277, 345), 'h2o_wave.ui.command', 'ui.command', ([], {'name': '"""prefere... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"paddle.fluid.core.supports_bfloat16",
"numpy.add",
"paddle.fluid.tests.unittests.op_test.convert_float_to_uint16",
"numpy.random.random",
"paddle.enable_static",
"unittest.main",
"paddle.fluid.core.CPUPlace"
] | [((2685, 2700), 'paddle.enable_static', 'enable_static', ([], {}), '()\n', (2698, 2700), False, 'from paddle import enable_static\n'), ((2705, 2720), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2718, 2720), False, 'import unittest\n'), ((1196, 1227), 'paddle.fluid.tests.unittests.op_test.convert_float_to_uint1... |
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
class Github:
def __init__(self):
self.brower = webdriver.Firefox(executable_pat... | [
"selenium.webdriver.Firefox",
"time.sleep"
] | [((288, 366), 'selenium.webdriver.Firefox', 'webdriver.Firefox', ([], {'executable_path': '"""C:\\\\Users\\\\<NAME>\\\\Downloads\\\\geckodriver"""'}), "(executable_path='C:\\\\Users\\\\<NAME>\\\\Downloads\\\\geckodriver')\n", (305, 366), False, 'from selenium import webdriver\n'), ((453, 461), 'time.sleep', 'sleep', ([... |
from sklearn import ensemble
def create():
return ensemble.AdaBoostClassifier()
| [
"sklearn.ensemble.AdaBoostClassifier"
] | [((56, 85), 'sklearn.ensemble.AdaBoostClassifier', 'ensemble.AdaBoostClassifier', ([], {}), '()\n', (83, 85), False, 'from sklearn import ensemble\n')] |
# builtins
import os
# import PIL as the saver
import PIL
import PIL.TiffImagePlugin
import PIL.TiffTags
def to_file(bands, meta, filepath, **kwargs):
def combine_bands(bands):
# saving in image-like format, so combine and prep final image
if len(bands) == 1:
img = bands[0].img
... | [
"os.path.join",
"os.path.splitext",
"os.path.split",
"PIL.TiffImagePlugin.ImageFileDirectory",
"PIL.Image.merge"
] | [((1059, 1082), 'os.path.split', 'os.path.split', (['savepath'], {}), '(savepath)\n', (1072, 1082), False, 'import os\n'), ((1113, 1147), 'os.path.splitext', 'os.path.splitext', (['filename_and_ext'], {}), '(filename_and_ext)\n', (1129, 1147), False, 'import os\n'), ((1695, 1721), 'os.path.splitext', 'os.path.splitext'... |
from __future__ import annotations
import re
from .boards import Keyboard, KeyboardPrinter, Scoreboard, ScoreboardPrinter
from .game import DoddleGame
from .scoring import from_ternary, to_ternary
from .words import Word, WordSeries
class InputMixin:
def get_input(self, prompt: str) -> str:
return input... | [
"re.compile"
] | [((956, 977), 're.compile', 're.compile', (['"""[0-2]+$"""'], {}), "('[0-2]+$')\n", (966, 977), False, 'import re\n'), ((995, 1028), 're.compile', 're.compile', (['"""^([A-Z]+)=([0-2]+)$"""'], {}), "('^([A-Z]+)=([0-2]+)$')\n", (1005, 1028), False, 'import re\n')] |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 09 13:52:37 2016
@author: _
"""
import cv, cv2, numpy as np
if __name__ == '__main__':
ESC_KEY = 27
INTERVAL= 33
FRAME_RATE = 30
DEVICE_ID = 0
cap = cv2.VideoCapture(DEVICE_ID)
end_flag, c_fr... | [
"cv2.merge",
"cv2.imshow",
"cv2.equalizeHist",
"cv.RGB",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.split",
"cv2.CascadeClassifier",
"cv2.waitKey"
] | [((265, 292), 'cv2.VideoCapture', 'cv2.VideoCapture', (['DEVICE_ID'], {}), '(DEVICE_ID)\n', (281, 292), False, 'import cv, cv2, numpy as np\n'), ((360, 402), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""scascade_shog.xml"""'], {}), "('scascade_shog.xml')\n", (381, 402), False, 'import cv, cv2, numpy as np\n'... |
import numpy as np
import scipy.linalg as la
from progress.bar import IncrementalBar
def eig_trajectories(A,T,verbose=False):
"""Computes the trajectories of the eigenvalues of the
matrix function A(t)
Parameters
----------
A : callable
Matrix-valued function of one parameter t
T : 1d ... | [
"numpy.sign",
"numpy.abs",
"numpy.empty",
"progress.bar.IncrementalBar"
] | [((634, 667), 'numpy.empty', 'np.empty', (['(n, m)'], {'dtype': '"""complex"""'}), "((n, m), dtype='complex')\n", (642, 667), True, 'import numpy as np\n'), ((1743, 1779), 'numpy.empty', 'np.empty', (['(n, m, l)'], {'dtype': '"""complex"""'}), "((n, m, l), dtype='complex')\n", (1751, 1779), True, 'import numpy as np\n'... |
import pygame
from pygame.locals import *
from utils import *
from movable import Movable
DEBUG_INFO = None
class Pacman(Movable):
"""Pacman is basically a regular movable, except it can teleport"""
fpt = 5
def __init__(self, x, y, wdx, wdy, tiles):
super().__init__(x, y, wdx, wdy, tiles)
... | [
"pygame.Color"
] | [((988, 1010), 'pygame.Color', 'pygame.Color', (['"""yellow"""'], {}), "('yellow')\n", (1000, 1010), False, 'import pygame\n')] |
#
# Copyright (C) <NAME>, <NAME>, and <NAME>, 2016
#
# Distributed under the same BSD license as Scipy.
#
# adapted from scipy's cython version
import numpy as np
import numpy.random as random
#pythran export directed_hausdorff(float64[:,:], float64[:,:], int)
#pythran export directed_hausdorff_noshuffle(float64[:,:]... | [
"numpy.sqrt",
"numpy.asarray",
"numpy.sum",
"numpy.random.seed",
"numpy.arange",
"numpy.random.shuffle"
] | [((806, 823), 'numpy.random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (817, 823), True, 'import numpy.random as random\n'), ((838, 851), 'numpy.arange', 'np.arange', (['N1'], {}), '(N1)\n', (847, 851), True, 'import numpy as np\n'), ((866, 879), 'numpy.arange', 'np.arange', (['N2'], {}), '(N2)\n', (875, 879), T... |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
from itertools import product
import math
try:
import numpy as np
except ImportError:
np = None
from .printing import number_to_scientific_html
from ._util import get_backend, mat_dot_vec, prodpow
class EqCalcResult(... | [
"numpy.abs",
"matplotlib.pyplot.gca",
"numpy.asarray",
"numpy.tanh",
"numpy.exp",
"sympy.Piecewise",
"numpy.zeros",
"numpy.empty_like",
"sympy.Min",
"sympy.tanh",
"numpy.arctanh",
"math.exp"
] | [((7799, 7812), 'math.exp', 'math.exp', (['(-80)'], {}), '(-80)\n', (7807, 7812), False, 'import math\n'), ((663, 692), 'numpy.empty_like', 'np.empty_like', (['self.all_inits'], {}), '(self.all_inits)\n', (676, 692), True, 'import numpy as np\n'), ((5770, 5812), 'sympy.Piecewise', 'sp.Piecewise', (['(yi ** 2, yi < 0)',... |
#!/usr/bin/env python3
import requests
import os
from jinja2 import Template
from datetime import datetime
AUTH_TOKEN = os.environ['AUTH_TOKEN']
API_URL = 'https://api.gotinder.com'
def api_request(path):
return requests.get(f'{API_URL}{path}', headers={'X-Auth-Token': AUTH_TOKEN}).json()
def get_matches():
... | [
"datetime.datetime.fromtimestamp",
"requests.get"
] | [((220, 290), 'requests.get', 'requests.get', (['f"""{API_URL}{path}"""'], {'headers': "{'X-Auth-Token': AUTH_TOKEN}"}), "(f'{API_URL}{path}', headers={'X-Auth-Token': AUTH_TOKEN})\n", (232, 290), False, 'import requests\n'), ((1798, 1843), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (["(m['timestamp']... |
import glob
import os
import sys
import time
import serial
import toga
import uPy_IDE.esptool as esptool
from toga.constants import COLUMN, ROW
from toga.style.pack import *
# TODO: Exportar un ejecutable de Windows
# Correr en un proceso aparte para que no se congele la UI
def run_in_process(self, button, code_to_r... | [
"toga.MainWindow",
"uPy_IDE.pyboard.execfile",
"sys.platform.startswith",
"uPy_IDE.pyboard.Pyboard",
"toga.Box",
"uPy_IDE.cli.put",
"toga.Selection",
"serial.Serial",
"uPy_IDE.esptool.main",
"timeit.timeit",
"threading.Thread",
"toga.MultilineTextInput",
"glob.glob"
] | [((356, 392), 'timeit.timeit', 'timeit.timeit', (['code_to_run'], {'number': '(1)'}), '(code_to_run, number=1)\n', (369, 392), False, 'import timeit\n'), ((468, 498), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (491, 498), False, 'import sys\n'), ((8723, 8789), 'threading.Thr... |
import logging
from django.conf import settings
from django.template.loader import render_to_string
try:
import weasyprint as wp
PDF_EXPORT_AVAILABLE = True
except ImportError:
PDF_EXPORT_AVAILABLE = False
from froide.helper.text_utils import remove_closing_inclusive
logger = logging.getLogger(__name_... | [
"logging.getLogger",
"weasyprint.HTML",
"django.template.loader.render_to_string",
"froide.helper.text_utils.remove_closing_inclusive"
] | [((295, 322), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (312, 322), False, 'import logging\n'), ((619, 660), 'django.template.loader.render_to_string', 'render_to_string', (['self.template_name', 'ctx'], {}), '(self.template_name, ctx)\n', (635, 660), False, 'from django.template.loa... |
import os
from permissions.roles import *
from permissions.tables._vars import add_post_visible_limit
from slim.base.permission import Ability, A, DataRecord
from slim.base.sqlquery import SQLQueryInfo, SQL_OP
from slim.utils import get_bytes_from_blob
TABLE_NAME = os.path.basename(__file__).split('.', 1)[0]
# 如果查询... | [
"permissions.tables._vars.add_post_visible_limit",
"os.path.basename",
"slim.utils.get_bytes_from_blob"
] | [((930, 964), 'permissions.tables._vars.add_post_visible_limit', 'add_post_visible_limit', (['TABLE_NAME'], {}), '(TABLE_NAME)\n', (952, 964), False, 'from permissions.tables._vars import add_post_visible_limit\n'), ((268, 294), 'os.path.basename', 'os.path.basename', (['__file__'], {}), '(__file__)\n', (284, 294), Fal... |
import unittest
import datetime as dt
from server import TWITTER_API_BEARER_TOKEN
from server.platforms.twitter import TwitterTwitterProvider
TERM = "robots"
class TwitterTwitterProviderTest(unittest.TestCase):
def setUp(self):
self._provider = TwitterTwitterProvider(TWITTER_API_BEARER_TOKEN)
def ... | [
"datetime.datetime.now",
"server.platforms.twitter.TwitterTwitterProvider",
"datetime.timedelta"
] | [((262, 310), 'server.platforms.twitter.TwitterTwitterProvider', 'TwitterTwitterProvider', (['TWITTER_API_BEARER_TOKEN'], {}), '(TWITTER_API_BEARER_TOKEN)\n', (284, 310), False, 'from server.platforms.twitter import TwitterTwitterProvider\n'), ((487, 504), 'datetime.datetime.now', 'dt.datetime.now', ([], {}), '()\n', (... |
import numpy as np
import astropy.units as u
import astropy.constants as const
import astropy.io.fits
import astropy.time as atime
import astropy.coordinates as coord
import numpy.random as random
import os
from simulacra.theory import TheoryModel
def read_in_fits(filename):
print('reading in {}'.format(filenam... | [
"numpy.sqrt",
"numpy.log",
"numpy.array",
"numpy.sin",
"numpy.mean",
"ftplib.FTP",
"astropy.units.spectral_density",
"numpy.exp",
"numpy.linspace",
"astropy.coordinates.Distance",
"numpy.ones",
"astroplan.Observer",
"os.path.isfile",
"astropy.coordinates.EarthLocation.of_site",
"numpy.me... | [((570, 600), 'os.path.join', 'os.path.join', (['outdir', 'filename'], {}), '(outdir, filename)\n', (582, 600), False, 'import os\n'), ((607, 630), 'os.path.isfile', 'os.path.isfile', (['outname'], {}), '(outname)\n', (621, 630), False, 'import os\n'), ((1470, 1500), 'os.path.join', 'os.path.join', (['outdir', 'filenam... |