code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.db.models import Max, Avg, Sum, F
from labs.common.models import Registration
def highest_discount(event_id=1):
"""
>>> SELECT MAX(registration.discount) AS max_discount FROM registration
WHERE registration.event_id = event_id
"""
registrations = Registration.objects.filter(event_... | [
"django.db.models.Max",
"labs.common.models.Registration.objects.annotate",
"django.db.models.Sum",
"labs.common.models.Registration.objects.filter",
"django.db.models.F",
"django.db.models.Avg",
"labs.common.models.Registration.objects.values"
] | [((286, 332), 'labs.common.models.Registration.objects.filter', 'Registration.objects.filter', ([], {'event_id': 'event_id'}), '(event_id=event_id)\n', (313, 332), False, 'from labs.common.models import Registration\n'), ((623, 669), 'labs.common.models.Registration.objects.filter', 'Registration.objects.filter', ([], ... |
from flask import Flask, request, json
from playlist_compare import playlistService, helloService, searchService
app = Flask(__name__)
@app.route("/")
def helloRoute():
data = helloService.hello()
return json.jsonify(data)
@app.route("/list")
def listAll():
token = request.args.get("token")
userna... | [
"playlist_compare.helloService.hello",
"flask.request.args.get",
"flask.Flask",
"flask.json.jsonify",
"playlist_compare.searchService.search",
"playlist_compare.playlistService.getAll",
"playlist_compare.playlistService.getDuplicates",
"playlist_compare.playlistService.getTracks"
] | [((121, 136), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (126, 136), False, 'from flask import Flask, request, json\n'), ((184, 204), 'playlist_compare.helloService.hello', 'helloService.hello', ([], {}), '()\n', (202, 204), False, 'from playlist_compare import playlistService, helloService, searchServ... |
import numpy as np
import torch
def person_embed(speaker_ids, person_vec):
'''
:param speaker_ids: torch.Tensor ( T, B)
:param person_vec: numpy array (num_speakers, 100)
:return:
speaker_vec: torch.Tensor (T, B, D)
'''
speaker_vec = []
for t in speaker_ids:
speaker_vec.app... | [
"torch.FloatTensor"
] | [((410, 440), 'torch.FloatTensor', 'torch.FloatTensor', (['speaker_vec'], {}), '(speaker_vec)\n', (427, 440), False, 'import torch\n')] |
# Generated by Django 2.1.4 on 2019-01-03 23:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('seimas', '0030_auto_20190103_2234'),
]
operations = [
migrations.AlterField(
model_name='committee',
name='slug',
... | [
"django.db.models.SlugField"
] | [((336, 365), 'django.db.models.SlugField', 'models.SlugField', ([], {'unique': '(True)'}), '(unique=True)\n', (352, 365), False, 'from django.db import migrations, models\n'), ((487, 516), 'django.db.models.SlugField', 'models.SlugField', ([], {'unique': '(True)'}), '(unique=True)\n', (503, 516), False, 'from django.d... |
import jieba #分词库
import jieba.analyse
import pymongo
import redis
import os
import re
import json
client = pymongo.MongoClient(host="127.0.0.1", port=27017)
db = client['job']
collection = db['position']
data = collection.find({})
text = ""
for item in data:
text += item['body']
pwd = os.path.sp... | [
"pymongo.MongoClient",
"jieba.cut",
"os.path.realpath",
"re.match",
"json.dumps",
"jieba.analyse.set_stop_words"
] | [((125, 174), 'pymongo.MongoClient', 'pymongo.MongoClient', ([], {'host': '"""127.0.0.1"""', 'port': '(27017)'}), "(host='127.0.0.1', port=27017)\n", (144, 174), False, 'import pymongo\n'), ((382, 420), 'jieba.analyse.set_stop_words', 'jieba.analyse.set_stop_words', (['stopWord'], {}), '(stopWord)\n', (410, 420), False... |
from urllib.parse import urlencode, urldefrag, quote, unquote
import requests
# from requests.urllib3 import urlretrieve
import urllib
from urllib.request import urlretrieve
mydict = {
"Name": "<NAME>",
"address": "test address",
"fav char": "<NAME>"
}
strUrl = urlencode(mydict)
print(strUrl)
string =... | [
"urllib.parse.unquote",
"urllib.parse.urldefrag",
"urllib.parse.urlencode",
"urllib.request.urlopen",
"urllib.request.urlretrieve",
"urllib.parse.quote"
] | [((279, 296), 'urllib.parse.urlencode', 'urlencode', (['mydict'], {}), '(mydict)\n', (288, 296), False, 'from urllib.parse import urlencode, urldefrag, quote, unquote\n'), ((321, 394), 'urllib.parse.urlencode', 'urlencode', (["{'v': 'what is your favroute editor, VS Code, atom , sublime'}"], {}), "({'v': 'what is your ... |
import decimal
import json
import typing
from datetime import datetime
import baseline_cloud.core.date
from baseline_cloud import core
class JSONEncoder(json.JSONEncoder):
def default(self, o: typing.Any) -> typing.Any:
if isinstance(o, datetime):
return core.date.format_utc(o)
if isi... | [
"baseline_cloud.core.date.format_utc"
] | [((282, 305), 'baseline_cloud.core.date.format_utc', 'core.date.format_utc', (['o'], {}), '(o)\n', (302, 305), False, 'from baseline_cloud import core\n')] |
import os, sys
import json
from collections import defaultdict
import numpy as np
import pandas as pd
dna_pair = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
amino_acid_index_table = {
'A': 0,
'B': 20,
'C': 1,
'D': 2,
'E': 3,
'F': 4,
'G': 5,
'H': 6,
'I': 7,
'J': 20,
'K': 8,
... | [
"collections.defaultdict",
"pandas.read_csv"
] | [((804, 820), 'collections.defaultdict', 'defaultdict', (['str'], {}), '(str)\n', (815, 820), False, 'from collections import defaultdict\n'), ((2114, 2166), 'pandas.read_csv', 'pd.read_csv', (['input_path'], {'sep': '"""\t"""', 'skiprows': 'skiprows'}), "(input_path, sep='\\t', skiprows=skiprows)\n", (2125, 2166), Tru... |
import os
import cv2
from matplotlib.pyplot import gray
import numpy as np
people = ['<NAME>', '<NAME>', '<NAME>', 'Madonna', '<NAME>']
DIR = r'/home/senai/tiago-projects/opencv-course/Resources/Faces/train'
haar_cascade = cv2.CascadeClassifier('/home/senai/tiago-projects/opencv-course/face_detection/haar_face.xml')
... | [
"numpy.save",
"cv2.face.LBPHFaceRecognizer_create",
"cv2.cvtColor",
"cv2.imread",
"numpy.array",
"cv2.CascadeClassifier",
"os.path.join",
"os.listdir"
] | [((224, 323), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""/home/senai/tiago-projects/opencv-course/face_detection/haar_face.xml"""'], {}), "(\n '/home/senai/tiago-projects/opencv-course/face_detection/haar_face.xml')\n", (245, 323), False, 'import cv2\n'), ((956, 974), 'numpy.array', 'np.array', (['featu... |
'''
Specialized scientific functions for biogeophysical variables and L4C model
processes.
'''
import numpy as np
from functools import partial
from scipy.ndimage import generic_filter
from scipy.linalg import solve_banded
from scipy.sparse import dia_matrix
from pyl4c import suppress_warnings
from pyl4c.data.fixtures... | [
"numpy.sum",
"numpy.ones",
"numpy.isnan",
"numpy.exp",
"numpy.unique",
"numpy.nanmean",
"numpy.multiply",
"pyl4c.stats.linear_constraint",
"numpy.power",
"numpy.isfinite",
"numpy.place",
"numpy.apply_along_axis",
"pyl4c.utils.get_pft_array",
"scipy.sparse.dia_matrix",
"numpy.var",
"num... | [((4740, 4761), 'numpy.sort', 'np.sort', (['series[:, 0]'], {}), '(series[:, 0])\n', (4747, 4761), True, 'import numpy as np\n'), ((4769, 4790), 'numpy.sort', 'np.sort', (['series[:, 1]'], {}), '(series[:, 1])\n', (4776, 4790), True, 'import numpy as np\n'), ((9339, 9367), 'numpy.zeros', 'np.zeros', (['arr_24hr.shape[1... |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2022 Scipp contributors (https://github.com/scipp)
# @author <NAME>
from .view import PlotView
from ..core import zeros, scalar
import numpy as np
from matplotlib.collections import PathCollection
class PlotView2d(PlotView):
"""
View object for 2 dimens... | [
"numpy.array",
"numpy.abs"
] | [((3143, 3206), 'numpy.abs', 'np.abs', (['(self.current_lims[dimx][1] - self.current_lims[dimx][0])'], {}), '(self.current_lims[dimx][1] - self.current_lims[dimx][0])\n', (3149, 3206), True, 'import numpy as np\n'), ((3220, 3283), 'numpy.abs', 'np.abs', (['(self.current_lims[dimy][1] - self.current_lims[dimy][0])'], {}... |
import Foundation
import objc
import AppKit
import sys
NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter')
NSUserNotification = objc.lookUpClass('NSUserNotification')
def notify(title, subtitle, info_text, delay=0, sound=False, userInfo={}):
notification = NSUserNotification.alloc().init()
... | [
"objc.lookUpClass",
"Foundation.NSDate.date"
] | [((83, 127), 'objc.lookUpClass', 'objc.lookUpClass', (['"""NSUserNotificationCenter"""'], {}), "('NSUserNotificationCenter')\n", (99, 127), False, 'import objc\n'), ((149, 187), 'objc.lookUpClass', 'objc.lookUpClass', (['"""NSUserNotification"""'], {}), "('NSUserNotification')\n", (165, 187), False, 'import objc\n'), (... |
import json
import pathlib
import datetime as dt
from io import StringIO
import jsonpickle
import pytest
from tellus import __version__
from tellus.configuration import TELLUS_GO, TELLUS_INTERNAL
from tellus.persistence import (
PickleFilePersistor,
TELLUS_SAVE_DIR,
PersistenceSetupException,
PERSISTO... | [
"io.StringIO",
"tellus.persistable.ZAuditInfo",
"datetime.datetime.fromisoformat",
"tellus.persistence.PickleFilePersistor.verify_save_file",
"pytest.fail",
"json.dumps",
"jsonpickle.decode",
"tellus.persistence.PickleFilePersistor",
"tellus.tell.Tell",
"pathlib.Path.cwd",
"datetime.datetime.now... | [((2030, 2119), 'tellus.persistence.PickleFilePersistor', 'PickleFilePersistor', ([], {'persist_root': 'None', 'save_file_name': '"""current_pickle"""', 'testing': '(True)'}), "(persist_root=None, save_file_name='current_pickle',\n testing=True)\n", (2049, 2119), False, 'from tellus.persistence import PickleFilePers... |
# -*- coding: utf-8 -*-
"""
Measure Rabi oscillation by changing the amplitude of the control pulse.
The control pulse has a sin^2 envelope, while the readout pulse is square.
"""
import ast
import math
import os
import time
import h5py
import numpy as np
from numpy.typing import ArrayLike
from mla_server import set... | [
"presto.pulsed.Pulsed",
"numpy.fft.rfft",
"presto.utils.rotate_opt",
"numpy.abs",
"numpy.angle",
"numpy.imag",
"numpy.mean",
"numpy.arange",
"numpy.exp",
"numpy.diag",
"os.path.join",
"presto.utils.sin2",
"numpy.max",
"numpy.linspace",
"numpy.real",
"mla_server.set_dc_bias",
"numpy.a... | [((14644, 14658), 'numpy.fft.rfft', 'np.fft.rfft', (['y'], {}), '(y)\n', (14655, 14658), True, 'import numpy as np\n'), ((14872, 14888), 'numpy.arccos', 'np.arccos', (['first'], {}), '(first)\n', (14881, 14888), True, 'import numpy as np\n'), ((14994, 15023), 'scipy.optimize.curve_fit', 'curve_fit', (['_func', 'x', 'y'... |
import math
print('Вас приветствует логарифмер.')
print('Выберите тип (1 - Двоичный, 2 - Стандартный десятичный)')
a = int(input())
b = float(input('Введите число: '))
if a == 1 :
print(math.log(b, 2))
elif a == 2 :
print(math.log(b))
else:
print('Ошибка!')
| [
"math.log"
] | [((196, 210), 'math.log', 'math.log', (['b', '(2)'], {}), '(b, 2)\n', (204, 210), False, 'import math\n'), ((238, 249), 'math.log', 'math.log', (['b'], {}), '(b)\n', (246, 249), False, 'import math\n')] |
"""Some basic tests to test installation."""
import os
import unittest
from flax import linen as nn
from flax.training.train_state import TrainState
import jax
import jax.numpy as jnp
import numpy as np
import optax
import ray
from alpa import (init, parallelize, grad, ShardParallel,
automatic_layer... | [
"unittest.TextTestRunner",
"unittest.TestSuite",
"jax.random.normal",
"flax.linen.Dense",
"alpa.ShardParallel",
"flax.training.train_state.TrainState.create",
"alpa.automatic_layer_construction",
"jax.random.PRNGKey",
"alpa.grad",
"alpa.init",
"optax.sgd",
"alpa.testing.assert_allclose",
"al... | [((956, 977), 'jax.random.PRNGKey', 'jax.random.PRNGKey', (['(0)'], {}), '(0)\n', (974, 977), False, 'import jax\n'), ((1318, 1339), 'jax.random.PRNGKey', 'jax.random.PRNGKey', (['(0)'], {}), '(0)\n', (1336, 1339), False, 'import jax\n'), ((1393, 1423), 'optax.sgd', 'optax.sgd', ([], {'learning_rate': '(0.001)'}), '(le... |
from textwrap import wrap
def proteins(strand):
# textwrap.wrap(s, i) creates a list of elements from s with a max width of i
codons = wrap(strand, 3)
codons_to_protein = {
'AUG': 'Methionine',
'UUU': 'Phenylalanine',
'UUC': 'Phenylalanine',
'UUA': 'Leucine',
'U... | [
"textwrap.wrap"
] | [((149, 164), 'textwrap.wrap', 'wrap', (['strand', '(3)'], {}), '(strand, 3)\n', (153, 164), False, 'from textwrap import wrap\n')] |
# Copyright 2014 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.
import collections
import threading
import time
from cros.factory.test import event
from cros.factory.test.i18n import _
from cros.factory.test import se... | [
"cros.factory.test.event.Event",
"cros.factory.test.i18n._",
"cros.factory.test.session.console.warn",
"time.sleep",
"cros.factory.test.session.console.info",
"threading.Event",
"collections.namedtuple",
"cros.factory.test.utils.serial_utils.FindTtyByDriver"
] | [((843, 917), 'collections.namedtuple', 'collections.namedtuple', (['"""ArduinoCommand"""', "['DOWN', 'UP', 'STATE', 'RESET']"], {}), "('ArduinoCommand', ['DOWN', 'UP', 'STATE', 'RESET'])\n", (865, 917), False, 'import collections\n'), ((984, 1104), 'collections.namedtuple', 'collections.namedtuple', (['"""ArduinoState... |
#!/usr/bin/env python3
import subprocess
import argparse
def increment_setup_version():
filename = 'setup.py'
# Read file
fd = open(filename, 'r')
line_arr = fd.readlines()
fd.close()
# Search for the specific line
count = 0
version = None
version_line = None
for i in range(... | [
"subprocess.run",
"argparse.ArgumentParser"
] | [((1479, 1548), 'subprocess.run', 'subprocess.run', (['cmd'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.STDOUT'}), '(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n', (1493, 1548), False, 'import subprocess\n'), ((2374, 2447), 'subprocess.run', 'subprocess.run', (['cmd_str'], {'stdout': 'subprocess.P... |
# Author: <NAME>
# Copyright (c) 2019, <NAME>
# All rights reserved.
# based on github.com/ClementPinard/SfMLearner-Pytorch
import torch
from torch import nn
from torch.autograd import Variable
from inverse_warp import inverse_warp, flow_warp
from ssim import ssim
from process_functions import depth_occlusion_masks,oc... | [
"torch.mean",
"process_functions.occlusion_masks",
"torch.nn.functional.binary_cross_entropy",
"torch.median",
"torch.ones",
"torch.stack",
"inverse_warp.flow_warp",
"torch.autograd.Variable",
"utils.logical_or",
"ssim.ssim",
"torch.cat",
"utils.robust_l1",
"torch.nn.functional.adaptive_avg_... | [((1030, 1080), 'torch.nn.functional.adaptive_avg_pool2d', 'nn.functional.adaptive_avg_pool2d', (['tgt_img', '(h, w)'], {}), '(tgt_img, (h, w))\n', (1063, 1080), False, 'from torch import nn\n'), ((1212, 1281), 'torch.cat', 'torch.cat', (['(intrinsics[:, 0:2] / downscale, intrinsics[:, 2:])'], {'dim': '(1)'}), '((intri... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"tests.utils.MockPsycopgConnection",
"urllib.parse.urljoin",
"unittest.mock.MagicMock",
"ossdbtoolsservice.driver.types.psycopg_driver.PostgreSQLConnection",
"pgsmo.objects.database.database.Database",
"unittest.mock.Mock",
"pgsmo.objects.server.server.Server",
"tests.pgsmo_tests.utils.MockPGServerCon... | [((1105, 1168), 'tests.pgsmo_tests.utils.MockPGServerConnection', 'MockPGServerConnection', (['None'], {'name': 'dbname', 'host': 'host', 'port': 'port'}), '(None, name=dbname, host=host, port=port)\n', (1127, 1168), False, 'from tests.pgsmo_tests.utils import MockPGServerConnection\n'), ((1186, 1203), 'pgsmo.objects.s... |
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"nemo.collections.nlp.parts.nlp_overrides.GlobalBatchDataFetcher",
"nemo.utils.logging.info",
"apex.transformer.pipeline_parallel.utils.get_num_microbatches",
"torch.isnan",
"nemo.utils.AppState",
"torch.utils.data.DataLoader",
"torch.isinf",
"torch.FloatTensor",
"apex.transformer.parallel_state.get... | [((1914, 1950), 'torch.nn.ModuleList', 'torch.nn.ModuleList', (['self.val_metric'], {}), '(self.val_metric)\n', (1933, 1950), False, 'import torch\n'), ((5687, 5697), 'nemo.utils.AppState', 'AppState', ([], {}), '()\n', (5695, 5697), False, 'from nemo.utils import AppState, logging\n'), ((6169, 6179), 'nemo.utils.AppSt... |
"""
準備用:データセットをTFRecord形式にする
"""
import tensorflow as tf
from absl import flags
from absl import app
from glob import glob
from tensorflow.keras.preprocessing.image import load_img, img_to_array
FLAGS = flags.FLAGS
flags.DEFINE_string('old_image_path', "./datasets/original_data", 'Path to the data folder')
flags.DEFI... | [
"tensorflow.data.Dataset.from_tensor_slices",
"absl.flags.DEFINE_string",
"absl.app.run",
"tensorflow.data.experimental.TFRecordWriter",
"glob.glob"
] | [((217, 313), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""old_image_path"""', '"""./datasets/original_data"""', '"""Path to the data folder"""'], {}), "('old_image_path', './datasets/original_data',\n 'Path to the data folder')\n", (236, 313), False, 'from absl import flags\n'), ((310, 404), 'absl.flags... |
# -*- Mode: python; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
#
# edit-file.py
#
# Adds an option to edit the file containing the selected track
# to the right click context menu.
# Based on code in
#
# Partly based on code in https://github.com/donaghhorgan/rhythmbox-plugins-open-containi... | [
"gi.repository.Gio.MenuItem",
"subprocess.Popen",
"gi.repository.Gio.Application.get_default",
"gi.repository.GObject.property",
"gi.repository.Gio.SimpleAction"
] | [((628, 665), 'gi.repository.GObject.property', 'GObject.property', ([], {'type': 'GObject.Object'}), '(type=GObject.Object)\n', (644, 665), False, 'from gi.repository import Gio, GObject, Gtk, Peas, RB\n'), ((926, 955), 'gi.repository.Gio.Application.get_default', 'Gio.Application.get_default', ([], {}), '()\n', (953,... |
# This file is part of GenMap and released under the MIT License, see LICENSE.
# Author: <NAME>
import networkx as nx
import random
import math
from multiprocessing import Pool
import multiprocessing as multi
class Placer():
def __init__(self, method, iterations = 50, randomness = "Full"):
""" Initia... | [
"random.randint",
"math.sqrt",
"math.ceil",
"math.floor",
"networkx.topological_sort",
"random.random",
"multiprocessing.Pool",
"networkx.nx_pydot.graphviz_layout",
"networkx.is_directed_acyclic_graph",
"multiprocessing.cpu_count"
] | [((1348, 1365), 'multiprocessing.cpu_count', 'multi.cpu_count', ([], {}), '()\n', (1363, 1365), True, 'import multiprocessing as multi\n'), ((3770, 3814), 'networkx.nx_pydot.graphviz_layout', 'nx.nx_pydot.graphviz_layout', (['dag'], {'prog': '"""dot"""'}), "(dag, prog='dot')\n", (3797, 3814), True, 'import networkx as ... |
from django.contrib import admin
# Register your models here.
from .models import Coin
admin.site.register(Coin) | [
"django.contrib.admin.site.register"
] | [((89, 114), 'django.contrib.admin.site.register', 'admin.site.register', (['Coin'], {}), '(Coin)\n', (108, 114), False, 'from django.contrib import admin\n')] |
# coding: utf-8
import timeit
import json
import time
from flask import jsonify
from mabed.es_corpus import Corpus
from mabed.mabed import MABED
from mabed.es_connector import Es_connector
from gensim.models.doc2vec import Doc2Vec, TaggedDocument
from nltk.tokenize import word_tokenize
__author__ = "<NAME>"
__email... | [
"json.load",
"mabed.es_corpus.Corpus",
"json.loads",
"timeit.default_timer",
"json.dumps",
"gensim.models.doc2vec.Doc2Vec",
"mabed.es_connector.Es_connector",
"mabed.mabed.MABED"
] | [((1204, 1226), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (1224, 1226), False, 'import timeit\n'), ((1247, 1285), 'mabed.es_corpus.Corpus', 'Corpus', (['sw', 'maf', 'mrf', 'sep'], {'index': 'index'}), '(sw, maf, mrf, sep, index=index)\n', (1253, 1285), False, 'from mabed.es_corpus import Corpus\... |
#!/usr/bin/env python2
import os
import sys
import re
import json
def main():
# Adapt manually.
duk = '/usr/local/bin/duk'
lzstring = '/home/duktape/duktape/lz-string/libs/lz-string.js'
duktape_repo = '/home/duktape/duktape'
duktape_testrunner_repo = '/home/duktape/duktape-testrunner'
duktape... | [
"os.system",
"json.dumps",
"re.compile"
] | [((620, 770), 'os.system', 'os.system', (["('cd %s && git log -n %d --merges --oneline --decorate=no --pretty=format:%%H > /tmp/tmp-hashes.txt'\n % (duktape_repo, merge_count))"], {}), "(\n 'cd %s && git log -n %d --merges --oneline --decorate=no --pretty=format:%%H > /tmp/tmp-hashes.txt'\n % (duktape_repo, ... |
import copy
import warnings
from collections.abc import Iterable
from inspect import Parameter, signature
import numpy as np
from sklearn.utils.validation import (
check_array,
column_or_1d,
assert_all_finite,
check_consistent_length,
check_random_state as check_random_state_sklearn,
)
from ._labe... | [
"numpy.sum",
"numpy.ones",
"sklearn.utils.validation.check_consistent_length",
"numpy.diag",
"numpy.unique",
"numpy.random.RandomState",
"numpy.max",
"inspect.signature",
"sklearn.utils.validation.check_array",
"copy.deepcopy",
"sklearn.utils.validation.column_or_1d",
"numpy.nanmax",
"numpy.... | [((5175, 5199), 'numpy.isscalar', 'np.isscalar', (['class_prior'], {}), '(class_prior)\n', (5186, 5199), True, 'import numpy as np\n'), ((17167, 17194), 'copy.deepcopy', 'copy.deepcopy', (['random_state'], {}), '(random_state)\n', (17180, 17194), False, 'import copy\n'), ((17214, 17254), 'sklearn.utils.validation.check... |
# Python application to test miniconda data science installation
import math
import os
import sys
libs = ["numpy", "pandas", "matplotlib", "sklearn", "skimage", "cv2",
"sqlalchemy", "bokeh", "nltk", "missingno", "geopandas", "wordcloud",
"lightgbm", "scipy", "xgboost", "catboost", "keras"]
def main()... | [
"sys.exit"
] | [((1304, 1315), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1312, 1315), False, 'import sys\n')] |
"""
curl -i -X POST -H "Content-Type:application/json" http://localhost:5000/train -d '{"userName":"TEST1","dataset":[[-15, -57, 88, 50, 16, 83, 198, 16, -70],[202, -53, 140, 134, 0, 84, 165, -16, -15],[15, -67, 96, 108, 0, 79, 212, -16, -23],[16, -67, 126, 119, -15, 67, 258, -16, -16],[53, -65, 155, 59, 15, 65, 179,... | [
"sys.path.append",
"unittest.main",
"logging.debug",
"app.app.test_client",
"json.dumps",
"app.init_log"
] | [((1851, 1876), 'sys.path.append', 'sys.path.append', (['"""../src"""'], {}), "('../src')\n", (1866, 1876), False, 'import sys\n'), ((2889, 2903), 'app.init_log', 'app.init_log', ([], {}), '()\n', (2901, 2903), False, 'import app\n'), ((2908, 2923), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2921, 2923), Fals... |
# -*- coding: utf-8 -*-
"""Simple demo of streaming transaction data."""
from oandapyV20 import API
from oandapyV20.exceptions import V20Error, StreamTerminated
from oandapyV20.endpoints.transactions import TransactionsStream
from exampleauth import exampleAuth
accountID, access_token = exampleAuth()
api = API(access_... | [
"oandapyV20.API",
"exampleauth.exampleAuth",
"oandapyV20.endpoints.transactions.TransactionsStream"
] | [((289, 302), 'exampleauth.exampleAuth', 'exampleAuth', ([], {}), '()\n', (300, 302), False, 'from exampleauth import exampleAuth\n'), ((309, 363), 'oandapyV20.API', 'API', ([], {'access_token': 'access_token', 'environment': '"""practice"""'}), "(access_token=access_token, environment='practice')\n", (312, 363), False... |
import unittest
import yaml
from pyspark.sql import *
from dataforj import schema
from test.test_samples import flow_simple, simple_yaml_text, flow_complex
city_yaml_text = '''
- name: city
tests:
- not_null
- accepted_values: ['Amsterdam', 'Dublin', 'Frankfurt']
'''
flag_yaml_text = '''
- name: flag
... | [
"dataforj.schema.check_schema_yaml",
"dataforj.schema.check_schema",
"yaml.safe_load"
] | [((1078, 1112), 'yaml.safe_load', 'yaml.safe_load', (['combined_yaml_text'], {}), '(combined_yaml_text)\n', (1092, 1112), False, 'import yaml\n'), ((1121, 1184), 'dataforj.schema.check_schema_yaml', 'schema.check_schema_yaml', (['"""ut_step_df"""', 'ut_step_df', 'schema_yaml'], {}), "('ut_step_df', ut_step_df, schema_y... |
from datetime import datetime, timedelta
from typing import Union
from .models.file import UploadUrlModel
from .cache import Cache
def format_route_name(name: str) -> str:
"""Used to format route name.
Parameters
----------
name : str
Returns
-------
str
"""
return name.replac... | [
"datetime.datetime.now",
"datetime.timedelta"
] | [((1184, 1198), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1196, 1198), False, 'from datetime import datetime, timedelta\n'), ((1702, 1716), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1714, 1716), False, 'from datetime import datetime, timedelta\n'), ((1719, 1750), 'datetime.timedelta'... |
from django.urls import path
from . import views
from os import name
from django.conf.urls.static import static
from django.conf import settings
urlpatterns=[
path('',views.welcome,name ='welcome'),
path('gallery/',views.pictures,name='pictures'),
path('search/', views.search_results, name='search_results'... | [
"django.conf.urls.static.static",
"django.urls.path"
] | [((164, 203), 'django.urls.path', 'path', (['""""""', 'views.welcome'], {'name': '"""welcome"""'}), "('', views.welcome, name='welcome')\n", (168, 203), False, 'from django.urls import path\n'), ((208, 257), 'django.urls.path', 'path', (['"""gallery/"""', 'views.pictures'], {'name': '"""pictures"""'}), "('gallery/', vi... |
import mp_modbus_master as mmm
import time
import struct
d1 = mmm.modbus_rtu_master(uart_no=2, parity=0, tx_pin=12, rx_pin=13, en_pin=32)
l = {
"U" : {"register": 305, "desc": "Voltage", "type": "uint16", "gain": 100, "unit": "V"},
"I" : {"register": 313, "desc":... | [
"mp_modbus_master.modbus_rtu_master",
"struct.unpack",
"time.sleep"
] | [((63, 138), 'mp_modbus_master.modbus_rtu_master', 'mmm.modbus_rtu_master', ([], {'uart_no': '(2)', 'parity': '(0)', 'tx_pin': '(12)', 'rx_pin': '(13)', 'en_pin': '(32)'}), '(uart_no=2, parity=0, tx_pin=12, rx_pin=13, en_pin=32)\n', (84, 138), True, 'import mp_modbus_master as mmm\n'), ((896, 909), 'time.sleep', 'time.... |
import copy
import re
import requests
import urllib.parse
from bs4 import BeautifulSoup
from typing import List
try:
import basesite
except (ModuleNotFoundError, ImportError) as e:
from . import basesite
class SoxsSite(basesite.BaseSite):
def __init__(self):
self.site_info = basesite.SiteInfo(
... | [
"requests.session",
"copy.deepcopy",
"basesite.Chapter",
"basesite.Book",
"re.search",
"bs4.BeautifulSoup",
"re.sub",
"basesite.SiteInfo"
] | [((300, 446), 'basesite.SiteInfo', 'basesite.SiteInfo', ([], {'type': '"""网络小说"""', 'statue': '"""上线版本"""', 'url': '"""https://www.soxs.cc"""', 'name': '"""搜小说"""', 'brief_name': '"""搜小说"""', 'version': '"""1.1"""', 'max_threading_number': '(50)'}), "(type='网络小说', statue='上线版本', url='https://www.soxs.cc',\n name='搜小... |
# You are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where each subsequences consist of at least 3 consecutive integers. Return whether you can make such a split.
#
# Example 1:
# Input: [1,2,3,3,4,5]
# Output: True
# Explanation:
# You c... | [
"collections.Counter"
] | [((823, 848), 'collections.Counter', 'collections.Counter', (['nums'], {}), '(nums)\n', (842, 848), False, 'import collections\n'), ((865, 886), 'collections.Counter', 'collections.Counter', ([], {}), '()\n', (884, 886), False, 'import collections\n')] |
# website.py
# Created by: <NAME>
# Date: 5 June 2015
# Purpouse: This file is for instantiating all the movie objects and then
# call display_page.py to render the movies in an html page
import display_page
import movie
# Creating objects for my favourite movie
cars = movie.Movie(
"Cars",
"Story ... | [
"display_page.open_movies_page",
"movie.Movie"
] | [((282, 575), 'movie.Movie', 'movie.Movie', (['"""Cars"""', '"""Story about live cars"""', '"""2006"""', '"""Pixar Animation Studios"""', '"""Walt Disney Pictures"""', '"""<NAME>"""', '"""Golden Globe Award for Best Animated Feature Film"""', '"""https://upload.wikimedia.org/wikipedia/en/3/34/Cars_2006.jpg"""', '"""htt... |
"""add Tutor and Moderator
Revision ID: 12b0e8390634
Revises: <PASSWORD>
Create Date: 2020-01-12 12:41:22.787337
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '12b0e8390634'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
... | [
"alembic.op.drop_table",
"sqlalchemy.VARCHAR",
"sqlalchemy.INTEGER",
"alembic.op.create_foreign_key",
"sqlalchemy.PrimaryKeyConstraint",
"alembic.op.drop_constraint",
"alembic.op.drop_column",
"sqlalchemy.Boolean",
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.String",
"sqlalchemy.Integer"
] | [((1385, 1451), 'alembic.op.create_foreign_key', 'op.create_foreign_key', (['None', '"""answer"""', '"""user"""', "['user_id']", "['id']"], {}), "(None, 'answer', 'user', ['user_id'], ['id'])\n", (1406, 1451), False, 'from alembic import op\n'), ((1456, 1530), 'alembic.op.create_foreign_key', 'op.create_foreign_key', (... |
# -*- coding: utf-8 -*-
# @Author : ydf
# @Time : 2019/8/8 0008 14:57
import time
from test_frame.best_simple_example.test_consume import consumer
consumer.publisher_of_same_queue.clear()
# 这里的publisher_of_same_queue 也可以使用get_publisher函数得到发布者,但需要手动确保消费者的队列名字与发布者的队列名字一致,并且中间件种类一致。用法如下。
# pb = get_publisher('queue_... | [
"time.sleep",
"test_frame.best_simple_example.test_consume.consumer.publisher_of_same_queue.publish",
"test_frame.best_simple_example.test_consume.consumer.publisher_of_same_queue.clear"
] | [((153, 193), 'test_frame.best_simple_example.test_consume.consumer.publisher_of_same_queue.clear', 'consumer.publisher_of_same_queue.clear', ([], {}), '()\n', (191, 193), False, 'from test_frame.best_simple_example.test_consume import consumer\n'), ((495, 511), 'time.sleep', 'time.sleep', (['(0.05)'], {}), '(0.05)\n',... |
#---------------------------------------------------------------------------
import warnings
import struct
import sys
sys.path.append("../../PLIDO-tanupoo")
import fragment
#import schc_fragment as fragment
sys.path.append("../python")
import BitBuffer as BitBufferModule
#-------------------------------------------... | [
"sys.path.append",
"BitBuffer.BitBuffer.__init__",
"struct.unpack",
"struct.pack",
"warnings.warn"
] | [((120, 158), 'sys.path.append', 'sys.path.append', (['"""../../PLIDO-tanupoo"""'], {}), "('../../PLIDO-tanupoo')\n", (135, 158), False, 'import sys\n'), ((210, 238), 'sys.path.append', 'sys.path.append', (['"""../python"""'], {}), "('../python')\n", (225, 238), False, 'import sys\n'), ((490, 547), 'BitBuffer.BitBuffer... |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
# <NAME>, KAIST: 2017-pres... | [
"logging.FileHandler",
"parlai.core.worlds.create_task",
"logging.StreamHandler",
"parlai.core.params.ParlaiParser",
"logging.Formatter",
"examples.train_model_seq2seq_ldecay.run_eval",
"parlai.core.agents.create_agent",
"logging.getLogger"
] | [((905, 929), 'parlai.core.params.ParlaiParser', 'ParlaiParser', (['(True)', '(True)'], {}), '(True, True)\n', (917, 929), False, 'from parlai.core.params import ParlaiParser\n'), ((2156, 2173), 'parlai.core.agents.create_agent', 'create_agent', (['opt'], {}), '(opt)\n', (2168, 2173), False, 'from parlai.core.agents im... |
from django.urls import path
from django.conf.urls import url
from reporter import views as r_views
from djgeojson.views import GeoJSONLayerView
from reporter import models as r_models
urlpatterns = [
path('home', r_views.Prohome, name='home'),
path('report/<str:code>/', r_views.Proreporter, name='code'),
... | [
"djgeojson.views.GeoJSONLayerView.as_view",
"django.urls.path"
] | [((206, 248), 'django.urls.path', 'path', (['"""home"""', 'r_views.Prohome'], {'name': '"""home"""'}), "('home', r_views.Prohome, name='home')\n", (210, 248), False, 'from django.urls import path\n'), ((254, 314), 'django.urls.path', 'path', (['"""report/<str:code>/"""', 'r_views.Proreporter'], {'name': '"""code"""'}),... |
import os
import sys
pointnet2_dir = os.path.split(os.path.abspath(__file__))[0]
main_dir = "/".join(pointnet2_dir.split("/")[0:-1])
pointnet2_ops_lib_dir = main_dir+"/pointnet2_ops_lib/"
sys.path.insert(0,main_dir)
sys.path.insert(0,pointnet2_ops_lib_dir)
import hydra
import omegaconf
import pytorch_lightning as p... | [
"os.path.abspath",
"sys.path.insert",
"surgeon_pytorch.get_layers",
"hydra.main",
"pytorch_lightning.callbacks.EarlyStopping",
"os.path.join"
] | [((191, 219), 'sys.path.insert', 'sys.path.insert', (['(0)', 'main_dir'], {}), '(0, main_dir)\n', (206, 219), False, 'import sys\n'), ((219, 260), 'sys.path.insert', 'sys.path.insert', (['(0)', 'pointnet2_ops_lib_dir'], {}), '(0, pointnet2_ops_lib_dir)\n', (234, 260), False, 'import sys\n'), ((954, 986), 'hydra.main', ... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: yacht/config/proto/policy.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import re... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor"
] | [((455, 481), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (479, 481), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((2479, 2854), 'google.protobuf.descriptor.FieldDescriptor', '_descriptor.FieldDescriptor', ([], {'name': '"""feature_extractor""... |
#!/usr/bin/env python
# coding: utf-8
import argparse
import concurrent.futures
import logging
import numpy as np
import pandas as pd
import pyBigWig
import pysam
import os
import re
import sys
from Bio import SeqIO
from Bio.Seq import Seq
from collections import Counter
from numpy.lib.stride_tricks import sliding_wind... | [
"os.remove",
"Bio.Seq.Seq",
"argparse.ArgumentParser",
"pandas.read_csv",
"re.finditer",
"numpy.clip",
"numpy.histogram",
"numpy.linalg.norm",
"pandas.DataFrame",
"logging.error",
"sys.stderr.isatty",
"os.path.exists",
"numpy.append",
"numpy.swapaxes",
"collections.Counter",
"numpy.sta... | [((519, 801), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""aligned_bam_to_cpg_scores.py"""', 'description': '"""Calculate CpG positions and scores from an aligned bam file. Outputs raw and \n coverage-filtered results in bed and bigwig format, including haplotype-specific results (when... |
import numpy as np
def get_monthly_rate(rate) -> float:
"""
computes the monthy interest rate based on the yearly interest rate
:param float rate: the yearly interest rate
:return: the monthly interest rate
This computation uses the 12th root on the growth factor
"""
growth_year = rate ... | [
"numpy.power"
] | [((343, 374), 'numpy.power', 'np.power', (['growth_year', '(1.0 / 12)'], {}), '(growth_year, 1.0 / 12)\n', (351, 374), True, 'import numpy as np\n')] |
# Open a reverse shell when executed on a victim computer.
import socket
import subprocess
HOST = "127.0.0.1"
PORT = 31337
sockobj = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sockobj.connect((HOST, PORT))
while 1:
data = sockobj.recv(4096) # returns a bytes object
# don't forget to decode the byte... | [
"socket.socket"
] | [((136, 185), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (149, 185), False, 'import socket\n')] |
########################################################################
## SPINN DESIGN CODE
# YOUTUBE: (SPINN TV) https://www.youtube.com/spinnTv
# WEBSITE: spinndesign.com
# TUTORIAL: KIVY
########################################################################
###############################################... | [
"kivy.graphics.Line",
"kivy.graphics.Ellipse",
"kivy.uix.button.Button",
"random.random",
"kivy.graphics.Color",
"kivy.uix.widget.Widget"
] | [((1776, 1784), 'kivy.uix.widget.Widget', 'Widget', ([], {}), '()\n', (1782, 1784), False, 'from kivy.uix.widget import Widget\n'), ((1895, 1915), 'kivy.uix.button.Button', 'Button', ([], {'text': '"""Clear"""'}), "(text='Clear')\n", (1901, 1915), False, 'from kivy.uix.button import Button\n'), ((1006, 1014), 'random.r... |
from copy import deepcopy
from dataclasses import dataclass
from parseridge.utils.logger import LoggerMixin
"""
TODO
[ ] Group the parameters
[ ] Add save to / load from YAML
[x] Add overwrite method from kwargs
"""
@dataclass
class Hyperparameters(LoggerMixin):
"""
Container for the various hyper-parameter... | [
"copy.deepcopy"
] | [((744, 758), 'copy.deepcopy', 'deepcopy', (['self'], {}), '(self)\n', (752, 758), False, 'from copy import deepcopy\n')] |
import pytest
from profanity.templatetags.profanity import censor
@pytest.mark.parametrize("word", ["fuck", "shit", "cunt", "ass"])
def test_censors_profane_words(word):
assert censor(word) == ("*" * len(word))
@pytest.mark.parametrize("word", ["fudge", "poop", "baddie", "butt"])
def test_does_not_censor_other_... | [
"pytest.mark.parametrize",
"profanity.templatetags.profanity.censor"
] | [((69, 133), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""word"""', "['fuck', 'shit', 'cunt', 'ass']"], {}), "('word', ['fuck', 'shit', 'cunt', 'ass'])\n", (92, 133), False, 'import pytest\n'), ((220, 288), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""word"""', "['fudge', 'poop', 'baddie',... |
from django.shortcuts import get_object_or_404, render
from django.urls import reverse
from django.http import HttpResponse, HttpResponseRedirect
import json
from .models import Color, Board, LED
def index(request):
"""Homepage"""
all_colors = Color.objects.all() # change to selected colors
all_boards ... | [
"django.shortcuts.render",
"django.shortcuts.get_object_or_404",
"django.urls.reverse"
] | [((967, 1010), 'django.shortcuts.render', 'render', (['request', '"""leds/index.html"""', 'context'], {}), "(request, 'leds/index.html', context)\n", (973, 1010), False, 'from django.shortcuts import get_object_or_404, render\n'), ((1105, 1147), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Color'], {'l... |
import numpy as np, pyemma as py
# from msmbuilder.decomposition.tica import tICA
from sklearn.kernel_approximation import Nystroem
class Kernel_tica(object):
def __init__(self, n_components, lag_time,
gamma, # gamma value for rbf kernel
n_components_nystroem=100, # ... | [
"sklearn.kernel_approximation.Nystroem",
"pyemma.coordinates.tica",
"numpy.sum",
"numpy.concatenate"
] | [((975, 1032), 'sklearn.kernel_approximation.Nystroem', 'Nystroem', ([], {'gamma': 'gamma', 'n_components': 'n_components_nystroem'}), '(gamma=gamma, n_components=n_components_nystroem)\n', (983, 1032), False, 'from sklearn.kernel_approximation import Nystroem\n'), ((1691, 1822), 'pyemma.coordinates.tica', 'py.coordina... |
import os
import subprocess
from unittest import mock
from . import BuilderTest, MockPackage, through_json
from .. import mock_open_log
from mopack.builders import Builder
from mopack.builders.custom import CustomBuilder
from mopack.iterutils import iterate
from mopack.path import Path
from mopack.shell import ShellA... | [
"mopack.builders.Builder.rehydrate",
"unittest.mock.patch.object",
"mopack.shell.ShellArguments",
"mopack.path.Path",
"mopack.iterutils.iterate",
"unittest.mock.patch",
"mopack.usage.pkg_config.PkgConfigUsage",
"mopack.builders.custom.CustomBuilder",
"os.path.join"
] | [((8989, 9030), 'os.path.join', 'os.path.join', (['self.pkgdir', '"""build"""', '"""foo"""'], {}), "(self.pkgdir, 'build', 'foo')\n", (9001, 9030), False, 'import os\n'), ((9280, 9357), 'mopack.builders.custom.CustomBuilder', 'CustomBuilder', (['"""foo"""'], {'build_commands': "['make']", 'submodules': 'None', '_option... |
import logging
import unittest
import mock
from qgis.core import QgsVectorLayer
from catatom2osm.app import QgsSingleton
from catatom2osm.geo.geometry import Geometry
from catatom2osm.geo.layer.cons import ConsLayer
from catatom2osm.geo.layer.parcel import ParcelLayer
qgs = QgsSingleton()
m_log = mock.MagicMock()
m_... | [
"qgis.core.QgsVectorLayer",
"catatom2osm.app.QgsSingleton",
"mock.patch",
"catatom2osm.geo.layer.parcel.ParcelLayer",
"catatom2osm.geo.layer.cons.ConsLayer",
"mock.MagicMock",
"catatom2osm.geo.geometry.Geometry.get_multipolygon"
] | [((278, 292), 'catatom2osm.app.QgsSingleton', 'QgsSingleton', ([], {}), '()\n', (290, 292), False, 'from catatom2osm.app import QgsSingleton\n'), ((301, 317), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (315, 317), False, 'import mock\n'), ((467, 518), 'mock.patch', 'mock.patch', (['"""catatom2osm.geo.layer.b... |
import FreeCAD, Part, Drawing, math, Mesh, importDXF
DOC = FreeCAD.activeDocument()
DOC_NAME = "part_rotor"
def clear_doc():
# Clear the active document deleting all the objects
for obj in DOC.Objects:
DOC.removeObject(obj.Name)
def setview():
# Rearrange View
FreeCAD.Gui.SendMsgToActiveVi... | [
"Mesh.export",
"FreeCAD.getDocument",
"FreeCAD.newDocument",
"importDXF.export",
"math.sin",
"FreeCAD.Gui.SendMsgToActiveView",
"FreeCAD.setActiveDocument",
"math.cos",
"FreeCAD.Gui.activeDocument",
"FreeCAD.activeDocument",
"Part.show",
"Part.makeCylinder"
] | [((60, 84), 'FreeCAD.activeDocument', 'FreeCAD.activeDocument', ([], {}), '()\n', (82, 84), False, 'import FreeCAD, Part, Drawing, math, Mesh, importDXF\n'), ((670, 724), 'Part.makeCylinder', 'Part.makeCylinder', (['(maximal_diameter / 2 - 5 - 5 - 5)', '(1)'], {}), '(maximal_diameter / 2 - 5 - 5 - 5, 1)\n', (687, 724),... |
import csv
from collections import OrderedDict
import threading
import time
from typing import Tuple
from django.http import Http404, JsonResponse
from django.shortcuts import render
from django.conf import settings
from django.contrib.auth.models import BaseUserManager, Group, User
from django.core.mail import EmailM... | [
"hknweb.utils.login_and_permission",
"threading.Thread",
"hknweb.candidate.constants.CandidateDTO",
"hknweb.thread.models.ThreadTask.objects.get",
"csv.DictReader",
"django.contrib.auth.models.User",
"hknweb.utils.get_rand_photo",
"django.contrib.auth.models.User.objects.filter",
"django.http.JsonRe... | [((698, 735), 'hknweb.utils.login_and_permission', 'login_and_permission', (['"""auth.add_user"""'], {}), "('auth.add_user')\n", (718, 735), False, 'from hknweb.utils import login_and_permission, get_rand_photo\n'), ((967, 1004), 'hknweb.utils.login_and_permission', 'login_and_permission', (['"""auth.add_user"""'], {})... |
import datetime
from flask import Flask, redirect, url_for
from flask_sqlalchemy import SQLAlchemy
from app.extensions.db import db
# from app.models import User
app = Flask(__name__)
app.config.from_object('config')
db.init_app(app)
# user_manager = UserManager(app, db, User)
# login_manager = LoginManager()
# login... | [
"flask.Flask",
"app.extensions.db.db.init_app",
"datetime.date.today"
] | [((170, 185), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (175, 185), False, 'from flask import Flask, redirect, url_for\n'), ((219, 235), 'app.extensions.db.db.init_app', 'db.init_app', (['app'], {}), '(app)\n', (230, 235), False, 'from app.extensions.db import db\n'), ((750, 771), 'datetime.date.today... |
from contextlib import closing
from downloader import AttachmentDownloader
import unittest
import shelve
import os.path
class TestOpportunityDownloader(unittest.TestCase):
def setUp(self):
self.test_data = {
'FA4626-14-R-0011': [
{
'desc': 'Solicitation',
... | [
"unittest.main",
"downloader.AttachmentDownloader",
"shelve.open"
] | [((3284, 3299), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3297, 3299), False, 'import unittest\n'), ((2307, 2370), 'downloader.AttachmentDownloader', 'AttachmentDownloader', ([], {'shelf': '"""test_attach"""', 'dl_dir': '"""py_test_dls"""'}), "(shelf='test_attach', dl_dir='py_test_dls')\n", (2327, 2370), Fal... |
from statsAuxiliary.statsAuxiliary import StatsAuxiliary
from generalStatistics.generalMedian import general_median
from generalStatistics.generalMode import general_mode
from generalStatistics.generalMean import general_mean
class GeneralStatistics(StatsAuxiliary):
result = 0
def __init__(self):
sup... | [
"generalStatistics.generalMode.general_mode",
"generalStatistics.generalMedian.general_median",
"generalStatistics.generalMean.general_mean"
] | [((397, 412), 'generalStatistics.generalMean.general_mean', 'general_mean', (['a'], {}), '(a)\n', (409, 412), False, 'from generalStatistics.generalMean import general_mean\n'), ((490, 507), 'generalStatistics.generalMedian.general_median', 'general_median', (['a'], {}), '(a)\n', (504, 507), False, 'from generalStatist... |
# -*- coding: utf-8 -*-
from django import forms
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from .models import Address
from .widgets import AddressWithMapWidget
class HasExceptionFilter(admin.SimpleListFilter):
title = _("exception")
parameter_name = "has_except... | [
"django.utils.translation.gettext_lazy"
] | [((273, 287), 'django.utils.translation.gettext_lazy', '_', (['"""exception"""'], {}), "('exception')\n", (274, 287), True, 'from django.utils.translation import gettext_lazy as _\n'), ((404, 412), 'django.utils.translation.gettext_lazy', '_', (['"""Yes"""'], {}), "('Yes')\n", (405, 412), True, 'from django.utils.trans... |
from django.urls import path, include
urlpatterns = [
path('api/', include(('rachis.apps.authentication.urls'), namespace='auth')),
path('api/', include(('rachis.apps.resource.urls'), namespace='resources')),
] | [
"django.urls.include"
] | [((94, 154), 'django.urls.include', 'include', (['"""rachis.apps.authentication.urls"""'], {'namespace': '"""auth"""'}), "('rachis.apps.authentication.urls', namespace='auth')\n", (101, 154), False, 'from django.urls import path, include\n'), ((176, 235), 'django.urls.include', 'include', (['"""rachis.apps.resource.url... |
# -*- coding: utf-8 -*-
from benedict import benedict
import unittest
class benedict_casting_test_case(unittest.TestCase):
def test__getitem__(self):
d = {
'a': 1,
'b': {
'c': {
'd': 2,
},
},
}
b = b... | [
"benedict.benedict"
] | [((319, 330), 'benedict.benedict', 'benedict', (['d'], {}), '(d)\n', (327, 330), False, 'from benedict import benedict\n'), ((733, 744), 'benedict.benedict', 'benedict', (['d'], {}), '(d)\n', (741, 744), False, 'from benedict import benedict\n'), ((758, 769), 'benedict.benedict', 'benedict', (['b'], {}), '(b)\n', (766,... |
import time
from typing import Any, Dict, List
from configs import GLOBAL_QUEUE_NAMES
from nxs_libs.queue import NxsQueueType
from nxs_libs.simple_key_value_db import NxsSimpleKeyValueDbType
from nxs_types.log import NxsBackendCmodelThroughputLog, NxsBackendThroughputLog
from nxs_types.nxs_args import NxsBackendMonitor... | [
"nxs_utils.nxs_helper.create_simple_key_value_db_from_args",
"nxs_utils.nxs_helper.create_queue_puller_from_args",
"main_processes.backend_monitor.args.parse_args",
"time.sleep",
"time.time"
] | [((2212, 2224), 'main_processes.backend_monitor.args.parse_args', 'parse_args', ([], {}), '()\n', (2222, 2224), False, 'from main_processes.backend_monitor.args import parse_args\n'), ((659, 752), 'nxs_utils.nxs_helper.create_queue_puller_from_args', 'create_queue_puller_from_args', (['args', 'NxsQueueType.REDIS', 'GLO... |
# -*- coding: utf-8 -*-
# Copyright 2020 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import unittest
from ansible.errors import AnsibleError
from ansible.errors import Ansi... | [
"ansible_collections.ansible.utils.plugins.filter.from_xml._from_xml"
] | [((1461, 1477), 'ansible_collections.ansible.utils.plugins.filter.from_xml._from_xml', '_from_xml', (['*args'], {}), '(*args)\n', (1470, 1477), False, 'from ansible_collections.ansible.utils.plugins.filter.from_xml import _from_xml\n'), ((1116, 1142), 'ansible_collections.ansible.utils.plugins.filter.from_xml._from_xml... |
import io
import json
import os
import sys
from http.server import ThreadingHTTPServer
from mjpegserver import StreamingHandler
from threading import Condition
from threading import Thread
import basler
from utility import ePrint
"""
FrameBuffer is a synchronized buffer which gets each frame and notifies to all waitin... | [
"threading.Thread",
"io.BytesIO",
"json.load",
"os.path.realpath",
"threading.Condition",
"mjpegserver.StreamingHandler",
"utility.DataStreamer",
"utility.ePrint",
"basler.Basler"
] | [((468, 480), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (478, 480), False, 'import io\n'), ((506, 517), 'threading.Condition', 'Condition', ([], {}), '()\n', (515, 517), False, 'from threading import Condition\n'), ((953, 969), 'utility.ePrint', 'ePrint', (['sys.argv'], {}), '(sys.argv)\n', (959, 969), False, 'from... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# FEDERAL UNIVERSITY OF UBERLANDIA
# Faculty of Electrical Engineering
# Biomedical Engineering Lab
# ------------------------------------------------------------------------------
# Author: <NAME>
# Contact: <EMAIL... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.figure",
"matlab_fspecial.fspecial",
"scipy.ndimage.uniform_filter",
"scipy.misc.imread"
] | [((2556, 2566), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2564, 2566), True, 'import matplotlib.pyplot as plt\n'), ((1113, 1146), 'scipy.misc.imread', 'imread', (['(files_folder + image_name)'], {}), '(files_folder + image_name)\n', (1119, 1146), False, 'from scipy.misc import imread\n'), ((1623, 1635), ... |
#!/usr/bin/env python3
'''
Export lastFM data as JSON files and merge them into a flat pandas.DataFrame.
'''
from __future__ import annotations # [PEP 563 -- Postponed Evaluation of Annotations](https://www.python.org/dev/peps/pep-0563/)
from apiWrapper import Param, getReq
from util import flattenDF, loadJSON, merge... | [
"json.dump",
"util.mergeRecentTracks",
"util.flattenDF",
"time.sleep",
"apiWrapper.getReq",
"enlighten.get_manager",
"apiWrapper.Param",
"util.writeCSV",
"util.loadJSON",
"datetime.datetime.now"
] | [((1716, 1731), 'util.loadJSON', 'loadJSON', (['param'], {}), '(param)\n', (1724, 1731), False, 'from util import flattenDF, loadJSON, mergeRecentTracks, writeCSV\n'), ((1741, 1788), 'util.flattenDF', 'flattenDF', ([], {'param': 'param', 'DF': 'DF', 'writeToDisk': '(True)'}), '(param=param, DF=DF, writeToDisk=True)\n',... |
#!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import
import csv
import sys
import duo_client
import json
from six.moves import input
argv_iter = iter(sys.argv[1:])
def get_next_arg(prompt):
try:
return next(argv_iter)
except StopIteration:
return ... | [
"six.moves.input",
"csv.writer"
] | [((972, 994), 'csv.writer', 'csv.writer', (['sys.stdout'], {}), '(sys.stdout)\n', (982, 994), False, 'import csv\n'), ((320, 333), 'six.moves.input', 'input', (['prompt'], {}), '(prompt)\n', (325, 333), False, 'from six.moves import input\n')] |
from django.contrib import admin
from .models import Post,Location
# Register your models here.
admin.site.register(Post)
admin.site.register(Location)
| [
"django.contrib.admin.site.register"
] | [((98, 123), 'django.contrib.admin.site.register', 'admin.site.register', (['Post'], {}), '(Post)\n', (117, 123), False, 'from django.contrib import admin\n'), ((124, 153), 'django.contrib.admin.site.register', 'admin.site.register', (['Location'], {}), '(Location)\n', (143, 153), False, 'from django.contrib import adm... |
'''
Created on 28 nov. 2021
@author: reinaqu_2
'''
import configurations
import DashboardDataExtraction as datextdash
import PublicationsQuality as pubq
from typing import TypeVar,Callable,Dict,List, Set
K = TypeVar('K')
V = TypeVar('V')
def mostrar_dict(d: Dict[str, Set[str]]):
for k,v in sorted(d.items()):
... | [
"PublicationsQuality.PublicationsQuality.of_excel",
"typing.TypeVar"
] | [((210, 222), 'typing.TypeVar', 'TypeVar', (['"""K"""'], {}), "('K')\n", (217, 222), False, 'from typing import TypeVar, Callable, Dict, List, Set\n'), ((227, 239), 'typing.TypeVar', 'TypeVar', (['"""V"""'], {}), "('V')\n", (234, 239), False, 'from typing import TypeVar, Callable, Dict, List, Set\n'), ((466, 541), 'Pub... |
from zci_bio.annotations.steps import AnnotationsStep
from common_utils.file_utils import write_fasta # copy_file, link_file
_instructions = """
Open web page http://www.herbalgenomics.org/cpgavas/
Probably one of mirrors:
Mirror 1: Central China : http://172.16.17.32:16019/analyzer/home
Mirror 2: East Coast USA :... | [
"zci_bio.annotations.steps.AnnotationsStep"
] | [((908, 976), 'zci_bio.annotations.steps.AnnotationsStep', 'AnnotationsStep', (['sequences_step.project', 'step_data'], {'remove_data': '(True)'}), '(sequences_step.project, step_data, remove_data=True)\n', (923, 976), False, 'from zci_bio.annotations.steps import AnnotationsStep\n')] |
# Copyright 2012 Hewlett-Packard Development Company, L.P. All Rights Reserved.
# Copyright 2012 Managed I.T.
#
# Author: <NAME> <<EMAIL>>
# Author: <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a ... | [
"designate.backend.impl_powerdns.tables.domain_metadata.delete",
"designate.sqlalchemy.expressions.InsertFromSelect",
"designate.openstack.common.excutils.save_and_reraise_exception",
"designate.exceptions.RecordNotFound",
"designate.exceptions.NotImplemented",
"oslo.config.cfg.OptGroup",
"designate.bac... | [((1199, 1226), 'designate.openstack.common.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1216, 1226), True, 'from designate.openstack.common import log as logging\n'), ((1305, 1391), 'oslo.config.cfg.OptGroup', 'cfg.OptGroup', ([], {'name': '"""backend:powerdns"""', 'title': '"""Configurati... |
from setuptools import (setup, find_namespace_packages)
from os import path
from pkg_resources import parse_version
from pyrsched.rpc import (NAME, VERSION)
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
LONG_DESCRIPTION = f.read()
setup(
name=NAM... | [
"setuptools.find_namespace_packages",
"os.path.dirname",
"os.path.join"
] | [((179, 201), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (191, 201), False, 'from os import path\n'), ((214, 242), 'os.path.join', 'path.join', (['here', '"""README.md"""'], {}), "(here, 'README.md')\n", (223, 242), False, 'from os import path\n'), ((926, 973), 'setuptools.find_namespace_pac... |
import sys
sys.path.append('../src/')
import os
import numpy as np
from mask_rcnn.mrcnn import utils
import mask_rcnn.mrcnn.model as modellib
from mask_rcnn.samples.coco import coco
import cv2
import argparse as ap
class InferenceConfig(coco.CocoConfig):
# Set batch size to 1 since we'll be running inference on
... | [
"sys.path.append",
"os.mkdir",
"cv2.equalizeHist",
"argparse.ArgumentParser",
"cv2.cvtColor",
"os.path.exists",
"numpy.shape",
"cv2.imread",
"numpy.where",
"mask_rcnn.mrcnn.model.MaskRCNN",
"os.path.join",
"os.listdir",
"cv2.resize"
] | [((11, 37), 'sys.path.append', 'sys.path.append', (['"""../src/"""'], {}), "('../src/')\n", (26, 37), False, 'import sys\n'), ((591, 620), 'numpy.where', 'np.where', (["(r['class_ids'] != 0)"], {}), "(r['class_ids'] != 0)\n", (599, 620), True, 'import numpy as np\n'), ((831, 853), 'numpy.where', 'np.where', (['(scores ... |
#!/usr/bin/env python3
from kanren import run, var, fact
from kanren.assoccomm import eq_assoccomm as eq
from kanren.assoccomm import commutative, associative
#define math operations
add = 'add'
mul = 'mul'
#define commutative/associative
fact(commutative, mul)
fact(commutative, add)
fact(associative, mul)
fact(asso... | [
"kanren.assoccomm.eq_assoccomm",
"kanren.var",
"kanren.fact"
] | [((242, 264), 'kanren.fact', 'fact', (['commutative', 'mul'], {}), '(commutative, mul)\n', (246, 264), False, 'from kanren import run, var, fact\n'), ((265, 287), 'kanren.fact', 'fact', (['commutative', 'add'], {}), '(commutative, add)\n', (269, 287), False, 'from kanren import run, var, fact\n'), ((288, 310), 'kanren.... |
import random
import string
from datetime import datetime
import json
from signup import db
from signup import emails
from mailgun import api as mailgun_api
from sequence import models as sequence_model
def create_signup( email, questions ):
""" Add signup to the current sequence """
sequence = sequence_mod... | [
"signup.db.UserSignup.objects.get",
"json.loads",
"mailgun.api.delete_all_unsubscribes",
"random.choice",
"json.dumps",
"datetime.datetime.utcnow",
"sequence.models.sequence_list_name",
"signup.db.UserSignup.objects.filter",
"sequence.models.get_current_sequence_number",
"mailgun.api.add_list_memb... | [((308, 352), 'sequence.models.get_current_sequence_number', 'sequence_model.get_current_sequence_number', ([], {}), '()\n', (350, 352), True, 'from sequence import models as sequence_model\n'), ((602, 619), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (617, 619), False, 'from datetime import dateti... |
"""Contains the ShotGroup base class."""
from collections import deque
from mpf.core.device_monitor import DeviceMonitor
from mpf.core.events import event_handler
from mpf.core.mode import Mode
from mpf.core.mode_device import ModeDevice
from mpf.core.player import Player
@DeviceMonitor("common_state", "rotation_e... | [
"mpf.core.device_monitor.DeviceMonitor",
"collections.deque",
"mpf.core.events.event_handler"
] | [((279, 328), 'mpf.core.device_monitor.DeviceMonitor', 'DeviceMonitor', (['"""common_state"""', '"""rotation_enabled"""'], {}), "('common_state', 'rotation_enabled')\n", (292, 328), False, 'from mpf.core.device_monitor import DeviceMonitor\n'), ((3187, 3203), 'mpf.core.events.event_handler', 'event_handler', (['(2)'], ... |
import argparse
from copy import deepcopy
from pprint import pprint
import torch.backends
from PIL import Image
from torch import optim
from torchvision.transforms import transforms
from tqdm import tqdm
from baal import get_heuristic, ActiveLearningLoop
from baal.bayesian.dropout import MCDropoutModule
from baal imp... | [
"baal.bayesian.dropout.MCDropoutModule",
"baal.get_heuristic",
"baal.ActiveLearningLoop",
"argparse.ArgumentParser",
"utils.active_pascal",
"torchvision.transforms.transforms.ToTensor",
"torch.nn.functional.adaptive_avg_pool2d",
"utils.FocalLoss",
"torch.cuda.is_available",
"pprint.pprint",
"baa... | [((829, 862), 'torch.from_numpy', 'torch.from_numpy', (['n[:, None, ...]'], {}), '(n[:, None, ...])\n', (845, 862), False, 'import torch\n'), ((907, 942), 'torch.nn.functional.adaptive_avg_pool2d', 'F.adaptive_avg_pool2d', (['n', 'grid_size'], {}), '(n, grid_size)\n', (928, 942), True, 'import torch.nn.functional as F\... |
""" Test suite for the murls module. """
from murls import http, https
def test_init():
assert http('site.com') == 'http://site.com'
assert https('site.com') == 'https://site.com'
def test_path():
url = http('site.com')
assert url.path('foo', 'bar') == 'http://site.com/foo/bar'
assert url.path... | [
"murls.http",
"murls.https"
] | [((221, 237), 'murls.http', 'http', (['"""site.com"""'], {}), "('site.com')\n", (225, 237), False, 'from murls import http, https\n'), ((383, 399), 'murls.http', 'http', (['"""site.com"""'], {}), "('site.com')\n", (387, 399), False, 'from murls import http, https\n'), ((103, 119), 'murls.http', 'http', (['"""site.com""... |
import os
import sys
import asyncio
import debugpy
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from sqlalchemy.ext.asyncio import AsyncEngine
from sqlalchemy.ext.asyncio import create_async_engine
from alembic import context
from alembic.config import Config
# debugpy.listen(5678)
# print("... | [
"sys.platform.startswith",
"alembic.context.is_offline_mode",
"os.path.abspath",
"alembic.config.Config",
"alembic.context.begin_transaction",
"sqlalchemy.ext.asyncio.create_async_engine",
"alembic.context.configure",
"alembic.context.run_migrations",
"os.getenv",
"asyncio.WindowsSelectorEventLoop... | [((515, 545), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (538, 545), False, 'import sys\n'), ((3228, 3381), 'alembic.context.configure', 'context.configure', ([], {'url': 'url', 'target_metadata': 'target_metadata', 'literal_binds': '(True)', 'include_object': 'include_objec... |
from abc import ABC, abstractmethod
from collections import OrderedDict
from functools import reduce
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import gym
import matplotlib.pyplot as plt
class Params():
"""
policy which outputs the policy parameters directly, i.e. ... | [
"numpy.random.randn"
] | [((517, 546), 'numpy.random.randn', 'np.random.randn', (['self.dim_act'], {}), '(self.dim_act)\n', (532, 546), True, 'import numpy as np\n')] |
from sklearn.model_selection import StratifiedKFold
import pandas as pd
skf = StratifiedKFold(n_splits=10, random_state=48, shuffle=True)
def CV(predictors,target):
for fold, (train_index, test_index) in enumerate(skf.split(predictors, target)):
x_train, x_valid = pd.DataFrame(predictors.iloc[train_i... | [
"pandas.DataFrame",
"sklearn.model_selection.StratifiedKFold"
] | [((79, 138), 'sklearn.model_selection.StratifiedKFold', 'StratifiedKFold', ([], {'n_splits': '(10)', 'random_state': '(48)', 'shuffle': '(True)'}), '(n_splits=10, random_state=48, shuffle=True)\n', (94, 138), False, 'from sklearn.model_selection import StratifiedKFold\n'), ((284, 326), 'pandas.DataFrame', 'pd.DataFrame... |
import socket
import nengo
import numpy as np
import pytest
from nengo.exceptions import SimulationError
from nengo_loihi.block import Axon, LoihiBlock, Synapse
from nengo_loihi.builder.builder import Model
from nengo_loihi.builder.discretize import discretize_model
from nengo_loihi.hardware import interface as hardw... | [
"nengo_loihi.builder.builder.Model",
"nengo_loihi.block.Axon",
"numpy.random.randint",
"nengo.Connection",
"nengo_loihi.hardware.builder.build_board",
"pytest.warns",
"nengo.Node",
"nengo_loihi.block.LoihiBlock",
"nengo_loihi.hardware.interface.HostSnip",
"pytest.raises",
"nengo.Network",
"nen... | [((4928, 4988), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:Model is precomputable."""'], {}), "('ignore:Model is precomputable.')\n", (4954, 4988), False, 'import pytest\n'), ((1655, 1683), 'pytest.importorskip', 'pytest.importorskip', (['"""nxsdk"""'], {}), "('nxsdk')\n", (1674, 1683), Fa... |
import shutil
import subprocess
import json
import os
# CLEANUP
MANIFEST_FILE = "manifest.json"
def cleanup_disabled_features():
print("⚒ Cleaning up...")
with open(MANIFEST_FILE) as manifest_file:
manifest = json.load(manifest_file)
for feature in manifest["features"]:
if not feature["e... | [
"os.remove",
"json.load",
"os.path.isdir",
"os.path.isfile",
"shutil.rmtree",
"subprocess.check_call"
] | [((529, 553), 'os.path.isfile', 'os.path.isfile', (['resource'], {}), '(resource)\n', (543, 553), False, 'import os\n'), ((1100, 1157), 'subprocess.check_call', 'subprocess.check_call', (["['python3', '-m', 'venv', '.venv']"], {}), "(['python3', '-m', 'venv', '.venv'])\n", (1121, 1157), False, 'import subprocess\n'), (... |
#import numpy as np
import jax.numpy as jnp
import pyqmc.eval_ecp as eval_ecp
from pyqmc.distance import RawDistance
def ee_energy(configs):
ne = configs.shape[1]
if ne == 1:
return jnp.zeros(configs.shape[0])
ee = jnp.zeros(configs.shape[0])
ee, ij = RawDistance().dist_matrix(configs)
ee ... | [
"jax.numpy.array",
"jax.numpy.sum",
"jax.numpy.linalg.norm",
"pyqmc.distance.RawDistance",
"jax.numpy.zeros",
"pyqmc.eval_ecp.ecp"
] | [((237, 264), 'jax.numpy.zeros', 'jnp.zeros', (['configs.shape[0]'], {}), '(configs.shape[0])\n', (246, 264), True, 'import jax.numpy as jnp\n'), ((322, 349), 'jax.numpy.linalg.norm', 'jnp.linalg.norm', (['ee'], {'axis': '(2)'}), '(ee, axis=2)\n', (337, 349), True, 'import jax.numpy as jnp\n'), ((361, 386), 'jax.numpy.... |
from app.models import DataSource, DataSourcePoll
def fetch_all_data_sources():
try:
all_data_sources = DataSource.query.all()
except Exception:
print("error fetching data sources; table likely empty")
all_data_sources = []
return all_data_sources
def fetch_all_data_source_polls(... | [
"app.models.DataSourcePoll.query.all",
"app.models.DataSource.query.all"
] | [((118, 140), 'app.models.DataSource.query.all', 'DataSource.query.all', ([], {}), '()\n', (138, 140), False, 'from app.models import DataSource, DataSourcePoll\n'), ((364, 390), 'app.models.DataSourcePoll.query.all', 'DataSourcePoll.query.all', ([], {}), '()\n', (388, 390), False, 'from app.models import DataSource, D... |
import os
import numpy as np
# from skimage.io import imread
import cv2
import copy
from skimage.transform import resize
def load_data_siamese(x_size,y_size,data_path,label_path,image_s_path,uncentain_path,validation_name,test_name):
tmp = np.loadtxt(label_path, dtype=np.str, delimiter=",")
# delete one image ... | [
"cv2.imread",
"numpy.append",
"numpy.loadtxt",
"numpy.argwhere",
"numpy.delete",
"cv2.resize"
] | [((245, 296), 'numpy.loadtxt', 'np.loadtxt', (['label_path'], {'dtype': 'np.str', 'delimiter': '""","""'}), "(label_path, dtype=np.str, delimiter=',')\n", (255, 296), True, 'import numpy as np\n'), ((431, 463), 'numpy.delete', 'np.delete', (['tmp', '(8252 + 1)'], {'axis': '(0)'}), '(tmp, 8252 + 1, axis=0)\n', (440, 463... |
# -*- coding: utf-8 -*-
"""
Simple logging class
Released under the MIT license
Copyright (c) 2012, <NAME>
@category misc
@version $Id: 1.7.0, 2016-08-22 14:53:29 ACST $;
@author <NAME>
@license http://opensource.org/licenses/MIT
"""
import logging
import os
import sys
class Logger(object):
def _... | [
"os.path.abspath",
"logging.FileHandler",
"logging.StreamHandler",
"logging.Formatter",
"logging.getLogger"
] | [((401, 499), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""', '"""%Y-%m-%d %H:%M:%S"""'], {}), "('%(asctime)s - %(name)s - %(levelname)s - %(message)s',\n '%Y-%m-%d %H:%M:%S')\n", (418, 499), False, 'import logging\n'), ((919, 942), 'logging.getLogger', 'logg... |
import os
import signal
import sys
import traceback
import time
from django.core.wsgi import get_wsgi_application
#from whitenoise.django import DjangoWhiteNoise
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "RiverFlows.settings")
application = get_wsgi_application()
#application = DjangoWhiteNoise(application)
| [
"django.core.wsgi.get_wsgi_application",
"os.environ.setdefault"
] | [((164, 234), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""RiverFlows.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'RiverFlows.settings')\n", (185, 234), False, 'import os\n'), ((250, 272), 'django.core.wsgi.get_wsgi_application', 'get_wsgi_application', ([], {}), '()\n', (... |
import pytest
import subprocess
from tests.utils import ingest_file_via_rest
from tests.utils import delete_urns_from_file
@pytest.fixture(scope="module", autouse=True)
def ingest_cleanup_data():
print("ingesting test data")
ingest_file_via_rest("tests/cypress/data.json")
yield
print("removing test d... | [
"tests.utils.ingest_file_via_rest",
"pytest.fixture",
"subprocess.Popen",
"tests.utils.delete_urns_from_file"
] | [((127, 171), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'autouse': '(True)'}), "(scope='module', autouse=True)\n", (141, 171), False, 'import pytest\n'), ((236, 283), 'tests.utils.ingest_file_via_rest', 'ingest_file_via_rest', (['"""tests/cypress/data.json"""'], {}), "('tests/cypress/data.json'... |
from os.path import dirname, join
import glob
from pathlib import Path
modules = glob.glob(join(dirname(__file__), '**/*.py'), recursive=True)
# __all__ = [basename(f)[:-3] for f in modules if isfile(f) and not f.startswith('_')]
paths = [Path(x) for x in modules]
__all__ = [
f'{p.parent.name}.{p.stem}' for p in p... | [
"pathlib.Path",
"os.path.dirname"
] | [((240, 247), 'pathlib.Path', 'Path', (['x'], {}), '(x)\n', (244, 247), False, 'from pathlib import Path\n'), ((97, 114), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (104, 114), False, 'from os.path import dirname, join\n')] |
# Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... | [
"mindspore.ops.ReduceSum",
"mindspore.nn.BCELoss"
] | [((907, 935), 'mindspore.nn.BCELoss', 'nn.BCELoss', ([], {'reduction': '"""mean"""'}), "(reduction='mean')\n", (917, 935), True, 'import mindspore.nn as nn\n'), ((955, 995), 'mindspore.ops.ReduceSum', 'mindspore.ops.ReduceSum', ([], {'keep_dims': '(False)'}), '(keep_dims=False)\n', (978, 995), False, 'import mindspore\... |
# -*- encoding: utf-8 -*-
#
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | [
"sqlalchemy.func.sum",
"ceilometer.storage.sqlalchemy.models.Meter.sources.any",
"ceilometer.openstack.common.timeutils.delta_seconds",
"ceilometer.storage.sqlalchemy.models.Meter",
"ceilometer.storage.sqlalchemy.session.get_session",
"ceilometer.storage.sqlalchemy.models.Resource.sources.any",
"ceilome... | [((1206, 1229), 'ceilometer.openstack.common.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (1219, 1229), False, 'from ceilometer.openstack.common import log\n'), ((4592, 4633), 'ceilometer.storage.sqlalchemy.session.get_session', 'sqlalchemy_session.get_session', (['url', 'conf'], {}), '(url, con... |
from setuptools import setup, find_packages
with open('README.md') as f:
readme = f.read()
setup(
name='plaza_routing',
version='0.0.1',
description='Plaza routing service for plazaroute',
long_description=readme,
author='<NAME>, <NAME>',
author_email='<EMAIL>',
url='https://github.c... | [
"setuptools.find_packages"
] | [((387, 427), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "('tests', 'docs')"}), "(exclude=('tests', 'docs'))\n", (400, 427), False, 'from setuptools import setup, find_packages\n')] |
from flask import Flask, render_template, request, url_for
from datetime import datetime
from readWeather import readWeather
app = Flask(__name__)
@app.route("/", methods=['GET', 'POST'])
def print_form():
now = datetime.now()
timeString = now.strftime("%Y-%m-%d %H:%M")
templateData = {
'title' :... | [
"flask.Flask",
"datetime.datetime.now",
"readWeather.readWeather",
"flask.render_template"
] | [((131, 146), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (136, 146), False, 'from flask import Flask, render_template, request, url_for\n'), ((219, 233), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (231, 233), False, 'from datetime import datetime\n'), ((448, 483), 'readWeather.readWeath... |
from datetime import datetime
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.python_operator import PythonOperator
from somalia.form.main import main
from somalia.form.somalia_form_data import run_form_data_scraping
from somalia.gsheets.somalia_sheet import mai... | [
"airflow.operators.bash_operator.BashOperator",
"utils.debugger.enable_cloud_debugger",
"airflow.operators.python_operator.PythonOperator",
"datetime.datetime"
] | [((409, 432), 'utils.debugger.enable_cloud_debugger', 'enable_cloud_debugger', ([], {}), '()\n', (430, 432), False, 'from utils.debugger import enable_cloud_debugger\n'), ((743, 830), 'airflow.operators.bash_operator.BashOperator', 'BashOperator', ([], {'task_id': '"""Echo"""', 'bash_command': '"""echo "Getting Somalia... |
# -*- coding: utf-8 -*-
"""Gtk.TreeView(), Gtk.TreeStore()."""
import gi
gi.require_version(namespace='Gtk', version='3.0')
from gi.repository import Gtk
class Handler:
brazilian_cities = {
'SP': ['Botucatu', 'São Manuel'],
'SC': ['Florianópolis', 'Joinville']
}
def __init__(self):
... | [
"gi.repository.Gtk.Builder.new",
"gi.require_version",
"gi.repository.Gtk.main"
] | [((75, 125), 'gi.require_version', 'gi.require_version', ([], {'namespace': '"""Gtk"""', 'version': '"""3.0"""'}), "(namespace='Gtk', version='3.0')\n", (93, 125), False, 'import gi\n'), ((1207, 1224), 'gi.repository.Gtk.Builder.new', 'Gtk.Builder.new', ([], {}), '()\n', (1222, 1224), False, 'from gi.repository import ... |
# -*- coding: utf-8; -*-
import pathlib
import matplotlib.pyplot as plt
import dolfin
from extrafeathers import meshfunction
from extrafeathers import meshiowrapper
from extrafeathers import plotmagic
print(pathlib.Path.cwd())
meshiowrapper.import_gmsh(src="demo/meshes/box.msh",
dst="dem... | [
"extrafeathers.meshiowrapper.import_gmsh",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"extrafeathers.plotmagic.plot_facet_meshfunction",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.suptitle",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.axis",
"dolfin.plot",
"matplotlib.pyplot.colorb... | [((233, 311), 'extrafeathers.meshiowrapper.import_gmsh', 'meshiowrapper.import_gmsh', ([], {'src': '"""demo/meshes/box.msh"""', 'dst': '"""demo/meshes/box.h5"""'}), "(src='demo/meshes/box.msh', dst='demo/meshes/box.h5')\n", (258, 311), False, 'from extrafeathers import meshiowrapper\n'), ((406, 456), 'extrafeathers.mes... |