code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from gensim.models import FastText
from gensim.models import word2vec
import logging
import argparse
def fasttext_train(tool):
assert tool == 'fasttext' or tool == 'word2vec', 'you can choose: [word2vec, fasttext]'
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
... | [
"logging.basicConfig",
"gensim.models.word2vec.Word2Vec.load",
"gensim.models.word2vec.Word2Vec",
"argparse.ArgumentParser",
"gensim.models.word2vec.LineSentence",
"gensim.models.FastText",
"gensim.models.FastText.load"
] | [((225, 320), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s : %(levelname)s : %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s : %(levelname)s : %(message)s',\n level=logging.INFO)\n", (244, 320), False, 'import logging\n'), ((333, 384), 'gensim.models.word2vec.LineSe... |
import unittest
from parameterized import parameterized as p
from solns.petriDish.petriDish import *
class UnitTest_PetriDish(unittest.TestCase):
@p.expand([
[]
])
def test_naive(self):
pass
| [
"parameterized.parameterized.expand"
] | [((153, 167), 'parameterized.parameterized.expand', 'p.expand', (['[[]]'], {}), '([[]])\n', (161, 167), True, 'from parameterized import parameterized as p\n')] |
"""Lab 2: Higher Order Functions & Lambdas"""
from utils import letter_to_num, num_to_letter, looper, mirror_letter
def make_derivative(f, h=1e-5):
"""Returns a function that approximates the derivative of f.
Recall that f'(a) = (f(a + h) - f(a)) / h as h approaches 0. We will
approximate the derivative b... | [
"utils.letter_to_num",
"utils.looper"
] | [((1856, 1866), 'utils.looper', 'looper', (['f1'], {}), '(f1)\n', (1862, 1866), False, 'from utils import letter_to_num, num_to_letter, looper, mirror_letter\n'), ((1868, 1878), 'utils.looper', 'looper', (['f2'], {}), '(f2)\n', (1874, 1878), False, 'from utils import letter_to_num, num_to_letter, looper, mirror_letter\... |
import numpy as np
class Player:
def __init__(self, strategy=0):
"""
:param strategy: defines the strategy to be played by the player as
0: always defect
1: always coorporate
2: random
3: tit for tat
4: tit for two tats
default: 0
"""
... | [
"numpy.random.rand"
] | [((2579, 2595), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (2593, 2595), True, 'import numpy as np\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import numpy
import sys
import subprocess
import platform
import shutil
import distutils.spawn
from setuptools import setup, Extension
from setuptools.command.sdist import sdist
from distutils.command.build_ext import build_ext
# some paranoia to start with
# ... | [
"os.path.exists",
"os.makedirs",
"distutils.command.build_ext.build_ext.run",
"os.path.join",
"setuptools.setup",
"setuptools.command.sdist.sdist.run",
"os.getcwd",
"setuptools.Extension",
"os.path.realpath",
"platform.system",
"os.chdir",
"shutil.copyfile",
"shutil.copytree",
"shutil.rmtr... | [((886, 937), 'os.path.join', 'os.path.join', (['DIR_PREFIX', '"""build"""', '"""release_notest"""'], {}), "(DIR_PREFIX, 'build', 'release_notest')\n", (898, 937), False, 'import os\n'), ((1077, 1119), 'os.path.join', 'os.path.join', (['DIR_PREFIX', '"""src"""', '"""include"""'], {}), "(DIR_PREFIX, 'src', 'include')\n"... |
import logging,pytest
from Tensile.SolutionStructs import Convolution
log =logging.getLogger("testlog")
"""
These tests run the convolution-vs-contraction mode always
"""
def test_simple(run_convolution_vs_contraction):
z={} # problemType definition
conv = Convolution(z, 'ConvolutionForward',
co... | [
"logging.getLogger",
"pytest.mark.skip",
"Tensile.SolutionStructs.Convolution"
] | [((75, 103), 'logging.getLogger', 'logging.getLogger', (['"""testlog"""'], {}), "('testlog')\n", (92, 103), False, 'import logging, pytest\n'), ((1058, 1122), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""dilationY breaks conv reference model"""'}), "(reason='dilationY breaks conv reference model')\n", (1... |
# -*- encoding: utf-8 -*-
from nose.tools import *
from nose import SkipTest
import networkx as nx
from networkx.utils import *
def test_is_string_like():
assert_true(is_string_like("aaaa"))
assert_false(is_string_like(None))
assert_false(is_string_like(123))
def test_iterable():
assert_false(iterable... | [
"nose.SkipTest",
"networkx.complete_graph",
"numpy.array"
] | [((537, 558), 'networkx.complete_graph', 'nx.complete_graph', (['(10)'], {}), '(10)\n', (554, 558), True, 'import networkx as nx\n'), ((2434, 2453), 'numpy.array', 'numpy.array', (['[2, 1]'], {}), '([2, 1])\n', (2445, 2453), False, 'import numpy\n'), ((2908, 2939), 'numpy.array', 'numpy.array', (['[[20, 10], [2, 1]]'],... |
import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions.categorical import Categorical
from src.util import init_weights, init_gate
from src.module import VGGExtractor, CNNExtractor, RNNLayer, ScaleDotAttention, LocationAwareAttention
class ASR(nn.Mo... | [
"torch.nn.Dropout",
"src.module.ScaleDotAttention",
"src.module.LocationAwareAttention",
"src.module.VGGExtractor",
"torch.rand",
"torch.nn.ModuleList",
"torch.stack",
"torch.distributions.categorical.Categorical",
"torch.cat",
"src.util.init_gate",
"src.module.RNNLayer",
"torch.nn.Linear",
... | [((7949, 7975), 'torch.nn.Linear', 'nn.Linear', (['dim', 'vocab_size'], {}), '(dim, vocab_size)\n', (7958, 7975), True, 'import torch.nn as nn\n'), ((8005, 8024), 'torch.nn.Dropout', 'nn.Dropout', (['dropout'], {}), '(dropout)\n', (8015, 8024), True, 'import torch.nn as nn\n'), ((10856, 10888), 'torch.nn.Linear', 'nn.L... |
from sklearn.neighbors import KNeighborsClassifier as skl_knn
from sklearn.base import TransformerMixin, BaseEstimator
import numpy as np
from dtaidistance.dtw_ndim import distance_fast
class KNeighborsClassifier(skl_knn):
def __init__(self, n_neighbors=1, classes=None, useClasses=False, **kwargs):
self.... | [
"dtaidistance.dtw_ndim.distance_fast",
"numpy.zeros"
] | [((771, 830), 'numpy.zeros', 'np.zeros', (['(n_observations, n_observations)'], {'dtype': 'np.double'}), '((n_observations, n_observations), dtype=np.double)\n', (779, 830), True, 'import numpy as np\n'), ((1357, 1382), 'dtaidistance.dtw_ndim.distance_fast', 'distance_fast', (['arr1', 'arr2'], {}), '(arr1, arr2)\n', (1... |
# Copyright (c) 2021 The Trustees of the University of Pennsylvania
#
# 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 use, co... | [
"smedl.structures.monitor.AssignmentAction",
"smedl.structures.expr.BinaryOp",
"smedl.structures.monitor.CallAction",
"smedl.structures.expr.EventParam",
"smedl.structures.monitor.Scenario",
"smedl.structures.expr.Literal",
"smedl.structures.monitor.IncrementAction",
"smedl.structures.monitor.MonitorS... | [((1798, 1833), 'smedl.structures.monitor.MonitorSpec', 'monitor.MonitorSpec', (['ast', 'self.path'], {}), '(ast, self.path)\n', (1817, 1833), False, 'from smedl.structures import monitor, expr\n'), ((4042, 4068), 'smedl.structures.monitor.Scenario', 'monitor.Scenario', (['ast.name'], {}), '(ast.name)\n', (4058, 4068),... |
# -*- coding: utf-8 -*-
import requests
import os
import skimage
import random
import json
import webbrowser
import time
import pandas as pd
import matplotlib.pyplot as plt
import os
import sys
from PIL import Image, ImageDraw
global population
global api_calls
global stop
global MUTATION_RATE
classList = []
confidenc... | [
"matplotlib.pyplot.ylabel",
"PIL.Image.new",
"matplotlib.pyplot.xlabel",
"webbrowser.open",
"time.sleep",
"sys.exc_info",
"PIL.ImageDraw.Draw",
"matplotlib.pyplot.scatter",
"pandas.DataFrame",
"matplotlib.pyplot.title",
"random.randint",
"matplotlib.pyplot.show"
] | [((507, 548), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(64, 64)'], {'color': '"""black"""'}), "('RGB', (64, 64), color='black')\n", (516, 548), False, 'from PIL import Image, ImageDraw\n'), ((560, 579), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['img'], {}), '(img)\n', (574, 579), False, 'from PIL import Image, Ima... |
from setuptools import setup, find_packages
import sys
import os
VERSION = '1.6'
# Cython has to be installed before. And I could not find any other ways.
os.system('pip install cython')
from Cython.Build import cythonize
if sys.version_info[0] < 3:
raise Exception('Must be using Python 3.')
setup(name='lead-l... | [
"Cython.Build.cythonize",
"os.system",
"setuptools.find_packages"
] | [((157, 188), 'os.system', 'os.system', (['"""pip install cython"""'], {}), "('pip install cython')\n", (166, 188), False, 'import os\n'), ((366, 425), 'Cython.Build.cythonize', 'cythonize', (['"""lead_lag/lead_lag_impl.pyx"""'], {'language_level': '"""3"""'}), "('lead_lag/lead_lag_impl.pyx', language_level='3')\n", (3... |
#!/usr/bin/env python
# Foundations of Python Network Programming - Chapter 12 - mime_parse_headers.py
import sys, email
from email.header import decode_header
msg = email.message_from_file(sys.stdin)
for header, raw in list(msg.items()):
parts = decode_header(raw)
value = ''
for data, charset in parts:
... | [
"email.message_from_file",
"email.header.decode_header"
] | [((168, 202), 'email.message_from_file', 'email.message_from_file', (['sys.stdin'], {}), '(sys.stdin)\n', (191, 202), False, 'import sys, email\n'), ((253, 271), 'email.header.decode_header', 'decode_header', (['raw'], {}), '(raw)\n', (266, 271), False, 'from email.header import decode_header\n')] |
from dataclasses import dataclass
from collections import Counter
from typing import ClassVar, TypeAlias
ELEMENT: TypeAlias = str # represents on character string
PAIR: TypeAlias = tuple[ELEMENT, ELEMENT]
RULES: TypeAlias = dict[PAIR, ELEMENT]
POLYMER: TypeAlias = Counter[PAIR]
@dataclass
class Polymer:
templat... | [
"collections.Counter"
] | [((476, 485), 'collections.Counter', 'Counter', ([], {}), '()\n', (483, 485), False, 'from collections import Counter\n'), ((899, 908), 'collections.Counter', 'Counter', ([], {}), '()\n', (906, 908), False, 'from collections import Counter\n'), ((1423, 1432), 'collections.Counter', 'Counter', ([], {}), '()\n', (1430, 1... |
import logging
import torch
from .compressor import Pruner
__all__ = ['LevelPruner', 'AGP_Pruner', 'FPGMPruner', 'L1FilterPruner', 'SlimPruner']
logger = logging.getLogger('torch pruner')
class LevelPruner(Pruner):
"""
Prune to an exact pruning level specification
"""
def __init__(self, model, conf... | [
"logging.getLogger",
"torch.gt",
"torch.sqrt",
"torch.cat",
"torch.ones"
] | [((156, 189), 'logging.getLogger', 'logging.getLogger', (['"""torch pruner"""'], {}), "('torch pruner')\n", (173, 189), False, 'import logging\n'), ((9508, 9521), 'torch.sqrt', 'torch.sqrt', (['x'], {}), '(x)\n', (9518, 9521), False, 'import torch\n'), ((12970, 12992), 'torch.cat', 'torch.cat', (['weight_list'], {}), '... |
import logging
import torch.multiprocessing as mp
logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
datefmt="%m/%d/%Y %H:%M:%S",
level=logging.INFO,
)
# reduce verbosity from transformers library
logging.getLogger('transformers.configuration_utils').setLevel(logging.WA... | [
"logging.basicConfig",
"logging.getLogger",
"resource.getrlimit",
"torch.multiprocessing.get_all_sharing_strategies",
"resource.setrlimit",
"torch.multiprocessing.set_sharing_strategy"
] | [((52, 195), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(name)s - %(message)s"""', 'datefmt': '"""%m/%d/%Y %H:%M:%S"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt=\n '%m/%d/%Y %H:%M:%S', level=lo... |
from git_changelog.build import Commit
from git_changelog.style import AngularStyle
def test_angular_style_breaking_change():
subject = "feat: this is a new breaking feature"
body = ["BREAKING CHANGE: there is a breaking feature in this code"]
commit = Commit(hash="aaaaaaa", subject=subject, body=body, au... | [
"git_changelog.build.Commit",
"git_changelog.style.AngularStyle"
] | [((267, 376), 'git_changelog.build.Commit', 'Commit', ([], {'hash': '"""aaaaaaa"""', 'subject': 'subject', 'body': 'body', 'author_date': '"""1574340645"""', 'committer_date': '"""1574340645"""'}), "(hash='aaaaaaa', subject=subject, body=body, author_date='1574340645',\n committer_date='1574340645')\n", (273, 376), ... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | [
"operator.attrgetter",
"oslo_utils.excutils.save_and_reraise_exception",
"oslo_db.sqlalchemy.orm.get_maker",
"oslo_db.sqlalchemy.engines.create_engine",
"threading.Lock",
"functools.wraps",
"oslo_db.exception.CantStartEngineError",
"oslo_db.exception.NoEngineContextEstablished",
"warnings.warn",
"... | [((38594, 38619), 'operator.attrgetter', 'operator.attrgetter', (['attr'], {}), '(attr)\n', (38613, 38619), False, 'import operator\n'), ((5720, 5736), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (5734, 5736), False, 'import threading\n'), ((18860, 18929), 'oslo_db.sqlalchemy.engines.create_engine', 'engines.... |
# -*- coding:utf-8 -*-
import numpy as np
import GVal
def initializationProcess():
localprefix = '/home/'
serverprefix = '/home/labcompute/'
GVal.setPARA('prefix_PARA', serverprefix)
# GVal.setPARA('prefix_PARA', localprefix)
return GVal.getPARA('prefix_PARA')
def processCodeEnc... | [
"GVal.getPARA",
"GVal.setPARA",
"numpy.array",
"numpy.arange"
] | [((165, 206), 'GVal.setPARA', 'GVal.setPARA', (['"""prefix_PARA"""', 'serverprefix'], {}), "('prefix_PARA', serverprefix)\n", (177, 206), False, 'import GVal\n'), ((269, 296), 'GVal.getPARA', 'GVal.getPARA', (['"""prefix_PARA"""'], {}), "('prefix_PARA')\n", (281, 296), False, 'import GVal\n'), ((1675, 1737), 'GVal.setP... |
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | [
"unittest.mock.Mock",
"rally_openstack.task.scenarios.ceilometer.events.CeilometerEventsCreateUserAndGetEvent",
"unittest.mock.MagicMock",
"rally_openstack.task.scenarios.ceilometer.events.CeilometerEventsCreateUserAndListEventTypes",
"unittest.mock.patch",
"rally_openstack.task.scenarios.ceilometer.event... | [((892, 964), 'unittest.mock.patch', 'mock.patch', (['"""rally_openstack.common.services.identity.identity.Identity"""'], {}), "('rally_openstack.common.services.identity.identity.Identity')\n", (902, 964), False, 'from unittest import mock\n'), ((1379, 1439), 'rally_openstack.task.scenarios.ceilometer.events.Ceilomete... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
from matplotlib import rcParams
font = {'family' : 'Dejavu Sans',
'weight' : 'normal',
'size' : 30}
rc('font', **font)
rcParams['lines.linewidth'] = 4
rcParams['lines.markersiz... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.title",
"matplotlib.rcParams.update",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.clf",
"matplotlib.rc",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.subplots",
"matpl... | [((244, 262), 'matplotlib.rc', 'rc', (['"""font"""'], {}), "('font', **font)\n", (246, 262), False, 'from matplotlib import rc\n'), ((368, 412), 'matplotlib.rcParams.update', 'rcParams.update', (["{'figure.autolayout': True}"], {}), "({'figure.autolayout': True})\n", (383, 412), False, 'from matplotlib import rcParams\... |
import os
print(os.getcwd())
l = os.listdir()
print(l)
assert "test_dirs.py" in l
assert "os" in l
for t in os.walk("."):
print(t)
for t in os.walk(".", False):
print(t)
| [
"os.listdir",
"os.walk",
"os.getcwd"
] | [((35, 47), 'os.listdir', 'os.listdir', ([], {}), '()\n', (45, 47), False, 'import os\n'), ((111, 123), 'os.walk', 'os.walk', (['"""."""'], {}), "('.')\n", (118, 123), False, 'import os\n'), ((148, 167), 'os.walk', 'os.walk', (['"""."""', '(False)'], {}), "('.', False)\n", (155, 167), False, 'import os\n'), ((17, 28), ... |
# ***************************************************************
# Copyright (c) 2022 Jittor. All Rights Reserved.
# Maintainers:
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>.
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
# *********... | [
"numpy.int32",
"numpy.stack",
"numpy.issubdtype",
"numpy.array",
"jittor.stack",
"time.time",
"numpy.float32"
] | [((859, 896), 'jittor.stack', 'jt.stack', (['[data for data in batch]', '(0)'], {}), '([data for data in batch], 0)\n', (867, 896), True, 'import jittor as jt\n'), ((974, 1011), 'numpy.stack', 'np.stack', (['[data for data in batch]', '(0)'], {}), '([data for data in batch], 0)\n', (982, 1011), True, 'import numpy as n... |
from tensorflow.keras import activations, constraints, initializers, regularizers
from tensorflow.keras.layers import Layer, Dropout, LeakyReLU
import tensorflow as tf
class DenseConvolution(Layer):
"""
Basic graph convolution layer as in:
`Semi-Supervised Classification with Graph Convolutional... | [
"tensorflow.keras.constraints.get",
"tensorflow.keras.regularizers.serialize",
"tensorflow.keras.activations.get",
"tensorflow.keras.initializers.serialize",
"tensorflow.keras.activations.serialize",
"tensorflow.keras.initializers.get",
"tensorflow.keras.regularizers.get",
"tensorflow.keras.constraint... | [((2795, 2822), 'tensorflow.keras.activations.get', 'activations.get', (['activation'], {}), '(activation)\n', (2810, 2822), False, 'from tensorflow.keras import activations, constraints, initializers, regularizers\n'), ((2857, 2893), 'tensorflow.keras.initializers.get', 'initializers.get', (['kernel_initializer'], {})... |
import os
import pathlib
import shutil
import tempfile
import unittest
import pfio
try:
import chainer
from chainer import testing
from chainer.training import extensions
chainer_available = True
# They depend on Chainer
from pfio.chainer_extensions import load_snapshot
from pfio.chainer_... | [
"tempfile.TemporaryDirectory",
"os.listdir",
"pfio.chainer_extensions.snapshot_writers.SimpleWriter",
"chainer.testing.get_trainer_with_mock_updater",
"unittest.skipIf",
"shutil.which",
"os.path.join",
"pfio.chainer_extensions.load_snapshot",
"pfio.create_handler",
"pfio.chainer_extensions.snapsho... | [((419, 485), 'unittest.skipIf', 'unittest.skipIf', (['(not chainer_available)', '"""Chainer is not available"""'], {}), "(not chainer_available, 'Chainer is not available')\n", (434, 485), False, 'import unittest\n'), ((906, 972), 'unittest.skipIf', 'unittest.skipIf', (['(not chainer_available)', '"""Chainer is not av... |
from django.contrib import admin
from .models import StudentProfile, FatherStudentProfile, MotherStudentProfile, StudentGuardianProfile, MajorStudent, PhotoProfile, StudentFile, RegisterSchedule
admin.site.register(StudentProfile)
admin.site.register(FatherStudentProfile)
admin.site.register(MotherStudentProfile)
adm... | [
"django.contrib.admin.site.register"
] | [((197, 232), 'django.contrib.admin.site.register', 'admin.site.register', (['StudentProfile'], {}), '(StudentProfile)\n', (216, 232), False, 'from django.contrib import admin\n'), ((233, 274), 'django.contrib.admin.site.register', 'admin.site.register', (['FatherStudentProfile'], {}), '(FatherStudentProfile)\n', (252,... |
from __future__ import annotations
import logging
import multiprocessing
import threading
import time
import timeit
from typing import Dict, List, TYPE_CHECKING, Union, Callable
from dswizard.core.model import EvaluationJob, StructureJob, CandidateId, CandidateStructure
if TYPE_CHECKING:
from dswizard.core.base_... | [
"logging.getLogger",
"timeit.default_timer",
"time.sleep",
"threading.Condition",
"time.time"
] | [((1558, 1579), 'threading.Condition', 'threading.Condition', ([], {}), '()\n', (1577, 1579), False, 'import threading\n'), ((2683, 2694), 'time.time', 'time.time', ([], {}), '()\n', (2692, 2694), False, 'import time\n'), ((1208, 1239), 'logging.getLogger', 'logging.getLogger', (['"""Dispatcher"""'], {}), "('Dispatcher... |
"""
University of La Laguna - Degree in Computer Engineering
Fourth grade - Computer vision
2021-2022
Authors: <NAME> - <EMAIL>
<NAME> - <EMAIL>
File utility.py: Functional functions
"""
import os.path
import PIL.Image
from pyautogui import size
import function
... | [
"function.max_value",
"function.brightness",
"function.contrast",
"function.min_value",
"function.calculate_normalized_frequencies"
] | [((2546, 2583), 'function.brightness', 'function.brightness', (['img.size', 'pixels'], {}), '(img.size, pixels)\n', (2565, 2583), False, 'import function\n'), ((2599, 2646), 'function.contrast', 'function.contrast', (['img.size', 'brightness', 'pixels'], {}), '(img.size, brightness, pixels)\n', (2616, 2646), False, 'im... |
# -*- coding: utf-8 -*-
import pytest
from mtpylon import long, int128
from mtpylon.messages import UnencryptedMessage, EncryptedMessage
from mtpylon.serialization import CallableFunc
from mtpylon.message_handler.strategies.utils import (
is_unencrypted_message,
is_rpc_call_message,
is_container_message,
... | [
"mtpylon.message_handler.strategies.utils.is_container_message",
"mtpylon.message_handler.strategies.utils.is_rpc_call_message",
"mtpylon.message_handler.strategies.utils.is_unencrypted_message",
"mtpylon.serialization.CallableFunc",
"mtpylon.int128",
"mtpylon.long",
"mtpylon.message_handler.strategies.... | [((969, 1000), 'mtpylon.message_handler.strategies.utils.is_unencrypted_message', 'is_unencrypted_message', (['message'], {}), '(message)\n', (991, 1000), False, 'from mtpylon.message_handler.strategies.utils import is_unencrypted_message, is_rpc_call_message, is_container_message, is_msgs_ack\n'), ((2886, 2914), 'mtpy... |
from typing import Optional
from pydantic import BaseModel
from pydantic import Field
__all__ = ["AccountData"]
class AccountData(BaseModel):
"""
Represents a single data object stored on by an account.
"""
value: str = Field(description="The key value for this data.")
# TODO: add description
... | [
"pydantic.Field"
] | [((242, 291), 'pydantic.Field', 'Field', ([], {'description': '"""The key value for this data."""'}), "(description='The key value for this data.')\n", (247, 291), False, 'from pydantic import Field\n')] |
import time
import os
import numpy as np
import pandas as pd
import tushare as ts
from utils.netease import *
read_dir = 'data/netease/hist'
write_dir = 'data/netease/hist_ma'
def cal_netease_ma(csv_path):
if not os.path.exists(csv_path):
print('invalid path:%s' % csv_path)
return None
df = p... | [
"os.path.exists",
"os.listdir",
"os.path.join",
"pandas.read_csv"
] | [((319, 360), 'pandas.read_csv', 'pd.read_csv', (['csv_path'], {'index_col': "['date']"}), "(csv_path, index_col=['date'])\n", (330, 360), True, 'import pandas as pd\n'), ((1097, 1117), 'os.listdir', 'os.listdir', (['read_dir'], {}), '(read_dir)\n', (1107, 1117), False, 'import os\n'), ((219, 243), 'os.path.exists', 'o... |
# -*- coding: utf-8; -*-
#
# @file base.py
# @brief coll-gate permission REST API
# @author <NAME> (INRA UMR1095)
# @date 2016-09-01
# @copyright Copyright (c) 2016 INRA/CIRAD
# @license MIT (see LICENSE file)
# @details
import operator
from django.contrib.auth.models import Permission, User, Group
from django.contr... | [
"django.shortcuts.get_object_or_404",
"django.contrib.contenttypes.models.ContentType.objects.get_by_natural_key",
"audit.models.Audit.objects.filter",
"django.db.models.Q",
"igdectk.rest.response.HttpResponseRest"
] | [((1775, 1832), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['User'], {'username': "request.GET['username']"}), "(User, username=request.GET['username'])\n", (1792, 1832), False, 'from django.shortcuts import get_object_or_404\n'), ((3831, 3865), 'igdectk.rest.response.HttpResponseRest', 'HttpResponseRe... |
import os
import json
import numpy
import re
import torch
import torch_rl
import utils
class Vocabulary:
"""A mapping from tokens to ids with a capacity of `max_size` words.
It can be saved in a `vocab.json` file."""
def __init__(self, model_dir):
self.path = utils.get_vocab_path(model_dir)
... | [
"os.path.exists",
"utils.get_vocab_path",
"utils.create_folders_if_necessary",
"numpy.array",
"torch.tensor",
"torch_rl.DictList"
] | [((283, 314), 'utils.get_vocab_path', 'utils.get_vocab_path', (['model_dir'], {}), '(model_dir)\n', (303, 314), False, 'import utils\n'), ((378, 403), 'os.path.exists', 'os.path.exists', (['self.path'], {}), '(self.path)\n', (392, 403), False, 'import os\n'), ((771, 815), 'utils.create_folders_if_necessary', 'utils.cre... |
from django.dispatch import Signal
# This signal indicates that the supplied project has been funded.
#
# :param first_time_funded: Whether or not the project has reached the funded state before. For instance, a project
# can become "unfunded" when a donation that was pending fails.
#
project... | [
"django.dispatch.Signal"
] | [((330, 374), 'django.dispatch.Signal', 'Signal', ([], {'providing_args': "['first_time_funded']"}), "(providing_args=['first_time_funded'])\n", (336, 374), False, 'from django.dispatch import Signal\n')] |
# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. 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 requir... | [
"logging.getLogger"
] | [((829, 859), 'logging.getLogger', 'logging.getLogger', (['LOGGER_NAME'], {}), '(LOGGER_NAME)\n', (846, 859), False, 'import logging\n')] |
from django.conf import settings
from django.db import models
from django.urls import reverse_lazy
BRA_CUP_NAMES = ("A", "B", "C", "D", "E", "F", "G")
BRA_CUP_STARTING_BAND_A_CUP_LOWER_CM = 77
BRA_CUP_JUMP_CUP_CM = 2
BRA_CUP_JUMP_BAND_CM = 5
BRA_BAND_SIZE_JUMP_CM = 6
BRA_BAND_SIZE_STARTING_UPPER_CM = 70
BRA_BAND_SIZE_... | [
"django.db.models.DateField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.urls.reverse_lazy",
"django.db.models.DecimalField"
] | [((728, 797), 'django.db.models.ForeignKey', 'models.ForeignKey', (['settings.AUTH_USER_MODEL'], {'on_delete': 'models.CASCADE'}), '(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)\n', (745, 797), False, 'from django.db import models\n'), ((809, 827), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\... |
from django.contrib import admin
from django.urls import path
from home import views
urlpatterns = [
path('admin/', admin.site.urls),
path("", views.index, name='home'),
path("about", views.about, name='about'),
path("contact", views.contact, name='contact'),
path("jokes", views.jokes, nam... | [
"django.urls.path"
] | [((111, 142), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (115, 142), False, 'from django.urls import path\n'), ((149, 183), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""home"""'}), "('', views.index, name='home')\n", (153, 183), False,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Storage plugin for RDFlib
see license https://github.com/DerwenAI/kglab#license-and-copyright
"""
from dataclasses import dataclass
import inspect
import typing
from cryptography.hazmat.primitives import hashes # type: ignore # pylint: disable=E0401
from icecream ... | [
"icecream.ic",
"rdflib.term.Literal",
"numpy.where",
"inspect.currentframe",
"dataclasses.dataclass",
"numpy.append",
"numpy.empty"
] | [((625, 647), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (634, 647), False, 'from dataclasses import dataclass\n'), ((1447, 1483), 'numpy.empty', 'np.empty', ([], {'shape': '[0, 1]', 'dtype': 'object'}), '(shape=[0, 1], dtype=object)\n', (1455, 1483), True, 'import numpy as np\... |
# Copyright 2015-2018 Canonical Ltd.
# Copyright 2020 <NAME>
# All Rights Reserved
"""Tests for a simple calculator."""
import math
from decimal import Decimal
from unittest import TestCase
import simplecalc
class BaseTestCase(TestCase):
"""Common code for all test cases."""
def check(self, operations):
... | [
"simplecalc.calc",
"decimal.Decimal"
] | [((7187, 7202), 'decimal.Decimal', 'Decimal', (['math.e'], {}), '(math.e)\n', (7194, 7202), False, 'from decimal import Decimal\n'), ((7224, 7240), 'decimal.Decimal', 'Decimal', (['math.pi'], {}), '(math.pi)\n', (7231, 7240), False, 'from decimal import Decimal\n'), ((644, 664), 'simplecalc.calc', 'simplecalc.calc', ([... |
#!/usr/bin/env python
"""Generate JA3 fingerprints from PCAPs using Python."""
import argparse
import dpkt
import json
import socket
import struct
import os
from hashlib import md5
__author__ = "<NAME>"
__copyright__ = "Copyright (c) 2017, salesforce.com, inc."
__credits__ = ["<NAME>", "<NAME>", "<NAME>"]
__license__... | [
"dpkt.ssl.tls_multi_factory",
"dpkt.pcap.Reader",
"argparse.ArgumentParser",
"socket.inet_ntop",
"json.dumps",
"dpkt.pcapng.Reader",
"dpkt.ssl.TLSHandshake"
] | [((4518, 4559), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'desc'}), '(description=desc)\n', (4541, 4559), False, 'import argparse\n'), ((652, 691), 'socket.inet_ntop', 'socket.inet_ntop', (['socket.AF_INET', 'value'], {}), '(socket.AF_INET, value)\n', (668, 691), False, 'import socket\n... |
# Enter your code here. Read input from STDIN. Print output to STDOUT
import numpy as np
from scipy import stats
i = 0
arr = []
n = int(input(''))
arr = list(map(int, input().split()))
arr.sort()
x = np.mean(arr)
y = np.median(arr)
z = stats.mode(arr)
print(round(x,1))
print(round(y,1))
print('%d' %(z[0])) | [
"scipy.stats.mode",
"numpy.mean",
"numpy.median"
] | [((200, 212), 'numpy.mean', 'np.mean', (['arr'], {}), '(arr)\n', (207, 212), True, 'import numpy as np\n'), ((217, 231), 'numpy.median', 'np.median', (['arr'], {}), '(arr)\n', (226, 231), True, 'import numpy as np\n'), ((236, 251), 'scipy.stats.mode', 'stats.mode', (['arr'], {}), '(arr)\n', (246, 251), False, 'from sci... |
from __future__ import absolute_import
import sys
try:
import threading
except ImportError:
threading = None
import time
from django.db import (connection, transaction,
DatabaseError, Error, IntegrityError, OperationalError)
from django.test import TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature... | [
"django.utils.unittest.skipUnless",
"time.sleep",
"sys.exc_info",
"django.utils.six.assertRaisesRegex",
"django.db.transaction.enter_transaction_management",
"django.test.skipUnlessDBFeature",
"django.db.transaction.commit",
"django.db.connection.close",
"django.db.transaction.get_autocommit",
"dj... | [((504, 605), 'django.utils.unittest.skipUnless', 'skipUnless', (['connection.features.uses_savepoints', '"""\'atomic\' requires transactions and savepoints."""'], {}), '(connection.features.uses_savepoints,\n "\'atomic\' requires transactions and savepoints.")\n', (514, 605), False, 'from django.utils.unittest impo... |
# Licensed under a 3-clause BSD style license - see PYFITS.rst
import gzip
import io
from ..file import _File
from .base import NonstandardExtHDU
from .hdulist import HDUList
from ..header import Header, _pad_length
from ..util import fileobj_name
from ....extern.six import string_types
from ....utils import lazypro... | [
"gzip.GzipFile",
"io.BytesIO"
] | [((854, 866), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (864, 866), False, 'import io\n'), ((2145, 2157), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (2155, 2157), False, 'import io\n'), ((1252, 1282), 'gzip.GzipFile', 'gzip.GzipFile', ([], {'fileobj': 'fileobj'}), '(fileobj=fileobj)\n', (1265, 1282), False, 'imp... |
#
"""
Various loss functions for policy gradients.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from texar.losses.losses_utils import mask_and_reduce
from texar.utils.shapes import get_rank
# pylint: disable=too-many-argumen... | [
"tensorflow.nn.sparse_softmax_cross_entropy_with_logits",
"tensorflow.stop_gradient",
"texar.losses.losses_utils.mask_and_reduce",
"tensorflow.reduce_mean",
"texar.utils.shapes.get_rank"
] | [((4997, 5022), 'tensorflow.stop_gradient', 'tf.stop_gradient', (['actions'], {}), '(actions)\n', (5013, 5022), True, 'import tensorflow as tf\n'), ((5043, 5120), 'tensorflow.nn.sparse_softmax_cross_entropy_with_logits', 'tf.nn.sparse_softmax_cross_entropy_with_logits', ([], {'logits': 'logits', 'labels': 'actions'}), ... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
from itertools import product
import numpy as np
from scipy.linalg import eigh, fractional_matrix_power
from .exceptions import SolutionMatrixIsZeroCanNotComputePODError
# le2d is a LinearElasticity2dProblem, not imported due to circular import
# rb_data is ReducedOrd... | [
"scipy.linalg.eigh",
"numpy.mean",
"numpy.linalg.solve",
"numpy.sqrt",
"itertools.product",
"numpy.sum",
"numpy.zeros",
"numpy.linspace",
"numpy.argwhere",
"quadpy.c1.gauss_lobatto",
"numpy.cumsum",
"scipy.linalg.fractional_matrix_power"
] | [((1929, 1956), 'numpy.zeros', 'np.zeros', (['(le2d.n_free, ns)'], {}), '((le2d.n_free, ns))\n', (1937, 1956), True, 'import numpy as np\n'), ((2065, 2101), 'itertools.product', 'product', (['e_young_vec', 'nu_poisson_vec'], {}), '(e_young_vec, nu_poisson_vec)\n', (2072, 2101), False, 'from itertools import product\n')... |
# refer https://github.com/titu1994/Keras-Multiplicative-LSTM
from __future__ import absolute_import
import numpy as np
__all__ = ['MultiplicativeLSTM']
from keras import backend as K
from keras import activations
from keras import initializers
from keras import regularizers
from keras import constraints
from keras... | [
"keras.engine.InputSpec",
"keras.backend.reshape",
"keras.backend.cast_to_floatx",
"keras.activations.get",
"keras.backend.bias_add",
"keras.backend.dot",
"keras.backend.dropout",
"keras.constraints.serialize",
"keras.initializers.Ones",
"keras.initializers.serialize",
"keras.backend.concatenate... | [((4723, 4750), 'keras.activations.get', 'activations.get', (['activation'], {}), '(activation)\n', (4738, 4750), False, 'from keras import activations\n'), ((4787, 4824), 'keras.activations.get', 'activations.get', (['recurrent_activation'], {}), '(recurrent_activation)\n', (4802, 4824), False, 'from keras import acti... |
import unittest
import numpy as np
from gym import spaces
class AdapterTestClass(object):
ENVIRONMENTS = []
def test_observation_space(self):
env = self.create_adapter()
observation_space = env.observation_space
self.assertTrue(
isinstance(observation_space, spaces.box.Bo... | [
"unittest.skip"
] | [((1109, 1166), 'unittest.skip', 'unittest.skip', (['"""The test annoyingly opens a glfw window."""'], {}), "('The test annoyingly opens a glfw window.')\n", (1122, 1166), False, 'import unittest\n')] |
# monitoring v3 for topology 2
# <NAME>
# <EMAIL>
from __future__ import division
from operator import attrgetter
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import MAIN_DISPATCHER, DEAD_DISPATCHER
from ryu.controller.handler import CONFIG_DISPATCHER
from ryu.con... | [
"operator.attrgetter",
"ryu.lib.hub.sleep",
"ryu.lib.hub.spawn",
"ryu.controller.handler.set_ev_cls",
"os.path.abspath"
] | [((1575, 1652), 'ryu.controller.handler.set_ev_cls', 'set_ev_cls', (['ofp_event.EventOFPStateChange', '[MAIN_DISPATCHER, DEAD_DISPATCHER]'], {}), '(ofp_event.EventOFPStateChange, [MAIN_DISPATCHER, DEAD_DISPATCHER])\n', (1585, 1652), False, 'from ryu.controller.handler import set_ev_cls\n'), ((4581, 4642), 'ryu.controll... |
#!/usr/bin/env python
import numpy as np
from time import time
import pyfftw
from numpy.fft import fft, ifft, fftshift, ifftshift, fft2, ifft2
from scipy.special import jv as besselj
import finufftpy
def translations_brute_force(Shathat, Mhat, cmul_trans):
# Shathat: (q, te, k)
# Mhat: (im, k × γ)
# ... | [
"numpy.sin",
"numpy.arange",
"numpy.multiply",
"numpy.repeat",
"numpy.fft.fft",
"finufftpy.nufft2d1",
"pyfftw.FFTW",
"finufftpy.nufft2d1many",
"numpy.exp",
"numpy.real",
"numpy.stack",
"numpy.empty",
"numpy.unravel_index",
"numpy.concatenate",
"numpy.matmul",
"numpy.meshgrid",
"numpy... | [((1078, 1156), 'pyfftw.empty_aligned', 'pyfftw.empty_aligned', (['(n_gamma, ngridr, n_images, n_trans)'], {'dtype': '"""complex128"""'}), "((n_gamma, ngridr, n_images, n_trans), dtype='complex128')\n", (1098, 1156), False, 'import pyfftw\n'), ((1211, 1325), 'pyfftw.FFTW', 'pyfftw.FFTW', (['Mhat_trans', 'Mhat_trans'], ... |
import numpy as np
import pytest
from ctrm.environment import Instance, ObstacleSphere
from ctrm.roadmap import (
get_timed_roadmaps_fully_random,
get_timed_roadmaps_random,
get_timed_roadmaps_random_common,
)
@pytest.fixture
def ins():
return Instance(
2,
[np.array([0, 0]), np.array(... | [
"numpy.array",
"ctrm.roadmap.get_timed_roadmaps_random",
"ctrm.roadmap.get_timed_roadmaps_random_common",
"ctrm.roadmap.get_timed_roadmaps_fully_random"
] | [((293, 309), 'numpy.array', 'np.array', (['[0, 0]'], {}), '([0, 0])\n', (301, 309), True, 'import numpy as np\n'), ((311, 327), 'numpy.array', 'np.array', (['[1, 0]'], {}), '([1, 0])\n', (319, 327), True, 'import numpy as np\n'), ((339, 355), 'numpy.array', 'np.array', (['[1, 1]'], {}), '([1, 1])\n', (347, 355), True,... |
"""Tests for citrine.informatics.processors serialization."""
import pytest
from citrine.informatics.processors import Processor, GridProcessor, EnumeratedProcessor, \
MonteCarloProcessor
@pytest.fixture(params=[
MonteCarloProcessor("test", description="mc optimizer test", max_candidates=123),
MonteCarlo... | [
"citrine.informatics.processors.MonteCarloProcessor",
"citrine.informatics.processors.EnumeratedProcessor",
"citrine.informatics.processors.GridProcessor",
"citrine.informatics.processors.Processor.build"
] | [((842, 863), 'citrine.informatics.processors.Processor.build', 'Processor.build', (['data'], {}), '(data)\n', (857, 863), False, 'from citrine.informatics.processors import Processor, GridProcessor, EnumeratedProcessor, MonteCarloProcessor\n'), ((224, 309), 'citrine.informatics.processors.MonteCarloProcessor', 'MonteC... |
__all__ = ("softwarePaths",)
# HKEY_CLASSES_ROOT\TypeLib\{1AFB341D-77DC-4C0C-BD3E-926FE318EB68}\1.0\0\win32
# HKEY_CLASSES_ROOT\Image Analysis
# HKEY_CLASSES_ROOT\MDT\Shell\Open\Command
import os
import winreg
from pathlib import Path
import lazy_object_proxy
def fileTypeOpenRegKeyToExecutablePath(key: tuple):
ret... | [
"os.path.exists",
"winreg.QueryValueEx",
"winreg.OpenKey"
] | [((602, 704), 'winreg.OpenKey', 'winreg.OpenKey', (['winreg.HKEY_CLASSES_ROOT', "(classname + '\\\\shell\\\\open\\\\command')", '(0)', 'winreg.KEY_READ'], {}), "(winreg.HKEY_CLASSES_ROOT, classname +\n '\\\\shell\\\\open\\\\command', 0, winreg.KEY_READ)\n", (616, 704), False, 'import winreg\n'), ((368, 385), 'os.pat... |
"""Support for Tesla charger switches."""
import logging
from homeassistant.components.switch import ENTITY_ID_FORMAT, SwitchDevice
from homeassistant.const import STATE_OFF, STATE_ON
from . import DOMAIN as TESLA_DOMAIN, TeslaDevice
_LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['tesla']
def setup_platform... | [
"logging.getLogger",
"homeassistant.components.switch.ENTITY_ID_FORMAT.format"
] | [((247, 274), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (264, 274), False, 'import logging\n'), ((1084, 1122), 'homeassistant.components.switch.ENTITY_ID_FORMAT.format', 'ENTITY_ID_FORMAT.format', (['self.tesla_id'], {}), '(self.tesla_id)\n', (1107, 1122), False, 'from homeassistant.... |
# Generated by Django 2.2.15 on 2020-09-09 15:51
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organisations', '0021_auto_20200619_1555'),
]
operations = [
migrations.AddField(
model_name='o... | [
"django.db.models.BooleanField"
] | [((391, 574), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': 'settings.DEFAULT_ORG_STORE_TRAITS_VALUE', 'help_text': '"""Disable this if you don\'t want Flagsmith to store trait data for this org\'s identities."""'}), '(default=settings.DEFAULT_ORG_STORE_TRAITS_VALUE,\n help_text=\n "Dis... |
import setuptools
__version__ = '1.3.2'
with open("README.md", "r") as fh:
readme = fh.read()
requirements = [
"matplotlib",
"numpy",
"tifffile",
"scikit-image>=0.15.0",
"aicsimageio==3.0.7",
"quilt3",
"bumpversion",
"twine",
"setuptools>=42",
"wheel",
"pandas",
"m... | [
"setuptools.find_packages"
] | [((640, 684), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'exclude': "['images']"}), "(exclude=['images'])\n", (664, 684), False, 'import setuptools\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('barsystem', '0003_product_active'),
]
operations = [
migrations.AlterField(
model_name='product',
na... | [
"django.db.models.DecimalField",
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((353, 411), 'django.db.models.CharField', 'models.CharField', ([], {'default': 'None', 'max_length': '(100)', 'blank': '(True)'}), '(default=None, max_length=100, blank=True)\n', (369, 411), False, 'from django.db import models, migrations\n'), ((533, 578), 'django.db.models.IntegerField', 'models.IntegerField', ([],... |
"""
Definition of forms.
"""
from django import forms
from django.contrib.auth.forms import AuthenticationForm
from django.utils.translation import ugettext_lazy as _
from app.models import *
from ckeditor.fields import RichTextField
class BootstrapAuthenticationForm(AuthenticationForm):
"""Authentication form wh... | [
"django.utils.translation.ugettext_lazy",
"django.forms.PasswordInput",
"ckeditor.fields.RichTextField",
"django.forms.IntegerField",
"django.forms.TextInput"
] | [((903, 918), 'ckeditor.fields.RichTextField', 'RichTextField', ([], {}), '()\n', (916, 918), False, 'from ckeditor.fields import RichTextField\n'), ((1062, 1082), 'django.forms.IntegerField', 'forms.IntegerField', ([], {}), '()\n', (1080, 1082), False, 'from django import forms\n'), ((431, 501), 'django.forms.TextInpu... |
from .query_type import query
from dataloaders import UserByIdLoader, UserByUsernameLoader
from authentication.authentication import needsAuthorization
from SdTypes import Permissions
@query.field("getUser")
@needsAuthorization([Permissions.USER_READ])
async def resolve_get_user(
obj=None,
info=None,
id: ... | [
"dataloaders.UserByUsernameLoader.load_from_id",
"authentication.authentication.needsAuthorization",
"dataloaders.UserByIdLoader.load_from_id"
] | [((211, 254), 'authentication.authentication.needsAuthorization', 'needsAuthorization', (['[Permissions.USER_READ]'], {}), '([Permissions.USER_READ])\n', (229, 254), False, 'from authentication.authentication import needsAuthorization\n'), ((392, 437), 'dataloaders.UserByIdLoader.load_from_id', 'UserByIdLoader.load_fro... |
import torch.nn as nn
import math
import torch
def init_model(model, **kwargs):
conv_type = kwargs.get("conv_type", None)
if conv_type == "def":
conv_type = None
bias_type = kwargs.get("bias_type", None)
if bias_type == "def":
bias_type = None
mode = kwargs.get("mode", None)
no... | [
"torch.nn.init.kaiming_normal",
"math.sqrt",
"torch.nn.init.xavier_normal_"
] | [((10190, 10204), 'math.sqrt', 'math.sqrt', (['fan'], {}), '(fan)\n', (10199, 10204), False, 'import math\n'), ((1922, 1965), 'torch.nn.init.xavier_normal_', 'torch.nn.init.xavier_normal_', (['m.weight.data'], {}), '(m.weight.data)\n', (1950, 1965), False, 'import torch\n'), ((2869, 2912), 'torch.nn.init.xavier_normal_... |
######################################################################
# Author: <NAME>
# Username: garrettz
#
# Assignment: A01
#
# Purpose: A program that returns your Chinese Zodiac animal given a
# birth year between 1988 and 1999. Also prints your friend's animal,
# and your compatibility with that friend's animal... | [
"time.sleep"
] | [((1182, 1195), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (1192, 1195), False, 'import time\n'), ((2831, 2844), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (2841, 2844), False, 'import time\n'), ((1313, 1326), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (1323, 1326), False, 'import time\n'), (... |
import datetime
import logging
import os
import time
import cv2
import numpy as np
import tensorflow as tf
import cnn_lstm_otc_ocr
import helper
from preparedata import PrepareData
import math
data_prep = PrepareData()
num_epochs = 25
save_epochs = 5 # save every save_epochs epochs
validation_steps = 500
checkpoint... | [
"tensorflow.local_variables_initializer",
"preparedata.PrepareData",
"tensorflow.Session",
"os.path.join",
"tensorflow.global_variables",
"cnn_lstm_otc_ocr.LSTMOCR",
"tensorflow.global_variables_initializer",
"os.path.isdir",
"os.mkdir",
"tensorflow.train.latest_checkpoint",
"tensorflow.summary.... | [((209, 222), 'preparedata.PrepareData', 'PrepareData', ([], {}), '()\n', (220, 222), False, 'from preparedata import PrepareData\n'), ((417, 450), 'cnn_lstm_otc_ocr.LSTMOCR', 'cnn_lstm_otc_ocr.LSTMOCR', (['"""train"""'], {}), "('train')\n", (441, 450), False, 'import cnn_lstm_otc_ocr\n'), ((747, 759), 'tensorflow.Sess... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-01-09 16:50
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('fileupload', '0008_auto_20180109_1634'),
]
operations = [
migrations.RenameField(
... | [
"django.db.migrations.RenameField"
] | [((295, 396), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""chequefile"""', 'old_name': '"""payment_received"""', 'new_name': '"""resolved"""'}), "(model_name='chequefile', old_name='payment_received',\n new_name='resolved')\n", (317, 396), False, 'from django.db import migrat... |
from django.db import models
from django.contrib.auth import get_user_model
from django.db.models.expressions import RawSQL
from django.utils import timezone
class NearbyShelterManager(models.Manager):
def with_distance(self, lat: float, lon: float):
"""
Shelterクエリセットに対してdistanceカラムを追加する
... | [
"django.contrib.auth.get_user_model",
"django.db.models.expressions.RawSQL",
"django.db.models.FloatField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.utils.timezone.now",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((1316, 1367), 'django.db.models.CharField', 'models.CharField', ([], {'verbose_name': '"""名前"""', 'max_length': '(255)'}), "(verbose_name='名前', max_length=255)\n", (1332, 1367), False, 'from django.db import models\n'), ((1382, 1433), 'django.db.models.CharField', 'models.CharField', ([], {'verbose_name': '"""住所"""',... |
"""Tool for handling rigs"""
import logging
import re
from collections import defaultdict
from itertools import combinations
import networkx as nx
import numpy as np
from opensfm import actions, pygeometry, pymap
from opensfm.dataset import DataSet, DataSetBase
logger = logging.getLogger(__name__)
def find_image_... | [
"logging.getLogger",
"opensfm.pygeometry.Pose",
"opensfm.pymap.RigModel",
"opensfm.actions.reconstruct.run_dataset",
"networkx.Graph",
"networkx.connected_components",
"itertools.combinations",
"numpy.exp",
"numpy.zeros",
"collections.defaultdict",
"opensfm.actions.detect_features.run_dataset",
... | [((275, 302), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (292, 302), False, 'import logging\n'), ((1227, 1244), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (1238, 1244), False, 'from collections import defaultdict\n'), ((1622, 1639), 'collections.defaultdict'... |
#!/usr/bin/env python3
# This file is part of Pixelsorting.
#
# Pixelsorting is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pixe... | [
"logging.getLogger",
"logging.basicConfig",
"os.path.exists",
"PIL.Image.open",
"filtering.pixelsorter.sort.SortingArgs",
"argparse.ArgumentParser",
"filtering.pixelsorter.sort.sort_image_tiles",
"os.makedirs",
"PIL.Image.new",
"filtering.pixelsorter.images2gif.writeGif",
"re.match",
"filterin... | [((1188, 1215), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1205, 1215), False, 'import logging\n'), ((2507, 2540), 'PIL.Image.new', 'Image.new', (['image.mode', 'image.size'], {}), '(image.mode, image.size)\n', (2516, 2540), False, 'from PIL import Image\n'), ((3907, 3943), 're.match... |
from waitress import serve
serve(api-v1, listen='*:8080')
| [
"waitress.serve"
] | [((27, 59), 'waitress.serve', 'serve', (['(api - v1)'], {'listen': '"""*:8080"""'}), "(api - v1, listen='*:8080')\n", (32, 59), False, 'from waitress import serve\n')] |
# coding: utf-8
from __future__ import division
import numpy as np
import pdb
import math
from . import data_generators
import copy
import cv2
import random
import keras
class_num =200
part_map_num = {'head':0,'legs':1,'wings':2,'back':3,'belly':4,'breast':5,'tail':6}
part_map_name = {}
crop_image = lambda img, x0, y0... | [
"keras.utils.to_categorical",
"numpy.array",
"numpy.sin",
"cv2.LUT",
"numpy.round",
"cv2.warpAffine",
"random.shuffle",
"numpy.cos",
"cv2.cvtColor",
"cv2.getRotationMatrix2D",
"cv2.resize",
"numpy.transpose",
"cv2.imread",
"numpy.copy",
"numpy.tan",
"cv2.flip",
"numpy.power",
"nump... | [((14927, 14950), 'numpy.zeros', 'np.zeros', (['(class_num + 1)'], {}), '(class_num + 1)\n', (14935, 14950), True, 'import numpy as np\n'), ((2967, 3054), 'numpy.zeros', 'np.zeros', (['[batech_size, self.input_img_size_heigth, self.input_img_size_witdth, 3]'], {}), '([batech_size, self.input_img_size_heigth, self.\n ... |
# -*- coding: utf-8 -*-
# 版权所有 2019 深圳米筐科技有限公司(下称“米筐科技”)
#
# 除非遵守当前许可,否则不得使用本软件。
#
# * 非商业用途(非商业用途指个人出于非商业目的使用本软件,或者高校、研究所等非营利机构出于教育、科研等目的使用本软件):
# 遵守 Apache License 2.0(下称“Apache 2.0 许可”),您可以在以下位置获得 Apache 2.0 许可的副本:http://www.apache.org/licenses/LICENSE-2.0。
# 除非法律有要求或以书面形式达成协议,否则本软件分发时需保持当前许可“原样”... | [
"rqalpha.model.positions.Positions"
] | [((1373, 1397), 'rqalpha.model.positions.Positions', 'Positions', (['StockPosition'], {}), '(StockPosition)\n', (1382, 1397), False, 'from rqalpha.model.positions import Positions\n')] |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import pathlib
import random
import numpy as np
import torch
import uuid
import activemri.envs.loupe_envs as loupe_envs
from ac... | [
"torch.manual_seed",
"activemri.baselines.non_rl.NonRLTester",
"argparse.ArgumentParser",
"matplotlib.use",
"activemri.envs.loupe_envs.LoupeBrainEnv",
"random.seed",
"uuid.uuid4",
"numpy.random.seed",
"activemri.envs.loupe_envs.LOUPERealKspaceEnv",
"torch.device"
] | [((396, 417), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (410, 417), False, 'import matplotlib\n'), ((460, 525), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""MRI Reconstruction Example"""'}), "(description='MRI Reconstruction Example')\n", (483, 525), False, ... |
import json
import os
import tempfile
from unittest.mock import MagicMock, patch
import cloudpickle
import pendulum
import pytest
import prefect
from prefect.client import Client
from prefect.engine.result_handlers import (
AzureResultHandler,
GCSResultHandler,
JSONResultHandler,
LocalResultHandler,
... | [
"pendulum.now",
"tempfile.TemporaryDirectory",
"prefect.engine.result_handlers.GCSResultHandler",
"pytest.mark.xfail",
"unittest.mock.MagicMock",
"prefect.utilities.configuration.set_temporary_config",
"prefect.engine.result_handlers.AzureResultHandler",
"pytest.mark.parametrize",
"cloudpickle.dumps... | [((3231, 3307), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'raises': 'ImportError', 'reason': '"""google extras not installed."""'}), "(raises=ImportError, reason='google extras not installed.')\n", (3248, 3307), False, 'import pytest\n'), ((6358, 6431), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'raises': 'I... |
# Generated by Django 3.2.9 on 2022-02-24 11:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('admins', '0006_auto_20220224_1259'),
]
operations = [
migrations.AddField(
model_name='topup',
name='stripe_payment_... | [
"django.db.models.TextField"
] | [((347, 374), 'django.db.models.TextField', 'models.TextField', ([], {'default': '(1)'}), '(default=1)\n', (363, 374), False, 'from django.db import migrations, models\n')] |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from itertools import izip_longest
from types import GeneratorType
def values_from_signal(signal_respons... | [
"itertools.izip_longest"
] | [((1964, 2016), 'itertools.izip_longest', 'izip_longest', (['[plugin]', 'value_list'], {'fillvalue': 'plugin'}), '([plugin], value_list, fillvalue=plugin)\n', (1976, 2016), False, 'from itertools import izip_longest\n')] |
from __future__ import print_function
# Copyright (c) 2013, <NAME>
# All rights reserved.
"""
Example timeseries reduction
"""
from collections import OrderedDict
import os
import glob
import time
import numpy as np
from pyvttbl import DataFrame
from undaqTools import Daq
# dependent variables and indices that... | [
"numpy.mean",
"collections.OrderedDict",
"numpy.abs",
"numpy.std",
"numpy.linalg.norm",
"pyvttbl.DataFrame",
"numpy.max",
"os.chdir",
"numpy.min",
"undaqTools.Daq",
"time.time",
"glob.glob"
] | [((775, 793), 'os.chdir', 'os.chdir', (['data_dir'], {}), '(data_dir)\n', (783, 793), False, 'import os\n'), ((878, 889), 'pyvttbl.DataFrame', 'DataFrame', ([], {}), '()\n', (887, 889), False, 'from pyvttbl import DataFrame\n'), ((956, 967), 'time.time', 'time.time', ([], {}), '()\n', (965, 967), False, 'import time\n'... |
import json
import os
from test.integration.base import DBTIntegrationTest, use_profile
import dbt.exceptions
class TestGoodDocsBlocks(DBTIntegrationTest):
@property
def schema(self):
return 'docs_blocks_035'
@staticmethod
def dir(path):
return os.path.normpath(path)
@property
... | [
"os.path.normpath",
"os.path.exists",
"json.load",
"test.integration.base.use_profile"
] | [((381, 404), 'test.integration.base.use_profile', 'use_profile', (['"""postgres"""'], {}), "('postgres')\n", (392, 404), False, 'from test.integration.base import DBTIntegrationTest, use_profile\n'), ((1773, 1796), 'test.integration.base.use_profile', 'use_profile', (['"""postgres"""'], {}), "('postgres')\n", (1784, 1... |
import numpy as np
from skimage.measure import label
import skimage.measure._ccomp as ccomp
from skimage._shared import testing
from skimage._shared.testing import assert_array_equal
BG = 0 # background value
class TestConnectedComponents:
def setup(self):
self.x = np.array([
[0, 0, 3, 2, ... | [
"numpy.ones_like",
"skimage._shared.testing.assert_array_equal",
"skimage.measure._ccomp.undo_reshape_array",
"numpy.ones",
"numpy.random.rand",
"numpy.random.random",
"numpy.array",
"numpy.zeros",
"skimage.measure._ccomp.reshape_array",
"skimage._shared.testing.raises",
"numpy.all",
"skimage.... | [((284, 378), 'numpy.array', 'np.array', (['[[0, 0, 3, 2, 1, 9], [0, 1, 1, 9, 2, 9], [0, 0, 1, 9, 9, 9], [3, 1, 1, 5, 3, 0]\n ]'], {}), '([[0, 0, 3, 2, 1, 9], [0, 1, 1, 9, 2, 9], [0, 0, 1, 9, 9, 9], [3, 1,\n 1, 5, 3, 0]])\n', (292, 378), True, 'import numpy as np\n'), ((447, 541), 'numpy.array', 'np.array', (['[[... |
import torch
import torch.nn as nn
import torchvision.models as models
import torch.autograd as autograd
from torch.autograd import Variable
import math
class net(nn.Module):
def __init__(self, args):
super(net, self).__init__()
self.resnet = nn.Sequential(*list(models.resnet152(pretrained=True).ch... | [
"torch.nn.BatchNorm1d",
"torch.no_grad",
"torchvision.models.resnet152",
"torch.nn.Linear"
] | [((442, 469), 'torch.nn.Linear', 'nn.Linear', (['(64)', 'args.num_cls'], {}), '(64, args.num_cls)\n', (451, 469), True, 'import torch.nn as nn\n'), ((488, 531), 'torch.nn.BatchNorm1d', 'nn.BatchNorm1d', (['args.num_cls'], {'momentum': '(0.01)'}), '(args.num_cls, momentum=0.01)\n', (502, 531), True, 'import torch.nn as ... |
from pyramid.view import view_config
from pyramid_oidc.interfaces import IOIDCUtility
from ..models import RefreshToken
@view_config(route_name='tokenstore_authorizations', renderer='json',
request_method='GET', permission='view', cors=True)
def authorizations(request):
res = []
user_id = reque... | [
"pyramid.view.view_config"
] | [((125, 249), 'pyramid.view.view_config', 'view_config', ([], {'route_name': '"""tokenstore_authorizations"""', 'renderer': '"""json"""', 'request_method': '"""GET"""', 'permission': '"""view"""', 'cors': '(True)'}), "(route_name='tokenstore_authorizations', renderer='json',\n request_method='GET', permission='view'... |
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 12 03:00:22 2017
@author: KIRI
"""
import tellurium as te
import roadrunner
#r1 = te.loada("""
#S1 + S2 -> S3 + S4; k1*S1*S2;
#
#S1 = 1.0; S2 = 2.0; S3 = 0.1; S4 = .5;
#k1 = 0.1
#""")
#
#rr1 = r1.simulate(0, 100, 100)
#r1.plot()
#
#r2 = te.loada("""
#S1 -> S3; k1*S1;
#S... | [
"tellurium.loada"
] | [((516, 706), 'tellurium.loada', 'te.loada', (['"""\nS1 -> S2; k1*S1/(S4 + 1);\nS2 -> S1; k2*S2;\nS3 -> S4; k3*S2*S3;\nS4 -> S3; k4*S4;\n\nS1 = .83; S2 = 2.0; S3 = 0.1; S4 = .5\nk1 = 0.05; k2 = 0.05; k3 = 0.05; k4 = 0.05;\n"""'], {}), '(\n """\nS1 -> S2; k1*S1/(S4 + 1);\nS2 -> S1; k2*S2;\nS3 -> S4; k3*S2*S3;\nS4 -> ... |
import os
import json
import logging
import sys
from django.db import transaction
from django.apps import apps
from scripts import utils as script_utils
from scripts.populate_preprint_providers import update_or_create
from website.app import init_app
from website import settings
logger = logging.getLogger(__name__)... | [
"logging.getLogger",
"logging.basicConfig",
"django.db.transaction.atomic",
"os.path.join",
"scripts.populate_preprint_providers.update_or_create",
"scripts.utils.add_file_logger",
"website.app.init_app",
"json.load",
"django.apps.apps.get_model"
] | [((293, 320), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (310, 320), False, 'import logging\n'), ((321, 360), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (340, 360), False, 'import logging\n'), ((764, 793), 'django.apps.apps... |
import torch
import torch.nn as nn
from torch.optim import lr_scheduler
from torch import optim
import torch.nn.functional as F
import random
import numpy as np
# import matplotlib.pyplot as plt
# import seaborn as sns
import os
import json
from utils.measures import wer, moses_multi_bleu
from utils.masked_cross_entro... | [
"os.path.exists",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"numpy.ones",
"torch.nn.Softmax",
"os.makedirs",
"torch.Tensor",
"numpy.array",
"torch.nn.BCELoss",
"torch.save",
"json.load",
"random.random",
"numpy.transpose"
] | [((926, 943), 'torch.nn.Softmax', 'nn.Softmax', ([], {'dim': '(0)'}), '(dim=0)\n', (936, 943), True, 'import torch.nn as nn\n'), ((2954, 3078), 'torch.optim.lr_scheduler.ReduceLROnPlateau', 'lr_scheduler.ReduceLROnPlateau', (['self.decoder_optimizer'], {'mode': '"""max"""', 'factor': '(0.5)', 'patience': '(1)', 'min_lr... |
#!/usr/bin/env python
import unittest
import day9
class TestDayNine(unittest.TestCase):
def test_p1_example(self):
data = 'London to Dublin = 464\nLondon to Belfast = 518\nDublin to Belfast = 141'
self.assertEqual(day9.part_one(data), 605)
def test_p2_example(self):
data = 'London to... | [
"unittest.main",
"day9.part_one",
"day9.part_two"
] | [((469, 484), 'unittest.main', 'unittest.main', ([], {}), '()\n', (482, 484), False, 'import unittest\n'), ((237, 256), 'day9.part_one', 'day9.part_one', (['data'], {}), '(data)\n', (250, 256), False, 'import day9\n'), ((410, 429), 'day9.part_two', 'day9.part_two', (['data'], {}), '(data)\n', (423, 429), False, 'import... |
from bert import binding, utils, constants
@binding.follow('noop')
def create_data():
work_queue, done_queue, ologger = utils.comm_binders(create_data)
for idx in range(0, 100):
done_queue.put({
'idx': idx
})
@binding.follow(create_data, pipeline_type=constants.PipelineType.CONCUR... | [
"bert.utils.comm_binders",
"bert.binding.follow",
"math.pow"
] | [((45, 67), 'bert.binding.follow', 'binding.follow', (['"""noop"""'], {}), "('noop')\n", (59, 67), False, 'from bert import binding, utils, constants\n'), ((249, 325), 'bert.binding.follow', 'binding.follow', (['create_data'], {'pipeline_type': 'constants.PipelineType.CONCURRENT'}), '(create_data, pipeline_type=constan... |
#These are imported packages
import random
#Preset Values
#Coordinates of player
player_pos = [0,0]
#Directional input for player coordinates based on the direction entered
nav = {'nx':0,'ny':1,'ex':1,'ey':0,'sx':0,'sy':-1,'wx':-1,'wy':0}
#Rooms are part of an object with their own coordinates. If a player is in a ... | [
"random.randrange"
] | [((742, 764), 'random.randrange', 'random.randrange', (['(0)', '(6)'], {}), '(0, 6)\n', (758, 764), False, 'import random\n'), ((819, 841), 'random.randrange', 'random.randrange', (['(0)', '(6)'], {}), '(0, 6)\n', (835, 841), False, 'import random\n')] |
from app import db, psycopg2
import json
LIMIT_RETRIES = 5
def get_columns(table):
column = None
try:
query = "SELECT column_name FROM information_schema.columns WHERE table_schema = 'public' AND table_name='"+table+"'"
db.prepare(query)
db.execute(query)
column = [row[0] for ... | [
"app.db.execute",
"app.db.fetchall",
"app.db.fetchone",
"app.db.prepare"
] | [((247, 264), 'app.db.prepare', 'db.prepare', (['query'], {}), '(query)\n', (257, 264), False, 'from app import db, psycopg2\n'), ((273, 290), 'app.db.execute', 'db.execute', (['query'], {}), '(query)\n', (283, 290), False, 'from app import db, psycopg2\n'), ((578, 595), 'app.db.prepare', 'db.prepare', (['query'], {}),... |
# Copyright 2020 The ElasticDL Authors. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | [
"elasticdl.proto.elasticdl_pb2.Model",
"elasticdl.python.ps.embedding_table.get_slot_table_name",
"numpy.random.rand",
"elasticdl.proto.elasticdl_pb2.PullEmbeddingVectorRequest",
"elasticdl.python.ps.parameters.Parameters",
"numpy.array",
"elasticdl.python.common.save_utils.CheckpointSaver",
"elasticd... | [((1566, 1636), 'elasticdl.python.common.model_utils.get_module_file_path', 'get_module_file_path', (['_test_model_zoo_path', '"""test_module.custom_model"""'], {}), "(_test_model_zoo_path, 'test_module.custom_model')\n", (1586, 1636), False, 'from elasticdl.python.common.model_utils import get_module_file_path, load_m... |
from avgn.utils.json import NoIndentEncoder
import librosa
import json
import avgn
from avgn.utils.paths import DATA_DIR
DATASET_ID = 'zebra_finch_gardner'
def generate_json_wav_noise(indv, wav_num, song, nonsong, sr, DT_ID):
wav_duration = len(song) / sr
wav_stem = indv + "_" + str(wav_num).zfill(4)
j... | [
"json.dumps",
"avgn.utils.paths.ensure_dir"
] | [((1167, 1219), 'json.dumps', 'json.dumps', (['json_dict'], {'cls': 'NoIndentEncoder', 'indent': '(2)'}), '(json_dict, cls=NoIndentEncoder, indent=2)\n', (1177, 1219), False, 'import json\n'), ((1264, 1300), 'avgn.utils.paths.ensure_dir', 'avgn.utils.paths.ensure_dir', (['wav_out'], {}), '(wav_out)\n', (1291, 1300), Fa... |
from pypdnsrest.dnsrecords import DNSMxRecord
from pypdnsrest.dnsrecords import DNSMxRecordData
from pypdnsrest.dnsrecords import InvalidDNSRecordException
from datetime import timedelta
from tests.records.test_records import TestRecords
class TestMxRecord(TestRecords):
def test_record(self):
mxdata = DNS... | [
"datetime.timedelta",
"pypdnsrest.dnsrecords.DNSMxRecordData",
"pypdnsrest.dnsrecords.DNSMxRecord"
] | [((383, 405), 'pypdnsrest.dnsrecords.DNSMxRecord', 'DNSMxRecord', (['self.zone'], {}), '(self.zone)\n', (394, 405), False, 'from pypdnsrest.dnsrecords import DNSMxRecord\n'), ((584, 606), 'pypdnsrest.dnsrecords.DNSMxRecord', 'DNSMxRecord', (['self.zone'], {}), '(self.zone)\n', (595, 606), False, 'from pypdnsrest.dnsrec... |
import matplotlib.pyplot as plt
import numpy as np
import sys
from os import walk
import matplotlib.colors as mcolors
'''
Return: table of lists of intervals {[%f,%f]}
'''
def read_log_file(filename):
result = {}
f = open(filename, 'r')
lines = f.readlines()
for line in lines:
line = line.repla... | [
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"os.walk",
"numpy.max",
"matplotlib.pyplot.close",
"numpy.sum",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.bar",
"numpy.std",
"matplotlib.pyplot.title... | [((4717, 4760), 'numpy.sum', 'np.sum', (['[(gap[1] - gap[0]) for gap in gaps]'], {}), '([(gap[1] - gap[0]) for gap in gaps])\n', (4723, 4760), True, 'import numpy as np\n'), ((4803, 4846), 'numpy.std', 'np.std', (['[(gap[1] - gap[0]) for gap in gaps]'], {}), '([(gap[1] - gap[0]) for gap in gaps])\n', (4809, 4846), True... |
import itertools
import math
import random
from functools import partial
from strong_graphs.output import output
from strong_graphs.data_structure import Network
from strong_graphs.negative import (
nb_neg_arcs,
nb_neg_loop_arcs,
nb_neg_tree_arcs,
)
from strong_graphs.arc_generators import (
gen_tree_ar... | [
"strong_graphs.mapping.map_graph",
"strong_graphs.arc_generators.gen_loop_arcs",
"math.ceil",
"strong_graphs.utils.shortest_path",
"math.floor",
"random.Random",
"strong_graphs.visualise.draw.draw_graph",
"strong_graphs.mapping.map_distances",
"strong_graphs.negative.nb_neg_loop_arcs",
"strong_gra... | [((1630, 1650), 'strong_graphs.negative.nb_neg_arcs', 'nb_neg_arcs', (['n', 'm', 'r'], {}), '(n, m, r)\n', (1641, 1650), False, 'from strong_graphs.negative import nb_neg_arcs, nb_neg_loop_arcs, nb_neg_tree_arcs\n'), ((1668, 1700), 'strong_graphs.negative.nb_neg_tree_arcs', 'nb_neg_tree_arcs', (['ξ', 'n', 'm', 'm_neg']... |
from multiprocessing import Process, Value, Array, Queue, Pipe
import time
from datetime import datetime
import cv2
import numpy
import RPi.GPIO as GPIO
import Iothub_client_functions as iot
import picamera
from picamera.array import PiRGBArray
import picamera.array
def f(n, a):
n.value = 3.1415927
... | [
"multiprocessing.Process",
"picamera.PiCameraCircularIO",
"multiprocessing.Value",
"time.sleep",
"picamera.PiCamera",
"cv2.imshow",
"cv2.waitKey",
"picamera.array.PiRGBArray",
"multiprocessing.Queue",
"multiprocessing.Pipe",
"time.time"
] | [((375, 388), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (385, 388), False, 'import time\n'), ((853, 868), 'multiprocessing.Value', 'Value', (['"""d"""', '(0.0)'], {}), "('d', 0.0)\n", (858, 868), False, 'from multiprocessing import Process, Value, Array, Queue, Pipe\n'), ((913, 920), 'multiprocessing.Queue', ... |
from pycograph.project import PythonProject
from pycograph.schemas.basic_syntax_elements import ABSOLUTE, ImportSyntaxElement
from pycograph.schemas.parse_result import (
PackageWithContext,
ResolvedImportRelationship,
)
from ..helper import create_module_with_content
def test_import_one_name():
content ... | [
"pycograph.schemas.parse_result.PackageWithContext",
"pycograph.schemas.basic_syntax_elements.ImportSyntaxElement",
"pycograph.project.PythonProject"
] | [((569, 637), 'pycograph.schemas.parse_result.PackageWithContext', 'PackageWithContext', ([], {'name': '"""package"""', 'full_name': '"""package"""', 'dir_path': '""""""'}), "(name='package', full_name='package', dir_path='')\n", (587, 637), False, 'from pycograph.schemas.parse_result import PackageWithContext, Resolve... |
"""
Slurm clusters under SNIC (:mod:`fluiddyn.clusters.snic`)
=========================================================
.. currentmodule:: fluiddyn.clusters.snic
Provides:
.. autoclass:: Beskow
:members:
.. autoclass:: Beskow32
:members:
.. autoclass:: Beskow36
:members:
.. autoclass:: Tetralith
:memb... | [
"warnings.warn",
"os.getenv"
] | [((3838, 3861), 'os.getenv', 'getenv', (['"""SNIC_RESOURCE"""'], {}), "('SNIC_RESOURCE')\n", (3844, 3861), False, 'from os import getenv\n'), ((516, 538), 'os.getenv', 'getenv', (['"""LOCAL_PYTHON"""'], {}), "('LOCAL_PYTHON')\n", (522, 538), False, 'from os import getenv\n'), ((670, 823), 'warnings.warn', 'warn', (['""... |
import unittest
from collections import OrderedDict
from conans.model.ref import ConanFileReference
from conans.test.utils.tools import TestServer, TurboTestClient, GenConanfile
class InstallCascadeTest(unittest.TestCase):
def setUp(self):
"""
A
/ \
B C
| \
D ... | [
"collections.OrderedDict",
"conans.test.utils.tools.TestServer",
"conans.model.ref.ConanFileReference.loads",
"conans.test.utils.tools.TurboTestClient",
"conans.test.utils.tools.GenConanfile"
] | [((393, 405), 'conans.test.utils.tools.TestServer', 'TestServer', ([], {}), '()\n', (403, 405), False, 'from conans.test.utils.tools import TestServer, TurboTestClient, GenConanfile\n'), ((424, 458), 'collections.OrderedDict', 'OrderedDict', (["[('default', server)]"], {}), "([('default', server)])\n", (435, 458), Fals... |
import sys, random, webbrowser, argparse, pkg_resources
import giphy_client
from giphy_client.rest import ApiException
__version__ = 'undefined'
try:
__version__ = pkg_resources.get_distribution('localvariables-demo-giphy')
except:
pass
def parse_args(argv):
arg_parser = argparse.ArgumentParser(descriptio... | [
"giphy_client.DefaultApi",
"pkg_resources.get_distribution",
"webbrowser.open",
"argparse.ArgumentParser"
] | [((169, 228), 'pkg_resources.get_distribution', 'pkg_resources.get_distribution', (['"""localvariables-demo-giphy"""'], {}), "('localvariables-demo-giphy')\n", (199, 228), False, 'import sys, random, webbrowser, argparse, pkg_resources\n'), ((286, 373), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'descr... |
# 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 required by applica... | [
"tensorflow.python.ops.array_ops.zeros",
"tensorflow.python.distribute.combinations.generate",
"tensorflow.python.ops.variables.global_variables_initializer",
"tensorflow.python.tpu.tpu_strategy_util.initialize_tpu_system",
"tensorflow.python.eager.def_function.function",
"tensorflow.python.framework.ops.... | [((17646, 17769), 'tensorflow.python.distribute.combinations.combine', 'combinations.combine', ([], {'distribution': '[strategy_combinations.mirrored_strategy_with_gpu_and_cpu]', 'mode': "['graph', 'eager']"}), "(distribution=[strategy_combinations.\n mirrored_strategy_with_gpu_and_cpu], mode=['graph', 'eager'])\n",... |
from muffin_shop.helpers.main.plugins import db
class Transaction(db.Model):
"""Represents a successful transaction -- a cart of products that someone bought"""
id = db.Column(db.Integer, primary_key=True, nullable=False)
uuid = db.Column(db.String(60), nullable=False)
products = db.Column(db.String(... | [
"muffin_shop.helpers.main.plugins.db.ForeignKey",
"muffin_shop.helpers.main.plugins.db.String",
"muffin_shop.helpers.main.plugins.db.Column"
] | [((177, 232), 'muffin_shop.helpers.main.plugins.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)', 'nullable': '(False)'}), '(db.Integer, primary_key=True, nullable=False)\n', (186, 232), False, 'from muffin_shop.helpers.main.plugins import db\n'), ((355, 391), 'muffin_shop.helpers.main.plugins.db.Colu... |
# MIT License
#
# Copyright (c) 2019 SSL-Roots
#
# 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 use, copy, modify, merge, pu... | [
"consai2_msgs.msg.ReplaceBall",
"python_qt_binding.QtCore.QRectF",
"python_qt_binding.QtCore.QPointF",
"math.cos",
"tool.Trans",
"copy.deepcopy",
"math.hypot",
"python_qt_binding.QtGui.QColor",
"rospy.Subscriber",
"python_qt_binding.QtGui.QPen",
"geometry_msgs.msg.Pose2D",
"rospy.get_param",
... | [((2045, 2059), 'python_qt_binding.QtGui.QColor', 'QColor', (['Qt.red'], {}), '(Qt.red)\n', (2051, 2059), False, 'from python_qt_binding.QtGui import QPainter, QPen, QColor, QPolygonF\n'), ((2550, 2608), 'rospy.get_param', 'rospy.get_param', (['"""consai2_description/ball_radius"""', '(0.0215)'], {}), "('consai2_descri... |
import base64
import json
from typing import Dict
from typing import List
from typing import Tuple
from django.conf import settings
from sendgrid import Attachment
from sendgrid import FileContent
from sendgrid import FileName
from sendgrid import FileType
from sendgrid import Mail
from sendgrid import SendGridAPIClie... | [
"collector.models.City.objects.get",
"sendgrid.FileName",
"sendgrid.FileContent",
"json.dumps",
"sendgrid.SendGridAPIClient",
"api2.serializers.CityDumpSerializer",
"sendgrid.Mail",
"sendgrid.FileType",
"sendgrid.Attachment"
] | [((1330, 1452), 'sendgrid.Mail', 'Mail', ([], {'from_email': '"""<EMAIL>"""', 'to_emails': 'email', 'subject': '"""Data dump"""', 'plain_text_content': '"""Your dump is in the attachment."""'}), "(from_email='<EMAIL>', to_emails=email, subject='Data dump',\n plain_text_content='Your dump is in the attachment.')\n", ... |
from ioweyou.BoundingBox import evaluate_model
PATH = "data/bird_dataset/"
# to_file(PATH + "test_index.txt", get_all_images(PATH + "test/"))
# to_file(PATH + "train_index.txt", get_all_images(PATH + "train/"))
# to_file(PATH + "eval_index.txt", get_all_images(PATH + "val/"))
def evaluate_yolov4():
from ioweyou.... | [
"pickle.dump",
"ioweyou.interface.parse_yolov4_results_json",
"pickle.load",
"ioweyou.BoundingBox.mAP",
"ioweyou.interface.import_bird_dataset",
"ioweyou.BoundingBox.precision_recall_curve"
] | [((530, 555), 'ioweyou.interface.import_bird_dataset', 'import_bird_dataset', (['PATH'], {}), '(PATH)\n', (549, 555), False, 'from ioweyou.interface import import_bird_dataset\n'), ((565, 611), 'ioweyou.interface.parse_yolov4_results_json', 'parse_yolov4_results_json', (['"""data/results.json"""'], {}), "('data/results... |
"""
Python interface to librclone.so using ctypes
Create an rclone object
rclone = Rclone(shared_object="/path/to/librclone.so")
Then call rpc calls on it
rclone.rpc("rc/noop", a=42, b="string", c=[1234])
When finished, close it
rclone.close()
"""
__all__ = ('Rclone', 'RcloneException')
import os
im... | [
"os.path.exists",
"json.dumps",
"subprocess.check_call"
] | [((2476, 2505), 'os.path.exists', 'os.path.exists', (['shared_object'], {}), '(shared_object)\n', (2490, 2505), False, 'import os\n'), ((2575, 2700), 'subprocess.check_call', 'subprocess.check_call', (["['go', 'build', '--buildmode=c-shared', '-o', shared_object,\n 'github.com/rclone/rclone/librclone']"], {}), "(['g... |