code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import sys
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
if PY2:
from httplib import HTTPConnection, HTTPSConnection
if PY3:
from http.client import HTTPConnection, HTTPSConnection
def basic():
conn = HTTPConnection('example.com')
conn.request('GET', '/path')
def indirect_caller():
... | [
"http.client.HTTPSConnection",
"http.client.HTTPConnection"
] | [((232, 261), 'http.client.HTTPConnection', 'HTTPConnection', (['"""example.com"""'], {}), "('example.com')\n", (246, 261), False, 'from http.client import HTTPConnection, HTTPSConnection\n'), ((331, 361), 'http.client.HTTPSConnection', 'HTTPSConnection', (['"""example.com"""'], {}), "('example.com')\n", (346, 361), Fa... |
# project/vitamins/views.py
#################
#### imports ####
#################
from flask import render_template, Blueprint, request, redirect, url_for, flash, abort, jsonify
from flask_login import current_user, login_required
from project import db, images, app
from project.models import Vitamin, User, Screening... | [
"flask.render_template",
"flask.flash",
"project.models.Screening.query.filter",
"project.models.Vitamin.query.filter_by",
"project.logic.suggest_vitamins",
"flask.url_for",
"project.models.Vitamin.query.filter",
"project.models.Vitamin.target_area.in_",
"flask.Blueprint"
] | [((559, 590), 'flask.Blueprint', 'Blueprint', (['"""vitamins"""', '__name__'], {}), "('vitamins', __name__)\n", (568, 590), False, 'from flask import render_template, Blueprint, request, redirect, url_for, flash, abort, jsonify\n'), ((1108, 1174), 'flask.render_template', 'render_template', (['"""home_page.html"""'], {... |
# built-in
import os
import subprocess
from fnmatch import fnmatch
from functools import lru_cache
from operator import attrgetter
from pathlib import Path
from typing import Iterable, Iterator, List, Optional
# external
import attr
from packaging.version import Version
# app
from ._cached_property import cached_prop... | [
"operator.attrgetter",
"attr.s",
"pathlib.Path",
"os.path.expandvars",
"os.environ.get",
"fnmatch.fnmatch",
"functools.lru_cache"
] | [((468, 498), 'attr.s', 'attr.s', ([], {'frozen': '(True)', 'hash': '(True)'}), '(frozen=True, hash=True)\n', (474, 498), False, 'import attr\n'), ((2523, 2544), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(32)'}), '(maxsize=32)\n', (2532, 2544), False, 'from functools import lru_cache\n'), ((694, 722), 'os.e... |
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
from matplotlib import cm
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x = y = np.arange(-15, 15, 0.5)
X, Y = np.meshgrid(x, y)
sigma = 4
Z = np.exp(-(X**2 + Y**2)/(2*sigma**2)) / (2*np.pi*sigma**2)
ax.plot_s... | [
"matplotlib.pyplot.savefig",
"numpy.exp",
"matplotlib.pyplot.figure",
"numpy.meshgrid",
"numpy.arange"
] | [((124, 136), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (134, 136), True, 'import matplotlib.pyplot as plt\n'), ((189, 212), 'numpy.arange', 'np.arange', (['(-15)', '(15)', '(0.5)'], {}), '(-15, 15, 0.5)\n', (198, 212), True, 'import numpy as np\n'), ((220, 237), 'numpy.meshgrid', 'np.meshgrid', (['x'... |
import json
import random
class ChineseNameGenerator(object):
"""中国姓名生成器
由预设好的姓和名随机组合而成 TODO:修改生成方式
"""
with open("./generators/phrase_generator/data/chinese_name/chinese_name.json") as f:
_name_data = json.load(f)
# 性别
GENDER_FEMALE = 0
GENDER_MALE = 1
GENDER_ANY = 2
d... | [
"json.load",
"random.choice"
] | [((230, 242), 'json.load', 'json.load', (['f'], {}), '(f)\n', (239, 242), False, 'import json\n'), ((768, 787), 'random.choice', 'random.choice', (['xing'], {}), '(xing)\n', (781, 787), False, 'import random\n'), ((790, 809), 'random.choice', 'random.choice', (['ming'], {}), '(ming)\n', (803, 809), False, 'import rando... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) <NAME>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Th... | [
"bot.CONFIRM_SENT_VIA.format",
"bot.user.User",
"bot.AKTIFPERINTAH.get",
"pyrogram.Client.on_message"
] | [((991, 1049), 'pyrogram.Client.on_message', 'Client.on_message', (['(filters.text & filters.private)'], {'group': '(1)'}), '(filters.text & filters.private, group=1)\n', (1008, 1049), False, 'from pyrogram import Client, filters\n'), ((1131, 1165), 'bot.AKTIFPERINTAH.get', 'AKTIFPERINTAH.get', (['message.chat.id'], {}... |
# Generates a list of every page on pathofexile.gamepedia.com
# This list is used to find the most appropriate page for a user's request.
# Imports
import pickle
import requests
from bs4 import BeautifulSoup
def getPages():
print("Getting pages...", end=" ")
pages = dict()
def getSet(url):
r = req... | [
"bs4.BeautifulSoup",
"pickle.dump",
"requests.get"
] | [((317, 375), 'requests.get', 'requests.get', (["('http://www.pathofexile.gamepedia.com' + url)"], {}), "('http://www.pathofexile.gamepedia.com' + url)\n", (329, 375), False, 'import requests\n'), ((391, 430), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.content', '"""html.parser"""'], {}), "(r.content, 'html.parser')\n"... |
import os
import time
openssl_dir = os.path.expanduser('~/openssl')
myCmd = f'{openssl_dir}/apps/openssl ecparam -out > /dev/null 2>&1'
startTime = time.time()
for i in range(1000):
os.system(myCmd)
endTime = time.time()
print (f'Time for ECDSA ECPARAM {(endTime-startTime)/1000}')
myCmd = f'{openssl_dir}/apps/... | [
"os.system",
"time.time",
"os.path.expanduser"
] | [((39, 70), 'os.path.expanduser', 'os.path.expanduser', (['"""~/openssl"""'], {}), "('~/openssl')\n", (57, 70), False, 'import os\n'), ((152, 163), 'time.time', 'time.time', ([], {}), '()\n', (161, 163), False, 'import time\n'), ((217, 228), 'time.time', 'time.time', ([], {}), '()\n', (226, 228), False, 'import time\n'... |
# -*- coding: utf-8 -*-
try:
from http.client import responses
except ImportError:
from httplib import responses
from hamcrest import *
from finch import errors
class TestHTTPError(object):
def test_when_404_then_message_is_not_found(self):
http_error = errors.HTTPError(404)
assert_tha... | [
"finch.errors.HTTPError"
] | [((279, 300), 'finch.errors.HTTPError', 'errors.HTTPError', (['(404)'], {}), '(404)\n', (295, 300), False, 'from finch import errors\n'), ((490, 511), 'finch.errors.HTTPError', 'errors.HTTPError', (['(422)'], {}), '(422)\n', (506, 511), False, 'from finch import errors\n'), ((649, 670), 'finch.errors.HTTPError', 'error... |
import ldap3
def authenticate(address, username, password):
try:
if len(password) == 0:
password = "<PASSWORD>"
server = ldap3.Server("ldap://192.168.4.222")
conn = ldap3.Connection(server)
# conn.search()
except Exception:
raise "Wrong username or passwor... | [
"ldap3.Connection",
"ldap3.Server"
] | [((155, 191), 'ldap3.Server', 'ldap3.Server', (['"""ldap://192.168.4.222"""'], {}), "('ldap://192.168.4.222')\n", (167, 191), False, 'import ldap3\n'), ((207, 231), 'ldap3.Connection', 'ldap3.Connection', (['server'], {}), '(server)\n', (223, 231), False, 'import ldap3\n')] |
# Generated by Django 3.0.7 on 2021-04-23 14:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('business_register', '0089_auto_20210419_1240'),
]
operations = [
migrations.RemoveField(
model_name='companysanction',
name=... | [
"django.db.migrations.RemoveField"
] | [((237, 308), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""companysanction"""', 'name': '"""is_foreign"""'}), "(model_name='companysanction', name='is_foreign')\n", (259, 308), False, 'from django.db import migrations\n'), ((353, 423), 'django.db.migrations.RemoveField', 'migrat... |
"""Typebot text typer for MacOS, Windows, and Linux - <NAME>"""
import pyautogui
import time
pyautogui.FAILSAFE = True
starttime = 20
#Recieve message from user
#print('What is your message?\n')
message = input('What is your message?\n')
#Split the message into individual words
words = message.split()
#Recieve nu... | [
"pyautogui.press",
"time.sleep",
"pyautogui.typewrite"
] | [((720, 741), 'time.sleep', 'time.sleep', (['starttime'], {}), '(starttime)\n', (730, 741), False, 'import time\n'), ((870, 899), 'pyautogui.typewrite', 'pyautogui.typewrite', (['words[i]'], {}), '(words[i])\n', (889, 899), False, 'import pyautogui\n'), ((905, 929), 'pyautogui.press', 'pyautogui.press', (['"""enter"""'... |
from data_for_testing import data
from lib import part1, part2
def test_part1():
assert part1(data) == 11
def test_part2():
pass
| [
"lib.part1"
] | [((94, 105), 'lib.part1', 'part1', (['data'], {}), '(data)\n', (99, 105), False, 'from lib import part1, part2\n')] |
# Source:
# https://www.kaggle.com/sachinsharma1123/otto-group-classification-acc-82from sklearn.pipeline import Pipeline
dataset = "otto"
metric = "neg_log_loss"
def make_pipeline():
from sklearn.pipeline import Pipeline
from sklearn.svm import SVC
# focused on SVC pipeline
# to provide some diversi... | [
"sklearn.pipeline.Pipeline",
"sklearn.svm.SVC"
] | [((416, 453), 'sklearn.svm.SVC', 'SVC', ([], {'probability': '(True)', 'random_state': '(0)'}), '(probability=True, random_state=0)\n', (419, 453), False, 'from sklearn.svm import SVC\n'), ((462, 486), 'sklearn.pipeline.Pipeline', 'Pipeline', (["[('clf', clf)]"], {}), "([('clf', clf)])\n", (470, 486), False, 'from skle... |
import asyncio
import os
import sys
import pytest
if os.name == 'nt' and sys.version_info >= (3, 7):
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
@pytest.fixture
def event_loop():
# Make sure we test against a selector event loop
# since pyzmq doesn't like the proactor loop.
... | [
"asyncio.SelectorEventLoop",
"asyncio.WindowsSelectorEventLoopPolicy"
] | [((516, 543), 'asyncio.SelectorEventLoop', 'asyncio.SelectorEventLoop', ([], {}), '()\n', (541, 543), False, 'import asyncio\n'), ((139, 179), 'asyncio.WindowsSelectorEventLoopPolicy', 'asyncio.WindowsSelectorEventLoopPolicy', ([], {}), '()\n', (177, 179), False, 'import asyncio\n'), ((463, 503), 'asyncio.WindowsSelect... |
from mef2_processor import MEF2Processor
if __name__ == '__main__':
task = MEF2Processor(cli=True)
task.run()
| [
"mef2_processor.MEF2Processor"
] | [((81, 104), 'mef2_processor.MEF2Processor', 'MEF2Processor', ([], {'cli': '(True)'}), '(cli=True)\n', (94, 104), False, 'from mef2_processor import MEF2Processor\n')] |
import sys
command_suite = (
"Interact with DataLad registry",
[
(
"datalad_registry_client.submit",
"RegistrySubmit",
"registry-submit",
"registry_submit",
),
(
"datalad_registry_client.submit_urls",
"RegistrySubmi... | [
"importlib.metadata.version"
] | [((562, 589), 'importlib.metadata.version', 'version', (['"""datalad-registry"""'], {}), "('datalad-registry')\n", (569, 589), False, 'from importlib.metadata import version\n')] |
from FDLJS import run
#IRS scam? 2023350440
from vpython import sphere
from vpython import vector as V
from attrthing import AttrThing, gimme
#import makemyVPHTML
edges=[(1,2),(2,3), (3,1), (3,4), (4,5), (4,6), (5,6)]
def IDsFromEdges(edges):
IDs=[]
for t in edges:
IDs.append(str(t[0]))
IDs.... | [
"attrthing.AttrThing",
"FDLJS.run",
"vpython.sphere",
"vpython.vector"
] | [((367, 378), 'attrthing.AttrThing', 'AttrThing', ([], {}), '()\n', (376, 378), False, 'from attrthing import AttrThing, gimme\n'), ((767, 834), 'FDLJS.run', 'run', (['edges'], {'iterations': '(3000)', 'updateNodes': 'updateSpheres', 'is_3d': '(False)'}), '(edges, iterations=3000, updateNodes=updateSpheres, is_3d=False... |
import os
from random import seed
import numpy as np
from hyperopt import hp, tpe, rand
import pytest
from sklearn.metrics import mean_squared_error as mse, roc_auc_score as roc
from fedot.core.data.data import InputData
from fedot.core.data.data_split import train_test_data_setup
from fedot.core.pipelines.node impor... | [
"fedot.core.pipelines.tuning.unified.PipelineTuner",
"fedot.core.pipelines.node.SecondaryNode",
"numpy.arange",
"fedot.core.data.data_split.train_test_data_setup",
"os.path.join",
"fedot.core.pipelines.pipeline.Pipeline",
"random.seed",
"fedot.core.pipelines.tuning.sequential.SequentialTuner",
"pyte... | [((712, 719), 'random.seed', 'seed', (['(1)'], {}), '(1)\n', (716, 719), False, 'from random import seed\n'), ((720, 737), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (734, 737), True, 'import numpy as np\n'), ((741, 757), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (755, 757), False, 'impo... |
from pathlib import Path
import environ
from datetime import timedelta
from django.conf import settings
BASE_DIR = Path(__file__).resolve().parent.parent
env = environ.Env(
DEBUG=(bool, False),
ENVIRONMENT=(str, "PRODUCTION"),
ALLOW_ALL_ORIGINS=(bool, False),
ALLOWED_HOSTS=(list, []),
ALLOWED_ORIGI... | [
"datetime.timedelta",
"environ.Env",
"environ.Env.read_env",
"pathlib.Path"
] | [((161, 572), 'environ.Env', 'environ.Env', ([], {'DEBUG': '(bool, False)', 'ENVIRONMENT': "(str, 'PRODUCTION')", 'ALLOW_ALL_ORIGINS': '(bool, False)', 'ALLOWED_HOSTS': '(list, [])', 'ALLOWED_ORIGINS': '(list, [])', 'CSRF_TRUSTED_ORIGINS': '(list, [])', 'DATABASE_ENGINE': "(str, 'django.db.backends.sqlite3')", 'DATABAS... |
# Authors: <NAME> and Elnaz
#
# Program that calculates the APD for a single cell in the grid by passing its
# transmembrane potential over the time as input.
#
# This program also works with multiple AP's !
import sys
import subprocess
import time
import numpy as np
def forwarddiff(y, h):
n = len(y)
res = ... | [
"sys.exit"
] | [((1947, 1958), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1955, 1958), False, 'import sys\n')] |
from functools import lru_cache
from typing import List, Set, Union, Optional
import yaml
from .root import HConfig
from .options import options_for
class Host:
"""
A host object is a convenient way to loading host inventory
items into a single object.
The default is to load "hostname", "os", and "... | [
"functools.lru_cache",
"yaml.safe_load"
] | [((2354, 2365), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (2363, 2365), False, 'from functools import lru_cache\n'), ((2965, 2976), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (2974, 2976), False, 'from functools import lru_cache\n'), ((5904, 5927), 'yaml.safe_load', 'yaml.safe_load', (['content']... |
import sys
import os
from scrapex import Scraper
from scrapex import common
s = Scraper(use_cache=False, use_session=False, proxy_file='/var/scrape/proxy-lumus.txt')
def case1():
doc = s.load('https://github.com/search?q=scraping+framework')
headline = doc.extract("//h3[contains(text(),'results')]").strip()
pri... | [
"scrapex.Scraper",
"scrapex.common.parse_address",
"collections.OrderedDict"
] | [((84, 174), 'scrapex.Scraper', 'Scraper', ([], {'use_cache': '(False)', 'use_session': '(False)', 'proxy_file': '"""/var/scrape/proxy-lumus.txt"""'}), "(use_cache=False, use_session=False, proxy_file=\n '/var/scrape/proxy-lumus.txt')\n", (91, 174), False, 'from scrapex import Scraper\n'), ((1297, 1331), 'scrapex.co... |
"""
'storage-remove' sub command
"""
# noqa # pylint: disable=duplicate-code
# noqa # pylint: disable=too-many-branches
#To prevent Py2 to interpreting print(val) as a tuple.
from __future__ import print_function
from string import Template
import os
import tempfile
import sys
import json
import utils
YAML_TEMPLAT... | [
"os.path.exists",
"json.loads",
"string.Template",
"utils.kubectl_cmd",
"utils.kubectl_cmd_help",
"utils.execute",
"utils.command_error",
"sys.exit",
"os.fdopen",
"tempfile.mkstemp",
"utils.add_global_flags",
"os.remove"
] | [((643, 673), 'utils.add_global_flags', 'utils.add_global_flags', (['parser'], {}), '(parser)\n', (665, 673), False, 'import utils\n'), ((2614, 2647), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {'prefix': '"""kadalu"""'}), "(prefix='kadalu')\n", (2630, 2647), False, 'import tempfile\n'), ((1038, 1049), 'sys.exit', 's... |
"""Tests for report formatting.
"""
from datetime import datetime
from textwrap import dedent
import pytest
from freezegun import freeze_time
from mutatest.report import (
analyze_mutant_trials,
build_report_section,
get_reported_results,
get_status_summary,
write_report,
)
@pytest.mark.paramet... | [
"datetime.datetime",
"textwrap.dedent",
"mutatest.report.get_reported_results",
"mutatest.report.write_report",
"pytest.mark.parametrize",
"mutatest.report.analyze_mutant_trials",
"mutatest.report.build_report_section",
"freezegun.freeze_time",
"mutatest.report.get_status_summary"
] | [((301, 395), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""status"""', "['SURVIVED', 'DETECTED', 'ERROR', 'TIMEOUT', 'UNKNOWN']"], {}), "('status', ['SURVIVED', 'DETECTED', 'ERROR',\n 'TIMEOUT', 'UNKNOWN'])\n", (324, 395), False, 'import pytest\n'), ((664, 689), 'freezegun.freeze_time', 'freeze_time',... |
from pathlib import Path
import shutil
import glob
import numpy as np
import pyarrow as pa
import pyarrow.parquet as pq
import pyarrow.dataset
import vaex
path = Path(__file__).parent.parent
data_path = path / 'data'
countries = ['US', 'US', 'NL', 'FR', 'NL', 'NL']
years = [2020, 2021, 2020, 2020, 2019, 2020]
val... | [
"pyarrow.parquet.write_to_dataset",
"pyarrow.dataset.dataset",
"pyarrow.table",
"pathlib.Path",
"pyarrow.string",
"vaex.open",
"shutil.rmtree",
"pyarrow.int64",
"vaex.from_arrow_table"
] | [((353, 417), 'pyarrow.table', 'pa.table', (["{'country': countries, 'year': years, 'value': values}"], {}), "({'country': countries, 'year': years, 'value': values})\n", (361, 417), True, 'import pyarrow as pa\n'), ((476, 562), 'shutil.rmtree', 'shutil.rmtree', (["(data_path / 'parquet_dataset_partitioned_hive')"], {'... |
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | [
"rally.plugins.openstack.scenarios.cinder.volume_types.CreateGetAndDeleteEncryptionType",
"mock.patch",
"tests.unit.test.get_test_context",
"mock.Mock",
"rally.plugins.openstack.scenarios.cinder.volume_types.CreateAndDeleteEncryptionType",
"rally.plugins.openstack.scenarios.cinder.volume_types.CreateAndUp... | [((6555, 6607), 'mock.patch', 'mock.patch', (["('%s.create_volume_type' % CINDER_V2_PATH)"], {}), "('%s.create_volume_type' % CINDER_V2_PATH)\n", (6565, 6607), False, 'import mock\n'), ((6613, 6665), 'mock.patch', 'mock.patch', (["('%s.update_volume_type' % CINDER_V2_PATH)"], {}), "('%s.update_volume_type' % CINDER_V2_... |
import numbers
from functools import reduce
def get_bit_values(number, size=32):
"""
Get bit values as a list for a given number
>>> get_bit_values(1) == [0]*31 + [1]
True
>>> get_bit_values(0xDEADBEEF)
[1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, \
1, 0, 1, 1, 1, 1, 1, 0, 1... | [
"functools.reduce"
] | [((1175, 1198), 'functools.reduce', 'reduce', (['operation', 'bits'], {}), '(operation, bits)\n', (1181, 1198), False, 'from functools import reduce\n')] |
import pyPLUTO as pp
import numpy as np
import matplotlib.pyplot as plt
import os, shutil, sys
from multiprocessing import Pool
# Value of theta and m
# TODO : Extract this directly from the run
gamma = 5.0/3.0
theta = 10.0
m = 1.0
def create_directory(path):
'''
Creates given directory.
Removes exist... | [
"matplotlib.pyplot.ylabel",
"numpy.array",
"numpy.gradient",
"os.path.exists",
"os.listdir",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.empty",
"os.mkdir",
"pyPLUTO.pload",
"numpy.abs",
"matplotlib.pyplot.savefig",
"numpy.average",
"numpy.save... | [((397, 417), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (411, 417), False, 'import os, shutil, sys\n'), ((451, 465), 'os.mkdir', 'os.mkdir', (['path'], {}), '(path)\n', (459, 465), False, 'import os, shutil, sys\n'), ((624, 640), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (634, 640), ... |
import pathlib
import pytest
import numpy as np
from plums.commons.data import TileWrapper, Record, RecordCollection, DataPoint
from plums.dataflow.dataset import PatternDataset
def _dummy_tile_driver(paths, **matches):
paths = sorted(paths, key=str, reverse=True)
print(paths)
print(matches)
retur... | [
"plums.commons.data.RecordCollection",
"plums.dataflow.dataset.PatternDataset",
"plums.commons.data.Record",
"numpy.zeros",
"pytest.raises"
] | [((488, 509), 'numpy.zeros', 'np.zeros', (['(12, 12, 3)'], {}), '((12, 12, 3))\n', (496, 509), True, 'import numpy as np\n'), ((1183, 1273), 'plums.commons.data.Record', 'Record', (['[[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]', "('label',)"], {'paths': 'paths'}), "([[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]], ('label',)... |
import os
import memory_trace.mem_util
from layer.layer import *
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True' # hacked by Adam
file_name = "run_auto_increment"
class NeuralNetwork(object):
def __init__(self, types, shapes, sequence, cost_function, optimizer, scope="main", gather_stats=False,
s... | [
"os.path.isfile"
] | [((1697, 1722), 'os.path.isfile', 'os.path.isfile', (['file_name'], {}), '(file_name)\n', (1711, 1722), False, 'import os\n')] |
from keras.utils import np_utils
import numpy as np
import h5py
import os
class HDF5DatasetWriter:
def __init__(self, dims, outputPath, dataKey="images",max_label_length=1,
bufSize=1000):
if os.path.exists(outputPath):
raise ValueError("The supplied 'outputPath' already "
"exists and cannot be overwritten... | [
"os.path.exists",
"numpy.ones",
"h5py.File",
"numpy.array",
"numpy.zeros",
"keras.utils.np_utils.to_categorical",
"h5py.special_dtype",
"numpy.arange"
] | [((198, 224), 'os.path.exists', 'os.path.exists', (['outputPath'], {}), '(outputPath)\n', (212, 224), False, 'import os\n'), ((442, 468), 'h5py.File', 'h5py.File', (['outputPath', '"""w"""'], {}), "(outputPath, 'w')\n", (451, 468), False, 'import h5py\n'), ((1155, 1183), 'h5py.special_dtype', 'h5py.special_dtype', ([],... |
import math
from maya import OpenMaya, OpenMayaMPx
class Circler(OpenMayaMPx.MPxNode): #(1)
def compute(self, *args):
pass
def create(): #(2)
return OpenMayaMPx.asMPxPtr(Circler())
def init(): #(3)
return
nodeName = 'circler' #(4)
nodeTypeID = OpenMaya.MTypeId(0x60005) #(5)
def _toplugin(mobjec... | [
"maya.OpenMaya.MFnNumericAttribute",
"maya.OpenMaya.MObject",
"math.cos",
"maya.OpenMayaMPx.MFnPlugin",
"maya.OpenMaya.MTypeId",
"math.sin"
] | [((268, 292), 'maya.OpenMaya.MTypeId', 'OpenMaya.MTypeId', (['(393221)'], {}), '(393221)\n', (284, 292), False, 'from maya import OpenMaya, OpenMayaMPx\n'), ((340, 388), 'maya.OpenMayaMPx.MFnPlugin', 'OpenMayaMPx.MFnPlugin', (['mobject', '"""<NAME>"""', '"""0.01"""'], {}), "(mobject, '<NAME>', '0.01')\n", (361, 388), F... |
from src.App import App
from src.Planet import Planet
from src.vecN import Vec3
def main():
# 8 loop
# pos = 10 * Vec3(-0.97000436, 0.24308753)
# vel2 = 10 * Vec3(-0.93240737, -0.86473146)
# vel13 = 10 * Vec3(0.4662036850, 0.4323657300)
# planets = [
# Planet(1000, pos, vel13, (200, 20, ... | [
"src.App.App",
"src.vecN.Vec3"
] | [((803, 808), 'src.App.App', 'App', ([], {}), '()\n', (806, 808), False, 'from src.App import App\n'), ((476, 484), 'src.vecN.Vec3', 'Vec3', (['(50)'], {}), '(50)\n', (480, 484), False, 'from src.vecN import Vec3\n'), ((486, 498), 'src.vecN.Vec3', 'Vec3', (['(-10)', '(5)'], {}), '(-10, 5)\n', (490, 498), False, 'from s... |
import random
from random import choice
import numpy as np
import pandas as pd
from pyspark.sql import SparkSession
from ydot.spark import smatrices
random.seed(37)
np.random.seed(37)
def get_spark_dataframe(spark):
n = 100
data = {
'a': [choice(['left', 'right']) for _ in range(n)],
'b': [... | [
"numpy.random.normal",
"random.choice",
"pyspark.sql.SparkSession.builder.master",
"ydot.spark.smatrices",
"random.seed",
"numpy.random.seed",
"pandas.DataFrame"
] | [((152, 167), 'random.seed', 'random.seed', (['(37)'], {}), '(37)\n', (163, 167), False, 'import random\n'), ((168, 186), 'numpy.random.seed', 'np.random.seed', (['(37)'], {}), '(37)\n', (182, 186), True, 'import numpy as np\n'), ((522, 540), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {}), '(data)\n', (534, 540), T... |
import os
import sys
import time
__Author__ = "AnonPrixor"
__Version__ = "1.0"
__CreatedD__ = "March 27, 2021"
__CreatedT__ = "6:25 AM (PHT)"
def backmenu():
back = input("\033[1;97mDo you want to go back to menu [Y/N]: ")
if (back == "Y") or (back == "y"):
menu()
if (back == "N") or (back == "n"):
print("Tha... | [
"os.system",
"time.sleep",
"sys.exit"
] | [((349, 362), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (359, 362), False, 'import time\n'), ((365, 383), 'os.system', 'os.system', (['"""clear"""'], {}), "('clear')\n", (374, 383), False, 'import os\n'), ((386, 396), 'sys.exit', 'sys.exit', ([], {}), '()\n', (394, 396), False, 'import sys\n'), ((949, 989), '... |
"""
This module runs tests on students in regards to scholarship eligibility.
"""
__author__ = "<NAME>, <NAME>"
__version__ = "0.1.0"
__license__ = "MIT"
import unittest
import student as student_class
import scholarship_eligibility
class TestValidStudents(unittest.TestCase):
"""These tests focus on students wh... | [
"unittest.main",
"student.Student",
"scholarship_eligibility.determine_eligibility"
] | [((2739, 2754), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2752, 2754), False, 'import unittest\n'), ((450, 495), 'student.Student', 'student_class.Student', (['(19)', '(10)', '(5)', '(2)', '(1)', '(15000)'], {}), '(19, 10, 5, 2, 1, 15000)\n', (471, 495), True, 'import student as student_class\n'), ((548, 602... |
from typing import List
import numpy as np
from scores.scoreutils import simple_normalization
from scores import weightsmodel
def _attentive_pool_with_weights(encoded, weights):
weights = simple_normalization(np.expand_dims(weights, axis=-1), axis=1) # [B,L,1]
weight_encoded = weights * encoded # [B,L,D]
... | [
"numpy.sum",
"numpy.array",
"scores.weightsmodel.SentenceWeightModel",
"numpy.expand_dims"
] | [((333, 363), 'numpy.sum', 'np.sum', (['weight_encoded'], {'axis': '(1)'}), '(weight_encoded, axis=1)\n', (339, 363), True, 'import numpy as np\n'), ((217, 249), 'numpy.expand_dims', 'np.expand_dims', (['weights'], {'axis': '(-1)'}), '(weights, axis=-1)\n', (231, 249), True, 'import numpy as np\n'), ((519, 553), 'score... |
# -*- coding: utf-8 -*-
"""Miscellaneous utilities."""
import gzip
import os
from subprocess import check_output # noqa:S404
__all__ = [
"obo_to_obograph",
"obo_to_owl",
]
def obo_to_obograph(obo_path, obograph_path) -> None:
"""Convert an OBO file to OBO Graph file with pronto."""
import pronto
... | [
"os.path.dirname",
"pronto.Ontology",
"gzip.open"
] | [((335, 360), 'pronto.Ontology', 'pronto.Ontology', (['obo_path'], {}), '(obo_path)\n', (350, 360), False, 'import pronto\n'), ((370, 400), 'gzip.open', 'gzip.open', (['obograph_path', '"""wb"""'], {}), "(obograph_path, 'wb')\n", (379, 400), False, 'import gzip\n'), ((724, 749), 'os.path.dirname', 'os.path.dirname', ([... |
import discord
import asyncio
class Poll :
def __init__(self) :
self.delay = 7200 #time the opinion poll will last
self.question = '' #the question that is asked '' if none
self.answers = dict() #a dictionnary that store the vote of the users, each user can change his opinion but only the l... | [
"asyncio.sleep"
] | [((2062, 2087), 'asyncio.sleep', 'asyncio.sleep', (['self.delay'], {}), '(self.delay)\n', (2075, 2087), False, 'import asyncio\n')] |
from threading import Thread, Lock
c = 0
lock = Lock()
def count_300():
global c
lock.acquire()
try:
while c < 30000:
c += 1
print(c)
finally:
lock.release()
def count_10000():
global c
x = 340
while c < 100000:
c += 1
print(c)
t_0 = Thr... | [
"threading.Lock",
"threading.Thread"
] | [((49, 55), 'threading.Lock', 'Lock', ([], {}), '()\n', (53, 55), False, 'from threading import Thread, Lock\n'), ((317, 367), 'threading.Thread', 'Thread', ([], {'target': 'count_300', 'name': '"""1000"""', 'daemon': '(True)'}), "(target=count_300, name='1000', daemon=True)\n", (323, 367), False, 'from threading impor... |
from gr1py.minnx import DiGraph
class DiGraph_test(object):
def setUp(self):
self.G = DiGraph()
def tearDown(self):
self.G = None
def test_add_remove_nodes(self):
assert self.G.number_of_nodes() == 0
self.G.add_node(0)
assert self.G.number_of_nodes() == 1
... | [
"gr1py.minnx.DiGraph"
] | [((100, 109), 'gr1py.minnx.DiGraph', 'DiGraph', ([], {}), '()\n', (107, 109), False, 'from gr1py.minnx import DiGraph\n')] |
'''
Author: <NAME>
Miscellaneous data related utilities used by the main.py file in the scripts folder.
'''
import numpy as np
import logging
from collections import Counter
import collections
import pickle
import re
import networkx as nx
import spacy
from spacy.tokens import Doc
import nltk
nltk.download('wordnet')... | [
"numpy.mean",
"collections.OrderedDict",
"json.loads",
"numpy.amax",
"numpy.amin",
"nltk.download",
"numpy.arange",
"json.dumps",
"pickle.load",
"h5py.File",
"collections.Counter",
"numpy.array",
"numpy.zeros",
"numpy.append",
"numpy.std",
"re.findall",
"pandas.concat",
"numpy.rand... | [((296, 320), 'nltk.download', 'nltk.download', (['"""wordnet"""'], {}), "('wordnet')\n", (309, 320), False, 'import nltk\n'), ((6470, 6479), 'collections.Counter', 'Counter', ([], {}), '()\n', (6477, 6479), False, 'from collections import Counter\n'), ((9899, 9912), 'numpy.zeros', 'np.zeros', (['dim'], {}), '(dim)\n',... |
import factory
from profiles.tests.factories import ProfileFactory
from services.models import AllowedDataField, Service, ServiceConnection
from ..enums import ServiceType
class ServiceFactory(factory.django.DjangoModelFactory):
service_type = ServiceType.BERTH
title = "Berth"
description = "Service for... | [
"factory.SubFactory",
"factory.Sequence"
] | [((483, 517), 'factory.SubFactory', 'factory.SubFactory', (['ProfileFactory'], {}), '(ProfileFactory)\n', (501, 517), False, 'import factory\n'), ((532, 566), 'factory.SubFactory', 'factory.SubFactory', (['ServiceFactory'], {}), '(ServiceFactory)\n', (550, 566), False, 'import factory\n'), ((703, 744), 'factory.Sequenc... |
import sys
sys.path.insert(0, '../dynamikontrol')
from dynamikontrol import Module, Timer
import time
t1 = Timer()
t2 = Timer()
module = Module(debug=True)
t1.callback_at(func=module.led.toggle, args=('r',), at='2021-03-02 19:46:30', interval=0.1)
t2.callback_after(func=module.led.toggle, args=('g',), after=1, int... | [
"dynamikontrol.Timer",
"dynamikontrol.Module",
"sys.path.insert",
"time.sleep"
] | [((11, 49), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../dynamikontrol"""'], {}), "(0, '../dynamikontrol')\n", (26, 49), False, 'import sys\n'), ((109, 116), 'dynamikontrol.Timer', 'Timer', ([], {}), '()\n', (114, 116), False, 'from dynamikontrol import Module, Timer\n'), ((122, 129), 'dynamikontrol.Timer', 'T... |
import pytest
from pytest import approx
from salamanca import ineq as iq
def test_gini_to_std():
obs = iq.gini_to_std(0.5)
exp = 0.95387
assert obs == approx(exp, abs=1e-5)
def test_std_to_gini():
obs = iq.std_to_gini(0.95387)
exp = 0.5
assert obs == approx(exp, abs=1e-5)
def test_theil_t... | [
"pytest.approx",
"salamanca.ineq.theil_to_std",
"salamanca.ineq.std_to_gini",
"salamanca.ineq.LogNormal",
"salamanca.ineq.gini_to_std",
"salamanca.ineq.gini_to_theil",
"pytest.raises",
"salamanca.ineq.theil_to_gini",
"salamanca.ineq.LogNormalData",
"salamanca.ineq.std_to_theil"
] | [((110, 129), 'salamanca.ineq.gini_to_std', 'iq.gini_to_std', (['(0.5)'], {}), '(0.5)\n', (124, 129), True, 'from salamanca import ineq as iq\n'), ((224, 247), 'salamanca.ineq.std_to_gini', 'iq.std_to_gini', (['(0.95387)'], {}), '(0.95387)\n', (238, 247), True, 'from salamanca import ineq as iq\n'), ((339, 360), 'salam... |
import json
import traceback
from typing import Sequence
from django.contrib import admin
from django.contrib import messages
from django.urls import ResolverMatch, reverse, path
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.utils.timezone import now
from django.uti... | [
"traceback.format_exc",
"jsanctions.models.Citizenship.objects.distinct",
"django.contrib.admin.site.register",
"django.utils.translation.gettext_lazy",
"jsanctions.models.SanctionEntity.objects.none",
"jsanctions.models.BirthDate.objects.filter",
"json.dumps",
"django.utils.timezone.now",
"jsanctio... | [((11457, 11519), 'django.contrib.admin.site.register', 'admin.site.register', (['SanctionsListFile', 'SanctionsListFileAdmin'], {}), '(SanctionsListFile, SanctionsListFileAdmin)\n', (11476, 11519), False, 'from django.contrib import admin\n'), ((11520, 11570), 'django.contrib.admin.site.register', 'admin.site.register... |
from Rules.RuleTextTooBigCompWords import RuleTextTooBigCompWords
from Rules.RuleVisionBoxHasSoManyInvalidTexts import RuleVisionBoxHasSoManyInvalidTexts
from Rules.RuleBaseOnNeighbour import RuleBaseOnNeighbour
from Rules.RuleAlignVertically import RuleAlignVertically
from Rules.RuleBigLotChildren import RuleBigLotChi... | [
"Rules.RuleValidByList.RuleValidByList",
"Rules.RuleBoxHasWordTooSmall.RuleBoxHasWordTooSmall",
"Rules.RuleNoChildren.RuleNoChildren",
"Rules.RuleSmallVericalShape.RuleSmallVericalShape",
"Rules.RuleCharacterDistance.RuleCharacterDistance",
"Rules.RuleNoHeight.RuleNoHeight",
"Rules.RuleOutOfBound.RuleOu... | [((1633, 1755), 'Rules.RuleTextTooBigCompWords.RuleTextTooBigCompWords', 'RuleTextTooBigCompWords', (['self.mDipCalculator', 'self.mOcrTesseractOCR', 'self.mMatLog', 'self.mOcrTextWrappers', 'self.mViews'], {}), '(self.mDipCalculator, self.mOcrTesseractOCR, self.\n mMatLog, self.mOcrTextWrappers, self.mViews)\n', (1... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2020, NVIDIA CORPORATION. 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/li... | [
"functools.reduce"
] | [((809, 845), 'functools.reduce', 'reduce', (['(lambda x, y: x * y)', 'shape', '(1)'], {}), '(lambda x, y: x * y, shape, 1)\n', (815, 845), False, 'from functools import reduce\n')] |
# Copyright (c) 2015 Cloudera, Inc. All rights reserved.
import pytest
from subprocess import check_call
from tests.common.test_vector import *
from tests.common.impala_test_suite import *
from tests.util.filesystem_utils import WAREHOUSE, IS_S3
TEST_DB = 'hidden_files_db'
TEST_TBL = 'hf'
class TestHiddenFiles(Impal... | [
"subprocess.check_call"
] | [((1923, 2080), 'subprocess.check_call', 'check_call', (["['hadoop', 'fs', '-cp', '%s/year=2010/month=1/100101.txt' % ALLTYPES_LOC, \n '%s/year=2010/month=1/100101.txt' % TEST_TBL_LOC]"], {'shell': '(False)'}), "(['hadoop', 'fs', '-cp', '%s/year=2010/month=1/100101.txt' %\n ALLTYPES_LOC, '%s/year=2010/month=1/100... |
class Family:
'''
This is the class for Family.
id is the only variable that is required. If other variable does not exist, it would return None
If children does not exist, it would return an empty list
all date value are passed in as str, and saved as tuple with formate (year, month, day)
'''
... | [
"datetime.date.today",
"datetime.date"
] | [((3167, 3179), 'datetime.date.today', 'date.today', ([], {}), '()\n', (3177, 3179), False, 'from datetime import date\n'), ((5014, 5029), 'datetime.date', 'date', (['*marriage'], {}), '(*marriage)\n', (5018, 5029), False, 'from datetime import date\n'), ((5032, 5046), 'datetime.date', 'date', (['*divorce'], {}), '(*di... |
import asyncio
from multiprocessing.util import register_after_fork
from queue import Queue
from threading import (
Barrier,
BoundedSemaphore,
Condition,
Event,
Lock,
RLock,
Semaphore,
)
from aioprocessing.locks import _ContextManager
from .executor import _ExecutorMixin
from .mp import man... | [
"aioprocessing.locks._ContextManager",
"multiprocessing.util.register_after_fork"
] | [((2677, 2715), 'multiprocessing.util.register_after_fork', 'register_after_fork', (['self', '_after_fork'], {}), '(self, _after_fork)\n', (2696, 2715), False, 'from multiprocessing.util import register_after_fork\n'), ((4203, 4224), 'aioprocessing.locks._ContextManager', '_ContextManager', (['self'], {}), '(self)\n', ... |
# -*- coding: utf-8 -*-
# videobox getters
# Commands that get photo/video URLs.
'''Getters File'''
import typing
import discord
from discord.ext import commands
class Getters(commands.Cog):
"""Provides commands that generate videos."""
def __init__(self, bot):
self.bot = bot
self.emoji = "... | [
"discord.ext.commands.cooldown",
"discord.ext.commands.command"
] | [((371, 429), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""getvideourl"""', 'aliases': "['getvideo']"}), "(name='getvideourl', aliases=['getvideo'])\n", (387, 429), False, 'from discord.ext import commands\n'), ((435, 468), 'discord.ext.commands.cooldown', 'commands.cooldown', ([], {'rate': '(3... |
from django.contrib import admin
from filmoteca_api.models.movie_models import Movie
admin.site.register(Movie)
| [
"django.contrib.admin.site.register"
] | [((86, 112), 'django.contrib.admin.site.register', 'admin.site.register', (['Movie'], {}), '(Movie)\n', (105, 112), False, 'from django.contrib import admin\n')] |
import tkinter
import os
import pandas as pd
import random
os.chdir(os.path.dirname(__file__))
BACKGROUND_COLOR = "#B1DDC6"
name = input("What is your first and last name?").lower().replace(" ", "")
try:
df = pd.read_csv(f"C:/Users/jared/GitHub/continued-ed/100-Days-of-Python/day-31-flash-cards/data/{name}_wo... | [
"random.choice",
"pandas.read_csv",
"tkinter.Button",
"os.path.dirname",
"tkinter.Canvas",
"tkinter.Tk",
"pandas.DataFrame",
"tkinter.PhotoImage"
] | [((1934, 1946), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (1944, 1946), False, 'import tkinter\n'), ((2039, 2124), 'tkinter.Canvas', 'tkinter.Canvas', ([], {'width': '(800)', 'height': '(526)', 'bg': 'BACKGROUND_COLOR', 'highlightthickness': '(0)'}), '(width=800, height=526, bg=BACKGROUND_COLOR, highlightthickness=... |
from django.contrib.auth.models import User
from django.core.paginator import Paginator
from django.shortcuts import render
from blog.models.help_request import Request
from django.template.defaulttags import register
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.urls import... | [
"django.shortcuts.render",
"blog.models.help_request.Request.objects.get",
"blog.models.help_request.Request.objects.all",
"django.core.paginator.Paginator"
] | [((763, 801), 'django.core.paginator.Paginator', 'Paginator', (['requests_list', 'NUM_OF_POSTS'], {}), '(requests_list, NUM_OF_POSTS)\n', (772, 801), False, 'from django.core.paginator import Paginator\n'), ((925, 1011), 'django.shortcuts.render', 'render', (['request', '"""blog/helprequests.html"""', "{'rqsts': reques... |
import click
import yaml
import re
from kubernetes import client
from os import path
from utils import hiss, util
from settings import settings
def generate_artifact():
domains = settings.ORDERER_DOMAINS.split(' ')
# Create temp folder & namespace
settings.k8s.prereqs(domains[0])
k8s_template_file =... | [
"click.group",
"utils.util.get_k8s_template_path",
"settings.settings.ORDERER_DOMAINS.split",
"settings.settings.k8s.delete_job",
"utils.hiss.rattle",
"settings.settings.k8s.apply_yaml_from_template",
"settings.settings.k8s.prereqs"
] | [((978, 991), 'click.group', 'click.group', ([], {}), '()\n', (989, 991), False, 'import click\n'), ((185, 220), 'settings.settings.ORDERER_DOMAINS.split', 'settings.ORDERER_DOMAINS.split', (['""" """'], {}), "(' ')\n", (215, 220), False, 'from settings import settings\n'), ((263, 295), 'settings.settings.k8s.prereqs',... |
'''
TODO:
main function
board initialization
functions for changing tile status
'''
import random
board = []
dimension = 5
def main():
global board
initialize_board()
print_board(board)
board = update_board(board)
print_board(board)
def initialize_board():
global board
for row in range(dimension):
... | [
"random.randint"
] | [((384, 404), 'random.randint', 'random.randint', (['(0)', '(2)'], {}), '(0, 2)\n', (398, 404), False, 'import random\n')] |
from PIL import Image, ImageDraw
from PIL import ImageFont
def draw(puzzle,solution):
im = Image.new('RGBA', (900, 900), (255, 255, 255, 255))
draw = ImageDraw.Draw(im)
for i in range(4):
draw.line((i*300,0,i*300,900), (0,0,0,255),5)
draw.line((0,i*300,900,i*300), (0,0,0,255),5)
... | [
"PIL.Image.new",
"PIL.ImageDraw.Draw",
"PIL.ImageFont.truetype"
] | [((102, 153), 'PIL.Image.new', 'Image.new', (['"""RGBA"""', '(900, 900)', '(255, 255, 255, 255)'], {}), "('RGBA', (900, 900), (255, 255, 255, 255))\n", (111, 153), False, 'from PIL import Image, ImageDraw\n'), ((166, 184), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['im'], {}), '(im)\n', (180, 184), False, 'from PIL impo... |
from typing import List, Union
import torch.utils.data
import numpy
from torch.optim.optimizer import Optimizer
import torch
import torchvision
from .utils.data import new_dataset
from .utils.toolkit import *
import warnings
import time
def fit(model: torch.nn.Module = None,
train_dataset: torch.utils.data.Da... | [
"torch.max",
"torch.cuda.is_available",
"torch.utils.data.DataLoader",
"warnings.warn",
"torch.no_grad",
"time.time"
] | [((3055, 3152), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['train_dataset'], {'batch_size': 'batch_size', 'shuffle': 'shuffle'}), '(train_dataset, batch_size=batch_size, shuffle=\n shuffle, **kwargs)\n', (3082, 3152), False, 'import torch\n'), ((2702, 2801), 'torch.utils.data.DataLoader', 'torch... |
# Pylint doesn't play well with fixtures and dependency injection from pytest
# pylint: disable=redefined-outer-name
import os
import pytest
from buildstream import _yaml
from buildstream.exceptions import ErrorDomain, LoadErrorReason
from buildstream.testing import cli # pylint: disable=unused-import
from buildstre... | [
"tests.testutils.filetypegenerator.generate_file_types",
"os.path.join",
"os.symlink",
"os.chmod",
"os.path.realpath",
"os.path.dirname",
"os.path.isfile",
"buildstream._yaml.roundtrip_dump",
"os.path.isdir",
"pytest.mark.skipif",
"os.path.islink",
"buildstream.testing.cli.run",
"os.remove"
... | [((6078, 6171), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not HAVE_SANDBOX)'], {'reason': '"""Only available with a functioning sandbox"""'}), "(not HAVE_SANDBOX, reason=\n 'Only available with a functioning sandbox')\n", (6096, 6171), False, 'import pytest\n'), ((687, 720), 'os.path.join', 'os.path.join', (['... |
# This code calculates the invariant scalars I, J, J1, J2, J3, and J4. It does so by following the papers
# arXiv:gr-qc/0407013 and arXiv:0704.1756, and the example set by the Kranc-generated ETK thorn which
# can be found at https://bitbucket.org/einsteintoolkit/einsteinanalysis/src. While WeylScalarInvariants_Cartesi... | [
"sympy.re",
"sympy.im",
"grid.register_gridfunctions"
] | [((1170, 1299), 'grid.register_gridfunctions', 'gri.register_gridfunctions', (['"""AUX"""', "['psi4r', 'psi4i', 'psi3r', 'psi3i', 'psi2r', 'psi2i', 'psi1r', 'psi1i',\n 'psi0r', 'psi0i']"], {}), "('AUX', ['psi4r', 'psi4i', 'psi3r', 'psi3i',\n 'psi2r', 'psi2i', 'psi1r', 'psi1i', 'psi0r', 'psi0i'])\n", (1196, 1299),... |
from django.urls import path
from . import views
urlpatterns = [
path('logout/', views.auth_logout),
path('login/', views.LoginView.as_view()),
path('register/', views.RegisterView.as_view()),
path('dashboard/', views.DashboardView.as_view())
] | [
"django.urls.path"
] | [((70, 104), 'django.urls.path', 'path', (['"""logout/"""', 'views.auth_logout'], {}), "('logout/', views.auth_logout)\n", (74, 104), False, 'from django.urls import path\n')] |
# This file exists within 'easy-as-pypi-termio':
#
# https://github.com/tallybark/easy-as-pypi-termio#🍉
#
# Copyright © 2018-2020 <NAME>. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# t... | [
"sys.exit"
] | [((2135, 2146), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (2143, 2146), False, 'import sys\n'), ((2288, 2299), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (2296, 2299), False, 'import sys\n')] |
"""Mean-scale hyperprior model (no context model), as described in "Joint Autoregressive and Hierarchical Priors for
Learned Image Compression", NeurIPS2018, by Minnen, Ballé, and Toderici (https://arxiv.org/abs/1809.02736
Also see
<NAME>, <NAME>, <NAME>:
"Improving Inference for Neural Image Compression", NeurIPS 202... | [
"numpy.prod",
"tf_boilerplate.train",
"tensorflow.compat.v1.exp",
"utils.write_png",
"tensorflow_compression.GaussianConditional",
"tensorflow.compat.v1.shape",
"numpy.log",
"tensorflow.compat.v1.train.AdamOptimizer",
"nn_models.AnalysisTransform",
"tensorflow.compat.v1.squared_difference",
"ten... | [((1130, 1150), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1144, 1150), True, 'import numpy as np\n'), ((1151, 1175), 'tensorflow.compat.v1.set_random_seed', 'tf.set_random_seed', (['seed'], {}), '(seed)\n', (1169, 1175), True, 'import tensorflow.compat.v1 as tf\n'), ((1964, 1999), 'nn_models.A... |
from datetime import datetime, timedelta
from io import StringIO
from lxml import etree
import requests
from order.source_handler import check_source
from utils import (
log,
success,
warn
)
from api_utils import (
build_url,
MAX_PAGE_SIZE,
ANSWER_BATCH_SIZE
)
from custom_filters import load_... | [
"utils.log",
"api_utils.build_url",
"lxml.etree.HTMLParser",
"custom_filters.load_filter_file",
"datetime.datetime.utcnow",
"io.StringIO",
"requests.get",
"datetime.timedelta",
"utils.warn",
"snippet.Snippet",
"order.source_handler.check_source"
] | [((370, 388), 'lxml.etree.HTMLParser', 'etree.HTMLParser', ([], {}), '()\n', (386, 388), False, 'from lxml import etree\n'), ((1026, 1235), 'api_utils.build_url', 'build_url', (['"""questions"""'], {'site': '"""stackoverflow"""', 'sort': '"""activity"""', 'order': '"""desc"""', 'tagged': "(['python'] + tags)", 'fromdat... |
"""
Support functions for BIDS MRI fieldmap handling
MIT License
Copyright (c) 2017-2022 <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 th... | [
"numpy.abs",
"numpy.unique",
"bids.layout.parse_file_entities",
"json.dump",
"os.path.join",
"os.path.splitext",
"os.path.isfile",
"os.path.dirname",
"json.load",
"os.path.basename",
"numpy.argmin",
"numpy.int",
"os.walk"
] | [((3069, 3084), 'numpy.unique', 'np.unique', (['dirs'], {}), '(dirs)\n', (3078, 3084), True, 'import numpy as np\n'), ((5602, 5624), 'os.path.basename', 'os.path.basename', (['tmp1'], {}), '(tmp1)\n', (5618, 5624), False, 'import os\n'), ((5637, 5658), 'os.path.dirname', 'os.path.dirname', (['tmp1'], {}), '(tmp1)\n', (... |
from pathlib import Path
import pandas as pd
import logging
import click
import datetime
from imgdb.utils import Tcolors, unzip, pickler
from imgdb.config import Config
from imgdb.imdb_poster_fetcher import imdb_download_poster
import re
def datasets_updater(freq):
"""This functions downloads Imdb's datasets and ... | [
"datetime.datetime",
"logging.debug",
"pandas.read_csv",
"pathlib.Path",
"imgdb.utils.unzip",
"logging.warning",
"datetime.datetime.now",
"click.echo",
"imgdb.imdb_poster_fetcher.imdb_download_poster",
"logging.critical",
"imgdb.utils.Tcolors",
"imgdb.utils.pickler",
"re.findall",
"logging... | [((671, 694), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (692, 694), False, 'import datetime\n'), ((711, 754), 'datetime.datetime', 'datetime.datetime', (['(2021)', '(11)', '(24)', '(23)', '(59)', '(59)'], {}), '(2021, 11, 24, 23, 59, 59)\n', (728, 754), False, 'import datetime\n'), ((801, 851)... |
# -*- coding: utf-8 -*-
import json
from pioreactor.pubsub import QOS
from pioreactor.utils.timing import current_utc_time
from pioreactor.background_jobs.subjobs.base import BackgroundSubJob
from pioreactor.background_jobs.temperature_control import TemperatureController
class TemperatureAutomation(BackgroundSubJob... | [
"pioreactor.utils.timing.current_utc_time",
"json.loads"
] | [((860, 878), 'pioreactor.utils.timing.current_utc_time', 'current_utc_time', ([], {}), '()\n', (876, 878), False, 'from pioreactor.utils.timing import current_utc_time\n'), ((2579, 2597), 'pioreactor.utils.timing.current_utc_time', 'current_utc_time', ([], {}), '()\n', (2595, 2597), False, 'from pioreactor.utils.timin... |
from vizdoom import *
import numpy as np
import itertools as it
class DoomEnvironment:
def __init__(self, scenario='defend_the_center', window=False):
self.game = DoomGame()
print(scenario)
self.game.load_config("ViZDoom/scenarios/" + scenario + ".cfg")
self.game.set_doom_scenario_... | [
"numpy.identity",
"numpy.zeros",
"numpy.transpose"
] | [((1507, 1537), 'numpy.transpose', 'np.transpose', (['state', '[1, 2, 0]'], {}), '(state, [1, 2, 0])\n', (1519, 1537), True, 'import numpy as np\n'), ((1608, 1646), 'numpy.zeros', 'np.zeros', (['(480, 640, 3)'], {'dtype': '"""uint8"""'}), "((480, 640, 3), dtype='uint8')\n", (1616, 1646), True, 'import numpy as np\n'), ... |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [
"oci.util.formatted_flat_dict"
] | [((7568, 7593), 'oci.util.formatted_flat_dict', 'formatted_flat_dict', (['self'], {}), '(self)\n', (7587, 7593), False, 'from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel\n')] |
import numpy as np
import cv2 as cv
import time
# OpenCV Facial Capture Test
_cap = cv.VideoCapture(0)
_cap.set(cv.CAP_PROP_FRAME_WIDTH, 512)
_cap.set(cv.CAP_PROP_FRAME_HEIGHT, 512)
_cap.set(cv.CAP_PROP_BUFFERSIZE, 1)
time.sleep(0.5)
facemark = cv.face.createFacemarkLBF()
try:
# Download the trained model lbfmo... | [
"cv2.rectangle",
"cv2.face.createFacemarkLBF",
"time.sleep",
"cv2.imshow",
"numpy.zeros",
"cv2.circle",
"cv2.VideoCapture",
"cv2.CascadeClassifier",
"cv2.waitKey"
] | [((87, 105), 'cv2.VideoCapture', 'cv.VideoCapture', (['(0)'], {}), '(0)\n', (102, 105), True, 'import cv2 as cv\n'), ((221, 236), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (231, 236), False, 'import time\n'), ((249, 276), 'cv2.face.createFacemarkLBF', 'cv.face.createFacemarkLBF', ([], {}), '()\n', (274, 2... |
from django.http import HttpResponse
from django.shortcuts import render
def about_view(request):
context = {}
names = ['内容1', '内容2', '内容3', '内容4', '内容5', '内容6']
data = [1, 2, 3, 4, 5, 6]
cols = ['c罗', '梅西', '卡卡', '小罗', '哈维', '小白']
data2 = [6, 5, 4, 3, 2, 1]
context['names'] = names
contex... | [
"django.shortcuts.render"
] | [((407, 445), 'django.shortcuts.render', 'render', (['request', '"""about.html"""', 'context'], {}), "(request, 'about.html', context)\n", (413, 445), False, 'from django.shortcuts import render\n')] |
#!/usr/bin/env python3
import sys
import datetime
# path to tools/
# you need this, if you want to execute this script from anywhere, otherwise comment next line
sys.path.append('/home/satan/vk')
from tools import *
api = tools.create_api(MESSAGES)
# TODO: make cool args
for arg in sys.argv[1:]:
if arg in dir... | [
"datetime.datetime.now",
"sys.path.append"
] | [((164, 197), 'sys.path.append', 'sys.path.append', (['"""/home/satan/vk"""'], {}), "('/home/satan/vk')\n", (179, 197), False, 'import sys\n'), ((676, 699), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (697, 699), False, 'import datetime\n')] |
import gast as ast
import beniget
mod = ast.parse("""
T = int
def func() -> T:
return 1
""")
fdef = mod.body[1]
node = fdef.returns
du = beniget.DefUseChains()
du.visit(mod)
du.chains[node]
ud = beniget.UseDefChains(du)
ud.chains[node]
| [
"beniget.UseDefChains",
"gast.parse",
"beniget.DefUseChains"
] | [((42, 98), 'gast.parse', 'ast.parse', (['"""\nT = int\ndef func() -> T:\n return 1\n"""'], {}), '("""\nT = int\ndef func() -> T:\n return 1\n""")\n', (51, 98), True, 'import gast as ast\n'), ((145, 167), 'beniget.DefUseChains', 'beniget.DefUseChains', ([], {}), '()\n', (165, 167), False, 'import beniget\n'), ((2... |
"""
输入一个正整数判断是不是素数。
素数指的是只能被1和自身整除的大于1的整数。
思路1):因此判断一个整数m是否是素数,只需把 m 被 2 ~ m-1 之间的每一个整数去除,如果都不能被整除,那么 m 就是一个素数。
思路2):如果 m 不能被 2 ~ m求平方根 间任一整数整除,m 必定是素数。
Version:0.1
Author:cjp
"""
a = int(input("请输入正整数:"))
b = False
for i in range(2,a-1):
if(a%i == 0):
b = True
break
if not b and a != 1:
print... | [
"math.sqrt"
] | [((434, 441), 'math.sqrt', 'sqrt', (['n'], {}), '(n)\n', (438, 441), False, 'from math import sqrt\n')] |
import streamlit as st
import datetime
import time
import pandas as pd
import numpy as np
# title
st.title('Streamlit Basics')
# header
st.header('header')
st.subheader('subheader')
# text
st.text('regular text')
# markdown
st.markdown('## markdown text')
# color text
st.success('Success!')
# misc
st.info('Info'... | [
"streamlit.table",
"matplotlib.pyplot.hist",
"streamlit.echo",
"time.sleep",
"streamlit.code",
"streamlit.multiselect",
"streamlit.text_input",
"streamlit.header",
"streamlit.title",
"datetime.time",
"streamlit.warning",
"streamlit.sidebar.header",
"numpy.random.normal",
"streamlit.markdow... | [((100, 128), 'streamlit.title', 'st.title', (['"""Streamlit Basics"""'], {}), "('Streamlit Basics')\n", (108, 128), True, 'import streamlit as st\n'), ((139, 158), 'streamlit.header', 'st.header', (['"""header"""'], {}), "('header')\n", (148, 158), True, 'import streamlit as st\n'), ((159, 184), 'streamlit.subheader',... |
# run a BWM search for a fixed source orientation (theta, phi, psi, t0)
import numpy as np
import argparse, os
import pickle
from enterprise.pulsar import Pulsar
from enterprise.signals import parameter
from enterprise.signals import selections
from enterprise.signals import utils
from enterprise.signals import signal... | [
"enterprise.signals.selections.Selection",
"enterprise.signals.white_signals.MeasurementNoise",
"enterprise.signals.gp_signals.FourierBasisGP",
"enterprise.signals.utils.powerlaw",
"utils.sample_utils.JupOrb_KDE_Draw",
"os.path.exists",
"enterprise.signals.gp_signals.TimingModel",
"argparse.ArgumentPa... | [((626, 701), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""run the BWM analysis with enterprise"""'}), "(description='run the BWM analysis with enterprise')\n", (649, 701), False, 'import argparse, os\n'), ((3491, 3519), 'os.path.abspath', 'os.path.abspath', (['args.outdir'], {}), '(ar... |
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
import pandas as pd
import timeit
import seaborn as sns
def elbow(vals, timer_start):
plt.figure('Elbow Graph showing the optimal amount of clusters k')
plt.plot(range(1, 10), vals, 'bx-')
plt.xlabel('k')
plt.ylabel('Distortion')
p... | [
"sklearn.cluster.KMeans",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"timeit.default_timer",
"matplotlib.pyplot.xlabel",
"seaborn.heatmap",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((159, 225), 'matplotlib.pyplot.figure', 'plt.figure', (['"""Elbow Graph showing the optimal amount of clusters k"""'], {}), "('Elbow Graph showing the optimal amount of clusters k')\n", (169, 225), True, 'import matplotlib.pyplot as plt\n'), ((270, 285), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""k"""'], {}), "(... |
from cozy.common import declare_case
from cozy.syntax import Type, Exp, Stm
TArray = declare_case(Type, "TArray", ["elem_type"])
EArrayCapacity = declare_case(Exp, "EArrayCapacity", ["e"])
EArrayLen = declare_case(Exp, "EArrayLen", ["e"])
EArrayGet = declare_case(Exp, "EArrayGet", ["a", "i"])
EArrayIndexOf = declare_c... | [
"cozy.common.declare_case"
] | [((86, 129), 'cozy.common.declare_case', 'declare_case', (['Type', '"""TArray"""', "['elem_type']"], {}), "(Type, 'TArray', ['elem_type'])\n", (98, 129), False, 'from cozy.common import declare_case\n'), ((147, 189), 'cozy.common.declare_case', 'declare_case', (['Exp', '"""EArrayCapacity"""', "['e']"], {}), "(Exp, 'EAr... |
# Generated by Django 2.0.1 on 2018-06-08 22:37
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('products', '0009_auto_20180520_2113'),
]
operations = [
migrations.RemoveField(
model_name='cart',
name='products',
... | [
"django.db.migrations.DeleteModel",
"django.db.migrations.RemoveField"
] | [((228, 286), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""cart"""', 'name': '"""products"""'}), "(model_name='cart', name='products')\n", (250, 286), False, 'from django.db import migrations\n'), ((331, 385), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'... |
#!/usr/bin/env python
# coding: utf-8
# In[426]:
import PIL
import cv2
import numpy as np
import os
from PIL import Image
#newly added modules :
import natsort
from typing import Tuple, Union
import math
from deskew import determine_skew
# In[412]:
def Setting_image_to_300DPI(img, img_ref) :
length_x, widt... | [
"numpy.array",
"cv2.bitwise_or",
"numpy.sin",
"os.remove",
"numpy.mean",
"os.listdir",
"cv2.threshold",
"cv2.medianBlur",
"deskew.determine_skew",
"numpy.round",
"cv2.fillPoly",
"cv2.merge",
"numpy.ones",
"math.radians",
"numpy.cos",
"cv2.cvtColor",
"cv2.split",
"cv2.getRotationMat... | [((752, 767), 'cv2.imread', 'cv2.imread', (['img'], {}), '(img)\n', (762, 767), False, 'import cv2\n'), ((780, 825), 'cv2.cvtColor', 'cv2.cvtColor', (['im', 'cv2.COLOR_BGR2GRAY'], {'dstCn': '(2)'}), '(im, cv2.COLOR_BGR2GRAY, dstCn=2)\n', (792, 825), False, 'import cv2\n'), ((840, 861), 'deskew.determine_skew', 'determi... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def apply_display_order(apps, schema_editor):
initial_display_order = {1: 1, 4: 2, 5: 3, 2: 4, 3: 5}
PortalCategory = apps.get_model('v1', 'PortalCategory')
for category in PortalCategory.objects.all():
... | [
"django.db.migrations.RunPython"
] | [((557, 598), 'django.db.migrations.RunPython', 'migrations.RunPython', (['apply_display_order'], {}), '(apply_display_order)\n', (577, 598), False, 'from django.db import migrations\n')] |
from django.conf import settings
from django.core.management.base import BaseCommand
from qfieldcloud.core import geodb_utils, utils
class Command(BaseCommand):
help = "Check qfieldcloud status"
def handle(self, *args, **options):
results = {}
results["redis"] = "ok"
# Check if redis... | [
"qfieldcloud.core.utils.redis_is_running",
"qfieldcloud.core.geodb_utils.geodb_is_running",
"qfieldcloud.core.utils.get_s3_client"
] | [((347, 371), 'qfieldcloud.core.utils.redis_is_running', 'utils.redis_is_running', ([], {}), '()\n', (369, 371), False, 'from qfieldcloud.core import geodb_utils, utils\n'), ((482, 512), 'qfieldcloud.core.geodb_utils.geodb_is_running', 'geodb_utils.geodb_is_running', ([], {}), '()\n', (510, 512), False, 'from qfieldclo... |
from __future__ import print_function
import unittest
import numpy as np
import scipy.sparse as sp
import discretize
from SimPEG import maps, utils
from SimPEG import data_misfit, simulation, survey
np.random.seed(17)
class DataMisfitTest(unittest.TestCase):
def setUp(self):
mesh = discretize.TensorMe... | [
"discretize.TensorMesh",
"numpy.ones",
"SimPEG.survey.BaseSrc",
"numpy.random.rand",
"SimPEG.maps.ExpMap",
"numpy.log",
"SimPEG.utils.Identity",
"SimPEG.survey.BaseSurvey",
"SimPEG.survey.BaseRx",
"numpy.random.seed",
"unittest.main",
"SimPEG.data_misfit.L2DataMisfit"
] | [((203, 221), 'numpy.random.seed', 'np.random.seed', (['(17)'], {}), '(17)\n', (217, 221), True, 'import numpy as np\n'), ((2453, 2468), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2466, 2468), False, 'import unittest\n'), ((301, 328), 'discretize.TensorMesh', 'discretize.TensorMesh', (['[30]'], {}), '([30])\n... |
import matplotlib.pyplot as plt
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
import numpy as np
import skimage.io as io
import ipdb;pdb=ipdb.set_trace
from collections import OrderedDict
# markdown format output
def _print_name_value(name_value, full_arch_name):
names = name_value.ke... | [
"collections.OrderedDict",
"pycocotools.coco.COCO",
"pycocotools.cocoeval.COCOeval"
] | [((1026, 1039), 'pycocotools.coco.COCO', 'COCO', (['gt_anns'], {}), '(gt_anns)\n', (1030, 1039), False, 'from pycocotools.coco import COCO\n'), ((1083, 1116), 'pycocotools.cocoeval.COCOeval', 'COCOeval', (['cocoGt', 'cocoDt', 'annType'], {}), '(cocoGt, cocoDt, annType)\n', (1091, 1116), False, 'from pycocotools.cocoeva... |
import numpy as np
import cv2
import copy
from polygon import Polygon
def draw_polygon(img, polygon):
# Create result image from input image
ret = img.copy()
# Create polygon image
poly = img.copy()
# Get image size
h, w = poly.shape[:2]
# Draw polygon
vertices = polygon.vertices.copy... | [
"numpy.random.rand",
"polygon.Polygon",
"numpy.array",
"cv2.addWeighted",
"copy.deepcopy"
] | [((425, 455), 'numpy.array', 'np.array', (['[vertices]', 'np.int32'], {}), '([vertices], np.int32)\n', (433, 455), True, 'import numpy as np\n'), ((469, 515), 'numpy.array', 'np.array', (['(polygon.color * 255 + 0.5)'], {'dtype': 'int'}), '(polygon.color * 255 + 0.5, dtype=int)\n', (477, 515), True, 'import numpy as np... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by pat on 4/9/18
"""
.. currentmodule:: modeldoc.py
.. moduleauthor:: <NAME> <<EMAIL>>
This module contains a Sphinx extension that can be used to generate specialized
documentation for model classes.
"""
import logging
import uuid
from typing import Any, cast, ... | [
"sphinx.util.docstrings.prepare_docstring",
"sphinx.ext.autodoc.ClassLevelDocumenter.add_content",
"uuid.uuid4",
"titlecase.titlecase",
"typing.cast"
] | [((4567, 4634), 'sphinx.ext.autodoc.ClassLevelDocumenter.add_content', 'ClassLevelDocumenter.add_content', (['self', 'more_content', '_no_docstring'], {}), '(self, more_content, _no_docstring)\n', (4599, 4634), False, 'from sphinx.ext.autodoc import ClassLevelDocumenter, AttributeDocumenter, ClassDocumenter\n'), ((6260... |
# coding: utf-8
from __future__ import print_function, division, absolute_import
try:
import xbmcgui
except ImportError:
import warnings
warnings.warn('Not running under Kodi, GUI will not work!')
xbmcgui = None
class Fakexbmc(object):
NOTIFICATION_ERROR = "ERR"
NOTIFICATION_INFO = "INFO"
... | [
"warnings.warn",
"xbmcgui.Dialog"
] | [((150, 209), 'warnings.warn', 'warnings.warn', (['"""Not running under Kodi, GUI will not work!"""'], {}), "('Not running under Kodi, GUI will not work!')\n", (163, 209), False, 'import warnings\n'), ((416, 454), 'warnings.warn', 'warnings.warn', (["('%s: %s' % (level, msg))"], {}), "('%s: %s' % (level, msg))\n", (429... |
from stn import spatial_transformer_network as transformer
from tensorflow.keras import layers, Model
class STModel(object):
def __init__(self, input_shape):
self.inpt = layers.Input(input_shape)
self.output = self.transformer_net(self.inpt, self.localization_net(self.inpt))
return Mod... | [
"tensorflow.keras.layers.Input",
"stn.spatial_transformer_network",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.Model",
"tensorflow.keras.layers.Activation",
"tensorflow.keras.layers.MaxPool2D"
] | [((188, 213), 'tensorflow.keras.layers.Input', 'layers.Input', (['input_shape'], {}), '(input_shape)\n', (200, 213), False, 'from tensorflow.keras import layers, Model\n'), ((317, 346), 'tensorflow.keras.Model', 'Model', (['self.inpt', 'self.output'], {}), '(self.inpt, self.output)\n', (322, 346), False, 'from tensorfl... |
# Copyright (c) 2022 by <NAME>
# Copyright (c) 2012 - 2021, Udacity, Inc.
# All rights reserved.
# This file is part of the computer vision course project submission of Udacity's Self-driving
# Cars Nanodegree Program. It has been developed based on the starter code provided by Udacity
# on https://github.com/udacity/n... | [
"tensorflow.compat.v1.image.resize",
"utils.parse_frame",
"io.BytesIO",
"utils.int64_list_feature",
"tensorflow.compat.v1.io.encode_jpeg",
"tensorflow.compat.v1.data.TFRecordDataset",
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"os.path.isdir",
"tensorflow.compat.v1.python_io.TFRe... | [((4518, 4546), 'os.path.basename', 'os.path.basename', (['input_path'], {}), '(input_path)\n', (4534, 4546), False, 'import os\n'), ((4757, 4792), 'os.path.join', 'os.path.join', (['data_dir', '"""processed"""'], {}), "(data_dir, 'processed')\n", (4769, 4792), False, 'import os\n'), ((4797, 4833), 'os.makedirs', 'os.m... |
from django.shortcuts import render, redirect
from .models import Image, Profile
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from .forms import PostForm
# Create your views here.
@login_required(login_url='/accounts/login/')
def home(request):
title = "Pixi... | [
"django.shortcuts.render",
"django.shortcuts.redirect",
"django.contrib.auth.decorators.login_required"
] | [((239, 283), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/accounts/login/"""'}), "(login_url='/accounts/login/')\n", (253, 283), False, 'from django.contrib.auth.decorators import login_required\n'), ((989, 1033), 'django.contrib.auth.decorators.login_required', 'login_req... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... | [
"pulumi.set",
"pulumi.ResourceOptions",
"pulumi.get"
] | [((1227, 1263), 'pulumi.set', 'pulumi.set', (['__self__', '"""color"""', 'color'], {}), "(__self__, 'color', color)\n", (1237, 1263), False, 'import pulumi\n'), ((1272, 1308), 'pulumi.set', 'pulumi.set', (['__self__', '"""group"""', 'group'], {}), "(__self__, 'group', group)\n", (1282, 1308), False, 'import pulumi\n'),... |
from pyabc import ABCSMC, Distribution
from pyabc.sampler import MulticoreEvalParallelSampler, SingleCoreSampler
import scipy.stats as st
import numpy as np
from datetime import datetime, timedelta
set_acc_rate = 0.2
pop_size = 10
def model(x):
"""Some model"""
return {"par": x["par"] + np.random.randn()}
... | [
"pyabc.sampler.MulticoreEvalParallelSampler",
"scipy.stats.uniform",
"datetime.datetime.now",
"datetime.timedelta",
"numpy.random.randn",
"pyabc.sampler.SingleCoreSampler"
] | [((1042, 1091), 'pyabc.sampler.MulticoreEvalParallelSampler', 'MulticoreEvalParallelSampler', ([], {'check_max_eval': '(True)'}), '(check_max_eval=True)\n', (1070, 1091), False, 'from pyabc.sampler import MulticoreEvalParallelSampler, SingleCoreSampler\n'), ((1109, 1147), 'pyabc.sampler.SingleCoreSampler', 'SingleCoreS... |
import os, random, sys, time, csv, pickle, re, pkg_resources
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
from tkinter import StringVar, DoubleVar, Tk, Label, Entry, Button, OptionMenu, Checkbutton, Message, Menu, IntVar, Scale, HORIZONTAL, simpledialog, messagebox, Toplevel
from tkinter.ttk import Progressbar, Se... | [
"tkinter.filedialog.askdirectory",
"scipy.io.savemat",
"git.Repo.clone_from",
"pkg_resources.require",
"scipy.io.loadmat",
"matplotlib.pyplot.Figure",
"tkinter.Button",
"scipy.interpolate.interp1d",
"scipy.optimize.nnls",
"numpy.nanmean",
"numpy.argsort",
"tkinter.Label",
"sys.exit",
"tkin... | [((2443, 2447), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (2445, 2447), False, 'from tkinter import StringVar, DoubleVar, Tk, Label, Entry, Button, OptionMenu, Checkbutton, Message, Menu, IntVar, Scale, HORIZONTAL, simpledialog, messagebox, Toplevel\n'), ((1392, 1414), 'os.path.isdir', 'os.path.isdir', (['sf_path'], {}), '... |
# -*- coding: utf-8 -*-
from typing import Type
import pytest
from returns.functions import raise_exception
from returns.result import Failure, Success
class _CustomException(Exception):
"""Just for the test."""
@pytest.mark.parametrize('exception_type', [
TypeError,
ValueError,
_CustomException,... | [
"returns.result.Success",
"pytest.mark.parametrize",
"pytest.raises"
] | [((224, 312), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""exception_type"""', '[TypeError, ValueError, _CustomException]'], {}), "('exception_type', [TypeError, ValueError,\n _CustomException])\n", (247, 312), False, 'import pytest\n'), ((456, 485), 'pytest.raises', 'pytest.raises', (['exception_type... |
import os
import pytest
from chpass.exceptions.operating_system_not_supported import OperatingSystemNotSupported
from chpass.exceptions.user_not_found_exception import UserNotFoundException
from chpass.services.path import get_home_directory, get_chrome_user_folder
@pytest.fixture(scope="module")
def invalid_os() -... | [
"os.path.exists",
"pytest.raises",
"os.path.basename",
"pytest.fixture",
"chpass.services.path.get_chrome_user_folder",
"chpass.services.path.get_home_directory"
] | [((271, 301), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (285, 301), False, 'import pytest\n'), ((344, 374), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (358, 374), False, 'import pytest\n'), ((492, 526), 'chpass.services.pat... |
import getpass
import logging
import os
import pathlib
import pytest
from libtmux import exc
from libtmux.server import Server
from libtmux.test import TEST_SESSION_PREFIX, get_test_session_name, namer
logger = logging.getLogger(__name__)
@pytest.fixture(autouse=True, scope="session")
def home_path(tmp_path_factor... | [
"logging.getLogger",
"libtmux.server.Server",
"getpass.getuser",
"pytest.fixture",
"libtmux.test.get_test_session_name",
"os.path.relpath"
] | [((214, 241), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (231, 241), False, 'import logging\n'), ((245, 290), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)', 'scope': '"""session"""'}), "(autouse=True, scope='session')\n", (259, 290), False, 'import pytest\n'), ((394, 4... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | [
"openerp.osv.fields.many2one",
"openerp.tools.translate._",
"time.strftime"
] | [((1203, 1349), 'openerp.osv.fields.many2one', 'fields.many2one', (['"""delivery.carrier"""', '"""Delivery Method"""'], {'help': '"""Complete this field if you plan to invoice the shipping based on picking."""'}), "('delivery.carrier', 'Delivery Method', help=\n 'Complete this field if you plan to invoice the shippi... |
# pylint: disable=missing-module-docstring
#
# Copyright (C) 2022 by YadavGulshan@Github, < https://github.com/YadavGulshan >.
#
# This file is part of < https://github.com/Yadavgulshan/pharmaService > project,
# and is released under the "BSD 3-Clause License Agreement".
# Please see < https://github.com/YadavGulshan/... | [
"rest_framework.decorators.permission_classes",
"pharmacy.api.serializers.MedicineSerializer",
"pharmacy.models.Medical.objects.filter",
"rest_framework.response.Response",
"pharmacy.models.Medicine.objects.filter"
] | [((686, 723), 'rest_framework.decorators.permission_classes', 'permission_classes', (['[IsAuthenticated]'], {}), '([IsAuthenticated])\n', (704, 723), False, 'from rest_framework.decorators import permission_classes\n'), ((1204, 1248), 'pharmacy.models.Medicine.objects.filter', 'Medicine.objects.filter', ([], {'name__co... |