code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
from argparse import ArgumentParser
from dodo_commands import Dodo
def _args():
parser = ArgumentParser(
description=(
"Writes (or removes) a small script that activates the latest "
+ "Dodo Commands project"
)
)
parser.add_argument("status", choices=["on... | [
"os.path.expanduser",
"argparse.ArgumentParser",
"os.unlink",
"os.path.exists",
"dodo_commands.Dodo.parse_args",
"os.path.join",
"dodo_commands.Dodo.is_main",
"dodo_commands.Dodo.run"
] | [((371, 405), 'dodo_commands.Dodo.is_main', 'Dodo.is_main', (['__name__'], {'safe': '(False)'}), '(__name__, safe=False)\n', (383, 405), False, 'from dodo_commands import Dodo\n'), ((106, 232), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': "('Writes (or removes) a small script that activates the lat... |
import numpy as np
import jetyak
import jviz
import sensors
import shapefile
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import utm
from mpl_toolkits.basemap import Basemap
import mpl_toolkits.basemap as mb
from scipy import stats
def lat2str(deg):
min = 60 * (deg - np.floor(deg))
deg... | [
"numpy.abs",
"matplotlib.pyplot.show",
"numpy.floor",
"numpy.arange",
"mpl_toolkits.basemap.Basemap"
] | [((323, 336), 'numpy.floor', 'np.floor', (['deg'], {}), '(deg)\n', (331, 336), True, 'import numpy as np\n'), ((582, 595), 'numpy.floor', 'np.floor', (['deg'], {}), '(deg)\n', (590, 595), True, 'import numpy as np\n'), ((844, 969), 'mpl_toolkits.basemap.Basemap', 'Basemap', ([], {'llcrnrlon': '(-170)', 'llcrnrlat': '(0... |
# -*- coding: utf-8 -*-
"""
ShrinkageLoss
"""
import torch
import torch.nn as nn
class ShrinkageLoss(nn.Module):
""" ShrinkageLoss class.
Modified version of shrinkage loss tailored to images:
http://openaccess.thecvf.com/content_ECCV_2018/papers/Xiankai_Lu_Deep_Regression_Tracking_ECCV_2018_paper.... | [
"torch.mean",
"torch.norm",
"torch.mul",
"torch.exp",
"torch.nn.Module.__init__"
] | [((823, 847), 'torch.nn.Module.__init__', 'nn.Module.__init__', (['self'], {}), '(self)\n', (841, 847), True, 'import torch.nn as nn\n'), ((1678, 1725), 'torch.norm', 'torch.norm', (['(estimate - ground_truth)'], {'p': '(2)', 'dim': '(1)'}), '(estimate - ground_truth, p=2, dim=1)\n', (1688, 1725), False, 'import torch\... |
import logging
from rest_framework import serializers
from rest_flex_fields.serializers import FlexFieldsSerializerMixin
from ..models import WorkflowTaskInstanceExecution
from .workflow_task_instance_execution_base_serializer import WorkflowTaskInstanceExecutionBaseSerializer
from .serializer_helpers impo... | [
"logging.getLogger"
] | [((417, 444), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (434, 444), False, 'import logging\n')] |
# target: export keras model we used as tensorflow model
import tensorflow as tf
from keras.backend.tensorflow_backend import set_session
import os
import os.path as osp
from keras import backend as K
import tensorflow as tf
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
config.gpu_options.... | [
"sys.path.append",
"keras.backend.get_session",
"apps.pspnet.pkg.pspnet.psp_tf.pspnet.PSPNet50",
"tensorflow.Session",
"tensorflow.ConfigProto",
"tensorflow.global_variables",
"tensorflow.python.framework.graph_util.convert_variables_to_constants",
"tensorflow.python.framework.graph_io.write_graph",
... | [((243, 259), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (257, 259), True, 'import tensorflow as tf\n'), ((368, 393), 'tensorflow.Session', 'tf.Session', ([], {'config': 'config'}), '(config=config)\n', (378, 393), True, 'import tensorflow as tf\n'), ((395, 412), 'keras.backend.tensorflow_backend.set... |
# -*- coding: utf-8 -*-
from data.reader import wiki_from_pickles, corpus_to_pickle
from data.corpus import Sentences
from stats.stat_functions import compute_freqs, merge_to_joint
from stats.entropy import typicality
from filtering.typicality import setup_filtering, filter_typicality_incremental
from operator import... | [
"argparse.ArgumentParser",
"stats.stat_functions.merge_to_joint",
"filtering.typicality.filter_typicality_incremental",
"data.corpus.Sentences",
"data.reader.corpus_to_pickle",
"data.reader.wiki_from_pickles"
] | [((372, 397), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (395, 397), False, 'import argparse\n'), ((918, 960), 'data.reader.wiki_from_pickles', 'wiki_from_pickles', (["('data/' + lang + '_pkl')"], {}), "('data/' + lang + '_pkl')\n", (935, 960), False, 'from data.reader import wiki_from_pick... |
import torch
import torch.utils.data as data
from torchvision.datasets.folder import has_file_allowed_extension, is_image_file, IMG_EXTENSIONS, pil_loader, accimage_loader,default_loader
from PIL import Image
import sys
import os
import os.path
import numpy as np
from random import shuffle
REGIONS_DICT={'Alabama':... | [
"os.path.expanduser",
"torchvision.datasets.folder.has_file_allowed_extension",
"os.path.isdir",
"random.shuffle",
"os.walk",
"numpy.array",
"os.path.join",
"os.listdir",
"os.scandir",
"numpy.repeat"
] | [((1095, 1118), 'os.path.expanduser', 'os.path.expanduser', (['dir'], {}), '(dir)\n', (1113, 1118), False, 'import os\n'), ((1144, 1159), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (1154, 1159), False, 'import os\n'), ((1174, 1199), 'os.path.join', 'os.path.join', (['dir', 'target'], {}), '(dir, target)\n', ... |
from django.urls import path, include
from django.contrib.auth import views as auth_views
from .views import (
PostlistView,
PostCreateView,
PostDetailView,
PostUpdateView,
PostDeleteView,
saved_posts,
PostLikeToggle,
)
app_name = 'insta'
urlpatterns = [
#local : http://127.0.0.1:... | [
"django.urls.path"
] | [((807, 854), 'django.urls.path', 'path', (['"""saved/"""', 'saved_posts'], {'name': '"""saved_posts"""'}), "('saved/', saved_posts, name='saved_posts')\n", (811, 854), False, 'from django.urls import path, include\n')] |
#!/usr/bin/env python3
import argparse
import csv
import logging
import os
import sys
import typing
from typing import Dict, Iterator, Optional, Tuple
from common import IncludeChange
from include_analysis import ParseError, parse_raw_include_analysis_output
from utils import (
get_include_analysis_edges_centrali... | [
"os.open",
"csv.reader",
"csv.writer",
"argparse.ArgumentParser",
"logging.basicConfig",
"utils.get_include_analysis_edges_centrality",
"logging.warning",
"sys.stdout.fileno",
"utils.get_include_analysis_edge_sizes",
"utils.get_include_analysis_edge_prevalence",
"utils.load_config",
"sys.stdou... | [((729, 753), 'csv.reader', 'csv.reader', (['changes_file'], {}), '(changes_file)\n', (739, 753), False, 'import csv\n'), ((2268, 2354), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Set edge weights in include changes output"""'}), "(description=\n 'Set edge weights in include chang... |
import argparse
import json
import os
import subprocess
import sys
top_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
parser = argparse.ArgumentParser(description='''
Script to generate a list of service accounts along with their privilege levels
''')
parser.add_argument('org',
... | [
"subprocess.run",
"json.load",
"argparse.ArgumentParser",
"os.path.realpath",
"os.path.join"
] | [((150, 284), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""\nScript to generate a list of service accounts along with their privilege levels\n"""'}), '(description=\n """\nScript to generate a list of service accounts along with their privilege levels\n"""\n )\n', (173, 284), Fal... |
import random
import numpy as np
from bayesnet.network import Network
def hmc(model, call_args, parameter=None, sample_size=100, step_size=1e-3, n_step=10):
"""
Hamiltonian Monte Carlo sampling aka Hybrid Monte Carlo sampling
Parameters
----------
model : Network
bayesian network
call... | [
"random.random",
"numpy.square",
"numpy.exp",
"numpy.random.normal"
] | [((3079, 3116), 'numpy.exp', 'np.exp', (['(hamiltonian - hamiltonian_new)'], {}), '(hamiltonian - hamiltonian_new)\n', (3085, 3116), True, 'import numpy as np\n'), ((2184, 2214), 'numpy.random.normal', 'np.random.normal', ([], {'size': 'v.shape'}), '(size=v.shape)\n', (2200, 2214), True, 'import numpy as np\n'), ((3129... |
#!/usr/bin/env python
import binascii
import hashlib
import random
class Xbin(object):
# def __init__(self):
# get random hex by length
def get_random_hex(self, length=1, is_bytes=0):
random_hex = ''
for _ in range(0, length):
random_hex += "{:0>2x}".format(random.randrange(0... | [
"hashlib.md5",
"random.randrange"
] | [((496, 509), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (507, 509), False, 'import hashlib\n'), ((302, 326), 'random.randrange', 'random.randrange', (['(0)', '(255)'], {}), '(0, 255)\n', (318, 326), False, 'import random\n')] |
# This file contains objects which represent QT models to encapsulate browser state
# (see BrowserState.py) which is NOT contained in any database (for that, see DbEntries.py and
# DbModel.py). Note that the models do not automatically react to
# any changes originating reloading the database entries, the controller m... | [
"PyQt5.QtCore.QModelIndex"
] | [((1833, 1853), 'PyQt5.QtCore.QModelIndex', 'QtCore.QModelIndex', ([], {}), '()\n', (1851, 1853), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((2495, 2515), 'PyQt5.QtCore.QModelIndex', 'QtCore.QModelIndex', ([], {}), '()\n', (2513, 2515), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((4058, 4078)... |
import collections
import math
import numbers
import numpy as np
from .. import base
from .. import optim
from .. import utils
__all__ = [
'LinearRegression',
'LogisticRegression'
]
class GLM:
"""Generalized Linear Model.
Parameters:
optimizer (optim.Optimizer): The sequential optimizer u... | [
"collections.defaultdict",
"numpy.argsort"
] | [((1625, 1661), 'collections.defaultdict', 'collections.defaultdict', (['initializer'], {}), '(initializer)\n', (1648, 1661), False, 'import collections\n'), ((8519, 8544), 'numpy.argsort', 'np.argsort', (['contributions'], {}), '(contributions)\n', (8529, 8544), True, 'import numpy as np\n')] |
from ROAR.agent_module.agent import Agent
from ROAR.utilities_module.data_structures_models import SensorsData
from ROAR.utilities_module.vehicle_models import Vehicle, VehicleControl
from ROAR.configurations.configuration import Configuration as AgentConfig
import cv2
import numpy as np
import open3d as o3d
from ROAR.... | [
"ROAR.perception_module.ground_plane_detector.GroundPlaneDetector",
"open3d.visualization.Visualizer",
"ROAR.utilities_module.occupancy_map.OccupancyGridMap",
"numpy.asarray",
"open3d.geometry.PointCloud",
"open3d.geometry.TriangleMesh.create_coordinate_frame",
"ROAR.utilities_module.vehicle_models.Vehi... | [((842, 870), 'ROAR.utilities_module.occupancy_map.OccupancyGridMap', 'OccupancyGridMap', ([], {'agent': 'self'}), '(agent=self)\n', (858, 870), False, 'from ROAR.utilities_module.occupancy_map import OccupancyGridMap\n'), ((899, 936), 'ROAR.perception_module.depth_to_pointcloud_detector.DepthToPointCloudDetector', 'De... |
#!/usr/bin/env python3
from PIL import Image
import glob
import os
def crear_folder():
if not os.path.exists('/opt/icons/'):
os.makedirs('/opt/icons/')
def guardar(imagen, filename):
save_path = '/opt/icons/' + filename
imagen.save(save_path, 'JPEG')
print(imagen.format, imagen.size)
def rota... | [
"PIL.Image.open",
"os.path.exists",
"os.makedirs",
"glob.glob"
] | [((494, 511), 'glob.glob', 'glob.glob', (['"""ic_*"""'], {}), "('ic_*')\n", (503, 511), False, 'import glob\n'), ((99, 128), 'os.path.exists', 'os.path.exists', (['"""/opt/icons/"""'], {}), "('/opt/icons/')\n", (113, 128), False, 'import os\n'), ((138, 164), 'os.makedirs', 'os.makedirs', (['"""/opt/icons/"""'], {}), "(... |
#!/usr/bin/env python3
"""Scan serial ports for ping devices
Symlinks to detected devices are created under /dev/serial/ping/
This script needs root permission to create the symlinks
"""
import subprocess
import numpy as np
import rospy
from brping import PingDevice, PingParser, PingMessage
from brping.defini... | [
"serial.Serial",
"brping.PingParser",
"rospy.Time.now",
"brping.PingDevice",
"numpy.frombuffer",
"subprocess.check_output",
"socket.socket",
"sensor_msgs.msg.MultiEchoLaserScan",
"rospy.Publisher",
"rospy.Rate",
"rospy.loginfo",
"sensor_msgs.msg.Range",
"rospy.is_shutdown",
"brping.PingMes... | [((5198, 5235), 'rospy.init_node', 'rospy.init_node', (['"""ping1d_driver_node"""'], {}), "('ping1d_driver_node')\n", (5213, 5235), False, 'import rospy\n'), ((5323, 5338), 'rospy.Rate', 'rospy.Rate', (['(1.0)'], {}), '(1.0)\n', (5333, 5338), False, 'import rospy\n'), ((5930, 5942), 'brping.PingParser', 'PingParser', (... |
# BSD 3-Clause License
# Copyright (c) 2020, Instit<NAME>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# lis... | [
"numpy.isin",
"scipy.sparse.find",
"numpy.logical_not",
"numpy.zeros",
"networkx.topological_sort",
"networkx.selfloop_edges",
"numpy.cumsum",
"scipy.sparse.csc_matrix",
"numpy.where",
"numpy.array",
"scipy.sparse.csgraph.connected_components",
"networkx.strongly_connected_components",
"netw... | [((2565, 2589), 'numpy.zeros', 'np.zeros', (['(matr_size, 1)'], {}), '((matr_size, 1))\n', (2573, 2589), True, 'import numpy as np\n'), ((3138, 3161), 'scipy.sparse.find', 'sparse.find', (['(t_matr > 0)'], {}), '(t_matr > 0)\n', (3149, 3161), True, 'import scipy.sparse as sparse\n'), ((3860, 3905), 'numpy.isin', 'np.is... |
"""Communication protocol stacks for easy abstractions of communication links."""
# Builtins
# Packages
from phyllo.protocol.application.stacks import make_preset_stack as make_preset_application
from phyllo.protocol.application.stacks import make_pubsub
from phyllo.protocol.communication import AutomaticStack, PRES... | [
"phyllo.protocol.transport.stacks.make_preset_stack",
"phyllo.protocol.application.stacks.make_preset_stack"
] | [((1390, 1480), 'phyllo.protocol.transport.stacks.make_preset_stack', 'make_preset_transport', ([], {'medium': 'transport_medium', 'logical': 'transport_logical', 'stack': 'stack'}), '(medium=transport_medium, logical=transport_logical,\n stack=stack)\n', (1411, 1480), True, 'from phyllo.protocol.transport.stacks im... |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 27 22:04:58 2020
@author: zhangjun
"""
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 27 20:06:37 2020
@author: zhangjun
"""
import numpy as np
class perceptron:
def __init__(self):
self.alpha = None
self.b = None
self.w... | [
"numpy.zeros",
"numpy.dot",
"numpy.array",
"numpy.sum"
] | [((1480, 1514), 'numpy.array', 'np.array', (['[[3, 3], [4, 3], [1, 1]]'], {}), '([[3, 3], [4, 3], [1, 1]])\n', (1488, 1514), True, 'import numpy as np\n'), ((1519, 1539), 'numpy.array', 'np.array', (['[1, 1, -1]'], {}), '([1, 1, -1])\n', (1527, 1539), True, 'import numpy as np\n'), ((405, 425), 'numpy.zeros', 'np.zeros... |
import pymssql
import logging
import sys
logger = logging.getLogger(__name__)
class DbaseException(Exception):
pass
class SelectorMSSQL:
def __init__(self, device, db_setting):
self.cursor = None
self.device = device
try:
self.connection = pymssql.connect(server=db_setti... | [
"sys.exit",
"logging.getLogger",
"pymssql.connect"
] | [((51, 78), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (68, 78), False, 'import logging\n'), ((289, 459), 'pymssql.connect', 'pymssql.connect', ([], {'server': "db_setting['server']", 'port': "db_setting['port']", 'user': "db_setting['user']", 'password': "db_setting['password']", 'da... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Test for ff_builder"""
from __future__ import absolute_import
from __future__ import print_function
from aiida.orm import Dict
from aiida.plugins import CalculationFactory
from aiida.engine import run_get_node
# Calculation objects
FFBuilder = CalculationFactory("lsmo.f... | [
"aiida.orm.Dict",
"aiida.plugins.CalculationFactory",
"aiida.engine.run_get_node"
] | [((294, 331), 'aiida.plugins.CalculationFactory', 'CalculationFactory', (['"""lsmo.ff_builder"""'], {}), "('lsmo.ff_builder')\n", (312, 331), False, 'from aiida.plugins import CalculationFactory\n'), ((381, 585), 'aiida.orm.Dict', 'Dict', ([], {'dict': "{'ff_framework': 'UFF', 'ff_molecules': {'CO2': 'TraPPE', 'N2': 'T... |
#!/usr/bin/env python3
from aws_cdk import core
from aws_cdk.aws_s3 import Bucket
from s3_share.s3_share_stack import S3ShareStack
app = core.App()
S3ShareStack(app, "s3-share")
app.synth()
| [
"aws_cdk.core.App",
"s3_share.s3_share_stack.S3ShareStack"
] | [((140, 150), 'aws_cdk.core.App', 'core.App', ([], {}), '()\n', (148, 150), False, 'from aws_cdk import core\n'), ((152, 181), 's3_share.s3_share_stack.S3ShareStack', 'S3ShareStack', (['app', '"""s3-share"""'], {}), "(app, 's3-share')\n", (164, 181), False, 'from s3_share.s3_share_stack import S3ShareStack\n')] |
# Generated by Django 2.2.6 on 2020-01-28 12:30
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('assistants', '0007_dummyassistant'),
]
operations = [
migrations.DeleteModel(
name='DummyAssistant',
),
]
| [
"django.db.migrations.DeleteModel"
] | [((226, 271), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""DummyAssistant"""'}), "(name='DummyAssistant')\n", (248, 271), False, 'from django.db import migrations\n')] |
# Generated by Django 3.0.8 on 2020-07-11 10:44
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('auctions', '0002_bids_listings'),
]
operations = [
migrations.RenameModel(
old_name='Bids',
new_name='Bid',
),
... | [
"django.db.migrations.RenameModel"
] | [((223, 278), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""Bids"""', 'new_name': '"""Bid"""'}), "(old_name='Bids', new_name='Bid')\n", (245, 278), False, 'from django.db import migrations\n'), ((323, 386), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_na... |
import numpy as np
import pylab as pl
from sklearn import mixture
np.random.seed(0)
#C1 = np.array([[3, -2.7], [1.5, 2.7]])
#C2 = np.array([[1, 2.0], [-1.5, 1.7]])
#
#X_train = np.r_[
# np.random.multivariate_normal((-7, -7), C1, size=7),
# np.random.multivariate_normal((7, 7), C2, size=7),
#]
X_train = np.r_[
... | [
"pylab.contour",
"pylab.show",
"numpy.random.seed",
"sklearn.mixture.GaussianMixture",
"pylab.scatter",
"numpy.array",
"numpy.column_stack"
] | [((67, 84), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (81, 84), True, 'import numpy as np\n'), ((470, 533), 'sklearn.mixture.GaussianMixture', 'mixture.GaussianMixture', ([], {'n_components': '(2)', 'covariance_type': '"""full"""'}), "(n_components=2, covariance_type='full')\n", (493, 533), False, ... |
"""
test_properties
~~~~~~~~~~~~~~~
This module implements tests for the properties module.
"""
import pytest
from binalyzer_core import (
ValueProperty,
ReferenceProperty,
StretchSizeProperty,
Template,
)
def test_reference_property_is_read_only():
property = ReferenceProperty(Templ... | [
"binalyzer_core.ValueProperty",
"pytest.raises",
"binalyzer_core.Template",
"binalyzer_core.StretchSizeProperty"
] | [((459, 474), 'binalyzer_core.ValueProperty', 'ValueProperty', ([], {}), '()\n', (472, 474), False, 'from binalyzer_core import ValueProperty, ReferenceProperty, StretchSizeProperty, Template\n'), ((497, 514), 'binalyzer_core.ValueProperty', 'ValueProperty', (['(42)'], {}), '(42)\n', (510, 514), False, 'from binalyzer_... |
import sys, time
num = 1
try:
while num<=10:
print(num)
num += 1
time.sleep(1)
except KeyboardInterrupt:
print('exit')
sys.exit(0)
else:
print('complete')
finally:
print('Goodbye Python') | [
"sys.exit",
"time.sleep"
] | [((94, 107), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (104, 107), False, 'import sys, time\n'), ((156, 167), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (164, 167), False, 'import sys, time\n')] |
#!/usr/bin/env python3
import os
import sys
import toml
from .utils import Utils
DEFAULT_FILE_CONTENT = [
"indent_style = 'spaces'",
"indent_size = 4",
"max_len_line = 80",
"max_size_function = 20",
"max_function_in_file = 5",
"epitech_header = true",
"return_values_in_parenthese = true",
... | [
"toml.loads",
"os.path.exists",
"sys.exit"
] | [((1175, 1202), 'os.path.exists', 'os.path.exists', (['config_file'], {}), '(config_file)\n', (1189, 1202), False, 'import os\n'), ((1063, 1082), 'toml.loads', 'toml.loads', (['content'], {}), '(content)\n', (1073, 1082), False, 'import toml\n'), ((1216, 1278), 'sys.exit', 'sys.exit', (['f"""{config_file} already exist... |
import numpy as np
import pandas as pd
from scipy.optimize import curve_fit
from .helper import exp_fit_func, inverse_exp_func, exp_func
def exp_curve_fit_(x_range, ln_y_range):
popc, pcov = curve_fit(exp_fit_func, x_range, ln_y_range)
ln_a, b = popc
a = np.exp(ln_a)
return a, b
def get_interm_zip_f... | [
"numpy.sum",
"numpy.log",
"scipy.optimize.curve_fit",
"numpy.min",
"numpy.exp",
"numpy.log10"
] | [((197, 241), 'scipy.optimize.curve_fit', 'curve_fit', (['exp_fit_func', 'x_range', 'ln_y_range'], {}), '(exp_fit_func, x_range, ln_y_range)\n', (206, 241), False, 'from scipy.optimize import curve_fit\n'), ((269, 281), 'numpy.exp', 'np.exp', (['ln_a'], {}), '(ln_a)\n', (275, 281), True, 'import numpy as np\n'), ((1105... |
import numpy as np
from scipy.spatial import cKDTree
from scipy.spatial.distance import pdist, squareform
from scipy.sparse import coo_matrix
import pylab as plt
def squared_exponential(x2,D=3):
#x = np.reshape(x,(-1,D))
return np.exp(-x2/2.)
def matern52(x2):
x = np.sqrt(x2)
res = x2
res *= 5./3.... | [
"numpy.meshgrid",
"numpy.sum",
"numpy.ones",
"scipy.sparse.coo_matrix",
"numpy.array",
"numpy.exp",
"numpy.linspace",
"scipy.spatial.cKDTree",
"scipy.spatial.distance.pdist",
"numpy.arange",
"numpy.sqrt"
] | [((237, 254), 'numpy.exp', 'np.exp', (['(-x2 / 2.0)'], {}), '(-x2 / 2.0)\n', (243, 254), True, 'import numpy as np\n'), ((279, 290), 'numpy.sqrt', 'np.sqrt', (['x2'], {}), '(x2)\n', (286, 290), True, 'import numpy as np\n'), ((1032, 1054), 'scipy.spatial.cKDTree', 'cKDTree', (['(points / corr)'], {}), '(points / corr)\... |
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.psvm import H2OSupportVectorMachineEstimator
def svm_svmguide3():
svmguide3 = h2o.import_file(pyunit_utils.locate("smalldata/svm_test/svmguide3scale.svm"))
svmguide3_te... | [
"h2o.estimators.psvm.H2OSupportVectorMachineEstimator",
"tests.pyunit_utils.standalone_test",
"sys.path.insert",
"tests.pyunit_utils.locate"
] | [((49, 80), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""../../../"""'], {}), "(1, '../../../')\n", (64, 80), False, 'import sys\n'), ((466, 564), 'h2o.estimators.psvm.H2OSupportVectorMachineEstimator', 'H2OSupportVectorMachineEstimator', ([], {'hyper_param': '(128)', 'gamma': '(0.125)', 'disable_training_metrics... |
# Translation in python of the Matlab implementation of <NAME> and
# <NAME>, of the algorithm described in
# "Mixtures of Probabilistic Principal Component Analysers",
# <NAME> and <NAME>, Neural Computation 11(2),
# pp 443–482, MIT Press, 1999
import numpy as np
def initialization_kmeans(X, p, q, variance_level=No... | [
"numpy.log",
"numpy.eye",
"numpy.random.randn",
"numpy.power",
"numpy.zeros",
"numpy.argmin",
"numpy.random.randint",
"numpy.linalg.inv",
"numpy.exp",
"numpy.dot",
"numpy.unique"
] | [((653, 679), 'numpy.random.randint', 'np.random.randint', (['(0)', 'N', 'p'], {}), '(0, N, p)\n', (670, 679), True, 'import numpy as np\n'), ((828, 844), 'numpy.zeros', 'np.zeros', (['(N, p)'], {}), '((N, p))\n', (836, 844), True, 'import numpy as np\n'), ((860, 887), 'numpy.zeros', 'np.zeros', (['N'], {'dtype': 'np.i... |
from flask import jsonify
from ast import literal_eval
from app import db
from app.models.office import User, Location
def validate_and_add_user(form):
status, new_user = validate_and_save_user(form, skip_location=False)
if status:
return jsonify(success=True, item=new_user.to_dict())
else:
... | [
"app.models.office.User",
"app.models.office.User.location_id.in_",
"flask.jsonify",
"app.db.session.delete",
"app.db.session.commit",
"app.models.office.User.query.filter_by",
"app.models.office.User.query.delete",
"app.models.office.Location.query.filter_by",
"app.models.office.User.query.all"
] | [((725, 741), 'app.models.office.User.query.all', 'User.query.all', ([], {}), '()\n', (739, 741), False, 'from app.models.office import User, Location\n'), ((1988, 2007), 'app.models.office.User.query.delete', 'User.query.delete', ([], {}), '()\n', (2005, 2007), False, 'from app.models.office import User, Location\n'),... |
from django.conf import settings
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver
from .models import KnownMember, StudentRegistration
from .tasks import notify_sds_registration, register_on_slack
from .utils import email_user_complete_registration
@receiver(pre_save, sen... | [
"django.dispatch.receiver"
] | [((298, 344), 'django.dispatch.receiver', 'receiver', (['pre_save'], {'sender': 'StudentRegistration'}), '(pre_save, sender=StudentRegistration)\n', (306, 344), False, 'from django.dispatch import receiver\n'), ((1078, 1125), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'StudentRegistration'}), '(... |
import os
import numpy as np
folder = ""
file_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
os.chdir(file_path)
map_files = {
"main": "main.csv",
"landmass": "landmass.csv"
}
save_file = "map_saves"
def save(maps):
for map_name in maps:
np.savetxt(save_file... | [
"numpy.loadtxt",
"os.path.abspath",
"numpy.savetxt",
"os.chdir"
] | [((121, 140), 'os.chdir', 'os.chdir', (['file_path'], {}), '(file_path)\n', (129, 140), False, 'import os\n'), ((92, 117), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (107, 117), False, 'import os\n'), ((300, 385), 'numpy.savetxt', 'np.savetxt', (["(save_file + '/' + map_files[map_name])",... |
from __future__ import absolute_import, unicode_literals
from django_pg import models
class Hobbit(models.Model):
name = models.CharField(max_length=50)
favorite_foods = models.ArrayField(models.CharField(max_length=100))
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeFiel... | [
"django_pg.models.CharField",
"django_pg.models.DateField",
"django_pg.models.DateTimeField",
"django_pg.models.UUIDField"
] | [((127, 158), 'django_pg.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (143, 158), False, 'from django_pg import models\n'), ((246, 285), 'django_pg.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (266, 285), False, 'f... |
"""Add journal content column
Revision ID: 088e13f2ae70
Revises: <KEY>
Create Date: 2017-08-21 04:34:29.541975
"""
# revision identifiers, used by Alembic.
revision = '088e13f2ae70'
down_revision = '<KEY>'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('journal', sa.Column('conten... | [
"sqlalchemy.Text"
] | [((324, 333), 'sqlalchemy.Text', 'sa.Text', ([], {}), '()\n', (331, 333), True, 'import sqlalchemy as sa\n')] |
#!usr/bin/env python
# Program to mine data from your own facebook account
import json
import facebook
import os
import sys
import random
token = os.environ.get('FACEBOOK_TOKEN')
group_id = str(os.environ.get('THOPGANG_GROUP_ID'))
timestamp = str(sys.argv[1])
polarity_file = '../data/polarity.may2020.pos'
print("The ... | [
"os.environ.get",
"random.choice",
"facebook.GraphAPI"
] | [((148, 180), 'os.environ.get', 'os.environ.get', (['"""FACEBOOK_TOKEN"""'], {}), "('FACEBOOK_TOKEN')\n", (162, 180), False, 'import os\n'), ((196, 231), 'os.environ.get', 'os.environ.get', (['"""THOPGANG_GROUP_ID"""'], {}), "('THOPGANG_GROUP_ID')\n", (210, 231), False, 'import os\n'), ((805, 829), 'facebook.GraphAPI',... |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import pytest
from twitter.common.contextutil import temporary_dir
from pex.common import safe_copy
from pex.fetcher import Fetcher
from pex.package import EggPackage, SourcePa... | [
"pex.fetcher.Fetcher",
"pex.package.EggPackage.from_href",
"pex.testing.make_sdist",
"os.path.basename",
"twitter.common.contextutil.temporary_dir",
"pex.resolver_options.ResolverOptionsBuilder",
"pytest.raises",
"pex.resolver._ResolvableSet",
"pex.resolvable.ResolvableRequirement.from_string",
"p... | [((576, 587), 'pex.resolver.resolve', 'resolve', (['[]'], {}), '([])\n', (583, 587), False, 'from pex.resolver import Unsatisfiable, _ResolvableSet, resolve\n'), ((774, 800), 'pex.testing.make_sdist', 'make_sdist', ([], {'name': '"""project"""'}), "(name='project')\n", (784, 800), False, 'from pex.testing import make_s... |
from django.http import JsonResponse
def response_template(msg, result, code, data):
return JsonResponse({
'result': result, 'code': code,
'msg': msg, 'data': data
})
def response_success(msg="", result=1, code=0, data=None):
return response_template(msg, result, code, data)
def respon... | [
"django.http.JsonResponse"
] | [((98, 170), 'django.http.JsonResponse', 'JsonResponse', (["{'result': result, 'code': code, 'msg': msg, 'data': data}"], {}), "({'result': result, 'code': code, 'msg': msg, 'data': data})\n", (110, 170), False, 'from django.http import JsonResponse\n')] |
# MIT License
# Copyright (c) 2018 the NJUNLP groups.
# 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, me... | [
"os.path.join"
] | [((2228, 2265), 'os.path.join', 'os.path.join', (['self.out_dir', 'eval_desc'], {}), '(self.out_dir, eval_desc)\n', (2240, 2265), False, 'import os\n')] |
"""file to deal with batch operations"""
import sys
import json
import xlwt
import extract_info
from fit_sheet_wrapper import FitSheetWrapper
from xlwt import Workbook
import random
# from desk import *
import requests
import pandas as pd
import numpy as np
import nltk
import json
import csv
from nltk.corpus import st... | [
"xlwt.Workbook",
"random.randint",
"xlwt.XFStyle",
"extract_info.main",
"json.dumps",
"sys.stdout.flush",
"xlwt.Font"
] | [((635, 645), 'xlwt.Workbook', 'Workbook', ([], {}), '()\n', (643, 645), False, 'from xlwt import Workbook\n'), ((701, 715), 'xlwt.XFStyle', 'xlwt.XFStyle', ([], {}), '()\n', (713, 715), False, 'import xlwt\n'), ((724, 735), 'xlwt.Font', 'xlwt.Font', ([], {}), '()\n', (733, 735), False, 'import xlwt\n'), ((2133, 2151),... |
"""Tests for 'layout' filters."""
from flask_extras.filters import layout
class TestBs3Col:
"""All tests for bs3 col function."""
def test_returns_right_width(self):
"""Test the return value for a valid type."""
assert layout.bs3_cols(1) == 12
assert layout.bs3_cols(2) == 6
a... | [
"flask_extras.filters.layout.bs3_cols"
] | [((247, 265), 'flask_extras.filters.layout.bs3_cols', 'layout.bs3_cols', (['(1)'], {}), '(1)\n', (262, 265), False, 'from flask_extras.filters import layout\n'), ((287, 305), 'flask_extras.filters.layout.bs3_cols', 'layout.bs3_cols', (['(2)'], {}), '(2)\n', (302, 305), False, 'from flask_extras.filters import layout\n'... |
import os
import getpass
import tempfile
from ..Task import Task
from ...TaskWrapper import TaskWrapper
from ...Crawler import Crawler
from ...Crawler.Fs.FsCrawler import FsCrawler
from ...Crawler.Fs.Image import ImageCrawler
class SGPublishTask(Task):
"""
Generic Shotgun publish task for data created by the C... | [
"tempfile.NamedTemporaryFile",
"getpass.getuser",
"os.unlink",
"os.path.basename",
"os.path.exists",
"os.environ.get"
] | [((367, 406), 'os.environ.get', 'os.environ.get', (['"""KOMBI_SHOTGUN_URL"""', '""""""'], {}), "('KOMBI_SHOTGUN_URL', '')\n", (381, 406), False, 'import os\n'), ((433, 479), 'os.environ.get', 'os.environ.get', (['"""KOMBI_SHOTGUN_SCRIPTNAME"""', '""""""'], {}), "('KOMBI_SHOTGUN_SCRIPTNAME', '')\n", (447, 479), False, '... |
"""Verify accuracy of the unsteady Navier-Stokes-Boussinesq solver."""
import firedrake as fe
import sapphire.mms
import tests.verification.test__navier_stokes_boussinesq
from sapphire.simulations.unsteady_navier_stokes_boussinesq import Simulation
import tests.validation.helpers
diff = fe.diff
def strong_residual(... | [
"firedrake.SpatialCoordinate",
"firedrake.assemble",
"firedrake.DirichletBC",
"firedrake.UnitSquareMesh"
] | [((688, 718), 'firedrake.SpatialCoordinate', 'fe.SpatialCoordinate', (['sim.mesh'], {}), '(sim.mesh)\n', (708, 718), True, 'import firedrake as fe\n'), ((961, 983), 'firedrake.assemble', 'fe.assemble', (['(p * fe.dx)'], {}), '(p * fe.dx)\n', (972, 983), True, 'import firedrake as fe\n'), ((1115, 1145), 'firedrake.Spati... |
from fromTxtToVec.corpus_build import Corpus
from fromTxtToVec.pad import Pad
from fromTxtToVec.BERT_feat import ExtractBertEmb
from fromTxtToVec.train_vector import Embedding
import numpy as np
class To_vec:
def __init__(self, mode, sent_maxlen):
self.mode = mode
self.sent_maxlen = ... | [
"fromTxtToVec.BERT_feat.ExtractBertEmb",
"numpy.array",
"fromTxtToVec.corpus_build.Corpus",
"fromTxtToVec.train_vector.Embedding",
"fromTxtToVec.pad.Pad"
] | [((1521, 1537), 'numpy.array', 'np.array', (['sents_'], {}), '(sents_)\n', (1529, 1537), True, 'import numpy as np\n'), ((382, 390), 'fromTxtToVec.corpus_build.Corpus', 'Corpus', ([], {}), '()\n', (388, 390), False, 'from fromTxtToVec.corpus_build import Corpus\n'), ((435, 456), 'fromTxtToVec.pad.Pad', 'Pad', (['self.s... |
""" Import needed modules """
"-----------------------------------------------------------------------------"
from scipy.integrate import solve_ivp
from Shared_Funcs.pemfc_transport_funcs import *
import cantera as ct
import numpy as np
import sys
""" Control options for derivative functions """
"---------------------... | [
"numpy.zeros_like",
"numpy.sum",
"numpy.zeros",
"numpy.hstack",
"numpy.append"
] | [((16058, 16100), 'numpy.hstack', 'np.hstack', (['[i_OCV, i_ext0, i_ext1, i_ext2]'], {}), '([i_OCV, i_ext0, i_ext1, i_ext2])\n', (16067, 16100), True, 'import numpy as np\n'), ((13776, 13793), 'numpy.zeros_like', 'np.zeros_like', (['sv'], {}), '(sv)\n', (13789, 13793), True, 'import numpy as np\n'), ((16119, 16139), 'n... |
# coding: utf-8
# -----------------------------------------------------------------------------------
# <copyright company="Aspose Pty Ltd" file="CadOptions.py">
# Copyright (c) 2003-2021 Aspose Pty Ltd
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of ... | [
"six.iteritems"
] | [((8710, 8743), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (8723, 8743), False, 'import six\n')] |
from proteus import Domain, Context
from proteus.mprans import SpatialTools as st
from proteus import Gauges as ga
from proteus import WaveTools as wt
from math import *
import numpy as np
from proteus.mprans import BodyDynamics as bd
opts=Context.Options([
# predefined test cases
("water_level", 0.325, "Heig... | [
"proteus.mprans.BodyDynamics.CaissonBody",
"proteus.Domain.PlanarStraightLineGraphDomain",
"proteus.Gauges.PointGauges",
"proteus.mprans.SpatialTools.assembleDomain",
"proteus.mprans.SpatialTools.CustomShape",
"numpy.array",
"numpy.linspace",
"proteus.mprans.SpatialTools.Rectangle",
"proteus.Context... | [((242, 3785), 'proteus.Context.Options', 'Context.Options', (["[('water_level', 0.325, 'Height of free surface above bottom'), ('Lgen', \n 1.0, 'Genaration zone in terms of wave lengths'), ('Labs', 1.0,\n 'Absorption zone in terms of wave lengths'), ('Ls', 1.0,\n 'Length of domain from genZone to the front to... |
from django.db import transaction
from django.shortcuts import get_object_or_404, redirect
from django.utils.translation import ugettext as _
from django.views.generic import FormView, TemplateView
from guardian.mixins import LoginRequiredMixin
from tally_ho.apps.tally.models.audit import Audit
from tally_ho.apps.tall... | [
"tally_ho.libs.permissions.groups.user_groups",
"django.shortcuts.redirect",
"tally_ho.libs.views.session.session_matches_post_result_form",
"tally_ho.apps.tally.models.audit.Audit.objects.create",
"tally_ho.libs.verify.quarantine_checks.quarantine_checks",
"django.shortcuts.get_object_or_404",
"django.... | [((1150, 1169), 'tally_ho.libs.verify.quarantine_checks.quarantine_checks', 'quarantine_checks', ([], {}), '()\n', (1167, 1169), False, 'from tally_ho.libs.verify.quarantine_checks import quarantine_checks\n'), ((2775, 2811), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['ResultForm'], {'pk': 'pk'}), '(R... |
"""
Helper functions for calculating MMD and performing MMD test
This module contains original code from: https://github.com/fengliu90/DK-for-TST
MIT License
Copyright (c) 2021 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentati... | [
"numpy.ceil",
"numpy.ix_",
"numpy.zeros",
"torch.cat",
"torch.diag",
"torch.exp",
"numpy.sort",
"numpy.random.choice",
"torch.sum",
"torch.transpose"
] | [((1922, 1945), 'torch.cat', 'torch.cat', (['(Kx, Kxy)', '(1)'], {}), '((Kx, Kxy), 1)\n', (1931, 1945), False, 'import torch\n'), ((2006, 2032), 'torch.cat', 'torch.cat', (['(Kxxy, Kyxy)', '(0)'], {}), '((Kxxy, Kyxy), 0)\n', (2015, 2032), False, 'import torch\n'), ((4606, 4621), 'numpy.zeros', 'np.zeros', (['N_per'], {... |
#!/usr/bin/env python
"""
My template:
"""
__date__ = "2016-07-07"
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__license__ = "GPL"
# imports
import sys
import os
import time
from argparse import ArgumentParser, RawTextHelpFormatter
import shutil
import subprocess
from subprocess import run
parser = ArgumentParser(de... | [
"subprocess.run",
"argparse.ArgumentParser",
"shutil.which",
"time.strftime",
"time.time",
"os.path.join",
"sys.exit"
] | [((303, 376), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'RawTextHelpFormatter'}), '(description=__doc__, formatter_class=RawTextHelpFormatter)\n', (317, 376), False, 'from argparse import ArgumentParser, RawTextHelpFormatter\n'), ((1676, 1718), 'os.path.join', 'os.p... |
# -*- coding: utf-8 -*-
from django.contrib import admin
from .models import Nav
class NavAdmin(admin.ModelAdmin):
list_display = ['__unicode__', 'parent', 'subnav_type', 'slug', ]
search_fields = ['name', ]
list_filter = ['parent', ]
prepopulated_fields = {'slug': ('name',)}
admin.site.register(Nav... | [
"django.contrib.admin.site.register"
] | [((297, 331), 'django.contrib.admin.site.register', 'admin.site.register', (['Nav', 'NavAdmin'], {}), '(Nav, NavAdmin)\n', (316, 331), False, 'from django.contrib import admin\n')] |
from st2reactor.sensor.base import Sensor
from signalr import Connection
__all__ = [
'SignalRHubSensor'
]
class SignalRHubSensor(Sensor):
def __init__(self, sensor_service, config=None):
super(SignalRHubSensor, self).__init__(sensor_service=sensor_service,
... | [
"signalr.Connection"
] | [((670, 704), 'signalr.Connection', 'Connection', (['self.url', 'self.session'], {}), '(self.url, self.session)\n', (680, 704), False, 'from signalr import Connection\n')] |
import dpctl
def has_gpu(backend="opencl"):
return bool(dpctl.get_num_devices(backend=backend, device_type="gpu"))
def has_cpu(backend="opencl"):
return bool(dpctl.get_num_devices(backend=backend, device_type="cpu"))
def has_sycl_platforms():
return bool(len(dpctl.get_platforms()))
| [
"dpctl.get_platforms",
"dpctl.get_num_devices"
] | [((62, 119), 'dpctl.get_num_devices', 'dpctl.get_num_devices', ([], {'backend': 'backend', 'device_type': '"""gpu"""'}), "(backend=backend, device_type='gpu')\n", (83, 119), False, 'import dpctl\n'), ((170, 227), 'dpctl.get_num_devices', 'dpctl.get_num_devices', ([], {'backend': 'backend', 'device_type': '"""cpu"""'}),... |
# Copyright (c) 2020 The FedVision 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 appl... | [
"typer.Typer",
"os.path.join",
"os.getcwd"
] | [((706, 740), 'typer.Typer', 'typer.Typer', ([], {'help': '"""template tools"""'}), "(help='template tools')\n", (717, 740), False, 'import typer\n'), ((828, 871), 'os.path.join', 'os.path.join', (['__template__', '"""template.yaml"""'], {}), "(__template__, 'template.yaml')\n", (840, 871), False, 'import os\n'), ((873... |
import os
import random
import pandas as pd
import requests
import wget
from bs4 import BeautifulSoup
def get_poster(movie_id):
base_url = 'http://www.imdb.com/title/tt{}/'.format(movie_id)
print(base_url)
return BeautifulSoup(requests.get(base_url).content, 'lxml').find('div', {'class': 'poster'}).find(... | [
"pandas.read_csv",
"random.shuffle",
"os.path.exists",
"wget.download",
"requests.get"
] | [((359, 408), 'pandas.read_csv', 'pd.read_csv', (['"""ml-latest-small/links.csv"""'], {'sep': '""","""'}), "('ml-latest-small/links.csv', sep=',')\n", (370, 408), True, 'import pandas as pd\n'), ((876, 898), 'random.shuffle', 'random.shuffle', (['movies'], {}), '(movies)\n', (890, 898), False, 'import random\n'), ((994... |
import datetime
import json
import os
import unittest
import responses
from config import TestingConfig
from response_operations_ui import create_app
from response_operations_ui.controllers import collection_exercise_controllers
from response_operations_ui.exceptions.exceptions import ApiError
ce_id = "4a084bc0-130f... | [
"responses.RequestsMock",
"json.load",
"response_operations_ui.create_app",
"response_operations_ui.controllers.collection_exercise_controllers.create_collection_exercise_event",
"os.path.dirname",
"response_operations_ui.controllers.collection_exercise_controllers.get_collection_exercise_events_by_id",
... | [((589, 614), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (604, 614), False, 'import os\n'), ((720, 733), 'json.load', 'json.load', (['fp'], {}), '(fp)\n', (729, 733), False, 'import json\n'), ((835, 862), 'response_operations_ui.create_app', 'create_app', (['"""TestingConfig"""'], {}), "(... |
from .images import (
extract_image_filenames, display_data_for_image, image_setup_cmd
)
from ipykernel.kernelbase import Kernel
import logging
from pexpect import replwrap, EOF
import pexpect
from subprocess import check_output
import os.path
import re
import signal
__version__ = '0.7.2'
version_pat = re.compi... | [
"pexpect.spawn",
"ipykernel.kernelbase.Kernel.__init__",
"pexpect.replwrap.REPLWrapper._expect_prompt",
"pexpect.replwrap.REPLWrapper.__init__",
"signal.signal",
"logging.getLogger",
"re.compile"
] | [((312, 350), 're.compile', 're.compile', (['"""version (\\\\d+(\\\\.\\\\d+)+)"""'], {}), "('version (\\\\d+(\\\\.\\\\d+)+)')\n", (322, 350), False, 'import re\n'), ((358, 385), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (375, 385), False, 'import logging\n'), ((992, 1104), 'pexpect.r... |
import numpy as np
from blind_walking.envs.env_modifiers.env_modifier import EnvModifier
from blind_walking.envs.env_modifiers.heightfield import HeightField
from blind_walking.envs.env_modifiers.stairs import Stairs, boxHalfLength, boxHalfWidth
""" Train robot to walk up stairs curriculum.
Equal chances for t... | [
"numpy.random.uniform",
"numpy.arange",
"numpy.random.choice",
"blind_walking.envs.env_modifiers.stairs.Stairs",
"blind_walking.envs.env_modifiers.heightfield.HeightField"
] | [((3324, 3337), 'blind_walking.envs.env_modifiers.heightfield.HeightField', 'HeightField', ([], {}), '()\n', (3335, 3337), False, 'from blind_walking.envs.env_modifiers.heightfield import HeightField\n'), ((3619, 3632), 'blind_walking.envs.env_modifiers.heightfield.HeightField', 'HeightField', ([], {}), '()\n', (3630, ... |
import argparse
import nltk
def process(input_file_name, output_file_name):
input_file = open(input_file_name, mode='r', encoding='utf-8')
output_file = open(output_file_name, mode='w', encoding='utf-8')
for line in input_file:
sentences = nltk.sent_tokenize(line)
output_line = " <segment>... | [
"nltk.sent_tokenize",
"argparse.ArgumentParser"
] | [((476, 563), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Add <segment> markers between each sentence"""'}), "(description=\n 'Add <segment> markers between each sentence')\n", (499, 563), False, 'import argparse\n'), ((262, 286), 'nltk.sent_tokenize', 'nltk.sent_tokenize', (['line... |
# 2-electron VMC code for 2dim quantum dot with importance sampling
# Using gaussian rng for new positions and Metropolis- Hastings
# Added energy minimization
from math import exp, sqrt
from random import random, seed, normalvariate
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import A... | [
"scipy.optimize.minimize",
"math.exp",
"math.sqrt",
"random.normalvariate",
"numpy.zeros",
"random.random",
"numpy.array",
"random.seed"
] | [((6999, 7005), 'random.seed', 'seed', ([], {}), '()\n', (7003, 7005), False, 'from random import random, seed, normalvariate\n'), ((7133, 7153), 'numpy.array', 'np.array', (['[0.9, 0.2]'], {}), '([0.9, 0.2])\n', (7141, 7153), True, 'import numpy as np\n'), ((7210, 7312), 'scipy.optimize.minimize', 'minimize', (['Energ... |
import numpy as np
import pandas as pd
import tensorflow as tf
from sklearn.metrics import average_precision_score as auprc
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Dense, concatenate, Input, LSTM
from tensorflow.keras.layers import Conv1D, Reshape, Lambda
from tensorflow.keras.opt... | [
"pandas.DataFrame",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.Conv1D",
"numpy.savetxt",
"tensorflow.keras.optimizers.SGD",
"tensorflow.keras.callbacks.ModelCheckpoint",
"tensorflow.keras.models.Model",
"iterutils.train_generator",
"tensorflow.keras.layers.concatenate",
"tensorflow.... | [((589, 653), 'iterutils.train_generator', 'train_generator', (["path['seq']", 'batchsize', 'seqlen', '"""seq"""', '"""repeat"""'], {}), "(path['seq'], batchsize, seqlen, 'seq', 'repeat')\n", (604, 653), False, 'from iterutils import train_generator\n'), ((852, 922), 'iterutils.train_generator', 'train_generator', (["p... |
import logging
import azure.functions as func
from backlogapiprocessmodule import *
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('-------Python HTTP trigger function processed a request.')
configFilePath = '/home/site/wwwroot/BacklogApiTimerTrigger/config.yml'
loggingConfigFi... | [
"azure.functions.HttpResponse",
"logging.info"
] | [((150, 222), 'logging.info', 'logging.info', (['"""-------Python HTTP trigger function processed a request."""'], {}), "('-------Python HTTP trigger function processed a request.')\n", (162, 222), False, 'import logging\n'), ((700, 735), 'azure.functions.HttpResponse', 'func.HttpResponse', (['f"""Hello {name}!"""'], {... |
# Copyright 2019-2020 by <NAME>, MGLAND animation studio. All rights reserved.
# This file is part of IUTest, and is released under the "MIT License Agreement".
# Please see the LICENSE file that should have been included as part of this package.
import logging
logger = logging.getLogger(__name__)
class _ErrorDummy... | [
"logging.getLogger"
] | [((273, 300), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (290, 300), False, 'import logging\n')] |
import pytest
from p2p.exceptions import PeerConnectionLost
from trinity.protocol.eth.peer import (
ETHPeerPoolEventServer,
)
from tests.core.integration_test_helpers import (
FakeAsyncChainDB,
run_peer_pool_event_server,
run_proxy_peer_pool,
run_request_server,
)
from tests.core.peer_helpers impo... | [
"tests.core.integration_test_helpers.run_proxy_peer_pool",
"pytest.raises",
"tests.core.integration_test_helpers.FakeAsyncChainDB",
"tests.core.integration_test_helpers.run_peer_pool_event_server",
"tests.core.peer_helpers.MockPeerPoolWithConnectedPeers"
] | [((1020, 1093), 'tests.core.peer_helpers.MockPeerPoolWithConnectedPeers', 'MockPeerPoolWithConnectedPeers', (['[client_peer]'], {'event_bus': 'client_event_bus'}), '([client_peer], event_bus=client_event_bus)\n', (1050, 1093), False, 'from tests.core.peer_helpers import get_directly_linked_peers, MockPeerPoolWithConnec... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
import optparse
from repository.utils import get_version, set_logger
from repository import RepositoryManager
from repository.minisetting import Setting
def print_cmd_header():
print('GitMirror {}'.format(get_version()))
def print_cmd_result(su... | [
"optparse.OptionGroup",
"os.path.basename",
"repository.RepositoryManager",
"repository.utils.get_version",
"optparse.TitledHelpFormatter",
"repository.minisetting.Setting",
"repository.utils.set_logger"
] | [((670, 679), 'repository.minisetting.Setting', 'Setting', ([], {}), '()\n', (677, 679), False, 'from repository.minisetting import Setting\n'), ((1061, 1087), 'repository.RepositoryManager', 'RepositoryManager', (['setting'], {}), '(setting)\n', (1078, 1087), False, 'from repository import RepositoryManager\n'), ((407... |
# ------------------------------------------------------------------------------
# Copyright (c) 2010-2013, EVEthing team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# Redistributions of... | [
"django.db.models.OneToOneField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.Sum",
"django.db.models.DecimalField",
"django.db.models.IntegerField",
"django.db.models.SmallIntegerField",
"datetime.datetime.utcnow",
"django.db.... | [((1786, 1877), 'django.db.models.OneToOneField', 'models.OneToOneField', (['Character'], {'unique': '(True)', 'primary_key': '(True)', 'related_name': '"""details"""'}), "(Character, unique=True, primary_key=True, related_name\n ='details')\n", (1806, 1877), False, 'from django.db import models\n'), ((1909, 1972), ... |
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from torch.utils.data import Dataset
from .builder import DATASETS
@DATASETS.register_module()
class QuickTestImageDataset(Dataset):
"""Dataset for quickly testing the correctness.
Args:
size (tuple[int]): The size of the images. Defaults ... | [
"torch.randn"
] | [((470, 512), 'torch.randn', 'torch.randn', (['(3)', 'self.size[0]', 'self.size[1]'], {}), '(3, self.size[0], self.size[1])\n', (481, 512), False, 'import torch\n')] |
# Copyright 2019 ZTE 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 ... | [
"mock.patch.object",
"oslo_serialization.jsonutils.loads"
] | [((921, 966), 'mock.patch.object', 'mock.patch.object', (['deapi', '"""DecisionEngineAPI"""'], {}), "(deapi, 'DecisionEngineAPI')\n", (938, 966), False, 'import mock\n'), ((1827, 1872), 'mock.patch.object', 'mock.patch.object', (['deapi', '"""DecisionEngineAPI"""'], {}), "(deapi, 'DecisionEngineAPI')\n", (1844, 1872), ... |
from algoliasearch_django import AlgoliaIndex
from algoliasearch_django.decorators import register
from django.conf import settings
from eahub.profiles.models import Profile, ProfileTag
if settings.IS_ENABLE_ALGOLIA:
class ProfilePublicIndex(AlgoliaIndex):
index_name = settings.ALGOLIA["INDEX_NAME_PROFIL... | [
"algoliasearch_django.decorators.register"
] | [((2250, 2267), 'algoliasearch_django.decorators.register', 'register', (['Profile'], {}), '(Profile)\n', (2258, 2267), False, 'from algoliasearch_django.decorators import register\n'), ((3627, 3647), 'algoliasearch_django.decorators.register', 'register', (['ProfileTag'], {}), '(ProfileTag)\n', (3635, 3647), False, 'f... |
# Django
from django.db import models
# Models
from django.contrib.auth.models import User
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile')
biography = models.CharField(max_length=160, blank=True, null=True)
follows = models.ManyToManyField... | [
"django.db.models.CharField",
"django.db.models.OneToOneField",
"django.db.models.ManyToManyField",
"django.db.models.DateTimeField"
] | [((135, 211), 'django.db.models.OneToOneField', 'models.OneToOneField', (['User'], {'on_delete': 'models.CASCADE', 'related_name': '"""profile"""'}), "(User, on_delete=models.CASCADE, related_name='profile')\n", (155, 211), False, 'from django.db import models\n'), ((228, 283), 'django.db.models.CharField', 'models.Cha... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2022/5/11 17:52
Desc: 加密货币
https://cn.investing.com/crypto/currencies
高频数据
https://bitcoincharts.com/about/markets-api/
"""
import math
import pandas as pd
import requests
from tqdm import tqdm
from akshare.datasets import get_crypto_info_csv
def crypto_name_ur... | [
"pandas.DataFrame",
"pandas.read_html",
"warnings.filterwarnings",
"pandas.read_csv",
"pandas.to_datetime",
"akshare.datasets.get_crypto_info_csv",
"requests.post",
"pandas.concat",
"pandas.to_numeric"
] | [((5568, 5601), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (5591, 5601), False, 'import warnings\n'), ((6620, 6669), 'requests.post', 'requests.post', (['url'], {'data': 'payload', 'headers': 'headers'}), '(url, data=payload, headers=headers)\n', (6633, 6669), False, '... |
#!/usr/bin/env python
"""
Name: nexus_from_genotype_probabilities.py
Author: <NAME>
Date: 10 July 2013
Convert genotype probabilities file output by Tom White's post-UNEAK processing scripts to nexus
alignment of concatenated SNPs
Usage: python nexus_from_genotype_probabilities.py in_file out_file sample_size
... | [
"argparse.ArgumentParser"
] | [((514, 572), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Program description"""'}), "(description='Program description')\n", (537, 572), False, 'import argparse\n')] |
import re
from sent2vec.vectorizer import Vectorizer
from scipy import spatial
class KG(object):
def __init__(self, mode='graph_overlap', n_gram=2):
self.mode = mode
self.graph = {}
self.set = set()
self.instr_node = None
self.instr_CC_size = 0
self.vectorizer = Vec... | [
"sent2vec.vectorizer.Vectorizer",
"scipy.spatial.distance.cosine"
] | [((317, 329), 'sent2vec.vectorizer.Vectorizer', 'Vectorizer', ([], {}), '()\n', (327, 329), False, 'from sent2vec.vectorizer import Vectorizer\n'), ((3218, 3265), 'scipy.spatial.distance.cosine', 'spatial.distance.cosine', (['vectors[0]', 'vectors[1]'], {}), '(vectors[0], vectors[1])\n', (3241, 3265), False, 'from scip... |
# Copyright 2017-2020 object_database Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | [
"typed_python.Set",
"typed_python.ConstDict",
"uuid.uuid4",
"logging.error",
"threading.RLock",
"typed_python.Tuple",
"typed_python.makeNamedTuple",
"typed_python.NamedTuple",
"typed_python.deserialize",
"typed_python.TupleOf",
"typed_python.ListOf",
"typed_python.OneOf",
"typed_python.Dict"... | [((10939, 10952), 'typed_python.Set', 'Set', (['ObjectId'], {}), '(ObjectId)\n', (10942, 10952), False, 'from typed_python import OneOf, NamedTuple, Dict, Set, Tuple, ConstDict, makeNamedTuple, TupleOf, ListOf, deserialize\n'), ((28223, 28250), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n... |
import tempfile
import os
# import pygame
import config
from playsound import playsound
from gtts import gTTS
# from pygame import mixer
class TTS:
# def __init__(self):
# mixer.init()
def playMP3(self, fileName, filePath = config.SOUNDS_DIR, blocking = False):
... | [
"gtts.gTTS",
"tempfile.NamedTemporaryFile",
"os.path.split",
"os.path.join"
] | [((340, 372), 'os.path.join', 'os.path.join', (['filePath', 'fileName'], {}), '(filePath, fileName)\n', (352, 372), False, 'import os\n'), ((962, 977), 'gtts.gTTS', 'gTTS', ([], {'text': 'text'}), '(text=text)\n', (966, 977), False, 'from gtts import gTTS\n'), ((998, 1065), 'tempfile.NamedTemporaryFile', 'tempfile.Name... |
import os
import numpy as np
from netCDF4 import Dataset
from compliance_checker.ioos import (
IOOS0_1Check,
IOOS1_1Check,
IOOS1_2_PlatformIDValidator,
IOOS1_2Check,
NamingAuthorityValidator,
)
from compliance_checker.tests import BaseTestCase
from compliance_checker.tests.helpers import MockTime... | [
"netCDF4.Dataset",
"compliance_checker.ioos.IOOS1_1Check",
"compliance_checker.tests.test_cf.get_results",
"compliance_checker.ioos.IOOS0_1Check",
"compliance_checker.ioos.IOOS1_2_PlatformIDValidator",
"compliance_checker.ioos.IOOS1_2Check",
"compliance_checker.ioos.NamingAuthorityValidator",
"numpy.a... | [((737, 751), 'compliance_checker.ioos.IOOS0_1Check', 'IOOS0_1Check', ([], {}), '()\n', (749, 751), False, 'from compliance_checker.ioos import IOOS0_1Check, IOOS1_1Check, IOOS1_2_PlatformIDValidator, IOOS1_2Check, NamingAuthorityValidator\n'), ((1166, 1205), 'netCDF4.Dataset', 'Dataset', (['os.devnull', '"""w"""'], {'... |
import argparse
import os.path
# https://stackoverflow.com/a/19476216/598057
import sys
main_parser = argparse.ArgumentParser()
main_parser.add_argument(
"input_path", type=str, help="One or more folders with *.sdoc files"
)
main_parser.add_argument(
"--file",
action="store_true",
default=False,
... | [
"argparse.ArgumentParser"
] | [((104, 129), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (127, 129), False, 'import argparse\n')] |
import weakref
class FlyweightMeta(type):
def __new__(mcs, name, parents, dct):
"""
Set up object pool
:param name: class name
:param parents: class parents
:param dct: dict: includes class attributes, class methods,
static methods, etc
:return: new class
... | [
"weakref.WeakValueDictionary"
] | [((353, 382), 'weakref.WeakValueDictionary', 'weakref.WeakValueDictionary', ([], {}), '()\n', (380, 382), False, 'import weakref\n')] |
import flatbuffers
import sys
from websocket import create_connection
sys.path.append("../../.") #Append project root directory so importing from schema works
import schema.GetHardwarePool as GetHardwarePool
import schema.GetResult as GetResult
import schema.Message as Message
import schema.Task as Task
import schema... | [
"sys.path.append",
"schema.Message.Start",
"schema.Message.AddTask",
"flatbuffers.Builder",
"schema.Stage.End",
"schema.Task.End",
"schema.Task.StartStagesVector",
"schema.Stage.Start",
"schema.Task.Start",
"schema.Message.AddType",
"websocket.create_connection",
"schema.Stage.StartCmdListVect... | [((71, 97), 'sys.path.append', 'sys.path.append', (['"""../../."""'], {}), "('../../.')\n", (86, 97), False, 'import sys\n'), ((661, 686), 'flatbuffers.Builder', 'flatbuffers.Builder', (['(1024)'], {}), '(1024)\n', (680, 686), False, 'import flatbuffers\n'), ((734, 779), 'schema.Stage.StartCmdListVector', 'Stage.StartC... |
import multiprocessing as mp
from multiprocessing.sharedctypes import RawArray
from ctypes import c_bool, c_double
import numpy as np
import pandas as pd
def standardize(X):
"""
Standardize each row in X to mean = 0 and SD = 1.
"""
X_m = np.ma.masked_invalid(X)
return ((X.T - X_m.mean(axis=1)) / X_... | [
"numpy.frombuffer",
"multiprocessing.sharedctypes.RawArray",
"numpy.ma.masked_invalid",
"numpy.isnan",
"multiprocessing.Pool"
] | [((255, 278), 'numpy.ma.masked_invalid', 'np.ma.masked_invalid', (['X'], {}), '(X)\n', (275, 278), True, 'import numpy as np\n'), ((1008, 1032), 'multiprocessing.sharedctypes.RawArray', 'RawArray', (['type', 'arr.flat'], {}), '(type, arr.flat)\n', (1016, 1032), False, 'from multiprocessing.sharedctypes import RawArray\... |
import typing
from flask_httpauth import HTTPTokenAuth, HTTPBasicAuth, MultiAuth
class Auth:
def __init__(self):
"""Creates access control class for authentication and authorization."""
self._basic_auth = HTTPBasicAuth()
self._token_auth = HTTPTokenAuth()
self._auth = MultiAuth(se... | [
"flask_httpauth.HTTPTokenAuth",
"flask_httpauth.HTTPBasicAuth",
"flask_httpauth.MultiAuth"
] | [((228, 243), 'flask_httpauth.HTTPBasicAuth', 'HTTPBasicAuth', ([], {}), '()\n', (241, 243), False, 'from flask_httpauth import HTTPTokenAuth, HTTPBasicAuth, MultiAuth\n'), ((271, 286), 'flask_httpauth.HTTPTokenAuth', 'HTTPTokenAuth', ([], {}), '()\n', (284, 286), False, 'from flask_httpauth import HTTPTokenAuth, HTTPB... |
import subprocess
import sys
def glslify(shader_path, *transforms):
args = ["glslify", shader_path]
if transforms:
args.append("-t")
args.extend(transforms)
return subprocess.check_output(args, encoding=sys.getdefaultencoding())
if __name__ == "__main__":
shader = glslify(sys.argv[1]... | [
"sys.getdefaultencoding"
] | [((233, 257), 'sys.getdefaultencoding', 'sys.getdefaultencoding', ([], {}), '()\n', (255, 257), False, 'import sys\n')] |
"""Platform for sensor integration."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from typing import cast
from geocachingapi.models import GeocachingStatus
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassista... | [
"typing.cast"
] | [((3687, 3734), 'typing.cast', 'cast', (['str', 'coordinator.data.user.reference_code'], {}), '(str, coordinator.data.user.reference_code)\n', (3691, 3734), False, 'from typing import cast\n')] |
"""
Utilities
@author: <NAME>
"""
import zlib
import sys
from sphinx.util.pycompat import sys_encoding
from bkcharts.stats import stats
def read_file(path):
"""Reads contents of file as bytes."""
with open(path, 'rb') as f:
return f.read()
def write_file(path, data):
"""Writes data bytes to file ... | [
"sys.stdout.write",
"sphinx.util.pycompat.sys_encoding.stdout.write",
"builtins.int"
] | [((1572, 1586), 'builtins.int', 'int', (['size_data'], {}), '(size_data)\n', (1575, 1586), False, 'from builtins import int\n'), ((2400, 2422), 'sys.stdout.write', 'sys.stdout.write', (['data'], {}), '(data)\n', (2416, 2422), False, 'import sys\n'), ((2611, 2642), 'sphinx.util.pycompat.sys_encoding.stdout.write', 'sys_... |
from __future__ import print_function
import torch, PIL.Image, cv2, pickle, sys, argparse
import numpy as np
import openmesh as om
from tqdm import trange
sys.path.append("../src/")
from network import shading_net
import renderer as rd
from utility import subdiv_mesh_x4
from utility import CamPara
from utility import m... | [
"numpy.absolute",
"network.shading_net",
"argparse.ArgumentParser",
"pickle.load",
"utility.subdiv_mesh_x4",
"torch.device",
"sys.path.append",
"numpy.pad",
"torch.load",
"utility.flatten_naval",
"utility.smpl_detoe",
"numpy.max",
"utility.make_trimesh",
"numpy.rollaxis",
"cv2.resize",
... | [((155, 181), 'sys.path.append', 'sys.path.append', (['"""../src/"""'], {}), "('../src/')\n", (170, 181), False, 'import torch, PIL.Image, cv2, pickle, sys, argparse\n'), ((463, 488), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (486, 488), False, 'import torch, PIL.Image, cv2, pickle, sys, a... |
from discord.ext import commands
import discord
import functions as fnc
from cogs.help import get_help_skill
class Skill(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
# Cogが読み込まれた時に発動
async def on_ready(self):
print("Load Skill module...")
@comma... | [
"cogs.help.get_help_skill",
"discord.ext.commands.command",
"discord.Embed",
"discord.ext.commands.Cog.listener"
] | [((196, 219), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (217, 219), False, 'from discord.ext import commands\n'), ((315, 333), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (331, 333), False, 'from discord.ext import commands\n'), ((1255, 1331), 'discord.Emb... |
'''
Created on 17.07.2011
@author: kca
'''
from ..collections import OrderedDict
import futile
class LRUCache(OrderedDict):
max_items = 100
def __init__(self, max_items = None, threadsafe = None, *args, **kw):
super(LRUCache, self).__init__(*args, **kw)
if max_items is not None:
if max_items <= 0:
rai... | [
"threading.RLock"
] | [((507, 514), 'threading.RLock', 'RLock', ([], {}), '()\n', (512, 514), False, 'from threading import RLock\n')] |
import ovito
print("Hello, this is OVITO %i.%i.%i" % ovito.version)
# Import OVITO modules.
from ovito.io import *
from ovito.modifiers import *
from ovito.data import *
from collections import Counter
# Import standard Python and NumPy modules.
import sys
import numpy
import os
from ovito.pipeline import StaticSourc... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.tight_layout",
"numpy.set_printoptions",
"matplotlib.pyplot.show",
"ovito.pipeline.StaticSource",
"matplotlib.pyplot.imshow",
"sklearn.metrics.accuracy_score",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.ylabel",
"collections.Counter",
"matplotlib... | [((4035, 4120), 'os.path.join', 'os.path.join', (['ase_db_dataset_dir', "('hcp-sc-fcc-diam-bcc_displacement-30%' + '.db')"], {}), "(ase_db_dataset_dir, 'hcp-sc-fcc-diam-bcc_displacement-30%' + '.db'\n )\n", (4047, 4120), False, 'import os\n'), ((7813, 7845), 'sklearn.metrics.confusion_matrix', 'confusion_matrix', ([... |
from esp8266_i2c_lcd import I2cLcd
from machine import I2C
from machine import Pin
# i2c = I2C(scl=Pin(22),sda=Pin(21),freq=100000)
# lcd = I2cLcd(i2c, 0x27, 2, 16)
# lcd.clear()
# lcd.putstr('Uncle Engineer\nMicroPython')
i2c = I2C(scl=Pin(22),sda=Pin(21),freq=100000)
lcd = I2cLcd(i2c, 0x27, 2, 16)
import u... | [
"esp8266_i2c_lcd.I2cLcd",
"utime.sleep",
"machine.Pin"
] | [((286, 308), 'esp8266_i2c_lcd.I2cLcd', 'I2cLcd', (['i2c', '(39)', '(2)', '(16)'], {}), '(i2c, 39, 2, 16)\n', (292, 308), False, 'from esp8266_i2c_lcd import I2cLcd\n'), ((522, 537), 'utime.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (532, 537), True, 'import utime as time\n'), ((246, 253), 'machine.Pin', 'Pin', ... |
import unittest
from ms_deisotope.data_source import memory
from ms_deisotope.test.common import datafile
from ms_deisotope.data_source import infer_type
scan_ids = [
"controllerType=0 controllerNumber=1 scan=10014",
"controllerType=0 controllerNumber=1 scan=10015",
"controllerType=0 controllerNumber=1 sc... | [
"unittest.main",
"ms_deisotope.data_source.memory.MemoryScanLoader.build",
"ms_deisotope.test.common.datafile",
"ms_deisotope.data_source.infer_type.MSFileLoader"
] | [((392, 425), 'ms_deisotope.test.common.datafile', 'datafile', (['"""three_test_scans.mzML"""'], {}), "('three_test_scans.mzML')\n", (400, 425), False, 'from ms_deisotope.test.common import datafile\n'), ((1063, 1078), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1076, 1078), False, 'import unittest\n'), ((485,... |
import subprocess as sbp
import sys
import os
import numpy as np
import numpy.linalg as la
import pandas as pd
import time
import math
from ast import literal_eval
from pdb import set_trace as pst
'''
decfreq01: The original opitimization with negative freq as first one.
decfreq02: Move the atoms to direction of negat... | [
"numpy.zeros",
"time.time",
"numpy.linalg.eigh",
"numpy.array",
"numpy.linspace",
"os.listdir",
"sys.exit"
] | [((13279, 13290), 'time.time', 'time.time', ([], {}), '()\n', (13288, 13290), False, 'import time\n'), ((3268, 3303), 'numpy.zeros', 'np.zeros', (['(P, P)'], {'dtype': 'np.complex_'}), '((P, P), dtype=np.complex_)\n', (3276, 3303), True, 'import numpy as np\n'), ((4268, 4281), 'numpy.linalg.eigh', 'la.eigh', (['Fuvk'],... |
#!/usr/bin/env python
"""This module supplies a function that can generate custom sequences of
optimization passes for arbitrary programs.
This module provides an implementation of a hill climber algorithm presented by
Kulkarni in his paper "Evaluating Heuristic Optimization Phase Order Search
Algorithms" (published 2... | [
"polyjit.experiments.sequences.polly_stats.get_regions_without_scops",
"multiprocessing.Manager",
"random.choice",
"multiprocessing.Pool",
"logging.getLogger"
] | [((3506, 3528), 'multiprocessing.Pool', 'multiprocessing.Pool', ([], {}), '()\n', (3526, 3528), False, 'import multiprocessing\n'), ((4732, 4759), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (4749, 4759), False, 'import logging\n'), ((7414, 7441), 'logging.getLogger', 'logging.getLogge... |
from unittest import skip
from scrapy.http import Request
from scrapers.scrapers.spiders.dcwd import DcwdSpider
from scrapers.tests.base_scraper_test_setup import ScraperTestCase, html_files
from scrapers.tests.utils import make_response_object, make_fake_id
class DcwdParserTests(ScraperTestCase):
def setUp(se... | [
"scrapers.scrapers.spiders.dcwd.DcwdSpider",
"scrapers.tests.utils.make_response_object",
"scrapers.tests.utils.make_fake_id"
] | [((347, 366), 'scrapers.scrapers.spiders.dcwd.DcwdSpider', 'DcwdSpider', ([], {'limit': '(1)'}), '(limit=1)\n', (357, 366), False, 'from scrapers.scrapers.spiders.dcwd import DcwdSpider\n'), ((516, 562), 'scrapers.tests.utils.make_response_object', 'make_response_object', (["html_files['dcwd_index']"], {}), "(html_file... |
from django.shortcuts import render
# Create your views here.
from .models import Comment
from blog.models import Article
from .forms import CommentForm
from django.views.generic.edit import FormView
from django.http import HttpResponseRedirect
from django.contrib.auth import get_user_model
from django import forms
... | [
"DjangoBlog.utils.cache.delete",
"django.http.HttpResponseRedirect",
"DjangoBlog.utils.cache.get",
"django.contrib.sites.models.Site.objects.get_current",
"django.contrib.auth.get_user_model",
"django.forms.HiddenInput",
"django.core.cache.utils.make_template_fragment_key",
"DjangoBlog.utils.expire_vi... | [((541, 575), 'blog.models.Article.objects.get', 'Article.objects.get', ([], {'pk': 'article_id'}), '(pk=article_id)\n', (560, 575), False, 'from blog.models import Article\n'), ((632, 671), 'django.http.HttpResponseRedirect', 'HttpResponseRedirect', (["(url + '#comments')"], {}), "(url + '#comments')\n", (652, 671), F... |
"""
Adapted from Res2Net (v1b) official git repo:
https://github.com/Res2Net/Res2Net-PretrainedModels/blob/master/res2net_v1b.py
"""
from os import stat
import pathlib
import math
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import torch.nn.functional as F
from lib.nets.basemodel impor... | [
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.ReLU",
"torch.nn.init.kaiming_normal_",
"torch.rand",
"torch.nn.ModuleList",
"torch.nn.Sequential",
"torch.load",
"torch.nn.Conv2d",
"torch.split",
"math.floor",
"torch.cat",
"torch.nn.functional.dropout",
"torch.nn.BatchNorm2d",
"torch.nn.init.const... | [((9126, 9181), 'torch.load', 'torch.load', (['model_params[model_key]'], {'map_location': '"""cpu"""'}), "(model_params[model_key], map_location='cpu')\n", (9136, 9181), False, 'import torch\n'), ((1627, 1688), 'torch.nn.Conv2d', 'nn.Conv2d', (['inplanes', '(width * scale)'], {'kernel_size': '(1)', 'bias': '(False)'})... |
from itertools import permutations
import torch
from torch import nn
from scipy.optimize import linear_sum_assignment
import numpy as np
import torch.nn.functional as F
class PITLossWrapper(nn.Module):
r"""Permutation invariant loss wrapper.
Args:
loss_func: function with signature (est_targets, targ... | [
"torch.mean",
"scipy.optimize.linear_sum_assignment",
"torch.stack",
"torch.gather",
"scipy.signal.get_window",
"torch.nn.functional.pad",
"torch.cat",
"torch.zeros",
"torch.index_select",
"torch.einsum",
"torch.autograd.set_grad_enabled",
"torch.arange",
"torch.unsqueeze",
"torch.nn.funct... | [((6089, 6109), 'torch.mean', 'torch.mean', (['min_loss'], {}), '(min_loss)\n', (6099, 6109), False, 'import torch\n'), ((8996, 9022), 'torch.min', 'torch.min', (['loss_set'], {'dim': '(1)'}), '(loss_set, dim=1)\n', (9005, 9022), False, 'import torch\n'), ((9093, 9145), 'torch.stack', 'torch.stack', (['[perms[m] for m ... |
import sqlite3
import json
import os
import db_constants
import frontmatter
from datetime import datetime
def create_projects_table_query(table_name, title, subtitle, content, image_path):
return 'CREATE TABLE IF NOT EXISTS {table_name}' \
' ({title} TEXT, {subtitle} TEXT,' \
' {content} TE... | [
"os.getcwd",
"datetime.datetime.strptime",
"sqlite3.connect"
] | [((3928, 3970), 'sqlite3.connect', 'sqlite3.connect', (['db_constants.content_path'], {}), '(db_constants.content_path)\n', (3943, 3970), False, 'import sqlite3\n'), ((1478, 1489), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1487, 1489), False, 'import os\n'), ((2322, 2333), 'os.getcwd', 'os.getcwd', ([], {}), '()\n',... |