code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from torch.autograd import Variable
from tqdm import tqdm
from torchvision import datasets, models, transforms
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
import numpy as np
import time
import os
import argparse
import torchvision
import copy
import sys
sys.path.a... | [
"modules.model_config.model_take_lower_layers",
"argparse.ArgumentParser",
"torch.load",
"utils.data_processing.feature_eval_prep",
"torch.nn.DataParallel",
"utils.data_processing.get_data_transforms",
"os.path.isdir",
"torchvision.models.inception_v3",
"sys.path.append",
"utils.data_processing.lo... | [((310, 334), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (325, 334), False, 'import sys\n'), ((873, 938), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch inception Training"""'}), "(description='PyTorch inception Training')\n", (896, 938), False, '... |
from zipfile import ZipFile
import numpy as np
def generate_report(task_a, task_b, task_c, save=True, zipname="res.zip"):
report = ""
task_a = task_a - 1
for i in range(task_a.shape[0]):
task_b_str = np.array2string(task_b[i], separator="")[1:-1]
task_c_str = np.array2string(task_c[i], sep... | [
"numpy.array2string",
"zipfile.ZipFile"
] | [((222, 262), 'numpy.array2string', 'np.array2string', (['task_b[i]'], {'separator': '""""""'}), "(task_b[i], separator='')\n", (237, 262), True, 'import numpy as np\n'), ((290, 330), 'numpy.array2string', 'np.array2string', (['task_c[i]'], {'separator': '""""""'}), "(task_c[i], separator='')\n", (305, 330), True, 'imp... |
from __future__ import unicode_literals
import os
import sys
import datetime
from datetime import timedelta
import logging
import ee
import eeUtil
import time
import requests
import rasterio
import boto3
from botocore.exceptions import NoCredentialsError
from netCDF4 import Dataset
import numpy as np
import copy
import... | [
"requests.patch",
"rasterio.transform.from_bounds",
"ee.ImageCollection",
"time.sleep",
"copy.copy",
"datetime.timedelta",
"logging.info",
"logging.error",
"eeUtil.uploadAssets",
"os.remove",
"os.listdir",
"eeUtil.exists",
"netCDF4.Dataset",
"json.dumps",
"eeUtil.removeAsset",
"eeUtil.... | [((4972, 4992), 'requests.get', 'requests.get', (['apiUrl'], {}), '(apiUrl)\n', (4984, 4992), False, 'import requests\n'), ((5394, 5449), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['nofrag', '"""%Y-%m-%dT%H:%M:%S"""'], {}), "(nofrag, '%Y-%m-%dT%H:%M:%S')\n", (5420, 5449), False, 'import datetime\n'),... |
#!/pxrpythonsubst
#
# Copyright 2017 Pixar
#
... | [
"pxr.Usd.Stage.CreateNew",
"pxr.UsdShade.Utils.GetConnectedSourcePath",
"pxr.Sdf.Path",
"pxr.UsdShade.Material.CreateMasterMaterialVariant",
"pxr.UsdGeom.SetStageUpAxis",
"pxr.UsdGeom.SetStageMetersPerUnit",
"unittest.main",
"pxr.UsdGeom.Scope.Define",
"pxr.UsdShade.Material"
] | [((12682, 12697), 'unittest.main', 'unittest.main', ([], {}), '()\n', (12695, 12697), False, 'import unittest\n'), ((2003, 2027), 'pxr.Sdf.Path', 'Sdf.Path', (['"""/ShadingDefs"""'], {}), "('/ShadingDefs')\n", (2011, 2027), False, 'from pxr import Sdf, Usd, UsdGeom, UsdShade\n'), ((9969, 10009), 'pxr.Usd.Stage.CreateNe... |
from amaranth.vendor.lattice_ice40 import *
from amaranth.vendor.lattice_ice40 import __all__
import warnings
warnings.warn("instead of nmigen.vendor.lattice_ice40, use amaranth.vendor.lattice_ice40",
DeprecationWarning, stacklevel=2)
| [
"warnings.warn"
] | [((112, 246), 'warnings.warn', 'warnings.warn', (['"""instead of nmigen.vendor.lattice_ice40, use amaranth.vendor.lattice_ice40"""', 'DeprecationWarning'], {'stacklevel': '(2)'}), "(\n 'instead of nmigen.vendor.lattice_ice40, use amaranth.vendor.lattice_ice40'\n , DeprecationWarning, stacklevel=2)\n", (125, 246),... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: proto/ndarray.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.p... | [
"google.protobuf.reflection.GeneratedProtocolMessageType",
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.descriptor.FileDescriptor"
] | [((419, 445), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (443, 445), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((521, 998), 'google.protobuf.descriptor.FileDescriptor', '_descriptor.FileDescriptor', ([], {'name': '"""proto/ndarray.proto"""'... |
from check_defn import *
import numpy as np
import random
def train(word_list, query_list, ensemble, iterations,l_rate,matrix,lamb):
#counter is used to go to next ensemble
counter = 0
total_data = len(word_list)
for iteration in range(iterations):
#To keep the cost
cost = 0
... | [
"numpy.savetxt",
"random.randint",
"numpy.save"
] | [((2275, 2304), 'numpy.save', 'np.save', (['"""matrix.npy"""', 'matrix'], {}), "('matrix.npy', matrix)\n", (2282, 2304), True, 'import numpy as np\n'), ((2306, 2338), 'numpy.savetxt', 'np.savetxt', (['"""matrix.txt"""', 'matrix'], {}), "('matrix.txt', matrix)\n", (2316, 2338), True, 'import numpy as np\n'), ((603, 625)... |
#!/usr/bin/env python3
from pathlib import Path
data = Path("input.txt").read_text().splitlines()
polymer = data[0]
transforms = {}
for line in data[2:]:
transforms[line[0:2]] = line[-1]
for _ in range(10):
new = ""
for i in range(len(polymer) - 1):
pair = polymer[i : i + 2]
new += pa... | [
"pathlib.Path"
] | [((57, 74), 'pathlib.Path', 'Path', (['"""input.txt"""'], {}), "('input.txt')\n", (61, 74), False, 'from pathlib import Path\n')] |
import argparse
import renderer
from cmath import * # has to be loaded this way for user input parsing
def main():
""" Main loop, acts as a command-line wrapper for the renderer. """
parser = argparse.ArgumentParser(description="Generates a Julia set for the given equation.")
parser.add_argument("equatio... | [
"renderer.rendertoimage",
"argparse.ArgumentParser"
] | [((203, 292), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generates a Julia set for the given equation."""'}), "(description=\n 'Generates a Julia set for the given equation.')\n", (226, 292), False, 'import argparse\n'), ((2406, 2496), 'renderer.rendertoimage', 'renderer.rendertoi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
import subprocess
import fhqtest
import signal
import time
import traceback
import libtestfhq
import libtestwebserver
import libtestusers
import libtestscoreboard
import libtestpublicevents
import libteststats
import libtestquests
import libtestleaks
... | [
"fhqtest.deinit_enviroment",
"fhqtest.log_err",
"fhqtest.print_success",
"libtestfhq.stop_server",
"libtestfhq.start_server",
"fhqtest.init_enviroment",
"fhqtest.throw_err",
"fhqtest.print_header"
] | [((654, 698), 'fhqtest.print_header', 'fhqtest.print_header', (['""" > > > TESTS: begin """'], {}), "(' > > > TESTS: begin ')\n", (674, 698), False, 'import fhqtest\n'), ((703, 728), 'libtestfhq.start_server', 'libtestfhq.start_server', ([], {}), '()\n', (726, 728), False, 'import libtestfhq\n'), ((733, 758), 'fhqtest.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Python toolkit for manipulating Indonesian Tagged Corpus
Latest version can be found at https://github.com/neocl/itctk
References:
Python documentation:
https://docs.python.org/
argparse module:
https://docs.python.org/3/howto/argparse.html
... | [
"os.path.isfile",
"barasa.barasa.gen_barasa",
"barasa.barasa.read_barasa",
"re.compile"
] | [((2514, 2538), 're.compile', 're.compile', (['pattern_text'], {}), '(pattern_text)\n', (2524, 2538), False, 'import re\n'), ((2837, 2861), 're.compile', 're.compile', (['pattern_text'], {}), '(pattern_text)\n', (2847, 2861), False, 'import re\n'), ((4761, 4788), 'os.path.isfile', 'os.path.isfile', (['BARASA_FILE'], {}... |
from flask import (
Blueprint, flash, g, redirect, render_template, request, url_for
)
from werkzeug.exceptions import abort
from .auth import login_required
from flaskr import models
from flaskr.models import db
bp = Blueprint('blog', __name__)
@bp.route('/')
def index():
posts = models.Post.query.order_by... | [
"flask.render_template",
"flaskr.models.db.session.commit",
"flask.flash",
"flaskr.models.Post.query.get",
"flaskr.models.Post",
"flaskr.models.Post.query.order_by",
"flaskr.models.db.session.delete",
"flask.url_for",
"flaskr.models.db.session.add",
"werkzeug.exceptions.abort",
"flask.Blueprint"... | [((225, 252), 'flask.Blueprint', 'Blueprint', (['"""blog"""', '__name__'], {}), "('blog', __name__)\n", (234, 252), False, 'from flask import Blueprint, flash, g, redirect, render_template, request, url_for\n'), ((294, 331), 'flaskr.models.Post.query.order_by', 'models.Post.query.order_by', (['"""created"""'], {}), "('... |
# -*- coding: utf-8 -*-
"""
DTQPy_M
Create sequences for Mayer terms
Contributor: <NAME> (AthulKrishnaSundarrajan on Github)
Primary Contributor: <NAME> (danielrherber on Github)
"""
# import inbuilt libraries
import numpy as np
from numpy.matlib import repmat
# import DTQPy specific functions
from dtqpy.src.utilitie... | [
"numpy.append",
"numpy.array",
"dtqpy.src.DTQPy_getQPIndex.DTQPy_getQPIndex"
] | [((600, 612), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (608, 612), True, 'import numpy as np\n'), ((621, 633), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (629, 633), True, 'import numpy as np\n'), ((642, 654), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (650, 654), True, 'import numpy as np\n')... |
import pygame
from general_functions import *
from random import shuffle
from SplendorClasses import *
class Game:
gemColors = ["black", "red", "green", "blue", "white", "gold"]
def create_table_from_file(self, filename):
decks = {}
with open(filename, ('r')) as f:
line = f.readli... | [
"random.shuffle"
] | [((1352, 1370), 'random.shuffle', 'shuffle', (['decks[ID]'], {}), '(decks[ID])\n', (1359, 1370), False, 'from random import shuffle\n')] |
import random
print('--------------------------')
print('----------GUESS THAT PRIMER GAME')
print('--------------------------')
goal = random.choice('ACGT')
goal += random.choice('ACGT')
goal += random.choice('ACGT')
goal += random.choice('ACGT')
goal += random.choice('ACGT')
print(goal)
guess = 'NNNN'
name = inp... | [
"random.choice"
] | [((139, 160), 'random.choice', 'random.choice', (['"""ACGT"""'], {}), "('ACGT')\n", (152, 160), False, 'import random\n'), ((169, 190), 'random.choice', 'random.choice', (['"""ACGT"""'], {}), "('ACGT')\n", (182, 190), False, 'import random\n'), ((199, 220), 'random.choice', 'random.choice', (['"""ACGT"""'], {}), "('ACG... |
import numpy as np
import pandas as pd
import datetime as dt
import matplotlib.pyplot as plt
import os
import math
#import utm
import shapefile as shp
import seaborn as sns
from collections import OrderedDict
import geopandas as gpd
from geopy.distance import distance
import argparse
# PRIMARY DATA SOURCE
# https:/... | [
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"numpy.array",
"pandas.to_datetime",
"numpy.mean",
"os.listdir",
"datetime.time",
"geopandas.read_file",
"argparse.ArgumentParser",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.style.use",
"datetime.date.fromordinal",... | [((1744, 1801), 'pandas.concat', 'pd.concat', (['df_list'], {'axis': '(0)', 'ignore_index': '(True)', 'sort': '(False)'}), '(df_list, axis=0, ignore_index=True, sort=False)\n', (1753, 1801), True, 'import pandas as pd\n'), ((7590, 7632), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'fields', 'data': 'records'})... |
#!/usr/bin/python3
from subprocess import STDOUT, call, TimeoutExpired
from time import sleep
runs = [ ('games120.col',7),
('miles250.col',5),
('miles500.col',5),
('miles750.col',5),
('miles1000.col',5),
('miles1500.col',3),
('le450_5b.col',18),
(... | [
"time.sleep"
] | [((1165, 1184), 'time.sleep', 'sleep', (['wait_seconds'], {}), '(wait_seconds)\n', (1170, 1184), False, 'from time import sleep\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-15 03:16
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('sh_app', '0003_suggestion_is_achieved'),
]
operations = [
migrations.RenameField(
... | [
"django.db.migrations.RenameField"
] | [((294, 393), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""suggestion"""', 'old_name': '"""is_achieved"""', 'new_name': '"""is_archived"""'}), "(model_name='suggestion', old_name='is_achieved',\n new_name='is_archived')\n", (316, 393), False, 'from django.db import migrations... |
# -*- coding: utf-8 -*-
"""
Test relex snowball
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import sys
import logging
import os
import unittest
from chemdataextractor.relex import Snowball, Chemica... | [
"logging.basicConfig",
"logging.getLogger",
"chemdataextractor.parse.elements.Any",
"chemdataextractor.relex.ChemicalRelationship",
"chemdataextractor.parse.elements.I",
"unittest.main",
"chemdataextractor.parse.elements.Optional",
"chemdataextractor.model.StringType",
"chemdataextractor.parse.eleme... | [((731, 771), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (750, 771), False, 'import logging\n'), ((778, 805), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (795, 805), False, 'import logging\n'), ((1797, 1896), 'chemdataextr... |
# Copyright (c) 2019. Sophos Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | [
"django.urls.path"
] | [((669, 731), 'django.urls.path', 'path', (['"""sample/"""', 'localintel.views.shalookup'], {'name': '"""sha_lookup"""'}), "('sample/', localintel.views.shalookup, name='sha_lookup')\n", (673, 731), False, 'from django.urls import path\n'), ((737, 809), 'django.urls.path', 'path', (['"""sample/<str:sha>/"""', 'localint... |
# coding=utf8
import unittest
from half_json.core import JSONFixer
class TestOtherCase(unittest.TestCase):
def test_patch_left_object(self):
line = '}'
ok, newline, _ = JSONFixer().fix(line)
self.assertTrue(ok)
self.assertEqual('{}', newline)
def test_patch_left_array(self)... | [
"half_json.core.JSONFixer"
] | [((194, 205), 'half_json.core.JSONFixer', 'JSONFixer', ([], {}), '()\n', (203, 205), False, 'from half_json.core import JSONFixer\n'), ((366, 377), 'half_json.core.JSONFixer', 'JSONFixer', ([], {}), '()\n', (375, 377), False, 'from half_json.core import JSONFixer\n'), ((540, 551), 'half_json.core.JSONFixer', 'JSONFixer... |
from boa_test.tests.boa_test import BoaFixtureTest
from boa.compiler import Compiler
from neo.Core.TX.Transaction import Transaction
from neo.Prompt.Commands.BuildNRun import TestBuild
class TestContract(BoaFixtureTest):
def test_Account(self):
output = Compiler.instance().load('%s/boa_test/example/bloc... | [
"boa.compiler.Compiler.instance"
] | [((270, 289), 'boa.compiler.Compiler.instance', 'Compiler.instance', ([], {}), '()\n', (287, 289), False, 'from boa.compiler import Compiler\n')] |
# Copyright 2017 Intel Corporation
#
# 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 wri... | [
"logging.getLogger",
"rbac_addressing.addresser.address_is",
"logging.StreamHandler",
"rbac_transaction_creation.role_transaction_creation.reject_add_role_tasks",
"sawtooth_cli.rest_client.RestClient",
"rbac_transaction_creation.task_transaction_creation.propose_remove_task_owners",
"rbac_transaction_cr... | [((1437, 1464), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1454, 1464), False, 'import logging\n'), ((1626, 1650), 'rbac_transaction_creation.common.Key', 'Key', (['BATCHER_PRIVATE_KEY'], {}), '(BATCHER_PRIVATE_KEY)\n', (1629, 1650), False, 'from rbac_transaction_creation.common impo... |
import os
import sys
TESTING = 'test' in sys.argv[:2]
DAPHNE_SERVER = 'daphne' in sys.argv
from .base import * # noqa
from .lego import * # noqa
from .rest_framework import * # noqa
from .search import * # noqa
from .logging import * # noqa
if TESTING:
from .test import * # noqa
else:
if os.environ.ge... | [
"os.environ.get"
] | [((307, 335), 'os.environ.get', 'os.environ.get', (['"""ENV_CONFIG"""'], {}), "('ENV_CONFIG')\n", (321, 335), False, 'import os\n')] |
'''
Missense variant miner:
find missense variants in ExAC, score them using PROVEAN, MutPred and dbNSFP
return csv file.
'''
from __future__ import print_function
import os
import pandas as pd
import csv
import zipfile
VCF_HEADER = ['CHROM', 'POS', 'ID', 'REF', 'ALT', 'QUAL', 'FILTER', 'INFO']
# Sets protein ID... | [
"csv.writer",
"zipfile.ZipFile",
"pandas.read_csv"
] | [((2206, 2261), 'zipfile.ZipFile', 'zipfile.ZipFile', (['"""/work/in/dbnsfp/dbNSFPv3.2a.zip"""', '"""r"""'], {}), "('/work/in/dbnsfp/dbNSFPv3.2a.zip', 'r')\n", (2221, 2261), False, 'import zipfile\n'), ((2503, 2521), 'csv.writer', 'csv.writer', (['csvout'], {}), '(csvout)\n', (2513, 2521), False, 'import csv\n'), ((401... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import unittest
import mock
from six.moves.urllib.parse import parse_qs
from laterpay import utils
from laterpay.compat import stringify
class UtilsTest(unittest.TestCase):
def test_signed_query_correct_signature(self):
pa... | [
"six.moves.urllib.parse.parse_qs",
"mock.patch",
"laterpay.utils.signed_query",
"laterpay.compat.stringify",
"laterpay.utils.signed_url"
] | [((1081, 1104), 'mock.patch', 'mock.patch', (['"""time.time"""'], {}), "('time.time')\n", (1091, 1104), False, 'import mock\n'), ((1491, 1514), 'mock.patch', 'mock.patch', (['"""time.time"""'], {}), "('time.time')\n", (1501, 1514), False, 'import mock\n'), ((535, 574), 'laterpay.utils.signed_query', 'utils.signed_query... |
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2020 FABRIC Testbed
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to ... | [
"fabric_cf.actor.core.common.constants.Constants.NOT_SPECIFIED_PREFIX.format",
"fabric_cf.actor.core.proxies.local.local_proxy.LocalProxy.LocalProxyRequestState"
] | [((2233, 2268), 'fabric_cf.actor.core.proxies.local.local_proxy.LocalProxy.LocalProxyRequestState', 'LocalProxy.LocalProxyRequestState', ([], {}), '()\n', (2266, 2268), False, 'from fabric_cf.actor.core.proxies.local.local_proxy import LocalProxy\n'), ((3718, 3771), 'fabric_cf.actor.core.common.constants.Constants.NOT_... |
#!/usr/bin/python3
"""
sys.argv[1] - input database file
sys.argv[2] - output mat file
Composed by <NAME> @THU_IVG
Last revision: <NAME> @THU_IVG @Oct 3rd, 2019 CST
"""
import json
import scipy.io as sio
import numpy as np
import itertools
import sys
db_f = sys.argv[1]
with open(db_f) as f:
database = json.l... | [
"numpy.copy",
"scipy.io.savemat",
"numpy.logical_not",
"numpy.sum",
"numpy.zeros",
"json.load"
] | [((563, 583), 'numpy.zeros', 'np.zeros', (['(nb_step,)'], {}), '((nb_step,))\n', (571, 583), True, 'import numpy as np\n'), ((600, 628), 'numpy.zeros', 'np.zeros', (['(nb_step, nb_step)'], {}), '((nb_step, nb_step))\n', (608, 628), True, 'import numpy as np\n'), ((1009, 1038), 'numpy.sum', 'np.sum', (['frequency_mat'],... |
import datetime
import json
import math
import numbers
import os
import pickle
import random
import re
import statistics
from collections.abc import MutableMapping
from datetime import datetime, timedelta
from resource import RUSAGE_SELF
from resource import getrusage as resource_usage
from time import time as timestam... | [
"pandas.read_pickle",
"os.makedirs",
"flask.Flask",
"resource.getrusage",
"json.dumps",
"pickle.load",
"os.chdir",
"pandas.DataFrame",
"time.time"
] | [((626, 641), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (631, 641), False, 'from flask import Flask, jsonify, request\n'), ((1028, 1050), 'os.chdir', 'os.chdir', (['app.ROOT_DIR'], {}), '(app.ROOT_DIR)\n', (1036, 1050), False, 'import os\n'), ((1193, 1257), 'pandas.read_pickle', 'pd.read_pickle', (["(... |
from attrdict import AttrDict
from util import grid
from util.grid import INTERSECTION_SIZE
# traffic lights
STEPS_PER_EPISODE = 200
SECONDS_PER_UPDATE = 2.7
STEP_LENGTH = 60 # in seconds
RED_DURATIONS = [0, 20, 40, 60] # table of all possible red durations (see: README)
# cars' movement
MAX_SPEED = 5 # in cells ... | [
"util.grid.make_line",
"util.grid.make_grid"
] | [((708, 763), 'util.grid.make_line', 'grid.make_line', (['(4)', '(False)', '(3)'], {'segment_len': 'SEGMENT_LENGTH'}), '(4, False, 3, segment_len=SEGMENT_LENGTH)\n', (722, 763), False, 'from util import grid\n'), ((781, 832), 'util.grid.make_grid', 'grid.make_grid', (['(4)', '(2)', '(4)'], {'segment_len': 'SEGMENT_LENG... |
from filogram import file_service
def test_correct_files_grouping_by_category(create_unique_file):
files = []
for category in ["books", "audio", "texts", "audio"]:
file = create_unique_file(category=category)
files.append(file)
(book_file, audio_file, text_file, another_audio_file) = file... | [
"filogram.file_service.group_files_by_category",
"filogram.file_service.save_file",
"filogram.file_service.get_owned_files"
] | [((385, 428), 'filogram.file_service.group_files_by_category', 'file_service.group_files_by_category', (['files'], {}), '(files)\n', (421, 428), False, 'from filogram import file_service\n'), ((1664, 1709), 'filogram.file_service.get_owned_files', 'file_service.get_owned_files', (['default_user.id'], {}), '(default_use... |
# coding=utf-8
# Copyright 2018 The TensorFlow 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 requ... | [
"densenet.logger.LogSessionRunHook",
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"os.getenv",
"os.makedirs",
"moxing.file.copy_parallel",
"os.path.join",
"os.path.realpath",
"os.path.dirname",
"densenet.layers.Layers",
"densenet.model.Model",
"os.system",
"densenet.hyper_par... | [((1748, 1774), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (1764, 1774), False, 'import os\n'), ((1928, 2007), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormat... |
from tobase64 import tobase64
from tobytes import tobytes
import hashlib
def jwk(e, n):
"""
Create JSON Web Key from RSA exponent end modulus
"""
return { "e": tobase64(e), "kty": "RSA", "n": tobase64(n) }
def jwkthumb(e, n):
"""
JSON Web Key Thumbprint SHA256 from R... | [
"tobase64.tobase64",
"tobytes.tobytes"
] | [((195, 206), 'tobase64.tobase64', 'tobase64', (['e'], {}), '(e)\n', (203, 206), False, 'from tobase64 import tobase64\n'), ((227, 238), 'tobase64.tobase64', 'tobase64', (['n'], {}), '(n)\n', (235, 238), False, 'from tobase64 import tobase64\n'), ((407, 418), 'tobase64.tobase64', 'tobase64', (['e'], {}), '(e)\n', (415,... |
# -*- coding: utf-8 -*-
"""
Created on 28.03.2019
@author: <EMAIL>
"""
#system
import logging
#3rd party
import numpy as np
#custom
def setupLogging(logfile="debug.log"):
logger = logging.getLogger('')
logger.setLevel(logging.DEBUG)
#loggingFormatter = logging.Formatter('%(asctime)s - %(name)s - %(l... | [
"logging.getLogger",
"logging.StreamHandler",
"logging.Formatter",
"logging.shutdown",
"logging.FileHandler"
] | [((187, 208), 'logging.getLogger', 'logging.getLogger', (['""""""'], {}), "('')\n", (204, 208), False, 'import logging\n'), ((370, 402), 'logging.Formatter', 'logging.Formatter', (['"""%(message)s"""'], {}), "('%(message)s')\n", (387, 402), False, 'import logging\n'), ((433, 471), 'logging.FileHandler', 'logging.FileHa... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-06-15 04:38
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('vinesF', '0013_emails'),
]
operations = [
migrations.RemoveField(
model... | [
"django.db.migrations.RemoveField"
] | [((279, 335), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""emails"""', 'name': '"""name"""'}), "(model_name='emails', name='name')\n", (301, 335), False, 'from django.db import migrations\n')] |
# Generated by Django 3.2.6 on 2021-08-11 10:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0019_rentalstory'),
]
operations = [
migrations.AddField(
model_name='rentalstory',
name='email',
... | [
"django.db.models.EmailField",
"django.db.models.CharField"
] | [((328, 419), 'django.db.models.EmailField', 'models.EmailField', ([], {'default': '"""<EMAIL>"""', 'max_length': '(254)', 'verbose_name': '"""E-mail uporabnika"""'}), "(default='<EMAIL>', max_length=254, verbose_name=\n 'E-mail uporabnika')\n", (345, 419), False, 'from django.db import migrations, models\n'), ((575... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2016-11-23 23:49
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("base", "0070_auto_20161110_1336"),
]
operations = [
migrations.AddField(
... | [
"django.db.models.URLField",
"django.db.models.CharField"
] | [((403, 663), 'django.db.models.URLField', 'models.URLField', ([], {'blank': '(True)', 'help_text': "b'\\n URL pattern for downloading language packs. Leave empty if language packs\\n not available for the project. Supports {locale_code} wildcard.\\n '", 'null': '(True)', 'verbose_name': "b'Language pa... |
from itertools import product
from hashlib import sha1
def password_cracker(hash):
for i in range(5):
for j in product("abcdefghijklmnopqrstuvwxyz", repeat=i+1):
if sha1("".join(j).encode('utf-8')).hexdigest()==hash:
return "".join(j)
| [
"itertools.product"
] | [((123, 174), 'itertools.product', 'product', (['"""abcdefghijklmnopqrstuvwxyz"""'], {'repeat': '(i + 1)'}), "('abcdefghijklmnopqrstuvwxyz', repeat=i + 1)\n", (130, 174), False, 'from itertools import product\n')] |
#!/usr/bin/env python
import logging
import re
import sys
import tempfile
import time
import uuid
from munch import Munch
from plaster.gen import helpers
from plaster.gen.vfs_v1_generator import VFSV1Generator
from plaster.gen.classify_v1_generator import ClassifyV1Generator
from plaster.gen.classify_v2_generator imp... | [
"logging.getLogger",
"plaster.gen.helpers.protein_fasta",
"re.compile",
"plaster.tools.uniprot.uniprot.get_ac_fasta",
"plaster.tools.zlog.zlog.ZlogFG",
"plumbum.cli.Flag",
"plaster.tools.zlog.zlog.tell",
"plaster.tools.utils.stats.subsample",
"plaster.gen.helpers.split_protein_name",
"sys.exit",
... | [((2639, 2666), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2656, 2666), False, 'import logging\n'), ((20593, 20610), 'munch.Munch', 'Munch', ([], {'protein': '[]'}), '(protein=[])\n', (20598, 20610), False, 'from munch import Munch\n'), ((20780, 20837), 'plumbum.cli.SwitchAttr', 'cli... |
from __future__ import print_function
import sys
import random
import numpy as np
def set_random_seed(seed):
"""Sets the random seed.
:param seed: new random seed
>>> set_random_seed(19)
>>> random.randint(0, 10000)
708
>>> np.random.rand(3, 2)
array([[0.6356515 , 0.15946741],
... | [
"numpy.random.randn",
"random.randint",
"random.seed",
"numpy.linalg.norm"
] | [((398, 415), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (409, 415), False, 'import random\n'), ((1395, 1416), 'numpy.random.randn', 'np.random.randn', (['n', 'd'], {}), '(n, d)\n', (1410, 1416), True, 'import numpy as np\n'), ((435, 465), 'random.randint', 'random.randint', (['(0)', '(100000000.0)'], {}... |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | [
"pyscf.cc.gintermediates.Wvvvo",
"pyscf.cc.gintermediates.Foo",
"pyscf.lib.logger.timer",
"time.clock",
"numpy.array",
"numpy.einsum",
"pyscf.cc.gintermediates.Fvv",
"pyscf.cc.gintermediates.Wvvvv",
"pyscf.scf.UHF",
"pyscf.cc.gccsd.GCCSD",
"numpy.dot",
"pyscf.cc.gintermediates.Fov",
"numpy.t... | [((1025, 1073), 'numpy.zeros', 'np.zeros', (['(nocc, nocc, nvir)'], {'dtype': 'vector.dtype'}), '((nocc, nocc, nvir), dtype=vector.dtype)\n', (1033, 1073), True, 'import numpy as np\n'), ((1087, 1112), 'numpy.tril_indices', 'np.tril_indices', (['nocc', '(-1)'], {}), '(nocc, -1)\n', (1102, 1112), True, 'import numpy as ... |
"""Base class for commands. Handles parsing supplied arguments."""
import getopt
import sys
__author__ = "<NAME>"
__license__ = "BSD"
__copyright__ = "Copyright 2016, <NAME>"
class Command:
def __init__(self, argv, options, flags, allowArgRemainder=False):
try:
self.flags ... | [
"sys.stderr.write",
"getopt.getopt",
"sys.exit"
] | [((1070, 1109), 'sys.stderr.write', 'sys.stderr.write', (["('ERROR: %s\\n' % error)"], {}), "('ERROR: %s\\n' % error)\n", (1086, 1109), False, 'import sys\n'), ((1118, 1130), 'sys.exit', 'sys.exit', (['(-1)'], {}), '(-1)\n', (1126, 1130), False, 'import sys\n'), ((449, 495), 'getopt.getopt', 'getopt.getopt', (['argv', ... |
# coding=utf-8
import numpy as np
import scipy as sp
import scipy.sparse as sparse
import scipy.sparse.linalg as sparse_alg
from time import time
import IEEE_cdf as cdf
from jacobian import jacobian
from P_Q import P_Q
class powerflow:
'''
'''
def __init__(self, filename=''):
n, mat_admitancia, lo... | [
"P_Q.P_Q",
"numpy.linalg.solve",
"numpy.ones",
"numpy.delete",
"jacobian.jacobian",
"scipy.sparse.issparse",
"numpy.append",
"IEEE_cdf.read",
"scipy.sparse.coo_matrix",
"matplotlib.pyplot.matshow",
"time.time",
"matplotlib.pyplot.show"
] | [((2972, 2978), 'time.time', 'time', ([], {}), '()\n', (2976, 2978), False, 'from time import time\n'), ((3022, 3028), 'time.time', 'time', ([], {}), '()\n', (3026, 3028), False, 'from time import time\n'), ((373, 391), 'IEEE_cdf.read', 'cdf.read', (['filename'], {}), '(filename)\n', (381, 391), True, 'import IEEE_cdf ... |
from deepmechanics.cell import QuadCell
from deepmechanics.utilities import make_array_unique, tensorize_1d, tensorize_2d
class Grid:
def __init__(self, spatial_dimensions):
self.spatial_dimensions = spatial_dimensions
self.base_cells = []
self._leaf_cells = []
self._active_leaf_c... | [
"deepmechanics.utilities.make_array_unique",
"deepmechanics.utilities.tensorize_1d",
"deepmechanics.utilities.tensorize_2d",
"deepmechanics.cell.QuadCell"
] | [((7986, 8011), 'deepmechanics.utilities.make_array_unique', 'make_array_unique', (['all_xs'], {}), '(all_xs)\n', (8003, 8011), False, 'from deepmechanics.utilities import make_array_unique, tensorize_1d, tensorize_2d\n'), ((8455, 8480), 'deepmechanics.utilities.make_array_unique', 'make_array_unique', (['all_xs'], {})... |
import time
import datetime
def convertStringDateToTimestamp(date):
return time.mktime(datetime.datetime.strptime(date, "%d/%m/%Y").timetuple())
| [
"datetime.datetime.strptime"
] | [((93, 137), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['date', '"""%d/%m/%Y"""'], {}), "(date, '%d/%m/%Y')\n", (119, 137), False, 'import datetime\n')] |
try:
import pybullet_envs # pytype: disable=import-error
except ImportError:
pybullet_envs = None
try:
import highway_env # pytype: disable=import-error
except ImportError:
highway_env = None
try:
import neck_rl # pytype: disable=import-error
except ImportError:
neck_rl = None
try:
imp... | [
"gym.envs.registration.register"
] | [((963, 1018), 'gym.envs.registration.register', 'gym.envs.registration.register', (['env_id', '*args'], {}), '(env_id, *args, **kvargs)\n', (993, 1018), False, 'import gym\n')] |
# -*- coding: utf-8 -*-
# Copyright (C) 2012, <NAME>
#
# Visvis is distributed under the terms of the (new) BSD License.
# The full license can be found in 'license.txt'.
""" The WX backend.
"""
# NOTICE: wx has the same general problem with OpenGl being kinda
# unmanaged and frames not being drawn on Gnome. Howev... | [
"visvis.events.processVisvisEvents",
"wx.PaintDC",
"visvis.guisupport.get_app_wx",
"wx.EventLoop.GetActive",
"wx.EventLoop",
"wx.EventLoop.SetActive",
"wx.Icon",
"wx.glcanvas.GLCanvas.__init__",
"visvis.core.misc.getResourceDir",
"visvis.BaseFigure.__init__"
] | [((2068, 2116), 'wx.glcanvas.GLCanvas.__init__', 'GLCanvas.__init__', (['self', 'parent', '*args'], {}), '(self, parent, *args, **kwargs)\n', (2085, 2116), False, 'from wx.glcanvas import GLCanvas\n'), ((7039, 7055), 'wx.PaintDC', 'wx.PaintDC', (['self'], {}), '(self)\n', (7049, 7055), False, 'import wx\n'), ((8067, 80... |
"""
Day Twelve - 2D rotations around origin
"""
import math
import utils
from utils import Cords
def clockwise_turn(dir: Cords) -> Cords:
if dir == (1, 0):
return Cords(0, -1)
elif dir == (0, -1):
return Cords(-1, 0)
elif dir == (-1, 0):
return Cords(0, 1)
elif dir == (0, 1):... | [
"utils.read_strings_from_lines",
"utils.Cords",
"math.radians",
"math.cos",
"math.sin"
] | [((612, 638), 'math.radians', 'math.radians', (['degree_angle'], {}), '(degree_angle)\n', (624, 638), False, 'import math\n'), ((855, 868), 'utils.Cords', 'Cords', (['qx', 'qy'], {}), '(qx, qy)\n', (860, 868), False, 'from utils import Cords\n'), ((1089, 1135), 'utils.read_strings_from_lines', 'utils.read_strings_from_... |
import numpy
import scipy.interpolate
import scipy.ndimage
import matplotlib.pyplot
import matplotlib.patches
import logging
def parseSpeedFlowsToCongestions(speeds, flows, speedThreshold, flowThreshold):
logging.debug("Starting parseSpeedFlowsToCongestions()")
congestions = speeds / speedThreshold ... | [
"numpy.ma.masked_invalid",
"numpy.meshgrid",
"logging.debug",
"numpy.arange"
] | [((220, 276), 'logging.debug', 'logging.debug', (['"""Starting parseSpeedFlowsToCongestions()"""'], {}), "('Starting parseSpeedFlowsToCongestions()')\n", (233, 276), False, 'import logging\n'), ((352, 406), 'logging.debug', 'logging.debug', (['"""Ending parseSpeedFlowsToCongestions()"""'], {}), "('Ending parseSpeedFlow... |
from flask import Flask, render_template, url_for, redirect, session
from .test import User
# Define the WSGI application object
app = Flask(__name__)
app.secret_key ="8a3971a57fea4db08d86aa844e8ecefe"
app.register_blueprint(User,url_prefix='/v1/api/user')
@app.route('/')
def main():
if session.get('user'):
re... | [
"flask.redirect",
"flask.render_template",
"flask.session.get",
"flask.Flask"
] | [((138, 153), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (143, 153), False, 'from flask import Flask, render_template, url_for, redirect, session\n'), ((295, 314), 'flask.session.get', 'session.get', (['"""user"""'], {}), "('user')\n", (306, 314), False, 'from flask import Flask, render_template, url_f... |
from CubeSolver import CubeSolver
import numpy as np
# disposition = np.array([[['U', 'G', 'Y'],
# ['U', 'W', 'O'],
# ['R', 'Y', 'W']],
# [['G', 'G', 'U'],
# ['Y', 'R', 'G'],
# ['O', 'Y', 'U']],
... | [
"numpy.array",
"CubeSolver.CubeSolver"
] | [((895, 1239), 'numpy.array', 'np.array', (["[[['G', 'U', 'W'], ['Y', 'W', 'Y'], ['U', 'G', 'Y']], [['R', 'R', 'O'], [\n 'O', 'R', 'U'], ['O', 'O', 'O']], [['G', 'G', 'Y'], ['Y', 'G', 'W'], [\n 'U', 'O', 'R']], [['R', 'O', 'U'], ['U', 'O', 'R'], ['U', 'R', 'R']], [\n ['Y', 'G', 'G'], ['U', 'U', 'G'], ['W', 'R'... |
from nose.tools import *
from exercises import ex6
def test_sum():
'''
Test out if our sum is correct
'''
test_sum_total = ex6.sum(1, 2,3 ,4)
assert_equal(test_sum_total, 10)
def test_multiply():
'''
Test out if multiplication works
'''
test_multiply_total = ex6.multiply(1, 2, 3,... | [
"exercises.ex6.sum",
"exercises.ex6.multiply"
] | [((141, 160), 'exercises.ex6.sum', 'ex6.sum', (['(1)', '(2)', '(3)', '(4)'], {}), '(1, 2, 3, 4)\n', (148, 160), False, 'from exercises import ex6\n'), ((299, 323), 'exercises.ex6.multiply', 'ex6.multiply', (['(1)', '(2)', '(3)', '(4)'], {}), '(1, 2, 3, 4)\n', (311, 323), False, 'from exercises import ex6\n')] |
""""""
import io
from tempfile import TemporaryDirectory
from typing import IO
import click
from accretion_common.util import PackageDetails
from accretion_common.venv_magic.builder import build_requirements
from accretion_common.venv_magic.zipper import build_zip
__all__ = ("build_and_write_workers", "build_worker_b... | [
"tempfile.TemporaryDirectory",
"accretion_common.util.PackageDetails",
"io.BytesIO",
"click.echo",
"accretion_common.venv_magic.zipper.build_zip",
"accretion_common.venv_magic.builder.build_requirements"
] | [((345, 404), 'accretion_common.util.PackageDetails', 'PackageDetails', ([], {'Name': '"""accretion_workers"""', 'Details': '"""==0.1.0"""'}), "(Name='accretion_workers', Details='==0.1.0')\n", (359, 404), False, 'from accretion_common.util import PackageDetails\n'), ((979, 991), 'io.BytesIO', 'io.BytesIO', ([], {}), '... |
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Driver for common sequences for image management on switchable usb port."""
import glob
import os
import shutil
import subprocess
import tempfile
impo... | [
"os.path.exists",
"urllib.urlretrieve",
"os.path.join",
"time.sleep",
"os.path.realpath",
"os.rmdir",
"shutil.copyfile",
"tempfile.mkdtemp",
"subprocess.call",
"glob.glob",
"os.path.basename",
"time.time",
"servo.utils.usb_hierarchy.Hierarchy.GetUsbDeviceSysfsPath",
"servo.utils.usb_hierar... | [((5631, 5685), 'servo.utils.usb_hierarchy.Hierarchy.GetUsbDeviceSysfsPath', 'usb_hierarchy.Hierarchy.GetUsbDeviceSysfsPath', (['*usb_id'], {}), '(*usb_id)\n', (5676, 5685), True, 'import servo.utils.usb_hierarchy as usb_hierarchy\n'), ((5705, 5760), 'servo.utils.usb_hierarchy.Hierarchy.GetSysfsParentHubStub', 'usb_hie... |
# Copyright 2020 The Pigweed 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"google.protobuf.compiler.plugin_pb2.CodeGeneratorRequest.FromString",
"pw_rpc.codegen_nanopb.process_proto_file",
"google.protobuf.compiler.plugin_pb2.CodeGeneratorResponse",
"pw_rpc.codegen_pwpb.process_proto_file",
"sys.stdin.buffer.read",
"pw_rpc.codegen_raw.process_proto_file"
] | [((2223, 2246), 'sys.stdin.buffer.read', 'sys.stdin.buffer.read', ([], {}), '()\n', (2244, 2246), False, 'import sys\n'), ((2261, 2309), 'google.protobuf.compiler.plugin_pb2.CodeGeneratorRequest.FromString', 'plugin_pb2.CodeGeneratorRequest.FromString', (['data'], {}), '(data)\n', (2303, 2309), False, 'from google.prot... |
import matplotlib
matplotlib.use('Agg') #display backend
import matplotlib.pyplot as plt
import numpy as np
import os
from scipy.spatial import KDTree
import scipy.stats as st
from scipy.optimize import curve_fit as cu
from astropy.io import fits
import astropy.cosmology as co
from legacyanalysis.pathnames import get_... | [
"matplotlib.pyplot.grid",
"numpy.log10",
"matplotlib.pyplot.ylabel",
"astropy.io.fits.open",
"legacyanalysis.pathnames.get_outdir",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.ylim",
"matplotlib.use",
"legacyanalysis.pathnames.get_indir",
"matplotlib.pyplot.axes",
"scipy.sta... | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((353, 372), 'legacyanalysis.pathnames.get_indir', 'get_indir', (['"""cosmos"""'], {}), "('cosmos')\n", (362, 372), False, 'from legacyanalysis.pathnames import get_indir, get_outdir, make_dir\n'),... |
import glob
import os
from typing import List, Callable
import cv2
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import to_rgb
from scipy.stats import wasserstein_distance
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
from sklearn.pipeline import Pipeline
from im... | [
"sklearn.cluster.KMeans",
"matplotlib.pyplot.imshow",
"numpy.histogram",
"os.listdir",
"os.makedirs",
"numpy.hstack",
"sklearn.decomposition.PCA",
"numpy.random.choice",
"numpy.sum",
"scipy.stats.wasserstein_distance",
"image_clustering.tiler.GridTiler",
"os.path.basename",
"numpy.linalg.nor... | [((4043, 4078), 'os.makedirs', 'os.makedirs', (['dataset'], {'exist_ok': '(True)'}), '(dataset, exist_ok=True)\n', (4054, 4078), False, 'import os\n'), ((678, 708), 'image_clustering.tiler.GridTiler', 'GridTiler', ([], {'tile_size': 'tile_size'}), '(tile_size=tile_size)\n', (687, 708), False, 'from image_clustering.til... |
import time
import json
from .master_valve_control_py3 import Master_Valve
from .valve_resistance_check_py3 import Valve_Resistance_Check
from .clean_filter_py3 import Clean_Filter
from .check_off_py3 import Check_Off
#from .irrigation_control_py3 import Irrigation_Control
f... | [
"json.loads",
"json.dumps",
"time.time"
] | [((6335, 6358), 'json.loads', 'json.loads', (['json_string'], {}), '(json_string)\n', (6345, 6358), False, 'import json\n'), ((6531, 6554), 'json.dumps', 'json.dumps', (['json_object'], {}), '(json_object)\n', (6541, 6554), False, 'import json\n'), ((7729, 7752), 'json.loads', 'json.loads', (['json_string'], {}), '(jso... |
from flask import Flask
from glob import escape
app = Flask(__name__)
# global escape: true
@app.route('/')
def index():
return 'Index Page'
@app.route('/datum')
def hello():
return 'The data to provide!'
@app.route('/unit/<uuid:unit_id>')
def show_unit(unit_id):
return 'Unit ID %d, albeit this would us... | [
"glob.escape",
"flask.Flask"
] | [((54, 69), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (59, 69), False, 'from flask import Flask\n'), ((534, 549), 'glob.escape', 'escape', (['subpath'], {}), '(subpath)\n', (540, 549), False, 'from glob import escape\n')] |
#!/usr/bin/env python
import torch
import torch.nn as nn
import torch.optim as optim
from ..modules.bucket import BucketData
class ClassifierBase(nn.Module):
def __init__(self, vocab, pretrained_embed=True, device='cpu'):
super().__init__()
self.vocab = vocab
self.device = torch.device(dev... | [
"torch.LongTensor",
"torch.max",
"torch.nn.CrossEntropyLoss",
"torch.device"
] | [((304, 324), 'torch.device', 'torch.device', (['device'], {}), '(device)\n', (316, 324), False, 'import torch\n'), ((481, 502), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (500, 502), True, 'import torch.nn as nn\n'), ((973, 1019), 'torch.LongTensor', 'torch.LongTensor', (['batch_in'], {'devi... |
""" Unit tests to cover the osm2pgsql_recommendation module."""
import os
import unittest
import osm2pgsql_recommendation
class Osm2pgsqlRecommendationTests(unittest.TestCase):
def test_get_recommended_script_returns_str(self):
expected = str
system_ram_gb = 2
osm_pbf_gb = 10
app... | [
"osm2pgsql_recommendation.get_recommended_script"
] | [((436, 549), 'osm2pgsql_recommendation.get_recommended_script', 'osm2pgsql_recommendation.get_recommended_script', (['system_ram_gb', 'osm_pbf_gb', 'append', 'pbf_filename', 'output_path'], {}), '(system_ram_gb, osm_pbf_gb,\n append, pbf_filename, output_path)\n', (483, 549), False, 'import osm2pgsql_recommendation... |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields
class AccountInvoiceReport(models.Model):
_inherit = 'account.invoice.report'
l10n_latam_document_type_id = fields.Many2one('l10n_latam.document.type', 'Document Type', index=True)
_depends = {'acc... | [
"odoo.fields.Many2one"
] | [((227, 299), 'odoo.fields.Many2one', 'fields.Many2one', (['"""l10n_latam.document.type"""', '"""Document Type"""'], {'index': '(True)'}), "('l10n_latam.document.type', 'Document Type', index=True)\n", (242, 299), False, 'from odoo import models, fields\n')] |
from functools import reduce
from operator import and_
from operator import or_
import collections
import copy
import enum
import itertools
from django.db.models import Q
from django.utils.functional import cached_property
import django.db.models.query
import django.template
import django_tables2 as tables
from . im... | [
"collections.OrderedDict",
"itertools.count",
"django.db.models.Q"
] | [((1009, 1027), 'itertools.count', 'itertools.count', (['(1)'], {}), '(1)\n', (1024, 1027), False, 'import itertools\n'), ((8913, 8952), 'collections.OrderedDict', 'collections.OrderedDict', (['parent_columns'], {}), '(parent_columns)\n', (8936, 8952), False, 'import collections\n'), ((9052, 9081), 'collections.Ordered... |
import torch.nn as nn
from mlperf_compliance import mlperf_log
import seq2seq.data.config as config
from .seq2seq_base import Seq2Seq
from .decoder import ResidualRecurrentDecoder
from .encoder import ResidualRecurrentEncoder
# SSY seq2seq/models/seq2seq_base.py , but it do nothing, just use the decoder and encoder ... | [
"mlperf_compliance.mlperf_log.gnmt_print",
"torch.nn.Embedding"
] | [((602, 677), 'mlperf_compliance.mlperf_log.gnmt_print', 'mlperf_log.gnmt_print', ([], {'key': 'mlperf_log.MODEL_HP_NUM_LAYERS', 'value': 'num_layers'}), '(key=mlperf_log.MODEL_HP_NUM_LAYERS, value=num_layers)\n', (623, 677), False, 'from mlperf_compliance import mlperf_log\n'), ((716, 793), 'mlperf_compliance.mlperf_l... |
"""Functions for reading and writing XDMF files."""
import logging
import os
from copy import deepcopy
import h5py
import lxml.etree as etree
import numpy as np
from mocmg.mesh import GridMesh, Mesh
module_log = logging.getLogger(__name__)
numpy_to_xdmf_dtype = {
"int32": ("Int", "4"),
"int64": ("Int", "8")... | [
"logging.getLogger",
"lxml.etree.Element",
"lxml.etree.SubElement",
"lxml.etree.ElementTree",
"os.path.splitext",
"h5py.File",
"numpy.stack",
"numpy.zeros",
"os.path.basename",
"numpy.concatenate",
"copy.deepcopy"
] | [((215, 242), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (232, 242), False, 'import logging\n'), ((4712, 4780), 'lxml.etree.SubElement', 'etree.SubElement', (['xml_element', '"""Grid"""'], {'Name': 'name', 'GridType': '"""Uniform"""'}), "(xml_element, 'Grid', Name=name, GridType='Unif... |
#!/usr/bin/python3
import serial
ser = serial.Serial('/dev/ttyACM0', 115200)
# read from Arduino
input = ser.read()
print ("Read input " + input.decode("utf-8") + " from Arduino")
# write something back
ser.write('test')
| [
"serial.Serial"
] | [((39, 76), 'serial.Serial', 'serial.Serial', (['"""/dev/ttyACM0"""', '(115200)'], {}), "('/dev/ttyACM0', 115200)\n", (52, 76), False, 'import serial\n')] |
import re
from typing import Any
from pytest import mark, warns
from omegaconf import OmegaConf
def test_legacy_env_is_cached(monkeypatch: Any) -> None:
monkeypatch.setenv("FOOBAR", "1234")
c = OmegaConf.create({"foobar": "${env:FOOBAR}"})
with warns(UserWarning):
before = c.foobar
monke... | [
"pytest.mark.parametrize",
"omegaconf.OmegaConf.create",
"pytest.warns",
"re.escape"
] | [((389, 927), 'pytest.mark.parametrize', 'mark.parametrize', (['"""value,expected"""', '[(\'false\', False), (\'true\', True), (\'10\', 10), (\'-10\', -10), (\'10.0\', 10.0),\n (\'-10.0\', -10.0), (\'off\', \'off\'), (\'no\', \'no\'), (\'on\', \'on\'), (\'yes\',\n \'yes\'), (\'>1234\', \'>1234\'), (\':1234\', \':... |
#!/usr/bin/env python3
# Copyright 2020-present NAVER Corp. Under BSD 3-clause license
import argparse
import logging
import os
import pathlib
from typing import Optional
import math
from tqdm import tqdm
import path_to_kapture_localization # noqa: F401
import kapture_localization.utils.logging
from kapture_localiza... | [
"logging.getLogger",
"kapture.utils.logging.getLogger",
"kapture.flatten",
"kapture.RecordsCamera",
"argparse.ArgumentParser",
"pathlib.Path",
"kapture_localization.pairing.distance.get_pairs_distance",
"kapture.Kapture",
"kapture.rigs_remove_inplace",
"os.umask",
"kapture.io.csv.kapture_from_di... | [((546, 589), 'logging.getLogger', 'logging.getLogger', (['"""compute_distance_pairs"""'], {}), "('compute_distance_pairs')\n", (563, 589), False, 'import logging\n'), ((1479, 1531), 'kapture.io.csv.kapture_from_dir', 'kapture_from_dir', (['mapping_path'], {'skip_list': 'skip_heavy'}), '(mapping_path, skip_list=skip_he... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code for compiling latex from Python.
Based on: https://github.com/GjjvdBurg/labella.py
Author: <NAME>
Copyright (c) 2020 - The Alan Turing Institute
License: See the LICENSE file.
"""
import os
import shutil
import subprocess
import tabulate
import tempfile
def ... | [
"subprocess.check_output",
"tempfile.TemporaryDirectory",
"shutil.copy2",
"os.path.join",
"tabulate._type"
] | [((590, 648), 'subprocess.check_output', 'subprocess.check_output', (['command'], {'stderr': 'subprocess.STDOUT'}), '(command, stderr=subprocess.STDOUT)\n', (613, 648), False, 'import subprocess\n'), ((937, 966), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {}), '()\n', (964, 966), False, 'import ... |
import math
import numpy as np
#
# line segment intersection using vectors
# see Computer Graphics by <NAME>
#
def segPerp(a) :
b = np.empty_like(a)
b[0] = -a[1]
b[1] = a[0]
return b
# line segment a given by endpoints a1, a2
# line segment b given by endpoints b1, b2
# return
def seg_intersect(a1,a2,... | [
"math.sqrt",
"numpy.dot",
"numpy.empty_like"
] | [((137, 153), 'numpy.empty_like', 'np.empty_like', (['a'], {}), '(a)\n', (150, 153), True, 'import numpy as np\n'), ((408, 423), 'numpy.dot', 'np.dot', (['dap', 'db'], {}), '(dap, db)\n', (414, 423), True, 'import numpy as np\n'), ((435, 450), 'numpy.dot', 'np.dot', (['dap', 'dp'], {}), '(dap, dp)\n', (441, 450), True,... |
# Copyright 2015 Cisco Systems.
#
# 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 ag... | [
"logging.getLogger",
"oasis_dashboard.api.oasis.httpapi_delete",
"oasis_dashboard.api.oasis.requestheader_delete",
"oasis_dashboard.api.oasis.endpoint_delete",
"oasis_dashboard.api.oasis.responsecode_create",
"oasis_dashboard.api.oasis.function_update",
"oasis_dashboard.api.oasis.responsemessage_create"... | [((811, 838), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (828, 838), False, 'import logging\n'), ((1226, 1243), 'openstack_dashboard.api.rest.utils.ajax', 'rest_utils.ajax', ([], {}), '()\n', (1241, 1243), True, 'from openstack_dashboard.api.rest import utils as rest_utils\n'), ((1579... |
# Combine multiple images into one.
from __future__ import print_function
import os
import random
import csv
from xml.etree import ElementTree
from xml.dom import minidom
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
import xml.etree.cElementTree as ET
from PIL import Image
def writeToXml(i... | [
"PIL.Image.open",
"random.choice",
"PIL.Image.new",
"xml.etree.cElementTree.ElementTree",
"os.path.isfile",
"xml.etree.ElementTree.Element",
"xml.etree.ElementTree.SubElement",
"random.randint",
"os.path.expanduser"
] | [((672, 693), 'xml.etree.ElementTree.Element', 'Element', (['"""annotation"""'], {}), "('annotation')\n", (679, 693), False, 'from xml.etree.ElementTree import Element, SubElement, Comment, tostring\n'), ((738, 763), 'xml.etree.ElementTree.SubElement', 'SubElement', (['root', '"""files"""'], {}), "(root, 'files')\n", (... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
@ Author : Max_Pengjb
@ date : 2018/9/23 22:37
@ IDE : PyCharm
@ GitHub : https://github.com/JackyPJB
@ Contact : <EMAIL>
----------------------------... | [
"threading.Lock",
"threading.Thread"
] | [((880, 896), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (894, 896), False, 'import threading\n'), ((959, 1007), 'threading.Thread', 'threading.Thread', ([], {'target': 'run', 'args': "('t-%s' % i,)"}), "(target=run, args=('t-%s' % i,))\n", (975, 1007), False, 'import threading\n')] |
# -*- coding: utf-8 -*-
import re
import requests
import sys # getting os
from unidecode import unidecode # Strip diactritics from characters
from genius_scrape import config
def convert_line_endings(temp):
"""
Sourced from http://code.activestate.com/recipes/66434-change-line-endings/
Convert line e... | [
"re.sub",
"requests.get",
"unidecode.unidecode"
] | [((845, 860), 'unidecode.unidecode', 'unidecode', (['temp'], {}), '(temp)\n', (854, 860), False, 'from unidecode import unidecode\n'), ((1190, 1208), 'requests.get', 'requests.get', (['site'], {}), '(site)\n', (1202, 1208), False, 'import requests\n'), ((660, 702), 're.sub', 're.sub', (["'\\r(?!\\n)|(?<!\\r)\\n'", "'\\... |
#!/usr/bin/python3
#
# This script calls a command from linux, converting any arguments from windows to linux before calling
# It then takes commands from stdin, converting space seperated arguments that it detects as windows paths
# This is to allow repl like tools to be used from windows but running in linux (i.e. fo... | [
"subprocess.getoutput",
"os.path.expandvars",
"time.sleep",
"io.TextIOWrapper",
"os.fdopen",
"sys.stderr.fileno",
"sys.stdout.fileno",
"pty.openpty",
"os.path.expanduser",
"re.search"
] | [((900, 913), 'pty.openpty', 'pty.openpty', ([], {}), '()\n', (911, 913), False, 'import pty\n'), ((1044, 1078), 'io.TextIOWrapper', 'io.TextIOWrapper', (['sys.stdin.buffer'], {}), '(sys.stdin.buffer)\n', (1060, 1078), False, 'import io\n'), ((1094, 1130), 'os.fdopen', 'os.fdopen', (['master', '"""wb"""'], {'buffering'... |
import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm, datasets
# import some data to play with
iris = datasets.load_iris()
X = iris.data[:, :2] # we only take the first two features. We could
y = iris.target
C = 1.0 # SVM regularization parameter
svc = svm.SVC(kernel='linear', C=1,gamma=0).fit(X,... | [
"sklearn.datasets.load_iris",
"matplotlib.pyplot.contourf",
"sklearn.svm.SVC",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((125, 145), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (143, 145), False, 'from sklearn import svm, datasets\n'), ((559, 579), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(1)', '(1)', '(1)'], {}), '(1, 1, 1)\n', (570, 579), True, 'import matplotlib.pyplot as plt\n'), ((651, 705), 'matplo... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019 <NAME>
# wwdtm_scoreimage is relased under the terms of the Apache License 2.0
"""Generate PNG image file based on WWDTM show score totals"""
import json
import math
import os
from typing import List
import mysql.connector
from mysql.connector.errors import DatabaseError, P... | [
"PIL.Image.fromarray",
"os.getenv",
"math.floor",
"numpy.array",
"json.load"
] | [((1450, 1471), 'math.floor', 'math.floor', (['new_value'], {}), '(new_value)\n', (1460, 1471), False, 'import math\n'), ((2275, 2313), 'numpy.array', 'numpy.array', (['values'], {'dtype': 'numpy.uint8'}), '(values, dtype=numpy.uint8)\n', (2286, 2313), False, 'import numpy\n'), ((2326, 2348), 'PIL.Image.fromarray', 'Im... |
from NHentai import NHentai
import discord
nhentai = NHentai()
blacklist = ["double penetration", "anal", "yaoi", "lolicon", "rape", "ugly bastard"]
async def create_embed(title, url, description, thumbnail, tags, pages, ctx):
embed = discord.Embed(title=title, url=url, description= description)
embed.set_thu... | [
"discord.Embed",
"NHentai.NHentai"
] | [((54, 63), 'NHentai.NHentai', 'NHentai', ([], {}), '()\n', (61, 63), False, 'from NHentai import NHentai\n'), ((241, 301), 'discord.Embed', 'discord.Embed', ([], {'title': 'title', 'url': 'url', 'description': 'description'}), '(title=title, url=url, description=description)\n', (254, 301), False, 'import discord\n')] |
from py42.services.alertrules import ExfiltrationService
class TestExfiltrationClient(object):
def test_get_by_id_posts_expected_data_for_exfiltration_type(self, mock_connection):
alert_rule_client = ExfiltrationService(mock_connection, u"tenant-id")
alert_rule_client.get(u"rule-id")
asse... | [
"py42.services.alertrules.ExfiltrationService"
] | [((214, 264), 'py42.services.alertrules.ExfiltrationService', 'ExfiltrationService', (['mock_connection', 'u"""tenant-id"""'], {}), "(mock_connection, u'tenant-id')\n", (233, 264), False, 'from py42.services.alertrules import ExfiltrationService\n')] |
#!/usr/bin/env python3
import importlib
import numpy as np
import math
import gc
import sys
import arkouda as ak
print(">>> Sanity checks on the arkouda_server")
ak.verbose = False
if len(sys.argv) > 1:
ak.connect(server=sys.argv[1], port=sys.argv[2])
els... | [
"arkouda.arange",
"arkouda.join_on_eq_with_dt",
"arkouda.ones",
"arkouda.connect"
] | [((356, 382), 'arkouda.ones', 'ak.ones', (['N'], {'dtype': 'np.int64'}), '(N, dtype=np.int64)\n', (363, 382), True, 'import arkouda as ak\n'), ((387, 405), 'arkouda.arange', 'ak.arange', (['(0)', 'N', '(1)'], {}), '(0, N, 1)\n', (396, 405), True, 'import arkouda as ak\n'), ((465, 537), 'arkouda.join_on_eq_with_dt', 'ak... |
#!/usr/bin/env python
from __future__ import print_function
import sys, imp, collections, itertools
# verify that same node isn't added to index multiple times
def _wrap_extend(extend):
def wrapped(self, files):
# files is a generator and not all items may be used before the program
# completes, b... | [
"imp.load_source",
"itertools.tee",
"sys.argv.pop"
] | [((637, 652), 'sys.argv.pop', 'sys.argv.pop', (['(0)'], {}), '(0)\n', (649, 652), False, 'import sys, imp, collections, itertools\n'), ((662, 699), 'imp.load_source', 'imp.load_source', (['"""dedup"""', 'sys.argv[0]'], {}), "('dedup', sys.argv[0])\n", (677, 699), False, 'import sys, imp, collections, itertools\n'), ((4... |
import random
import types
from .const import *
from .genetic import encoder
from .formatter import *
from .utils import longest_common_subseqence as lcs
__all__ = ['transform_column']
regex_table = {
INDEX_TABLE(0x00) : '\\d',
INDEX_TABLE(0x01) : '[A-Z]',
INDEX_TABLE(0x02) : '[a-z]',
INDEX_TABLE(0x03... | [
"random.choice",
"random.randint"
] | [((2016, 2041), 'random.choice', 'random.choice', (['selectable'], {}), '(selectable)\n', (2029, 2041), False, 'import random\n'), ((2406, 2427), 'random.randint', 'random.randint', (['(0)', '(99)'], {}), '(0, 99)\n', (2420, 2427), False, 'import random\n')] |
import pygame
import math
import numpy as np
from scipy import interpolate
from scipy.interpolate import interp1d
import catmull_rom_curve as catmull
from config import Path_Planning_Settings as settings
from objects import *
class path_plan():
def __init__(self,path_map):
#Outer range radius
self.... | [
"pygame.draw.circle",
"config.Path_Planning_Settings",
"pygame.draw.lines",
"pygame.draw.line",
"math.sqrt",
"math.degrees",
"math.radians",
"catmull_rom_curve.catmull_rom"
] | [((2650, 2669), 'math.radians', 'math.radians', (['angle'], {}), '(angle)\n', (2662, 2669), False, 'import math\n'), ((9445, 9483), 'math.sqrt', 'math.sqrt', (['(vec1[0] ** 2 + vec1[1] ** 2)'], {}), '(vec1[0] ** 2 + vec1[1] ** 2)\n', (9454, 9483), False, 'import math\n'), ((9498, 9536), 'math.sqrt', 'math.sqrt', (['(ve... |
import datetime
import json
import types
from uuid import UUID
import lazy_object_proxy
from future.utils import iteritems
from simpleflow.futures import Future
def serialize_complex_object(obj):
if isinstance(
obj, bytes
): # Python 3 only (serialize_complex_object not called here in Python 2)
... | [
"json.loads",
"json.dumps",
"future.utils.iteritems"
] | [((2181, 2206), 'json.dumps', 'json.dumps', (['obj'], {}), '(obj, **kwargs)\n', (2191, 2206), False, 'import json\n'), ((2740, 2756), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (2750, 2756), False, 'import json\n'), ((2420, 2445), 'json.dumps', 'json.dumps', (['obj'], {}), '(obj, **kwargs)\n', (2430, 2445)... |
'''
Units tests for the cpptraj wrappers for nasqm
'''
import os
import pytest
import numpy as np
from pynasqm.nmr.trajdistance import TrajDistance
def setup_module(module):
'''
Switch to test directory
'''
os.chdir("tests/trajDistance")
def teardown_module(module):
'''
Return to main director... | [
"os.chdir",
"pynasqm.nmr.trajdistance.TrajDistance"
] | [((224, 254), 'os.chdir', 'os.chdir', (['"""tests/trajDistance"""'], {}), "('tests/trajDistance')\n", (232, 254), False, 'import os\n'), ((334, 351), 'os.chdir', 'os.chdir', (['"""../.."""'], {}), "('../..')\n", (342, 351), False, 'import os\n'), ((499, 533), 'pynasqm.nmr.trajdistance.TrajDistance', 'TrajDistance', (['... |
from application import db
from utilities.common import utc_now_ts as now
class User(db.Document):
username = db.StringField(db_field="u", required=True, unique=True)
password = db.StringField(db_field="p", required=True)
email = db.EmailField(db_field="e", required=True, unique=True)
first_name = db.... | [
"application.db.EmailField",
"utilities.common.utc_now_ts",
"application.db.StringField"
] | [((116, 172), 'application.db.StringField', 'db.StringField', ([], {'db_field': '"""u"""', 'required': '(True)', 'unique': '(True)'}), "(db_field='u', required=True, unique=True)\n", (130, 172), False, 'from application import db\n'), ((188, 231), 'application.db.StringField', 'db.StringField', ([], {'db_field': '"""p"... |
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
import time
from jobsbg.parser import parse_job_element
class JobsScraper:
def __init__(self):
baseUrl = 'https://www.jobs.bg/'
chrome_options = Optio... | [
"selenium.webdriver.chrome.options.Options",
"jobsbg.parser.parse_job_element",
"selenium.webdriver.Chrome",
"time.sleep"
] | [((315, 324), 'selenium.webdriver.chrome.options.Options', 'Options', ([], {}), '()\n', (322, 324), False, 'from selenium.webdriver.chrome.options import Options\n'), ((348, 395), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'chrome_options': 'chrome_options'}), '(chrome_options=chrome_options)\n', (364, 395)... |
from django.shortcuts import render, redirect
from django.http import HttpResponse, Http404
from .forms import NewProfileForm, NewProjectForm, NewCommentForm
from .models import Profile, Projects, Comments
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
fr... | [
"django.shortcuts.render",
"rest_framework.response.Response",
"django.shortcuts.redirect",
"django.contrib.auth.decorators.login_required",
"django.contrib.auth.models.User.objects.get",
"django.http.Http404"
] | [((710, 754), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/accounts/login/"""'}), "(login_url='/accounts/login/')\n", (724, 754), False, 'from django.contrib.auth.decorators import login_required\n'), ((634, 709), 'django.shortcuts.render', 'render', (['request', '"""awards... |
from dependency_injector.wiring import Provide, inject
from fastapi.params import Depends
from server.container import AppContainer
from server.utils import make_router
from tarkov.profile.dependencies import with_profile
from tarkov.insurance.interfaces import IInsuranceService
from tarkov.models import TarkovSuccess... | [
"fastapi.params.Depends",
"tarkov.models.TarkovSuccessResponse",
"server.utils.make_router"
] | [((500, 529), 'server.utils.make_router', 'make_router', ([], {'tags': "['Offraid']"}), "(tags=['Offraid'])\n", (511, 529), False, 'from server.utils import make_router\n'), ((674, 695), 'fastapi.params.Depends', 'Depends', (['with_profile'], {}), '(with_profile)\n', (681, 695), False, 'from fastapi.params import Depen... |
#!/usr/bin/env python
# Core
from __future__ import print_function
from decimal import *
from functools import wraps
import logging
import math
import pprint
import random
import re
import time
import ConfigParser
# Third-Party
import argh
from clint.textui import progress
import funcy
import html2text
from PIL im... | [
"re.compile",
"math.floor",
"time.sleep",
"ConfigParser.ConfigParser",
"logging.info",
"argh.dispatch_command",
"logging.warn",
"html2text.HTML2Text",
"functools.wraps",
"pprint.PrettyPrinter",
"selenium.webdriver.support.ui.WebDriverWait",
"random.randrange",
"splinter.Browser",
"selenium... | [((818, 892), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(lineno)s - %(message)s"""', 'level': 'logging.INFO'}), "(format='%(lineno)s - %(message)s', level=logging.INFO)\n", (837, 892), False, 'import logging\n'), ((904, 917), 'random.seed', 'random.seed', ([], {}), '()\n', (915, 917), False, 'i... |
# Create your views here.
from oauth2_provider.ext.rest_framework import OAuth2Authentication
from rest_framework import permissions, generics
from rest_framework.viewsets import ModelViewSet
from feedback_survey.filters import FeedbackStudentFilter
from rest_framework.response import Response
from feedback_survey.mod... | [
"feedback_survey.models.Feedback.objects.all",
"feedback_survey.models.SectionField.objects.all",
"feedback_survey.models.Course.objects.all",
"rest_framework.response.Response",
"feedback_survey.models.Section.objects.all",
"feedback_survey.models.Teacher.objects.all",
"feedback_survey.models.Student.o... | [((986, 1008), 'feedback_survey.models.Feedback.objects.all', 'Feedback.objects.all', ([], {}), '()\n', (1006, 1008), False, 'from feedback_survey.models import Feedback, Course, Teacher, Section, Student, SectionField\n'), ((1608, 1628), 'feedback_survey.models.Course.objects.all', 'Course.objects.all', ([], {}), '()\... |
import numpy as np
class Perceptron:
@staticmethod
def step(z):
return 1 if z >= 0 else 0
def __init__(self, lr=0.01, epochs=100):
self.lr = lr
self.epochs = epochs
self.W = None
self.errors = None
@staticmethod
def weight_init(x):
a = 1 + x.shape[1]
sigma = np.sqrt(2/(a+1))
return np.random.n... | [
"numpy.random.normal",
"numpy.shape",
"numpy.dot",
"numpy.sqrt"
] | [((283, 303), 'numpy.sqrt', 'np.sqrt', (['(2 / (a + 1))'], {}), '(2 / (a + 1))\n', (290, 303), True, 'import numpy as np\n'), ((309, 343), 'numpy.random.normal', 'np.random.normal', (['(0)', 'sigma'], {'size': 'a'}), '(0, sigma, size=a)\n', (325, 343), True, 'import numpy as np\n'), ((379, 400), 'numpy.dot', 'np.dot', ... |
from jwt.compat import constant_time_compare
from jwt.utils import force_bytes
class TestCompat:
def test_constant_time_compare_returns_true_if_same(self):
assert constant_time_compare(
force_bytes('abc'), force_bytes('abc')
)
def test_constant_time_compare_returns_false_if_diff_l... | [
"jwt.utils.force_bytes"
] | [((212, 230), 'jwt.utils.force_bytes', 'force_bytes', (['"""abc"""'], {}), "('abc')\n", (223, 230), False, 'from jwt.utils import force_bytes\n'), ((232, 250), 'jwt.utils.force_bytes', 'force_bytes', (['"""abc"""'], {}), "('abc')\n", (243, 250), False, 'from jwt.utils import force_bytes\n'), ((388, 406), 'jwt.utils.for... |
import re
import os.path
import functools
import mathutils
from math import radians
import bpy
import pyawd
from pyawd.core import *
from pyawd.anim import *
from pyawd.scene import *
from pyawd.geom import *
from pyawd.material import *
from pyawd.utils.math import *
from pyawd.utils.geom import AWDGeomUtil
class... | [
"bpy.path.abspath",
"functools.reduce",
"pyawd.utils.geom.AWDGeomUtil",
"mathutils.Matrix.Translation",
"mathutils.Matrix"
] | [((11798, 11811), 'pyawd.utils.geom.AWDGeomUtil', 'AWDGeomUtil', ([], {}), '()\n', (11809, 11811), False, 'from pyawd.utils.geom import AWDGeomUtil\n'), ((16914, 16948), 'bpy.path.abspath', 'bpy.path.abspath', (['"""//blendout.awd"""'], {}), "('//blendout.awd')\n", (16930, 16948), False, 'import bpy\n'), ((4178, 4242),... |
# +
import numpy as np
import tensorflow as tf
from gpflow import set_trainable
from gpflow.ci_utils import ci_niter
from gpflow.kernels import RBF
from gpflow.likelihoods import Gaussian
from matplotlib import pyplot as plt
from markovflow.kernels import Matern32
from markovflow.models import SparseSpatioTemporalVaria... | [
"gpflow.ci_utils.ci_niter",
"matplotlib.pyplot.savefig",
"numpy.random.rand",
"markovflow.ssm_natgrad.SSMNaturalGradient",
"markovflow.kernels.Matern32",
"numpy.linspace",
"numpy.random.randn",
"tensorflow.optimizers.Adam",
"numpy.random.seed",
"numpy.concatenate",
"gpflow.kernels.RBF",
"numpy... | [((382, 400), 'numpy.random.seed', 'np.random.seed', (['(10)'], {}), '(10)\n', (396, 400), True, 'import numpy as np\n'), ((473, 508), 'gpflow.kernels.RBF', 'RBF', ([], {'variance': '(1.0)', 'lengthscales': '(0.2)'}), '(variance=1.0, lengthscales=0.2)\n', (476, 508), False, 'from gpflow.kernels import RBF\n'), ((523, 5... |
# ===============================================================================
#
# Copyright (c) 2013-2017 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# ===============================================================================
"""
Create... | [
"os.urandom",
"re.match",
"random.randint",
"re.search"
] | [((3285, 3316), 'random.randint', 'random.randint', (['(0)', '(max_size - 1)'], {}), '(0, max_size - 1)\n', (3299, 3316), False, 'import random\n'), ((3333, 3373), 'random.randint', 'random.randint', (['(left_index + 1)', 'max_size'], {}), '(left_index + 1, max_size)\n', (3347, 3373), False, 'import random\n'), ((4201,... |
import socket
import sys
import os
from control_flow_constants import *
print("HELLO")
from timeit import default_timer as timer
start = timer()
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server_address = (CHEETAH_MASTER_IP, CHEETAH_MASTER_PORT)
sock.bind(server_address)
for i in range(CHEETAH_WORKER... | [
"timeit.default_timer",
"socket.socket"
] | [((140, 147), 'timeit.default_timer', 'timer', ([], {}), '()\n', (145, 147), True, 'from timeit import default_timer as timer\n'), ((156, 204), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (169, 204), False, 'import socket\n'), ((360, 367), 't... |
import pylab # Requires matplotlib
from time import time
from datetime import datetime
from brownie import Contract
WEEK = 86400 * 7
def main():
distributor = Contract("0xA464e6DCda8AC41e03616F95f4BC98a13b8922Dc")
tri_pool = Contract("0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7")
t = int(time()) // WEEK... | [
"datetime.datetime.fromtimestamp",
"pylab.xlabel",
"brownie.Contract",
"time.time",
"pylab.ylabel",
"pylab.show"
] | [((168, 222), 'brownie.Contract', 'Contract', (['"""0xA464e6DCda8AC41e03616F95f4BC98a13b8922Dc"""'], {}), "('0xA464e6DCda8AC41e03616F95f4BC98a13b8922Dc')\n", (176, 222), False, 'from brownie import Contract\n'), ((238, 292), 'brownie.Contract', 'Contract', (['"""0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7"""'], {}), "('... |
import h5py
import numpy as np
import torch
import cv2
from torch.utils.data import DataLoader, TensorDataset
def get_data(batch_size=64):
train_dataset = h5py.File('datasets/train_signs.h5', "r")
x_train = np.array(train_dataset["train_set_x"][:]) # your train set features
x_train = np.transpose(x_train,... | [
"torch.utils.data.TensorDataset",
"h5py.File",
"numpy.array",
"torch.tensor",
"torch.utils.data.DataLoader",
"cv2.resize",
"numpy.transpose",
"cv2.imread"
] | [((161, 202), 'h5py.File', 'h5py.File', (['"""datasets/train_signs.h5"""', '"""r"""'], {}), "('datasets/train_signs.h5', 'r')\n", (170, 202), False, 'import h5py\n'), ((217, 258), 'numpy.array', 'np.array', (["train_dataset['train_set_x'][:]"], {}), "(train_dataset['train_set_x'][:])\n", (225, 258), True, 'import numpy... |
import pytest
import json
import hsc_compile
import hsc_deploy
aergo = None
hsc_address = "AmgUPYeR2w8Hrh4pauwDRzykGUjvRTNEoH65S6xXawoy3CAZrEda"
pond_creator = "AmLaWMFr8jpJqLVwGrEnsX62mKEm62ztjSsAmB2APL3Z9qeGyk1s"
def call_function(func_name, args):
return hsc_deploy.call_sc(aergo, hsc_address, 'callFunctio... | [
"hsc_deploy.call_sc",
"hsc_deploy.query_sc",
"hsc_deploy.check_aergo_conn_info",
"json.loads",
"json.dumps",
"pytest.fixture"
] | [((588, 619), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (602, 619), False, 'import pytest\n'), ((269, 376), 'hsc_deploy.call_sc', 'hsc_deploy.call_sc', (['aergo', 'hsc_address', '"""callFunction"""', "(['__HSC_SPACE_BLOCKCHAIN__', func_name] + args)"], {}), "(aergo, hs... |