code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Generated by Django 3.1.6 on 2021-02-19 14:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('CyberUser', '0006_auto_20210219_2041'),
]
operations = [
migrations.AlterField(
model_name='news',
name='published_d... | [
"django.db.models.DateTimeField"
] | [((344, 405), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)', 'default': '"""2021-01-01"""'}), "(auto_now_add=True, default='2021-01-01')\n", (364, 405), False, 'from django.db import migrations, models\n')] |
import myapp.views as myapp
from django.urls import path
app_name = 'myapp'
urlpatterns = [
path('', myapp.index, name='index'),
path('catalog/', myapp.catalog, name='catalog'),
path('catalog/category/<int:category_pk>/', myapp.catalog_section, name='catalog_section'),
path('catalog/product/<int:pro... | [
"django.urls.path"
] | [((98, 133), 'django.urls.path', 'path', (['""""""', 'myapp.index'], {'name': '"""index"""'}), "('', myapp.index, name='index')\n", (102, 133), False, 'from django.urls import path\n'), ((139, 186), 'django.urls.path', 'path', (['"""catalog/"""', 'myapp.catalog'], {'name': '"""catalog"""'}), "('catalog/', myapp.catalog... |
"""Linked List v2
=== CSC148 Winter 2018 ===
University of Toronto,
Computer Science
__author__ = '<NAME>'
=== Module Description ===
This module contains a linked list implementation. Note that the size can be
reduced by using multiple assignment statements. This module was made for lab 4.
"""
from typing import Opt... | [
"doctest.testmod"
] | [((29327, 29344), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (29342, 29344), False, 'import doctest\n')] |
import warnings
from random import randint
from unittest import TestCase
from .models import (
ColumnFamilyTestModel,
ColumnFamilyIndexedTestModel,
ClusterPrimaryKeyModel,
ForeignPartitionKeyModel,
DictFieldModel
)
from .util import (
connect_db,
destroy_db,
create_model
)
class Colu... | [
"django.setup",
"warnings.catch_warnings",
"random.randint"
] | [((1659, 1673), 'django.setup', 'django.setup', ([], {}), '()\n', (1671, 1673), False, 'import django\n'), ((3900, 3914), 'django.setup', 'django.setup', ([], {}), '()\n', (3912, 3914), False, 'import django\n'), ((4731, 4745), 'django.setup', 'django.setup', ([], {}), '()\n', (4743, 4745), False, 'import django\n'), (... |
import uuid
from src.data_layer.db_connector import Base
from sqlalchemy import Column, Boolean, DateTime
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy import func
class OrderModel(Base):
"""
Define Item database table ORM model
"""
__tablename__ = "order"
# Register columns
... | [
"sqlalchemy.dialects.postgresql.UUID",
"sqlalchemy.func.now",
"sqlalchemy.Column"
] | [((660, 690), 'sqlalchemy.Column', 'Column', (['Boolean'], {'default': '(False)'}), '(Boolean, default=False)\n', (666, 690), False, 'from sqlalchemy import Column, Boolean, DateTime\n'), ((760, 790), 'sqlalchemy.Column', 'Column', (['Boolean'], {'default': '(False)'}), '(Boolean, default=False)\n', (766, 790), False, ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd.gradcheck import zero_gradients
from common.utils import split_states
class FCNet(nn.Module):
def __init__(self, inp_dim, hid_dim, num_layers, bias):
super(FCNet,self).__init__()
self.inp_dim = inp_dim
... | [
"torch.nn.Softplus",
"torch.nn.LeakyReLU",
"torch.autograd.gradcheck.zero_gradients",
"torch.nn.init.xavier_uniform_",
"common.utils.split_states",
"torch.transpose",
"torch.tril_indices",
"torch.einsum",
"torch.autograd.grad",
"torch.nn.Linear",
"torch.zeros"
] | [((3859, 3900), 'torch.transpose', 'torch.transpose', (['jacobian'], {'dim0': '(0)', 'dim1': '(1)'}), '(jacobian, dim0=0, dim1=1)\n', (3874, 3900), False, 'import torch\n'), ((520, 557), 'torch.nn.Linear', 'nn.Linear', (['self.inp_dim', 'self.hid_dim'], {}), '(self.inp_dim, self.hid_dim)\n', (529, 557), True, 'import t... |
# import dash related libraries
import dash
import dash_html_components as html
import dash_bootstrap_components as dbc
import warnings
warnings.filterwarnings('ignore')
# import local libraries
from callbacks import register_callbacks
from lib import tabs
from lib import title
# create dash App server
app = dash.Da... | [
"callbacks.register_callbacks",
"lib.tabs.build_tabs",
"dash.Dash",
"warnings.filterwarnings",
"dash_html_components.Div"
] | [((137, 170), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (160, 170), False, 'import warnings\n'), ((313, 377), 'dash.Dash', 'dash.Dash', (['__name__'], {'external_stylesheets': '[dbc.themes.BOOTSTRAP]'}), '(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])\n', (32... |
import time
import os.path
import sys
class Log:
def __init__(self,output=sys.stdout):
self.output=output
def __call__(self, f):
def func(environ, start_response):
res=f(environ, start_response)
tts=time.strftime("%d/%b/%Y:%H:%M:%S", time.gmtime())
if type(r... | [
"time.gmtime"
] | [((284, 297), 'time.gmtime', 'time.gmtime', ([], {}), '()\n', (295, 297), False, 'import time\n')] |
import pandas as pd
import numpy as np
from catboost import CatBoostClassifier
import xgboost as xgb
import lightgbm as lgb
from sklearn.utils import class_weight
from abc import ABC, abstractmethod
class predict_model(ABC):
"""
Abstract class for working with classifiers.
"""
@abstractmethod
def... | [
"numpy.unique",
"lightgbm.LGBMClassifier",
"pandas.DataFrame",
"catboost.CatBoostClassifier",
"xgboost.XGBClassifier"
] | [((2413, 2443), 'pandas.DataFrame', 'pd.DataFrame', ([], {'index': 'test.index'}), '(index=test.index)\n', (2425, 2443), True, 'import pandas as pd\n'), ((3233, 3285), 'catboost.CatBoostClassifier', 'CatBoostClassifier', ([], {'class_weights': 'c_w'}), '(**self.params, class_weights=c_w)\n', (3251, 3285), False, 'from ... |
# -*- coding: utf-8 -*-
"""
knowledge about ECG arrhythmia
Standard 12Leads ECG
--------------------
Inferior leads: II, III, aVF
Lateral leads: I, aVL, V5-6
Septal leads: aVR, V1
Anterior leads: V2-4
-----------------------------------
Chest (precordial) leads: V1-6
Limb leads: I, II, III,... | [
"easydict.EasyDict",
"io.StringIO"
] | [((2632, 3287), 'easydict.EasyDict', 'ED', (["{'fullname': 'atrial fibrillation', 'url': [\n 'https://litfl.com/atrial-fibrillation-ecg-library/',\n 'https://en.wikipedia.org/wiki/Atrial_fibrillation#Screening'],\n 'knowledge': ['irregularly irregular rhythm', 'no P waves',\n 'absence of an isoelectric base... |
"""
@authors:
# =============================================================================
Information:
The functions in this script are used to export and create array files
todo:
Something is wrong with: Store_temp_GLl
# =============================================================================
"""... | [
"matplotlib.pyplot.figure",
"matplotlib.pyplot.savefig",
"numpy.ones"
] | [((2905, 2923), 'matplotlib.pyplot.figure', 'plt.figure', (['fignum'], {}), '(fignum)\n', (2915, 2923), True, 'import matplotlib.pyplot as plt\n'), ((3062, 3093), 'matplotlib.pyplot.savefig', 'plt.savefig', (['file_name'], {'dpi': 'dpi'}), '(file_name, dpi=dpi)\n', (3073, 3093), True, 'import matplotlib.pyplot as plt\n... |
import numpy as np
from scipy import optimize
from sklearn.metrics import euclidean_distances
from ashic.utils import rotation, fill_array3d
def prepare_data(x, tab, alpha, beta, mask, loci, bias):
n = int(x.shape[0]/2)
x1 = x[:n, :][loci, :]
x2 = x[n:, :][loci, :]
# find the centroids of x1, x2
c... | [
"numpy.repeat",
"numpy.power",
"sklearn.metrics.euclidean_distances",
"numpy.log",
"ashic.utils.rotation",
"numpy.outer",
"numpy.concatenate",
"ashic.utils.fill_array3d"
] | [((658, 685), 'sklearn.metrics.euclidean_distances', 'euclidean_distances', (['x1', 'x2'], {}), '(x1, x2)\n', (677, 685), False, 'from sklearn.metrics import euclidean_distances\n'), ((1009, 1044), 'ashic.utils.rotation', 'rotation', (['thetaxm', 'thetaym', 'thetazm'], {}), '(thetaxm, thetaym, thetazm)\n', (1017, 1044)... |
import torch
from torch.utils.data import DataLoader
from data.iemocap import MultimodalDataset
from data.mosei import MoseiNewDataset
from train import params
#TODO: make batch size so that the number of samples is divisible by it
###attempt 1: based on FMT code###
def get_train_loader(dataset):
if dataset == '... | [
"torch.utils.data.DataLoader"
] | [((571, 684), 'torch.utils.data.DataLoader', 'DataLoader', ([], {'dataset': 'train_dataset', 'batch_size': 'params.batch_size', 'shuffle': '(True)', 'num_workers': '(1)', 'drop_last': '(True)'}), '(dataset=train_dataset, batch_size=params.batch_size, shuffle=\n True, num_workers=1, drop_last=True)\n', (581, 684), Fa... |
#Schrodinger 1D equation solved in an infinite potential well by Numerov's algorithm and the shooting method
#Not generalized to any potential yet as I'm not sure about the boundary conditions.
from __future__ import division
import numpy as np
from matplotlib import pyplot as plt
hbar = 1
m = 1
xmin = -1
xmax = 1
N... | [
"matplotlib.pyplot.legend",
"numpy.linspace",
"matplotlib.pyplot.grid",
"numpy.zeros"
] | [((437, 477), 'numpy.linspace', 'np.linspace', (['xmin', 'xmax', 'N'], {'retstep': '(True)'}), '(xmin, xmax, N, retstep=True)\n', (448, 477), True, 'import numpy as np\n'), ((506, 517), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (514, 517), True, 'import numpy as np\n'), ((739, 750), 'numpy.zeros', 'np.zeros', ([... |
# -*- coding: utf-8 -*-
#
# Copyright 2017 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compli... | [
"nbformat.notebooknode.from_dict",
"renga.notebook.RengaStorageManager",
"pytest.raises"
] | [((1811, 1832), 'renga.notebook.RengaStorageManager', 'RengaStorageManager', ([], {}), '()\n', (1830, 1832), False, 'from renga.notebook import RengaStorageManager\n'), ((2783, 2804), 'renga.notebook.RengaStorageManager', 'RengaStorageManager', ([], {}), '()\n', (2802, 2804), False, 'from renga.notebook import RengaSto... |
#!/usr/bin/env python
# coding: utf-8
# import torch.nn.functional as F
# import torch.optim as optim
# from apex import amp
# from tqdm import tqdm
# from skimage import io as img
# import torchvision.models as models
# from torchsummaryX import summary as modelsummary
# import nni
import time
import os
import warni... | [
"configs.get_configs",
"torch.nn.L1Loss",
"utils_functions.data_augmenter",
"torch.cuda.synchronize",
"torch.nn.MSELoss",
"utils_functions.ran_gen",
"training_functions.organise_models",
"argparse.ArgumentParser",
"training_functions.VGGPerceptualLoss",
"evaluation.calculate_sifid_given_paths",
... | [((995, 1028), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1018, 1028), False, 'import warnings\n'), ((1029, 1050), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (1043, 1050), False, 'import matplotlib\n'), ((1171, 1196), 'argparse.ArgumentParse... |
from django.utils import simplejson
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from basic.blog.models import Post, Category
from django.conf import settings
from django import http
from django.template import loader, Context
from django_proxy.models import Proxy
from django.view... | [
"basic.blog.models.Settings.get_current",
"django.views.generic.list_detail.object_list",
"re.compile",
"view_cache_utils.cache_page_with_prefix",
"django_proxy.models.Proxy.objects.published",
"django.shortcuts.get_object_or_404",
"django.template.RequestContext",
"django.db.models.Q",
"basic.blog.... | [((3770, 3813), 'view_cache_utils.cache_page_with_prefix', 'cache_page_with_prefix', (['(60)', 'page_key_prefix'], {}), '(60, page_key_prefix)\n', (3792, 3813), False, 'from view_cache_utils import cache_page_with_prefix\n'), ((1958, 1992), 'django.template.loader.get_template', 'loader.get_template', (['template_name'... |
from bokeh.resources import CDN
from flask import request, current_app
from flask_security import login_required
from flask_security.core import current_user
from flexmeasures.data.config import db
from flexmeasures.ui.views import flexmeasures_ui
from flexmeasures.ui.utils.view_utils import render_flexmeasures_templa... | [
"flexmeasures.ui.utils.view_utils.clear_session",
"flexmeasures.data.services.resources.get_asset_group_queries",
"flexmeasures.data.services.resources.Resource",
"flexmeasures.ui.views.flexmeasures_ui.route",
"flask.current_app.config.get",
"flexmeasures.data.services.resources.get_center_location"
] | [((518, 553), 'flexmeasures.ui.views.flexmeasures_ui.route', 'flexmeasures_ui.route', (['"""/dashboard"""'], {}), "('/dashboard')\n", (539, 553), False, 'from flexmeasures.ui.views import flexmeasures_ui\n'), ((1117, 1183), 'flexmeasures.data.services.resources.get_asset_group_queries', 'get_asset_group_queries', ([], ... |
import os
import pandas as pd
import seaborn as sns
dataDir = '..\\Test_Data\\'
pilotMarkerDataFile = 'Pilot.csv'
df = pd.read_csv( dataDir + '\\' + pilotMarkerDataFile,sep='\t', engine='python')
repr(df.head())
# TODO times per position
# plotting a heatmap http://stanford.edu/~mwaskom/software/seaborn/examples... | [
"pandas.read_csv"
] | [((121, 197), 'pandas.read_csv', 'pd.read_csv', (["(dataDir + '\\\\' + pilotMarkerDataFile)"], {'sep': '"""\t"""', 'engine': '"""python"""'}), "(dataDir + '\\\\' + pilotMarkerDataFile, sep='\\t', engine='python')\n", (132, 197), True, 'import pandas as pd\n')] |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 30 14:22:15 2020
@author: paras
"""
import pandas as pd
import numpy as np
from sklearn.externals import joblib
from flask import Flask, jsonify, request
import json
import flask
from keras.preprocessing import image
from keras.preprocessing.image import ImageDataGene... | [
"flask.render_template",
"keras.preprocessing.image.img_to_array",
"flask.Flask",
"sklearn.externals.joblib.load",
"flask.request.form.to_dict",
"numpy.expand_dims",
"urllib.request.urlopen"
] | [((552, 567), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (557, 567), False, 'from flask import Flask, jsonify, request\n'), ((520, 543), 'keras.preprocessing.image.img_to_array', 'image.img_to_array', (['img'], {}), '(img)\n', (538, 543), False, 'from keras.preprocessing import image\n'), ((626, 661), ... |
#!/usr/bin/env python3
# Day 14: Longest Palindrome
#
# Given a string which consists of lowercase or uppercase letters, find the
# length of the longest palindromes that can be built with those letters.
# This is case sensitive, for example "Aa" is not considered a palindrome here.
import collections
class Solution... | [
"collections.Counter"
] | [((455, 477), 'collections.Counter', 'collections.Counter', (['s'], {}), '(s)\n', (474, 477), False, 'import collections\n')] |
from keras import backend as K
from keras.layers import LSTM, time_distributed_dense
from keras import initializations, activations, regularizers
from keras.engine import InputSpec
# LSTM with Layer Normalization as described in:
# https://arxiv.org/pdf/1607.06450v1.pdf
# page 13, equation (20), (21), and (22)
class... | [
"keras.backend.dot",
"keras.backend.mean",
"keras.backend.var"
] | [((477, 511), 'keras.backend.mean', 'K.mean', (['xs'], {'axis': '(-1)', 'keepdims': '(True)'}), '(xs, axis=-1, keepdims=True)\n', (483, 511), True, 'from keras import backend as K\n'), ((531, 564), 'keras.backend.var', 'K.var', (['xs'], {'axis': '(-1)', 'keepdims': '(True)'}), '(xs, axis=-1, keepdims=True)\n', (536, 56... |
# server.py
import logging
logging.basicConfig(level=logging.DEBUG, format='%(message)s', )
import datetime as dt
import logging
import sys
import socketserver
logging.basicConfig(level=logging.DEBUG,
format='%(name)s: %(message)s',
)
local_ip = '0.0.0.0'
#local_ip = "172.19.13... | [
"logging.basicConfig",
"socket.socket",
"inspect.currentframe",
"sys.getsizeof",
"datetime.datetime.now",
"sys.exc_info",
"sys.exit",
"threading.Thread",
"traceback.print_exc"
] | [((27, 89), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(message)s"""'}), "(level=logging.DEBUG, format='%(message)s')\n", (46, 89), False, 'import inspect, logging\n'), ((161, 233), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': ... |
import argparse
import os
import shutil
import yaml
import subprocess
from pathlib import Path
from copy import deepcopy
import zipfile
import tarfile
import fnmatch
from datetime import datetime
import sys
from helper_classes.node import Node
import stat
# TODO rename to `offline_log_collector_path`
project_root_path... | [
"sys.path.insert",
"tarfile.open",
"argparse.ArgumentParser",
"pathlib.Path",
"subprocess.run",
"os.path.join",
"os.path.realpath",
"datetime.datetime.now",
"yaml.safe_load",
"helper_classes.node.Node",
"os.path.basename",
"shutil.rmtree"
] | [((552, 607), 'os.path.join', 'os.path.join', (['project_root_path', '"""config/settings.yaml"""'], {}), "(project_root_path, 'config/settings.yaml')\n", (564, 607), False, 'import os\n'), ((640, 699), 'os.path.join', 'os.path.join', (['project_root_path', '"""config/environments.yaml"""'], {}), "(project_root_path, 'c... |
import numpy as np
import pygenome as pg
# fitness function: measures the sortness of a permutation
def sorted_permutation(vector):
unsorted = vector.size
for i in range(vector.size):
if vector[i] == i:
unsorted -= 1
return unsorted
permutation_size = 10
# GA 1
def generational_n... | [
"pygenome.genetic_algorithm_permutation",
"numpy.random.seed",
"pygenome.best_individual"
] | [((337, 355), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (351, 355), True, 'import numpy as np\n'), ((366, 462), 'pygenome.genetic_algorithm_permutation', 'pg.genetic_algorithm_permutation', (['sorted_permutation', 'permutation_size'], {'total_generations': '(25)'}), '(sorted_permutation, permutat... |
"""Structure classes."""
import numpy as np
import rmsd
import math
import warnings
from collections import Counter, OrderedDict, defaultdict
from .base import StructureClass, query, StructureSet
class AtomStructure:
"""A structure made of atoms. This contains various useful methods that rely
on a ``atoms()``... | [
"numpy.sqrt",
"math.ceil",
"math.floor",
"numpy.asarray",
"numpy.sum",
"numpy.array",
"numpy.dot",
"collections.defaultdict",
"numpy.cos",
"numpy.linalg.norm",
"numpy.sin",
"rmsd.kabsch_rmsd",
"warnings.warn",
"numpy.round"
] | [((2860, 2890), 'numpy.sqrt', 'np.sqrt', (['mean_square_deviation'], {}), '(mean_square_deviation)\n', (2867, 2890), True, 'import numpy as np\n'), ((30474, 30493), 'numpy.array', 'np.array', (['[x, y, z]'], {}), '([x, y, z])\n', (30482, 30493), True, 'import numpy as np\n'), ((32562, 32578), 'numpy.asarray', 'np.asarr... |
# Generated by Django 3.0.3 on 2020-02-27 22:21
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("Washlist", "0002_auto_20200227_2219"),
("StudentVillage", "0002_auto_20200227_2219"),
]
operations = [
... | [
"django.db.models.ForeignKey"
] | [((441, 564), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'to': '"""Washlist.TemplateWashList"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.SET_NULL, to='Washlist.TemplateWashList')\n", (458... |
import subprocess
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--batch_size", default=4)
parser.add_argument("--epochs", default=10)
args = parser.parse_args()
cl = " ".join([
"python train.py",
"--dataset", os.path.join("data", "voc2012_train.tfrecord"),
"--val_datase... | [
"subprocess.run",
"os.path.join",
"argparse.ArgumentParser"
] | [((54, 79), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (77, 79), False, 'import argparse\n'), ((568, 610), 'subprocess.run', 'subprocess.run', (['cl'], {'shell': '(True)', 'check': '(True)'}), '(cl, shell=True, check=True)\n', (582, 610), False, 'import subprocess\n'), ((255, 301), 'os.path... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 1 16:21:45 2019
@author: peter
"""
from singleCaptchaGenerate import generateCaptchaText
generateNumber = 10**2
if __name__ == '__main__':
for i in range(0, generateNumber):
text = generateCaptchaText(save=True)
if i % 100 ==0:
print("... | [
"singleCaptchaGenerate.generateCaptchaText"
] | [((246, 276), 'singleCaptchaGenerate.generateCaptchaText', 'generateCaptchaText', ([], {'save': '(True)'}), '(save=True)\n', (265, 276), False, 'from singleCaptchaGenerate import generateCaptchaText\n')] |
import os
import re
import requests
import json
def get_results(race,year,gender):
gender = gender[0]
race = race[0]
url = "http://eodg.atm.ox.ac.uk/user/dudhia/rowing/bumps/%s%s/%s%s%s.txt" % (race,year,race,year,gender)
try:
r = requests.get(url)
return r.content.split('\n'... | [
"os.path.exists",
"os.path.join",
"requests.get",
"os.mkdir",
"json.dump"
] | [((266, 283), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (278, 283), False, 'import requests\n'), ((2926, 2948), 'os.path.exists', 'os.path.exists', (['"""data"""'], {}), "('data')\n", (2940, 2948), False, 'import os\n'), ((2959, 2975), 'os.mkdir', 'os.mkdir', (['"""data"""'], {}), "('data')\n", (2967, 2... |
import pytest
from parse_license import parse, parse_one
def test_no_children_sums_metadata():
assert parse('0 3 4 5 6') == 4 + 5 + 6
assert parse('0 2 0 7') == 7
def test_one_child():
assert parse('1 2 0 1 9 2 7') == 18
# @pytest.mark.xfail
def test_two_child():
assert parse('2 2 0 1 9 0 3 6 6 6 2... | [
"parse_license.parse",
"parse_license.parse_one"
] | [((108, 126), 'parse_license.parse', 'parse', (['"""0 3 4 5 6"""'], {}), "('0 3 4 5 6')\n", (113, 126), False, 'from parse_license import parse, parse_one\n'), ((151, 167), 'parse_license.parse', 'parse', (['"""0 2 0 7"""'], {}), "('0 2 0 7')\n", (156, 167), False, 'from parse_license import parse, parse_one\n'), ((208... |
from itertools import count
from problem import Problem
from utils.math import factors
from utils.primes import sieve_of_eratosthenes
class HighlyDivisibleTriangleNumber(Problem, name="Highly divisible triangular number", expected=76576500):
@Problem.solution()
def brute_force(self):
for i in count(3... | [
"utils.math.factors",
"itertools.count",
"problem.Problem.solution",
"utils.primes.sieve_of_eratosthenes"
] | [((250, 268), 'problem.Problem.solution', 'Problem.solution', ([], {}), '()\n', (266, 268), False, 'from problem import Problem\n'), ((313, 321), 'itertools.count', 'count', (['(3)'], {}), '(3)\n', (318, 321), False, 'from itertools import count\n'), ((527, 554), 'utils.primes.sieve_of_eratosthenes', 'sieve_of_eratosth... |
import redio
# holds the class that manages the player info in redis
# todo: Consider using a single coroutine to do all loading and storing of players so that
# todo: we can detect if a player is getting race condition'd (i.e. there are two copies of them)
# todo: out and they might get squashed
def redis_factory()... | [
"redio.Redis"
] | [((348, 381), 'redio.Redis', 'redio.Redis', (['"""redis://localhost/"""'], {}), "('redis://localhost/')\n", (359, 381), False, 'import redio\n')] |
import mock
from celery.signals import worker_init
from .utils import get_flask_app
class TestFlaskTracingHelper(object):
@mock.patch('celery.signals.worker_init')
def test_no_celery(self, *mocks):
import celery.signals
del celery.signals.worker_init
get_flask_app()
@mock.patch(... | [
"celery.signals.worker_init.send",
"mock.patch"
] | [((131, 171), 'mock.patch', 'mock.patch', (['"""celery.signals.worker_init"""'], {}), "('celery.signals.worker_init')\n", (141, 171), False, 'import mock\n'), ((309, 365), 'mock.patch', 'mock.patch', (['"""intracing.base.TracingHelper.apply_patches"""'], {}), "('intracing.base.TracingHelper.apply_patches')\n", (319, 36... |
# import the necessary packages
from imutils.video import VideoStream
import numpy as np
import argparse
import imutils
import time
import cv2
import os
import torch
from PIL import Image
import torch.nn as nn
import torch.nn.functional as F
from torchvision import transforms
from torch.autograd import Variable
import ... | [
"cv2.rectangle",
"torch.nn.ReLU",
"torch.max",
"time.sleep",
"cv2.imshow",
"numpy.array",
"cv2.destroyAllWindows",
"torch.nn.BatchNorm2d",
"imutils.video.VideoStream",
"argparse.ArgumentParser",
"cv2.dnn.readNetFromCaffe",
"torchvision.transforms.ToTensor",
"torch.autograd.Variable",
"cv2.... | [((2149, 2174), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2172, 2174), False, 'import argparse\n'), ((2660, 2717), 'cv2.dnn.readNetFromCaffe', 'cv2.dnn.readNetFromCaffe', (["args['prototxt']", "args['model']"], {}), "(args['prototxt'], args['model'])\n", (2684, 2717), False, 'import cv2\n... |
# based on tut_mission_B737.py and Vehicle.py from Regional Jet Optimization
#
# Created: Aug 2014, SUAVE Team
# Modified: Aug 2017, SUAVE Team
# Modified: Jul 2018, geo
# ----------------------------------------------------------------------
# Imports
# ------------------------------------------------------------... | [
"SUAVE.Input_Output.Results.print_parasite_drag",
"numpy.sqrt",
"pylab.savefig",
"SUAVE.Components.Energy.Converters.Compression_Nozzle",
"SUAVE.Components.Landing_Gear.Landing_Gear",
"SUAVE.Analyses.Vehicle",
"SUAVE.Components.Energy.Converters.Compressor",
"SUAVE.Input_Output.Results.print_mission_b... | [((1246, 1359), 'SUAVE.Methods.Center_of_Gravity.compute_aircraft_center_of_gravity', 'SUAVE.Methods.Center_of_Gravity.compute_aircraft_center_of_gravity', (['weights.vehicle'], {'nose_load_fraction': '(0.06)'}), '(weights.\n vehicle, nose_load_fraction=0.06)\n', (1312, 1359), False, 'import SUAVE\n'), ((1834, 1908)... |
from tests.app_tests import BaseTestCase
from app.mod_todo.models import *
from flask import url_for
import datetime
TODO = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ille enim occurrentia nescio quae comminiscebatur; Sin tantum modo ad indicia veteris memoriae cognoscenda, curiosorum. Duo Reges: constr... | [
"datetime.datetime.now",
"datetime.timedelta",
"datetime.date",
"flask.url_for"
] | [((660, 687), 'datetime.date', 'datetime.date', (['(2020)', '(12)', '(12)'], {}), '(2020, 12, 12)\n', (673, 687), False, 'import datetime\n'), ((842, 896), 'flask.url_for', 'url_for', (['"""adminpanel.configure_module"""'], {'bp_name': '"""todo"""'}), "('adminpanel.configure_module', bp_name='todo')\n", (849, 896), Fal... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : handler.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 09/08/2019
#
# This file is part of JacMLDash.
# Distributed under terms of the MIT license.
import os
import os.path as osp
import mimetypes
from tornado.web import StaticFileHandler
from jacweb.web i... | [
"os.getcwd",
"jacweb.web.route"
] | [((354, 375), 'jacweb.web.route', 'route', (['"""/viewer/(.*)"""'], {}), "('/viewer/(.*)')\n", (359, 375), False, 'from jacweb.web import route, JacRequestHandler\n'), ((533, 544), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (542, 544), False, 'import os\n')] |
import logging
log = logging.getLogger(__name__)
import datetime
import re
import requests
import requests.exceptions
import botologist.plugin
def format_number(number):
if not isinstance(number, int):
number = float(number)
if number % 1 == 0.0:
number = int(number)
if isinstance(number, int):
f_number... | [
"logging.getLogger",
"datetime.datetime.now",
"requests.get",
"re.compile"
] | [((21, 48), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (38, 48), False, 'import logging\n'), ((991, 1088), 're.compile', 're.compile', (['"""<Cube currency=["\\\\\']([A-Za-z]{3})["\\\\\'] rate=["\\\\\']([\\\\d.]+)["\\\\\']/>"""'], {}), '(\n \'<Cube currency=["\\\\\\\']([A-Za-z]{3})... |
from django.db import models
from datetime import datetime
# Create your models here.
class CaseNode(models.Model):
"""
节点管理
"""
parent_id = models.ForeignKey("self", models.CASCADE, related_name='subs', blank=True, null=True,
verbose_name="父节点")
parent_ids = mode... | [
"django.db.models.DateTimeField",
"django.db.models.IntegerField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((159, 268), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""self"""', 'models.CASCADE'], {'related_name': '"""subs"""', 'blank': '(True)', 'null': '(True)', 'verbose_name': '"""父节点"""'}), "('self', models.CASCADE, related_name='subs', blank=True,\n null=True, verbose_name='父节点')\n", (176, 268), False, 'f... |
def fastio():
import sys
from io import StringIO
from atexit import register
global input
sys.stdin = StringIO(sys.stdin.read())
input = lambda : sys.stdin.readline().rstrip()
sys.stdout = StringIO()
register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
def t():
n,k ... | [
"sys.stdin.readline",
"sys.stdout.getvalue",
"io.StringIO",
"sys.stdin.read"
] | [((217, 227), 'io.StringIO', 'StringIO', ([], {}), '()\n', (225, 227), False, 'from io import StringIO\n'), ((131, 147), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (145, 147), False, 'import sys\n'), ((170, 190), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (188, 190), False, 'import sys\n')... |
# --------------------------------------------------------------------------
# Source file provided under Apache License, Version 2.0, January 2004,
# http://www.apache.org/licenses/
# (c) Copyright IBM Corp. 2015, 2016
# --------------------------------------------------------------------------
# gendoc: ignore... | [
"docplex.mp.utils.iter_emptyset"
] | [((2101, 2116), 'docplex.mp.utils.iter_emptyset', 'iter_emptyset', ([], {}), '()\n', (2114, 2116), False, 'from docplex.mp.utils import iter_emptyset, is_number\n'), ((2346, 2361), 'docplex.mp.utils.iter_emptyset', 'iter_emptyset', ([], {}), '()\n', (2359, 2361), False, 'from docplex.mp.utils import iter_emptyset, is_n... |
from env_FireFighter import EnvFireFighter
import random
def generate_tgt_list(agt_num):
tgt_list = []
for i in range(agt_num):
tgt_list.append(random.randint(0, 1))
return tgt_list
env = EnvFireFighter(4)
max_iter = 100
for i in range(max_iter):
print("iter= ", i)
print("actual fire lev... | [
"random.randint",
"env_FireFighter.EnvFireFighter"
] | [((211, 228), 'env_FireFighter.EnvFireFighter', 'EnvFireFighter', (['(4)'], {}), '(4)\n', (225, 228), False, 'from env_FireFighter import EnvFireFighter\n'), ((161, 181), 'random.randint', 'random.randint', (['(0)', '(1)'], {}), '(0, 1)\n', (175, 181), False, 'import random\n')] |
# 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... | [
"numpy.linspace"
] | [((3580, 3655), 'numpy.linspace', 'np.linspace', (['self._min_rate', 'self._max_rate', 'self._num_rates'], {'endpoint': '(True)'}), '(self._min_rate, self._max_rate, self._num_rates, endpoint=True)\n', (3591, 3655), True, 'import numpy as np\n')] |
from django.conf.urls import url, patterns
urlpatterns = patterns('notification.views',
url(r'^notification/$', 'notification_list', name='notification_list'),
url(r'^request/$', 'request_list', name='request_list'),
) | [
"django.conf.urls.url"
] | [((93, 162), 'django.conf.urls.url', 'url', (['"""^notification/$"""', '"""notification_list"""'], {'name': '"""notification_list"""'}), "('^notification/$', 'notification_list', name='notification_list')\n", (96, 162), False, 'from django.conf.urls import url, patterns\n'), ((169, 223), 'django.conf.urls.url', 'url', ... |
# -*- coding: utf-8 -*-
"""This module provides access to the condition REST api of Camunda."""
from __future__ import annotations
import typing
import pycamunda.processinst
import pycamunda.base
from pycamunda.request import BodyParameter
URL_SUFFIX = '/condition'
__all__ = ['Evaluate']
class Evaluate(pycamund... | [
"pycamunda.request.BodyParameter"
] | [((361, 387), 'pycamunda.request.BodyParameter', 'BodyParameter', (['"""variables"""'], {}), "('variables')\n", (374, 387), False, 'from pycamunda.request import BodyParameter\n'), ((407, 435), 'pycamunda.request.BodyParameter', 'BodyParameter', (['"""businessKey"""'], {}), "('businessKey')\n", (420, 435), False, 'from... |
# Copyright 2018-2021 The glTF-Blender-IO authors.
#
# 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 ... | [
"os.path.exists",
"os.makedirs",
"re.compile",
"pathlib.Path",
"io_scene_gltf2_msfs.io.exp.gltf2_io_user_extensions.export_user_extensions",
"os.path.join",
"os.path.normpath",
"io_scene_gltf2_msfs.io.com.gltf2_io.Buffer",
"re.findall",
"os.path.dirname",
"os.path.basename",
"io_scene_gltf2_ms... | [((19198, 19220), 'os.path.normpath', 'os.path.normpath', (['path'], {}), '(path)\n', (19214, 19220), False, 'import os\n'), ((1944, 2011), 'io_scene_gltf2_msfs.io.exp.gltf2_io_user_extensions.export_user_extensions', 'export_user_extensions', (['"""gather_asset_hook"""', 'export_settings', 'asset'], {}), "('gather_ass... |
from utils.utils import *
import os
from embedding.greedy_encoding import AutoEncoder
from model_configs.ae import *
cur_dir = os.path.dirname(__file__)
project_root = os.path.join(cur_dir, '..', '..')
data_folder = os.path.join(project_root, 'data', 'images', 'all')
'''
Trained:
c_2000_1000_300_1000_2000 # working... | [
"os.path.exists",
"os.makedirs",
"embedding.greedy_encoding.AutoEncoder",
"os.path.join",
"os.path.dirname"
] | [((129, 154), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (144, 154), False, 'import os\n'), ((170, 203), 'os.path.join', 'os.path.join', (['cur_dir', '""".."""', '""".."""'], {}), "(cur_dir, '..', '..')\n", (182, 203), False, 'import os\n'), ((218, 269), 'os.path.join', 'os.path.join', ([... |
'''
Created on 2015年12月22日
@author: sunshyran
'''
import time
import unittest
from framework.client.Client import AbstractClient
from framework.driver.Invoker import Invoker
from framework.driver.InvokerHandler import InvokerHandler
from test.rpcframework.FakeChannel import FakeChannel
class FakeClien... | [
"unittest.main",
"framework.driver.Invoker.Invoker",
"time.sleep",
"test.rpcframework.FakeChannel.FakeChannel"
] | [((969, 984), 'unittest.main', 'unittest.main', ([], {}), '()\n', (982, 984), False, 'import unittest\n'), ((819, 832), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (829, 832), False, 'import time\n'), ((411, 424), 'test.rpcframework.FakeChannel.FakeChannel', 'FakeChannel', ([], {}), '()\n', (422, 424), False, '... |
# -*- coding: utf-8 -*-
from functools import reduce
from operator import mul
from string import ascii_lowercase
from io import open
import time
import math
import pkg_resources
import os
import struct
from .constants import *
__all__ = [
"clean_word_list",
"permutations",
"calculate_entropy",
"load... | [
"os.urandom",
"math.sqrt",
"pkg_resources.resource_filename",
"io.open",
"time.time"
] | [((1216, 1227), 'time.time', 'time.time', ([], {}), '()\n', (1225, 1227), False, 'import time\n'), ((2066, 2077), 'time.time', 'time.time', ([], {}), '()\n', (2075, 2077), False, 'import time\n'), ((6986, 6997), 'time.time', 'time.time', ([], {}), '()\n', (6995, 6997), False, 'import time\n'), ((7584, 7603), 'math.sqrt... |
# encoding: utf-8
"""
@author: yp
@software: PyCharm
@file: GoodsManageDemo.py
@time: 2019/8/1 0001 16:43
"""
from AutoTestPlatform.web.WebDriver import Driver
driver = Driver()
#登录Dbshop
driver.get("http://192.168.1.16/DBshop/admin")
driver.find_element_by_id_data("user_name", 'admin')
driver.find_element_by_id_d... | [
"AutoTestPlatform.web.WebDriver.Driver"
] | [((173, 181), 'AutoTestPlatform.web.WebDriver.Driver', 'Driver', ([], {}), '()\n', (179, 181), False, 'from AutoTestPlatform.web.WebDriver import Driver\n')] |
"""
Extractive summarization based on keywords genetared
by keyword extraction step in the pipeline
Al alternative approach would be domain-specific
sentence extraction.
Ideally, we want the summarized sentences to appear
"""
import math
from collections import OrderedDict
import networkx as nx
import text_processi... | [
"utilities.read_write.read_file",
"keyword_extraction.keywords_filtered.get_keywords_with_scores",
"networkx.DiGraph",
"text_processing.preprocessing.sentence_tokenize",
"text_processing.preprocessing.clean_to_doc",
"networkx.pagerank"
] | [((750, 768), 'networkx.pagerank', 'nx.pagerank', (['graph'], {}), '(graph)\n', (761, 768), True, 'import networkx as nx\n'), ((1310, 1339), 'text_processing.preprocessing.clean_to_doc', 'preprocess.clean_to_doc', (['text'], {}), '(text)\n', (1333, 1339), True, 'import text_processing.preprocessing as preprocess\n'), (... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Remade on Sun 30 May 2021 22:32
@author: <NAME> - <EMAIL>
"""
#%%
# =============================================================================
# Dependencies
# =============================================================================
## Importing modules
im... | [
"datetime.datetime.today",
"numpy.array",
"pandas.read_csv",
"xarray.Dataset"
] | [((527, 889), 'numpy.array', 'np.array', (["['1979', '1980', '1981', '1982', '1983', '1984', '1985', '1986', '1987',\n '1988', '1989', '1990', '1991', '1992', '1993', '1994', '1995', '1996',\n '1997', '1998', '1999', '2000', '2001', '2002', '2003', '2004', '2005',\n '2006', '2007', '2008', '2009', '2010', '201... |
"""
Mask R-CNN
Copyright (c) 2018 Matterport, Inc.
Licensed under the MIT License (see LICENSE for details)
Written by <NAME>
------------------------------------------------------------
Minor Changes applied from <NAME>
Applied for:
IEEE Intelligent Vehicles Symposium - IV2020:
"Vehicle Position Estimation with A... | [
"mrcnn.model.MaskRCNN",
"scipy.io.savemat",
"mrcnn.utils.download_trained_weights",
"mrcnn.visualize.display_instances",
"sys.path.append",
"os.walk",
"os.path.exists",
"numpy.mean",
"mrcnn.model.mold_image",
"argparse.ArgumentParser",
"matplotlib.pyplot.close",
"mrcnn.utils.compute_ap_range",... | [((1186, 1211), 'os.path.abspath', 'os.path.abspath', (['"""../../"""'], {}), "('../../')\n", (1201, 1211), False, 'import os\n'), ((1232, 1257), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (1247, 1257), False, 'import sys\n'), ((1644, 1687), 'os.path.join', 'os.path.join', (['ROOT_DIR', '... |
#!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name='BOSCH-GLM-rangefinder',
version='0.0',
author='philipptrenz',
author_email='<EMAIL>',
description='Remote control a BOSCH GLM 100C rangefinder via its Bluetooth serial interface.',
url='https://github.com/philipptre... | [
"setuptools.setup"
] | [((68, 395), 'setuptools.setup', 'setup', ([], {'name': '"""BOSCH-GLM-rangefinder"""', 'version': '"""0.0"""', 'author': '"""philipptrenz"""', 'author_email': '"""<EMAIL>"""', 'description': '"""Remote control a BOSCH GLM 100C rangefinder via its Bluetooth serial interface."""', 'url': '"""https://github.com/philipptre... |
"""
Tests for attack.dictionaries module.
"""
import math
import os
import dataclasses
import pytest
import tempfile
from typing import List
from test_common.fs.ops import copy_files
from test_common.fs.temp import temp_dir
from cifra.attack.dictionaries import Dictionary, get_words_from_text, \
NotExistingLangua... | [
"tempfile.TemporaryDirectory",
"cifra.attack.dictionaries.Dictionary.open",
"cifra.attack.dictionaries.get_histogram_from_text_file",
"cifra.attack.dictionaries.Dictionary",
"cifra.attack.dictionaries.get_words_from_text",
"cifra.attack.dictionaries.get_words_from_text_file",
"os.path.join",
"cifra.at... | [((5614, 5645), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (5628, 5645), False, 'import pytest\n'), ((6548, 6564), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (6562, 6564), False, 'import pytest\n'), ((7309, 7777), 'pytest.fixture', 'pytest.fixture', ([], {'pa... |
from faker import Faker
from faker.providers.date_time import Provider
from faker_extensions.abstract_providers import BoundedWeightedProvider
class AgeProvider(BoundedWeightedProvider):
""" Provide Fake age and date of birth"""
age_distribution = {
(0, 4): 0.062,
(5, 9): 0.056,
(10,... | [
"faker.Faker",
"faker.providers.date_time.Provider"
] | [((1301, 1317), 'faker.Faker', 'Faker', (["['en_UK']"], {}), "(['en_UK'])\n", (1306, 1317), False, 'from faker import Faker\n'), ((837, 856), 'faker.providers.date_time.Provider', 'Provider', (['generator'], {}), '(generator)\n', (845, 856), False, 'from faker.providers.date_time import Provider\n')] |
import os
import random
import cherrypy
from snake_board import SnakeBoard
import numpy as np
"""
This is a simple Battlesnake server written in Python.
For instructions see https://github.com/BattlesnakeOfficial/starter-snake-python/README.md
"""
class Battlesnake(object):
def __init__(self):
self.board... | [
"cherrypy.tools.json_out",
"random.choice",
"cherrypy.tools.json_in",
"cherrypy.quickstart",
"cherrypy.config.update",
"os.environ.get",
"snake_board.SnakeBoard"
] | [((536, 560), 'cherrypy.tools.json_in', 'cherrypy.tools.json_in', ([], {}), '()\n', (558, 560), False, 'import cherrypy\n'), ((566, 591), 'cherrypy.tools.json_out', 'cherrypy.tools.json_out', ([], {}), '()\n', (589, 591), False, 'import cherrypy\n'), ((971, 995), 'cherrypy.tools.json_in', 'cherrypy.tools.json_in', ([],... |
"""JSON encoding functions."""
import datetime
import decimal
import types
from json import JSONEncoder as _JSONEncoder
from tg.support.converters import asbool
from webob.multidict import MultiDict
from tg._compat import string_type
from tg.configuration.utils import GlobalConfigurable
from tg.util.sqlalchemy impor... | [
"logging.getLogger",
"tg.util.sqlalchemy.is_query_result",
"tg.util.ming.is_objectid",
"json.JSONEncoder.default",
"tg.util.ming.is_mingobject",
"tg.util.sqlalchemy.dictify",
"tg.util.ming.dictify",
"tg.util.sqlalchemy.is_saobject",
"tg.util.sqlalchemy.is_query_row"
] | [((489, 516), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (506, 516), False, 'import logging\n'), ((4013, 4029), 'tg.util.sqlalchemy.is_saobject', 'is_saobject', (['obj'], {}), '(obj)\n', (4024, 4029), False, 'from tg.util.sqlalchemy import dictify as dictify_sqla, is_saobject, is_quer... |
import torch
import torch.backends.cudnn as cudnn
import torch.nn.functional as F
import torch.nn as nn
from torch.quantization import QuantStub, DeQuantStub
import torch.optim as optim
from torchvision import models, datasets, transforms
import torch.utils.data.distributed as distributed
import torch.multiprocessing a... | [
"custom_modules.resnet.imagenet_resnet50",
"torch.eq",
"horovod.torch.size",
"torch.cuda.is_available",
"torch.utils.tensorboard.SummaryWriter",
"os.path.exists",
"utils.meters.TimeMeter",
"argparse.ArgumentParser",
"horovod.torch.rank",
"torchvision.datasets.ImageFolder",
"pruning.pruning.apply... | [((22867, 22934), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Imagenet_ResNet50 experiment"""'}), "(description='Imagenet_ResNet50 experiment')\n", (22890, 22934), False, 'import argparse\n'), ((1319, 1338), 'custom_modules.resnet.imagenet_resnet50', 'imagenet_resnet50', ([], {}), '()... |
# encoding: utf-8
from efl.elementary.label import Label
from efl.elementary.icon import Icon
from efl.elementary.box import Box
from efl.elementary.list import List
from efl.elementary.genlist import Genlist, GenlistItem, GenlistItemClass, \
ELM_LIST_COMPRESS
from efl.elementary.button import Button
from efl.elem... | [
"efl.elementary.list.List",
"math.sqrt",
"efl.elementary.genlist.GenlistItem",
"efl.elementary.box.Box",
"efl.elementary.icon.Icon",
"efl.elementary.panes.Panes",
"efl.elementary.hoversel.Hoversel",
"collections.deque",
"efl.elementary.separator.Separator",
"efl.elementary.genlist.Genlist",
"efl... | [((1793, 1843), 'efl.elementary.box.Box.__init__', 'Box.__init__', (['self', 'parent_widget', '*args'], {}), '(self, parent_widget, *args, **kwargs)\n', (1805, 1843), False, 'from efl.elementary.box import Box\n'), ((2041, 2077), 'efl.ecore.Timer', 'ecore.Timer', (['(0.02)', 'self.populateFile'], {}), '(0.02, self.popu... |
import ctypes
import numpy
import pygame
import time
from OpenGL.GL import *
from OpenGL.GL.shaders import *
from pygame.locals import *
width = 1024
height = 768
def getFileContents(filename):
return open(filename, 'r').read()
def init():
vertexShader = compileShader(getFileContents("data/shaders/triangl... | [
"pygame.init",
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.display.flip",
"numpy.array",
"ctypes.c_void_p"
] | [((2208, 2247), 'numpy.array', 'numpy.array', (['vertex_list', 'numpy.float32'], {}), '(vertex_list, numpy.float32)\n', (2219, 2247), False, 'import numpy\n'), ((2844, 2865), 'pygame.display.flip', 'pygame.display.flip', ([], {}), '()\n', (2863, 2865), False, 'import pygame\n'), ((2889, 2902), 'pygame.init', 'pygame.in... |
from django.contrib.auth.models import User
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ['pk', 'fullname', 'first_name', 'last_name', 'email']
fullname = serializers.CharField(source='get_full_name')
| [
"rest_framework.serializers.CharField"
] | [((261, 306), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'source': '"""get_full_name"""'}), "(source='get_full_name')\n", (282, 306), False, 'from rest_framework import serializers\n')] |
from django.shortcuts import render,redirect
from django.contrib import messages
from .forms import UserRegestrationForm,UserUpdateForm,ProfileUpdateForm
from django.contrib.auth.decorators import login_required
# from .forms import ReviewForm
from django.contrib.auth.models import User
from .models import Profile
# ... | [
"django.shortcuts.render",
"django.shortcuts.redirect",
"django.contrib.messages.success"
] | [((839, 893), 'django.shortcuts.render', 'render', (['request', '"""users/register.html"""', "{'form': form}"], {}), "(request, 'users/register.html', {'form': form})\n", (845, 893), False, 'from django.shortcuts import render, redirect\n'), ((1586, 1632), 'django.shortcuts.render', 'render', (['request', '"""users/pro... |
import random
import string
from django.shortcuts import render
from zxcvbn import zxcvbn
def home(req):
return render(req, 'index.html') # this return index.html
def password(request):
strengthText = {
0: "The Worst",
1: "Very Bad",
2: "Still Weak",
3: "Good",
4: "... | [
"django.shortcuts.render",
"random.choice",
"zxcvbn.zxcvbn"
] | [((119, 144), 'django.shortcuts.render', 'render', (['req', '"""index.html"""'], {}), "(req, 'index.html')\n", (125, 144), False, 'from django.shortcuts import render\n'), ((1129, 1145), 'zxcvbn.zxcvbn', 'zxcvbn', (['password'], {}), '(password)\n', (1135, 1145), False, 'from zxcvbn import zxcvbn\n'), ((1255, 1378), 'd... |
import astropy.units as u
from astropy.coordinates import Distance
from agnpy.emission_regions import Blob
import matplotlib.pyplot as plt
from agnpy.utils.plot import load_mpl_rc
# matplotlib adjustments
load_mpl_rc()
# set the spectrum normalisation (total energy in electrons in this case)
spectrum_norm = 1e48 * ... | [
"astropy.coordinates.Distance",
"astropy.units.Unit",
"agnpy.emission_regions.Blob",
"agnpy.utils.plot.load_mpl_rc",
"matplotlib.pyplot.show"
] | [((207, 220), 'agnpy.utils.plot.load_mpl_rc', 'load_mpl_rc', ([], {}), '()\n', (218, 220), False, 'from agnpy.utils.plot import load_mpl_rc\n'), ((654, 715), 'agnpy.emission_regions.Blob', 'Blob', (['R_b', 'z', 'delta_D', 'Gamma', 'B', 'spectrum_norm', 'spectrum_dict'], {}), '(R_b, z, delta_D, Gamma, B, spectrum_norm, ... |
#/usr/bin/python
#coding:utf8
import numpy as np
def Cosine(x, y):
return 1.0*np.dot(x, y)/np.sqrt(np.dot(x,x))/np.sqrt(np.dot(y,y))
def Sigmoid(x):
return 1.0 / (1.0 + np.exp(-1.0 * x))
def SigmoidGradient(x):
return Sigmoid(x) * (1 - Sigmoid(x))
#平方误差,2范式的正则化项
def SquareErrorFunction2F(target_matrix_y, output... | [
"numpy.random.random_sample",
"numpy.sqrt",
"numpy.log",
"numpy.diag",
"numpy.exp",
"numpy.sum",
"numpy.dot",
"numpy.linalg.inv",
"numpy.array",
"numpy.linalg.det"
] | [((1051, 1071), 'numpy.linalg.inv', 'np.linalg.inv', (['sigma'], {}), '(sigma)\n', (1064, 1071), True, 'import numpy as np\n'), ((1111, 1132), 'numpy.dot', 'np.dot', (['e', '(x - mu).T'], {}), '(e, (x - mu).T)\n', (1117, 1132), True, 'import numpy as np\n'), ((1085, 1104), 'numpy.dot', 'np.dot', (['(x - mu)', 'inv'], {... |
import ctypes
import time
import os
from rhba_utils import BotUtils, WindowCapture
os.chdir(os.path.dirname(os.path.abspath(__file__)))
# def get_monitor_scaling():
# scaleFactor = ctypes.windll.shcore.GetScaleFactorForDevice(0) / 100
# return float(scaleFactor)
# time.sleep(2)
# print(get_monitor_scaling())... | [
"os.path.abspath",
"rhba_utils.WindowCapture"
] | [((392, 415), 'rhba_utils.WindowCapture', 'WindowCapture', (['gamename'], {}), '(gamename)\n', (405, 415), False, 'from rhba_utils import BotUtils, WindowCapture\n'), ((108, 133), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (123, 133), False, 'import os\n')] |
import matplotlib.pyplot as plt
import numpy
from PIL import Image
import sys
import cv2
import time
from sklearn.cluster import KMeans
from sklearn.mixture import GaussianMixture
import glob
import os
method = 'threshold'
#method = 'threshold_adp'
#method = 'backSub'
#method = 'kmeans'
dataset = 'beach'
save_frame = ... | [
"cv2.createBackgroundSubtractorMOG2",
"numpy.logical_not",
"numpy.array",
"sys.exit",
"matplotlib.pyplot.imshow",
"os.path.exists",
"numpy.mean",
"cv2.threshold",
"cv2.medianBlur",
"glob.glob",
"numpy.argmax",
"numpy.nonzero",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.title",
"time.t... | [((646, 682), 'cv2.createBackgroundSubtractorMOG2', 'cv2.createBackgroundSubtractorMOG2', ([], {}), '()\n', (680, 682), False, 'import cv2\n'), ((749, 777), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 30)'}), '(figsize=(20, 30))\n', (759, 777), True, 'import matplotlib.pyplot as plt\n'), ((1072, 11... |
from unittest.mock import Mock
import dash_bootstrap_components as dbc
from dash import html
from src.dashboard.widgets.stats_card import StatsCardWidget
class TestStatsCard:
# Create a new mock client and data manager
mock_data_manager = Mock()
def test_stats_card_date_range(self):
stats_card_... | [
"src.dashboard.widgets.stats_card.StatsCardWidget",
"unittest.mock.Mock"
] | [((251, 257), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (255, 257), False, 'from unittest.mock import Mock\n'), ((333, 435), 'src.dashboard.widgets.stats_card.StatsCardWidget', 'StatsCardWidget', (['self.mock_data_manager', '"""Steps"""', '"""2022-04-01"""', '"""2022-04-04"""', '"""Test Stats Card"""', '(0)'], {}... |
import logging
import argparse
from pathlib import Path
import dicom2nifti
def main(args):
data_dir = args.data_dir
output_dir = args.output_dir
if output_dir.exists() is False:
output_dir.mkdir(parents=True)
for sub_dir in data_dir.iterdir():
dir_name = sub_dir.name
(output... | [
"logging.basicConfig",
"argparse.ArgumentParser"
] | [((1531, 1629), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Convert the data of VIPCUP from dicom to nifti format."""'}), "(description=\n 'Convert the data of VIPCUP from dicom to nifti format.')\n", (1554, 1629), False, 'import argparse\n'), ((1884, 2008), 'logging.basicConfig', ... |
from rest_framework import status
from rest_framework.response import Response
from rest_framework.decorators import APIView
from apps.tms.models import ActiveUserProfile, PS2TSTransfer, TS2PSTransfer
from apps.tms.serializers import PS2TSTransferSerializer, TS2PSTrnasferSerializer
#without authentication
class PS2T... | [
"apps.tms.models.ActiveUserProfile.objects.get",
"rest_framework.response.Response",
"apps.tms.serializers.PS2TSTransferSerializer",
"apps.tms.serializers.TS2PSTrnasferSerializer"
] | [((527, 582), 'apps.tms.models.ActiveUserProfile.objects.get', 'ActiveUserProfile.objects.get', ([], {'email': 'request.user.email'}), '(email=request.user.email)\n', (556, 582), False, 'from apps.tms.models import ActiveUserProfile, PS2TSTransfer, TS2PSTransfer\n'), ((1075, 1117), 'apps.tms.serializers.PS2TSTransferSe... |
import pandas as pd
import numpy as np
from sklearn.decomposition import PCA
class FairnessPCA:
def __init__(self, fobject, fairness_metrics=['acc', 'tpr', 'ppv', 'fpr', 'stp']):
data = fobject.parity_loss_metric_data[fairness_metrics]
data[data == np.inf] = np.NaN
data = data.dropna(axis... | [
"sklearn.decomposition.PCA",
"pandas.DataFrame"
] | [((339, 358), 'sklearn.decomposition.PCA', 'PCA', ([], {'n_components': '(2)'}), '(n_components=2)\n', (342, 358), False, 'from sklearn.decomposition import PCA\n'), ((674, 705), 'pandas.DataFrame', 'pd.DataFrame', (['pca.components_.T'], {}), '(pca.components_.T)\n', (686, 705), True, 'import pandas as pd\n')] |
import os
import string
import unittest
from common.StrUtils import isEmpty, isAnyEmpty
from vo.LogVO import LogVO
class MyTestCase(unittest.TestCase):
def test_something(self):
# ./deploy-web.sh account 397 dp 10.30.0.48,10.30.0.49 1
n = "dp"
c = "./deploy-web.sh"
p = "version-10... | [
"unittest.main",
"common.StrUtils.isEmpty",
"os.path.abspath",
"vo.LogVO.LogVO"
] | [((1119, 1134), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1132, 1134), False, 'import unittest\n'), ((738, 748), 'common.StrUtils.isEmpty', 'isEmpty', (['s'], {}), '(s)\n', (745, 748), False, 'from common.StrUtils import isEmpty, isAnyEmpty\n'), ((888, 914), 'os.path.abspath', 'os.path.abspath', (['os.curdir... |
import asyncio
from ..openc2.oc2_types import OC2Response, StatusCode
class Transport():
"""Base class for any transports implemented."""
def __init__(self, transport_config):
self.config = transport_config
self.process_config()
def process_config(self):
raise NotImplemen... | [
"asyncio.get_running_loop"
] | [((1275, 1301), 'asyncio.get_running_loop', 'asyncio.get_running_loop', ([], {}), '()\n', (1299, 1301), False, 'import asyncio\n')] |
# Generated by Django 2.2.5 on 2019-09-08 20:16
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('commerce', '0007_auto_20190908_1843'),
]
operations = [
migrations.CreateModel(
name='Comment',... | [
"django.db.models.EmailField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((365, 458), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (381, 458), False, 'from django.db import migrations, models\... |
import numpy as np
from supervised.algorithms.knn import KNeighborsAlgorithm, KNeighborsRegressorAlgorithm
import optuna
from supervised.utils.metric import Metric
from supervised.algorithms.registry import BINARY_CLASSIFICATION
from supervised.algorithms.registry import MULTICLASS_CLASSIFICATION
from supervised.algor... | [
"supervised.utils.metric.Metric.optimize_negative"
] | [((1771, 1818), 'supervised.utils.metric.Metric.optimize_negative', 'Metric.optimize_negative', (['self.eval_metric.name'], {}), '(self.eval_metric.name)\n', (1795, 1818), False, 'from supervised.utils.metric import Metric\n')] |
#!/usr/bin/env pybricks-micropython
from pybricks.hubs import EV3Brick
from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor,
InfraredSensor, UltrasonicSensor, GyroSensor)
from pybricks.parameters import Port, Stop, Direction, Button, Color
from pybricks.tools import wait, St... | [
"pybricks.hubs.EV3Brick"
] | [((604, 614), 'pybricks.hubs.EV3Brick', 'EV3Brick', ([], {}), '()\n', (612, 614), False, 'from pybricks.hubs import EV3Brick\n')] |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | [
"logging.getLogger",
"openstack_dashboard.api.savanna.list_templates",
"django.utils.translation.ugettext_lazy",
"openstack_dashboard.api.savanna.list_clusters",
"django.core.urlresolvers.reverse_lazy"
] | [((1344, 1371), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1361, 1371), False, 'import logging\n'), ((2261, 2305), 'django.core.urlresolvers.reverse_lazy', 'reverse_lazy', (['"""horizon:project:hadoop:index"""'], {}), "('horizon:project:hadoop:index')\n", (2273, 2305), False, 'from d... |
import requests
from . import utils
class Unocoin(object):
"""Main Unocoin Class"""
def __init__(self):
# The following Unocoin client id and secret only have access for prices
self.client_id = "PXOHP8NOXL"
self.client_secret = "<KEY>"
self.URL = "https://www.unocoin.com/trade?... | [
"requests.post"
] | [((2132, 2222), 'requests.post', 'requests.post', (['self.auth_URL'], {'data': 'payload', 'auth': '(self.client_id, self.client_secret)'}), '(self.auth_URL, data=payload, auth=(self.client_id, self.\n client_secret))\n', (2145, 2222), False, 'import requests\n'), ((1055, 1102), 'requests.post', 'requests.post', (['s... |
import zmq
import galah.sheep.utility.universal as universal
import galah.sheep.utility.exithelpers as exithelpers
from galah.sheep.utility.suitehelpers import get_virtual_suite
from galah.base.flockmail import FlockMessage
import time
import threading
import logging
import random
import datetime
# Load Galah's config... | [
"threading.currentThread",
"galah.sheep.utility.universal.ShepherdLost",
"galah.sheep.utility.suitehelpers.get_virtual_suite",
"galah.sheep.utility.universal.orphaned_results.put",
"datetime.datetime.now",
"galah.base.config.load_config",
"galah.base.flockmail.FlockMessage",
"galah.sheep.utility.unive... | [((380, 400), 'galah.base.config.load_config', 'load_config', (['"""sheep"""'], {}), "('sheep')\n", (391, 400), False, 'from galah.base.config import load_config\n'), ((790, 832), 'galah.sheep.utility.suitehelpers.get_virtual_suite', 'get_virtual_suite', (["config['VIRTUAL_SUITE']"], {}), "(config['VIRTUAL_SUITE'])\n",... |
from gtts import gTTS
def speak(text): #https://pypi.org/project/gtts/
tts = gTTS(text=text, lang='en')
tts.save("speech.mp3")
import os
import playsound
playsound.playsound("speech.mp3", True)
os.remove("speech.mp3")
'''
import pyttsx3 #https://pypi.... | [
"playsound.playsound",
"gtts.gTTS",
"os.remove"
] | [((98, 124), 'gtts.gTTS', 'gTTS', ([], {'text': 'text', 'lang': '"""en"""'}), "(text=text, lang='en')\n", (102, 124), False, 'from gtts import gTTS\n'), ((195, 234), 'playsound.playsound', 'playsound.playsound', (['"""speech.mp3"""', '(True)'], {}), "('speech.mp3', True)\n", (214, 234), False, 'import playsound\n'), ((... |
"""Tests for the Sonos number platform."""
from unittest.mock import patch
from homeassistant.components.number import DOMAIN as NUMBER_DOMAIN, SERVICE_SET_VALUE
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.helpers import entity_registry as ent_reg
async def test_number_entities(hass, async_auto... | [
"unittest.mock.patch",
"homeassistant.helpers.entity_registry.async_get"
] | [((394, 417), 'homeassistant.helpers.entity_registry.async_get', 'ent_reg.async_get', (['hass'], {}), '(hass)\n', (411, 417), True, 'from homeassistant.helpers import entity_registry as ent_reg\n'), ((1403, 1433), 'unittest.mock.patch', 'patch', (['"""soco.SoCo.audio_delay"""'], {}), "('soco.SoCo.audio_delay')\n", (140... |
from __future__ import absolute_import, print_function
import os.path
from uuid import uuid4
from functools import wraps
import warnings
import logging
logger = logging.getLogger(__file__)
from six import add_metaclass, iteritems
from six.moves.urllib.parse import urlsplit
from .embed import autoload_static, autolo... | [
"logging.getLogger",
"six.moves.urllib.parse.urlsplit",
"six.add_metaclass",
"functools.wraps",
"uuid.uuid4",
"warnings.warn",
"six.iteritems",
"logging.error"
] | [((163, 190), 'logging.getLogger', 'logging.getLogger', (['__file__'], {}), '(__file__)\n', (180, 190), False, 'import logging\n'), ((4353, 4376), 'six.add_metaclass', 'add_metaclass', (['Viewable'], {}), '(Viewable)\n', (4366, 4376), False, 'from six import add_metaclass, iteritems\n'), ((2939, 2950), 'functools.wraps... |
"""Turnt is a simple expect-style testing tool for command-line
programs.
"""
import click
import tomlkit
import os
import shlex
import subprocess
import tempfile
import shutil
import sys
import re
import contextlib
from concurrent import futures
__version__ = '1.6.0'
DIFF_DEFAULT = 'diff --new-file --unified'
STDOUT... | [
"sys.exit",
"click.option",
"subprocess.run",
"os.path.isdir",
"sys.stderr.buffer.flush",
"contextlib.ExitStack",
"tempfile.NamedTemporaryFile",
"shlex.quote",
"os.unlink",
"click.command",
"os.path.splitext",
"os.path.isfile",
"os.path.dirname",
"sys.stderr.buffer.write",
"shutil.copy",... | [((9753, 9768), 'click.command', 'click.command', ([], {}), '()\n', (9766, 9768), False, 'import click\n'), ((9770, 9870), 'click.option', 'click.option', (['"""--save"""'], {'is_flag': '(True)', 'default': '(False)', 'help': '"""Save new outputs (overwriting old)."""'}), "('--save', is_flag=True, default=False, help=\... |
from __future__ import annotations
import pytest
from testing.runner import and_exit
@pytest.mark.parametrize('key', ('^C', 'Enter'))
def test_replace_cancel(run, key):
with run() as h, and_exit(h):
h.press('^\\')
h.await_text('search (to replace):')
h.press(key)
h.await_text('ca... | [
"testing.runner.and_exit",
"pytest.mark.parametrize"
] | [((90, 137), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""key"""', "('^C', 'Enter')"], {}), "('key', ('^C', 'Enter'))\n", (113, 137), False, 'import pytest\n'), ((1158, 1200), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""key"""', "('y', 'Y')"], {}), "('key', ('y', 'Y'))\n", (1181, 1200), F... |
# from main import *
import main
import re
import random
# output_english = open("output_english.txt","w")
# file_e = open("input_english.txt","rt")
# input_english = file_e.read()
# input_english = input_english.lower()
# input_english = re.sub(' +', ' ', input_english)
# input_english = re.sub('[^a-zA-Z \n]+', '', ... | [
"main.get_dependencies",
"main.get_pos_tags",
"main.nlp_hi"
] | [((974, 1006), 'main.nlp_hi', 'main.nlp_hi', (['input_hindi_list[i]'], {}), '(input_hindi_list[i])\n', (985, 1006), False, 'import main\n'), ((1042, 1074), 'main.get_dependencies', 'main.get_dependencies', (['doc_hi', '(1)'], {}), '(doc_hi, 1)\n', (1063, 1074), False, 'import main\n'), ((1107, 1135), 'main.get_pos_tags... |
# Copyright (C) 2022 by <EMAIL>, < 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/pharmaService/blob/master/LICENCE >
#
# All rights reserv... | [
"rest_framework.test.APIRequestFactory",
"django.contrib.auth.models.User.objects.create_user",
"rest_framework.test.APIClient"
] | [((500, 519), 'rest_framework.test.APIRequestFactory', 'APIRequestFactory', ([], {}), '()\n', (517, 519), False, 'from rest_framework.test import APIClient, APIRequestFactory\n'), ((537, 548), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (546, 548), False, 'from rest_framework.test import APIClient, ... |
#!/bin/env python3
#-------------------------------------------------------------------------
# run_standard_drc.py --- A script to run magic in batch mode and apply
# full DRC checks on a layout. This inclues full DRC but excludes
# antenna and density checks, for which there are separate scripts.
#
# Usage:
#
# r... | [
"subprocess.run",
"os.path.splitext",
"os.environ.copy",
"os.getcwd",
"os.path.isfile",
"os.path.split",
"os.path.isdir",
"os.path.abspath",
"glob.glob"
] | [((988, 1021), 'os.path.abspath', 'os.path.abspath', (['sch_netlist_file'], {}), '(sch_netlist_file)\n', (1003, 1021), False, 'import os\n'), ((2835, 2852), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (2850, 2852), False, 'import os\n'), ((2890, 2927), 'os.path.isfile', 'os.path.isfile', (["(magpath + '/.ma... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-02 10:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('restaurant', '0001_initial'),
]
operations = [
migrations.AddField(
... | [
"django.db.models.ImageField"
] | [((405, 510), 'django.db.models.ImageField', 'models.ImageField', ([], {'default': '"""collections_pic/images/no-name.jpg"""', 'upload_to': '"""images/collections_pic/"""'}), "(default='collections_pic/images/no-name.jpg', upload_to=\n 'images/collections_pic/')\n", (422, 510), False, 'from django.db import migratio... |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
# @author Darrell
import os
import re
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
from PIL import ImageColor
_visualizeMargins = False
# -----------------------------------------------------------------------------
class FontData:
de... | [
"re.compile",
"PIL.Image.new",
"os.path.join",
"PIL.ImageFont.truetype",
"os.path.dirname",
"PIL.ImageDraw.Draw"
] | [((411, 436), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (426, 436), False, 'import os\n'), ((454, 481), 'os.path.join', 'os.path.join', (['dir', '"""static"""'], {}), "(dir, 'static')\n", (466, 481), False, 'import os\n'), ((497, 527), 'os.path.join', 'os.path.join', (['static', 'fontNam... |
#!/usr/bin/env python3
import sys
import array
from gi.repository import HarfBuzz as hb
from gi.repository import GLib
fontdata = open(sys.argv[1], 'rb').read()
text = sys.argv[2]
# Need to create GLib.Bytes explicitly until this bug is fixed:
# https://bugzilla.gnome.org/show_bug.cgi?id=729541
blob = hb.glib_blob_cr... | [
"gi.repository.HarfBuzz.buffer_guess_segment_properties",
"gi.repository.HarfBuzz.font_create",
"gi.repository.HarfBuzz.face_create",
"gi.repository.HarfBuzz.font_set_scale",
"gi.repository.HarfBuzz.ot_font_set_funcs",
"gi.repository.HarfBuzz.buffer_set_message_func",
"gi.repository.HarfBuzz.buffer_get_... | [((358, 381), 'gi.repository.HarfBuzz.face_create', 'hb.face_create', (['blob', '(0)'], {}), '(blob, 0)\n', (372, 381), True, 'from gi.repository import HarfBuzz as hb\n'), ((398, 418), 'gi.repository.HarfBuzz.font_create', 'hb.font_create', (['face'], {}), '(face)\n', (412, 418), True, 'from gi.repository import HarfB... |
# -*- coding: utf-8 -*-
"""
@date: 2020/4/16 下午1:10
@file: basic_conv2d.py
@author: zj
@description:
"""
import torch.nn as nn
class BasicConv2d(nn.Module):
"""
结合BN的卷积操作
"""
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=0,
norm_layer=None, relu_la... | [
"torch.nn.Conv2d"
] | [((532, 618), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_channels', 'out_channels', 'kernel_size'], {'stride': 'stride', 'padding': 'padding'}), '(in_channels, out_channels, kernel_size, stride=stride, padding=\n padding)\n', (541, 618), True, 'import torch.nn as nn\n')] |
import sys
import typer
from ..transform import transform
from typer import Argument as Arg
from .main import program
from .. import helpers
@program.command(name="transform")
def program_transform(
source: str = Arg(None, help="Path to a transform pipeline [default: stdin]"),
):
"""Transform data source usin... | [
"typer.Exit",
"typer.secho",
"sys.stdin.buffer.read",
"typer.Argument"
] | [((219, 282), 'typer.Argument', 'Arg', (['None'], {'help': '"""Path to a transform pipeline [default: stdin]"""'}), "(None, help='Path to a transform pipeline [default: stdin]')\n", (222, 282), True, 'from typer import Argument as Arg\n'), ((770, 788), 'typer.secho', 'typer.secho', (['"""---"""'], {}), "('---')\n", (78... |
# MIT License
#
# Copyright (C) 2021. Huawei Technologies Co., Ltd. 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"), to deal
# in the Software without restriction, including without limitation th... | [
"copy.copy"
] | [((1899, 1913), 'copy.copy', 'copy.copy', (['obs'], {}), '(obs)\n', (1908, 1913), False, 'import copy\n')] |
from django.contrib import admin
from .models import Following, Post, User
# Register your models here.
admin.site.register(Following)
admin.site.register(Post)
admin.site.register(User)
| [
"django.contrib.admin.site.register"
] | [((106, 136), 'django.contrib.admin.site.register', 'admin.site.register', (['Following'], {}), '(Following)\n', (125, 136), False, 'from django.contrib import admin\n'), ((137, 162), 'django.contrib.admin.site.register', 'admin.site.register', (['Post'], {}), '(Post)\n', (156, 162), False, 'from django.contrib import ... |
import csv
import os
import random
import numpy as np
import sys
from sklearn import svm
from keras.models import Sequential, model_from_yaml
from keras.layers import Dropout, Dense
from keras.callbacks import EarlyStopping
def open_csv(file_path):
# Input read as f_wh, f_wmt, f_posh, f_posmt, f_len, y
asser... | [
"sklearn.externals.joblib.load",
"numpy.subtract",
"os.path.isfile",
"numpy.array",
"csv.reader",
"numpy.divide"
] | [((322, 347), 'os.path.isfile', 'os.path.isfile', (['file_path'], {}), '(file_path)\n', (336, 347), False, 'import os\n'), ((818, 838), 'numpy.subtract', 'np.subtract', (['a', 'mean'], {}), '(a, mean)\n', (829, 838), True, 'import numpy as np\n'), ((847, 864), 'numpy.divide', 'np.divide', (['b', 'std'], {}), '(b, std)\... |
# coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... | [
"talon_one.configuration.Configuration",
"six.iteritems"
] | [((16580, 16613), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (16593, 16613), False, 'import six\n'), ((2699, 2714), 'talon_one.configuration.Configuration', 'Configuration', ([], {}), '()\n', (2712, 2714), False, 'from talon_one.configuration import Configuration\n')] |
"""
Function to convert MAC address onti EUI style format.
Creds to https://stackoverflow.com/a/29446103 unswers on stackoeverflow
and NAPALM base helpers module
"""
from re import sub
def mac_eui(data):
mac = str(data)
# remove delimiters and convert to lower case
mac = sub("[.:-]", "", mac).lower()
... | [
"re.sub"
] | [((289, 310), 're.sub', 'sub', (['"""[.:-]"""', '""""""', 'mac'], {}), "('[.:-]', '', mac)\n", (292, 310), False, 'from re import sub\n')] |
#!/usr/bin/env python3
import os
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py
from setuptools.command.sdist import sdist
from setuptools.command.develop import develop
import versioneer
PACKAGE_NAME = 'opsdroid'
HERE = os.path.abspath(os.path.dirname(__file__))
README = ... | [
"setuptools.find_packages",
"os.path.join",
"setuptools.command.sdist.sdist.run",
"versioneer.get_version",
"os.path.dirname",
"versioneer.get_cmdclass",
"setuptools.command.build_py.build_py.run",
"setuptools.command.develop.develop.run"
] | [((394, 483), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests', 'tests.*', 'modules', 'modules.*', 'docs', 'docs.*']"}), "(exclude=['tests', 'tests.*', 'modules', 'modules.*', 'docs',\n 'docs.*'])\n", (407, 483), False, 'from setuptools import setup, find_packages\n'), ((284, 309), 'os.path.di... |