code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#!/usr/bin/env python3
# pyre-strict
import os
from copy import deepcopy
from typing import List, Optional
import torch
from torch ... | [
"copy.deepcopy",
"torchrecipes.vision.core.ops.fine_tuning_wrapper.FineTuningWrapper",
"torch.equal",
"torch.randn",
"torchvision.models.resnet.resnet18",
"torch.nn.Linear",
"torch.no_grad",
"os.path.join",
"torchrecipes.vision.core.utils.model_weights.load_model_weights"
] | [((1844, 1854), 'torchvision.models.resnet.resnet18', 'resnet18', ([], {}), '()\n', (1852, 1854), False, 'from torchvision.models.resnet import resnet18\n'), ((1879, 1916), 'os.path.join', 'os.path.join', (['root_dir', '"""weights.pth"""'], {}), "(root_dir, 'weights.pth')\n", (1891, 1916), False, 'import os\n'), ((2032... |
# Copyright 2015-2016 Palo Alto Networks, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | [
"functools.partial",
"netaddr.IPNetwork",
"requests.get",
"requests.Request",
"bs4.BeautifulSoup",
"itertools.chain",
"logging.getLogger"
] | [((785, 812), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (802, 812), False, 'import logging\n'), ((1236, 1262), 'netaddr.IPNetwork', 'netaddr.IPNetwork', (['iprange'], {}), '(iprange)\n', (1253, 1262), False, 'import netaddr\n'), ((1622, 1655), 'netaddr.IPNetwork', 'netaddr.IPNetwork'... |
import xmlrpc.client as xmlrpclib
import pytest
from tests.factories import ReleaseFactory
@pytest.fixture(params=['/RPC2', '/pypi'])
def rpc_endpoint(request):
return request.param
@pytest.mark.django_db
def test_search_package_name(client, admin_user, live_server, repository,
rp... | [
"pytest.fixture",
"xmlrpc.client.ServerProxy",
"tests.factories.ReleaseFactory"
] | [((96, 137), 'pytest.fixture', 'pytest.fixture', ([], {'params': "['/RPC2', '/pypi']"}), "(params=['/RPC2', '/pypi'])\n", (110, 137), False, 'import pytest\n'), ((337, 439), 'tests.factories.ReleaseFactory', 'ReleaseFactory', ([], {'package__name': '"""my-package"""', 'package__repository': 'repository', 'summary': '""... |
# Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
"tripleo_common.utils.passwords.generate_passwords",
"yaml.safe_dump",
"logging.getLogger",
"openstackclient.i18n._",
"os.path.join",
"subprocess.check_call",
"os.path.abspath",
"os.path.exists",
"heatclient.common.template_utils.process_multiple_environments_and_files",
"urllib.request.urlopen",
... | [((2155, 2204), 'logging.getLogger', 'logging.getLogger', (["(__name__ + '.DeployUndercloud')"], {}), "(__name__ + '.DeployUndercloud')\n", (2172, 2204), False, 'import logging\n'), ((2311, 2371), 'subprocess.Popen', 'subprocess.Popen', (["['hostname', '-s']"], {'stdout': 'subprocess.PIPE'}), "(['hostname', '-s'], stdo... |
#!/usr/bin/env python
# coding: utf-8
"""
This module subsets the certain number of important features
and detects student behavior and grouping students
"""
# Load libraries
import pandas as pd
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.neighbors import KNeighborsClassifier
from skl... | [
"sklearn.ensemble.RandomForestClassifier",
"sklearn.naive_bayes.GaussianNB",
"sklearn.cluster.KMeans",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.ensemble.ExtraTreesClassifier",
"sklearn.neighbors.KNeighborsClassifier",
"sklearn.linear_model.LogisticRegression",
"pandas.Series",
"sklearn.svm.SV... | [((2150, 2187), 'sklearn.ensemble.ExtraTreesClassifier', 'ExtraTreesClassifier', ([], {'n_estimators': '(50)'}), '(n_estimators=50)\n', (2170, 2187), False, 'from sklearn.ensemble import ExtraTreesClassifier\n'), ((2269, 2323), 'pandas.Series', 'pd.Series', (['clf.feature_importances_'], {'index': 'ivs.columns'}), '(cl... |
"""Symbolic model code generation.
Improvement ideas
-----------------
* Add compiled code to linecache so that tracebacks can be produced, like done
in the `IPython.core.compilerop` module.
"""
import abc
import collections
import collections.abc
import contextlib
import functools
import inspect
import itertools... | [
"jinja2.Template",
"functools.partial",
"numpy.asarray",
"inspect.signature",
"functools.wraps",
"attrdict.AttrDict"
] | [((7770, 7790), 'inspect.signature', 'inspect.signature', (['f'], {}), '(f)\n', (7787, 7790), False, 'import inspect\n'), ((8156, 8174), 'functools.wraps', 'functools.wraps', (['f'], {}), '(f)\n', (8171, 8174), False, 'import functools\n'), ((5161, 5196), 'jinja2.Template', 'jinja2.Template', (['model_template_src'], {... |
from sys import argv, exit
import csv
import re
if len(argv) != 3:
print("Usage: dna.py data.csv sequence.txt")
exit(1)
elif re.match(".*\.csv$", argv[1]) is None or re.match(".*\.txt$", argv[2]) is None:
print("Usage: dna.py data.csv sequence.txt")
exit(2)
else:
# opening csvfile
with open(ar... | [
"csv.DictReader",
"csv.reader",
"re.match",
"sys.exit"
] | [((122, 129), 'sys.exit', 'exit', (['(1)'], {}), '(1)\n', (126, 129), False, 'from sys import argv, exit\n'), ((268, 275), 'sys.exit', 'exit', (['(2)'], {}), '(2)\n', (272, 275), False, 'from sys import argv, exit\n'), ((2624, 2631), 'sys.exit', 'exit', (['(0)'], {}), '(0)\n', (2628, 2631), False, 'from sys import argv... |
#!/usr/bin/env python3
# coding: utf-8
"""
@author: <NAME> <EMAIL>
@last modified by: <NAME>
@file:qc.py
@time:2021/03/26
"""
from scipy.sparse import issparse
import numpy as np
def cal_qc(data):
"""
calculate three qc index including the number of genes expressed in the count matrix, the total counts per c... | [
"scipy.sparse.issparse",
"numpy.char.lower",
"numpy.count_nonzero"
] | [((1770, 1790), 'scipy.sparse.issparse', 'issparse', (['exp_matrix'], {}), '(exp_matrix)\n', (1778, 1790), False, 'from scipy.sparse import issparse\n'), ((1796, 1832), 'numpy.count_nonzero', 'np.count_nonzero', (['exp_matrix'], {'axis': '(0)'}), '(exp_matrix, axis=0)\n', (1812, 1832), True, 'import numpy as np\n'), ((... |
from django import template
from ..utils import sanitize_richtext
register = template.Library()
@register.filter
def baseplugin_pluginid(plugin_object):
return 'data-plugin-id="%s"' % plugin_object.pk
@register.filter
def baseplugin_sanitize_richtext(text):
return sanitize_richtext(text)
| [
"django.template.Library"
] | [((79, 97), 'django.template.Library', 'template.Library', ([], {}), '()\n', (95, 97), False, 'from django import template\n')] |
import pandas as pd
import numpy as np
def load_cancer():
# data, target, feature_names
result_dict = {'features': np.array(["Clump Thickness",
"Uniformity of Cell Size",
"Uniformity of Cell Shape",
... | [
"pandas.read_csv",
"numpy.array"
] | [((754, 779), 'numpy.array', 'np.array', (["df_dict['data']"], {}), "(df_dict['data'])\n", (762, 779), True, 'import numpy as np\n'), ((2022, 2047), 'numpy.array', 'np.array', (["df_dict['data']"], {}), "(df_dict['data'])\n", (2030, 2047), True, 'import numpy as np\n'), ((125, 337), 'numpy.array', 'np.array', (["['Clum... |
import pyshark
cap = pyshark.FileCapture('drox.pcapng')
key = b'xord'
for packet in cap:
try:
data = bytes([int(x, 16) for x in packet.tcp.payload.split(":")])
r = range(max(len(key), len(data)))
print(''.join([chr((key[i%len(key)]) ^ (data[i])) for i in r]))
except Exception as e:
print(e)
| [
"pyshark.FileCapture"
] | [((21, 55), 'pyshark.FileCapture', 'pyshark.FileCapture', (['"""drox.pcapng"""'], {}), "('drox.pcapng')\n", (40, 55), False, 'import pyshark\n')] |
import pytest
from enphaseAI.problem1 import find_lines_from_points, find_lines_intersection
def test_find_lines_from_points() -> None:
p0 = 0., "string_input"
p1 = 1., 2.5
# Test for string input
args = [p0, p1]
pytest.raises(AssertionError, find_lines_from_points, *args)
# Test... | [
"enphaseAI.problem1.find_lines_intersection",
"pytest.raises",
"enphaseAI.problem1.find_lines_from_points"
] | [((246, 306), 'pytest.raises', 'pytest.raises', (['AssertionError', 'find_lines_from_points', '*args'], {}), '(AssertionError, find_lines_from_points, *args)\n', (259, 306), False, 'import pytest\n'), ((363, 423), 'pytest.raises', 'pytest.raises', (['AssertionError', 'find_lines_from_points', '*args'], {}), '(Assertion... |
"""
Integration/unit test for the AlleleFilter module.
Since it consists mostly of database queries, it's tested on a live database.
"""
import pytest
from datalayer import AlleleFilter
from vardb.datamodel import sample, jsonschema
FILTER_CONFIG_NUM = 0
def insert_filter_config(session, filter_config):
global ... | [
"datalayer.AlleleFilter",
"pytest.raises",
"vardb.datamodel.jsonschema.JSONSchema.get_or_create",
"pytest.mark.aa"
] | [((420, 544), 'vardb.datamodel.jsonschema.JSONSchema.get_or_create', 'jsonschema.JSONSchema.get_or_create', (['session'], {}), "(session, **{'name': 'filterconfig',\n 'version': 10000, 'schema': {'type': 'object'}})\n", (455, 544), False, 'from vardb.datamodel import sample, jsonschema\n'), ((1292, 1324), 'datalayer... |
# Generated by Django 3.0.7 on 2020-07-28 12:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('data', '0097_auto_20200724_1157'),
]
operations = [
migrations.RenameModel(
old_name='Culture',
new_name='SimulatorCulture',... | [
"django.db.migrations.RenameModel"
] | [((224, 295), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""Culture"""', 'new_name': '"""SimulatorCulture"""'}), "(old_name='Culture', new_name='SimulatorCulture')\n", (246, 295), False, 'from django.db import migrations\n')] |
# -*- encoding: utf-8 -*-
# Copyright (c) Alibaba, Inc. and its affiliates.
import logging
import re
from abc import abstractmethod
import six
import tensorflow as tf
from tensorflow.python.framework import tensor_shape
from tensorflow.python.ops.variables import PartitionedVariable
from easy_rec.python.compat impor... | [
"tensorflow.gfile.Exists",
"easy_rec.python.utils.restore_filter.KeywordFilter",
"easy_rec.python.compat.regularizers.l2_regularizer",
"tensorflow.train.NewCheckpointReader",
"tensorflow.global_variables",
"tensorflow.python.framework.tensor_shape.TensorShape",
"easy_rec.python.utils.load_class.get_regi... | [((687, 763), 'easy_rec.python.utils.load_class.get_register_class_meta', 'get_register_class_meta', (['_EASY_REC_MODEL_CLASS_MAP'], {'have_abstract_class': '(True)'}), '(_EASY_REC_MODEL_CLASS_MAP, have_abstract_class=True)\n', (710, 763), False, 'from easy_rec.python.utils.load_class import get_register_class_meta\n')... |
# Copyright 2021 Google LLC
#
# 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, ... | [
"pyreach.mock.calibration_mock.CalibrationMock",
"numpy.zeros"
] | [((4429, 4464), 'numpy.zeros', 'np.zeros', (['(3, 5, 3)'], {'dtype': 'np.uint8'}), '((3, 5, 3), dtype=np.uint8)\n', (4437, 4464), True, 'import numpy as np\n'), ((4529, 4614), 'pyreach.mock.calibration_mock.CalibrationMock', 'cal_mock.CalibrationMock', (['"""device_type"""', '"""device_name"""', '"""color_camera_link_n... |
from pyvisdk.base.managed_object_types import ManagedObjectTypes
from pyvisdk.mo.managed_entity import ManagedEntity
import logging
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
class HostSystem(ManagedEn... | [
"logging.getLogger"
] | [((265, 292), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (282, 292), False, 'import logging\n')] |
from util.Color import *
class Consulta():
def __init__(self, preco, data, paciente_id, medico_id, realizada, paga, id=None):
self.id=id
self.preco=preco
self.data=data
self.paciente_id=paciente_id
self.medico_id=medico_id
self.realizada=realizada
... | [
"database.PacienteDAO.PacienteDAO",
"database.MedicoDAO.MedicoDAO"
] | [((555, 566), 'database.MedicoDAO.MedicoDAO', 'MedicoDAO', ([], {}), '()\n', (564, 566), False, 'from database.MedicoDAO import MedicoDAO\n'), ((626, 639), 'database.PacienteDAO.PacienteDAO', 'PacienteDAO', ([], {}), '()\n', (637, 639), False, 'from database.PacienteDAO import PacienteDAO\n')] |
"""electoral URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-bas... | [
"electoral_backend.views.Authenticate.as_view",
"electoral_backend.views.PrivacyPolicy.as_view",
"django.urls.path",
"electoral_backend.views.FrontendAppView.as_view",
"electoral_backend.views.TestDataView.as_view",
"electoral_backend.views.TermsOfService.as_view"
] | [((836, 867), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (840, 867), False, 'from django.urls import path, re_path\n'), ((895, 917), 'electoral_backend.views.TestDataView.as_view', 'TestDataView.as_view', ([], {}), '()\n', (915, 917), False, 'from electoral_b... |
import numpy as np
from scipy.fftpack import rfft, irfft, rfftfreq
from ....routines import rescale
def fourier_filter(data: np.ndarray, fs: float,
lp_freq: float = None, hp_freq: float = None, bs_freqs: list = [],
trans_width: float = 1, band_width: float = 1) -> np.ndarray:
... | [
"scipy.fftpack.rfftfreq",
"scipy.fftpack.rfft",
"numpy.ones_like",
"numpy.apply_along_axis",
"numpy.exp",
"scipy.fftpack.irfft"
] | [((1143, 1157), 'scipy.fftpack.rfftfreq', 'rfftfreq', (['T', 'd'], {}), '(T, d)\n', (1151, 1157), False, 'from scipy.fftpack import rfft, irfft, rfftfreq\n'), ((1171, 1190), 'scipy.fftpack.rfft', 'rfft', (['data'], {'axis': '(-1)'}), '(data, axis=-1)\n', (1175, 1190), False, 'from scipy.fftpack import rfft, irfft, rfft... |
import os
import sys
import re
import shutil
import importlib.util
import numpy as np
from datetime import datetime
import time
import pathlib
import logging
import PSICT_UIF._include36._LogLevels as LogLevels
## Worker script breakpoints - DO NOT MODIFY
OPTIONS_DICT_BREAKPOINT = '## OPTIONS DICT BREAKPOINT'
SCRIPT_C... | [
"logging.addLevelName",
"logging.Formatter",
"pathlib.Path",
"logging.NullHandler",
"os.path.join",
"shutil.copy",
"os.path.abspath",
"logging.FileHandler",
"os.path.exists",
"datetime.datetime.now",
"re.split",
"os.path.basename",
"logging.StreamHandler",
"time.sleep",
"re.compile",
"... | [((6010, 6037), 'os.path.split', 'os.path.split', (['original_dir'], {}), '(original_dir)\n', (6023, 6037), False, 'import os\n'), ((6060, 6079), 'os.path.split', 'os.path.split', (['head'], {}), '(head)\n', (6073, 6079), False, 'import os\n'), ((6104, 6123), 'os.path.split', 'os.path.split', (['head'], {}), '(head)\n'... |
import random
import math
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import colorsys
import copy
def visualization(machines, jobs, algo):
# Declaring a figure "gnt"
fig, gnt = plt.subplots()
# Setting labels for x-axis and y-axis
gnt.set_xlabel('Processing Time')
gnt.set_yla... | [
"matplotlib.pyplot.title",
"math.isnan",
"copy.deepcopy",
"matplotlib.pyplot.show",
"random.randint",
"math.sqrt",
"math.ceil",
"matplotlib.pyplot.yticks",
"math.floor",
"random.random",
"colorsys.hls_to_rgb",
"matplotlib.pyplot.subplots"
] | [((208, 222), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (220, 222), True, 'import matplotlib.pyplot as plt\n'), ((2127, 2141), 'matplotlib.pyplot.yticks', 'plt.yticks', (['[]'], {}), '([])\n', (2137, 2141), True, 'import matplotlib.pyplot as plt\n'), ((2178, 2193), 'matplotlib.pyplot.title', 'plt.... |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "IP Check"
class Input:
ADDRESS = "address"
class Output:
ADDRESS = "address"
FOUND = "found"
STATUS = "status"
URL = "url"
class LookupInput(komand.Input):
schema = json.loads(""... | [
"json.loads"
] | [((307, 575), 'json.loads', 'json.loads', (['"""\n {\n "type": "object",\n "title": "Variables",\n "properties": {\n "address": {\n "type": "string",\n "title": "Address",\n "description": "IPv4 Address",\n "order": 1\n }\n },\n "required": [\n "address"\n ]\n}\n """'], {}), '(\n... |
from gym.envs.registration import register
## off-policy variBAD benchmark
register(
"PointRobot-v0",
entry_point="envs.meta.toy_navigation.point_robot:PointEnv",
kwargs={"max_episode_steps": 60, "n_tasks": 2},
)
register(
"PointRobotSparse-v0",
entry_point="envs.meta.toy_navigation.point_robot:S... | [
"gym.envs.registration.register"
] | [((77, 221), 'gym.envs.registration.register', 'register', (['"""PointRobot-v0"""'], {'entry_point': '"""envs.meta.toy_navigation.point_robot:PointEnv"""', 'kwargs': "{'max_episode_steps': 60, 'n_tasks': 2}"}), "('PointRobot-v0', entry_point=\n 'envs.meta.toy_navigation.point_robot:PointEnv', kwargs={\n 'max_epis... |
#!/usr/bin/evn python
import sqlite3
from flask import Flask, jsonify, g
app = Flask(__name__)
DATABASE = 'union-bridge'
def query_db(query, args=(), one=False):
cur=g.db.execute(query, args)
rv = [dict((cur.description[idx][0], value)
for idx, value in enumerate(row)) for row in cur.fetchall()]
... | [
"flask.g.db.execute",
"flask.Flask",
"flask.jsonify",
"flask.g.db.close",
"sqlite3.connect"
] | [((82, 97), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (87, 97), False, 'from flask import Flask, jsonify, g\n'), ((175, 200), 'flask.g.db.execute', 'g.db.execute', (['query', 'args'], {}), '(query, args)\n', (187, 200), False, 'from flask import Flask, jsonify, g\n'), ((398, 423), 'sqlite3.connect', '... |
from punkweb_boards.conf import settings as BOARD_SETTINGS
from punkweb_boards.models import Report
def settings(request):
return {
"BOARD_SETTINGS": {
"BOARD_NAME": BOARD_SETTINGS.BOARD_NAME,
"BOARD_THEME": BOARD_SETTINGS.BOARD_THEME,
"SHOUTBOX_ENABLED": BOARD_SETTINGS... | [
"punkweb_boards.models.Report.objects.filter"
] | [((1039, 1076), 'punkweb_boards.models.Report.objects.filter', 'Report.objects.filter', ([], {'resolved': '(False)'}), '(resolved=False)\n', (1060, 1076), False, 'from punkweb_boards.models import Report\n')] |
import os
import hou
def main(arguments):
file = arguments["file"].replace(os.sep, '/')
if(arguments["force"] == 0):
hou.hipFile.load(file, suppress_save_prompt=True)
else:
hou.hipFile.save(file_name=None)
hou.hipFile.load(file, suppress_save_prompt=False)
# workspace_path = f... | [
"hou.hipFile.load",
"hou.hipFile.save"
] | [((135, 184), 'hou.hipFile.load', 'hou.hipFile.load', (['file'], {'suppress_save_prompt': '(True)'}), '(file, suppress_save_prompt=True)\n', (151, 184), False, 'import hou\n'), ((203, 235), 'hou.hipFile.save', 'hou.hipFile.save', ([], {'file_name': 'None'}), '(file_name=None)\n', (219, 235), False, 'import hou\n'), ((2... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
# pylint: disable=too-few-public-methods
"""Driloader Command Line Interface
Using Google Python Style Guide:
http://google.github.io/styleguide/pyguide.html
"""
import argparse
import sys
from driloader.brows... | [
"driloader.factories.browser_factory.BrowserFactory",
"argparse.ArgumentParser",
"sys.exit"
] | [((3882, 3923), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""driloader"""'}), "(prog='driloader')\n", (3905, 3923), False, 'import argparse\n'), ((5618, 5637), 'sys.exit', 'sys.exit', (['exit_code'], {}), '(exit_code)\n', (5626, 5637), False, 'import sys\n'), ((1429, 1453), 'driloader.factori... |
# -*- coding: utf-8 -*-
import flask
import os
import sys
import ast
import json
import argparse
app = flask.Flask(__name__)
filename = ''
@app.route('/latency_metrics')
def get_latency_percentiles():
""" Retrieves the last saved latency hdr histogram percentiles
and the average latency
Args:
... | [
"flask.Flask",
"argparse.ArgumentParser",
"json.dumps"
] | [((104, 125), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (115, 125), False, 'import flask\n'), ((1105, 1170), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Give configuration options"""'}), "(description='Give configuration options')\n", (1128, 1170), False, 'impo... |
import numpy as np
import unittest
from numpy.testing import assert_array_less
from GPyOpt.core.errors import InvalidConfigError
from GPyOpt.core.task.space import Design_space
from GPyOpt.experiment_design import initial_design
class TestInitialDesign(unittest.TestCase):
def setUp(self):
self.space = [
... | [
"GPyOpt.core.task.space.Design_space",
"numpy.array",
"GPyOpt.experiment_design.initial_design",
"numpy.in1d"
] | [((592, 616), 'GPyOpt.core.task.space.Design_space', 'Design_space', (['self.space'], {}), '(self.space)\n', (604, 616), False, 'from GPyOpt.core.task.space import Design_space\n'), ((1451, 1511), 'GPyOpt.experiment_design.initial_design', 'initial_design', (['"""grid"""', 'self.design_space', 'init_points_count'], {})... |
import os
from datetime import datetime, timedelta
#
# Airflow root directory
#
PROJECT_ROOT = os.path.dirname(
os.path.dirname(
os.path.dirname(__file__)
)
)
#
# Dates
#
# yesterday at beginning of day
yesterday_start = datetime.now() - timedelta(days=1)
yesterday_start = yesterday_start.replace(hour... | [
"os.path.dirname",
"datetime.datetime.now",
"datetime.timedelta"
] | [((239, 253), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (251, 253), False, 'from datetime import datetime, timedelta\n'), ((256, 273), 'datetime.timedelta', 'timedelta', ([], {'days': '(1)'}), '(days=1)\n', (265, 273), False, 'from datetime import datetime, timedelta\n'), ((453, 467), 'datetime.datetim... |
import time
import argparse
import numpy as np
import json
import os
import sys
# from matplotlib import pyplot
from torch.utils.data import DataLoader
from preprocessing import Constants
from util import construct_data_from_json
from dgl_treelstm.KNN import KNN
from dgl_treelstm.nn_models import *
from dgl_treelstm... | [
"argparse.ArgumentParser",
"sklearn.metrics.accuracy_score",
"json.dumps",
"sklearn.metrics.f1_score",
"numpy.mean",
"preprocessing.Tree_Dataset.Tree_Dataset",
"preprocessing.Vector_Dataset.Vector_Dataset",
"os.path.exists",
"train.batcher",
"util.construct_data_from_json",
"preprocessing.Vocab"... | [((858, 891), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (881, 891), False, 'import warnings\n'), ((14925, 14946), 'os.path.exists', 'os.path.exists', (['input'], {}), '(input)\n', (14939, 14946), False, 'import os\n'), ((20244, 20289), 'sklearn.metrics.accuracy_score'... |
from setuptools import setup
setup(
name="integrity",
version="0.1.0",
author="<NAME>",
author_email="<EMAIL>",
packages=["integrity"],
entry_points={"console_scripts": ["integrity = integrity.__main__:main"]},
)
| [
"setuptools.setup"
] | [((30, 220), 'setuptools.setup', 'setup', ([], {'name': '"""integrity"""', 'version': '"""0.1.0"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'packages': "['integrity']", 'entry_points': "{'console_scripts': ['integrity = integrity.__main__:main']}"}), "(name='integrity', version='0.1.0', author='<NAM... |
from SingleLog.log import Logger
from . import data_type
from . import i18n
from . import connect_core
from . import screens
from . import exceptions
from . import command
from . import _api_util
def get_bottom_post_list(api, board):
api._goto_board(board, end=True)
logger = Logger('get_bottom_post_list', L... | [
"SingleLog.log.Logger"
] | [((288, 331), 'SingleLog.log.Logger', 'Logger', (['"""get_bottom_post_list"""', 'Logger.INFO'], {}), "('get_bottom_post_list', Logger.INFO)\n", (294, 331), False, 'from SingleLog.log import Logger\n')] |
"""
Set of bot commands designed for Maths Challenges.
"""
from io import BytesIO
import aiohttp
import dateutil.parser
import httpx
from discord import Colour, Embed, File
from discord.ext import tasks
from discord.ext.commands import Bot, Cog, Context, command
from html2markdown import convert
from cdbot.constants ... | [
"io.BytesIO",
"discord.ext.commands.command",
"html2markdown.convert",
"cdbot.constants.Maths.LATEX_RE.findall",
"cdbot.constants.Maths.Challenges.TOPIC.format",
"discord.ext.commands.Cog.listener",
"httpx.AsyncClient",
"aiohttp.ClientSession",
"discord.ext.tasks.loop",
"discord.Colour"
] | [((2807, 2828), 'discord.ext.tasks.loop', 'tasks.loop', ([], {'minutes': '(1)'}), '(minutes=1)\n', (2817, 2828), False, 'from discord.ext import tasks\n'), ((3903, 3917), 'discord.ext.commands.Cog.listener', 'Cog.listener', ([], {}), '()\n', (3915, 3917), False, 'from discord.ext.commands import Bot, Cog, Context, comm... |
# Generated by Django 2.1.3 on 2019-03-09 13:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('learn', '0012_challenge_has_indent'),
]
operations = [
migrations.RemoveField(
model_name='challenge',
name='has_indent',
... | [
"django.db.migrations.RemoveField"
] | [((227, 292), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""challenge"""', 'name': '"""has_indent"""'}), "(model_name='challenge', name='has_indent')\n", (249, 292), False, 'from django.db import migrations\n')] |
import re
def split_phone_numbers(s):
return re.split(r'[ -]', s)
for i in range(int(input())):
match = split_phone_numbers(input())
print('CountryCode=' + match[0] + ',LocalAreaCode=' + match[1] + ',Number=' + match[2])
| [
"re.split"
] | [((50, 69), 're.split', 're.split', (['"""[ -]"""', 's'], {}), "('[ -]', s)\n", (58, 69), False, 'import re\n')] |
from sqlalchemy.schema import FetchedValue
from app.api.utils.models_mixins import AuditMixin, Base
from app.extensions import db
class GovernmentAgencyType(AuditMixin, Base):
__tablename__ = 'government_agency_type'
government_agency_type_code = db.Column(db.String, primary_key=True)
description = db.Co... | [
"app.extensions.db.Column",
"sqlalchemy.schema.FetchedValue"
] | [((258, 296), 'app.extensions.db.Column', 'db.Column', (['db.String'], {'primary_key': '(True)'}), '(db.String, primary_key=True)\n', (267, 296), False, 'from app.extensions import db\n'), ((315, 351), 'app.extensions.db.Column', 'db.Column', (['db.String'], {'nullable': '(False)'}), '(db.String, nullable=False)\n', (3... |
"""This file is the main module which contains the app.
"""
from app import create_app, db
from app.auth.auth_cli import getToken
from decouple import config
from flask.cli import AppGroup
import click
import config as configs
# Figure out which config we want based on the `ENV` env variable, default to local
from ap... | [
"click.argument",
"app.auth.auth_cli.getToken",
"decouple.config",
"flask.cli.AppGroup",
"app.utils.backfill.backfill"
] | [((367, 411), 'decouple.config', 'config', (['"""ENV"""'], {'cast': 'str', 'default': '"""localpsql"""'}), "('ENV', cast=str, default='localpsql')\n", (373, 411), False, 'from decouple import config\n'), ((857, 873), 'flask.cli.AppGroup', 'AppGroup', (['"""auth"""'], {}), "('auth')\n", (865, 873), False, 'from flask.cl... |
import json
from pathlib import Path
from pbpstats.data_loader.abs_data_loader import check_file_directory
from pbpstats.data_loader.stats_nba.file_loader import StatsNbaFileLoader
class StatsNbaShotsFileLoader(StatsNbaFileLoader):
"""
A ``StatsNbaShotsFileLoader`` object should be instantiated and passed in... | [
"pathlib.Path",
"json.load"
] | [((1094, 1119), 'pathlib.Path', 'Path', (['self.home_file_path'], {}), '(self.home_file_path)\n', (1098, 1119), False, 'from pathlib import Path\n'), ((1366, 1391), 'pathlib.Path', 'Path', (['self.away_file_path'], {}), '(self.away_file_path)\n', (1370, 1391), False, 'from pathlib import Path\n'), ((1319, 1339), 'json.... |
import numpy as np
import pandas as pd
students = 250
nr_to_label = {0: 'bike', 1: 'car', 2: 'bus 40', 3: 'bus 240'}
label_to_nr = {v: k for k, v in nr_to_label.items()}
def choice(income, distance, lazy):
"""
Generate a choice based on the params
"""
if income < 500:
if distance < 8 and dist... | [
"pandas.DataFrame",
"numpy.random.randint",
"numpy.random.random",
"numpy.random.poisson",
"numpy.random.normal"
] | [((1058, 1100), 'numpy.random.randint', 'np.random.randint', (['(0)', '(4)'], {'size': 'replace.size'}), '(0, 4, size=replace.size)\n', (1075, 1100), True, 'import numpy as np\n'), ((1122, 1193), 'pandas.DataFrame', 'pd.DataFrame', (['idct'], {'columns': "['income', 'distance', 'lazy', 'transport']"}), "(idct, columns=... |
# Generated by Django 3.1.7 on 2021-04-22 15:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_auto_20210414_1640'),
]
operations = [
migrations.AddField(
model_name='document',
name='... | [
"django.db.models.CharField"
] | [((350, 393), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(16)'}), '(blank=True, max_length=16)\n', (366, 393), False, 'from django.db import migrations, models\n'), ((524, 568), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(255)... |
from __future__ import print_function
import os
from apiclient.discovery import build
from httplib2 import Http
from oauth2client import file, client, tools
from apiclient.http import MediaFileUpload
import pandas as pd
import sys
def upload_files():
try:
import argparse
flags = argpars... | [
"oauth2client.file.Storage",
"pandas.DataFrame",
"os.remove",
"oauth2client.tools.run",
"httplib2.Http",
"argparse.ArgumentParser",
"oauth2client.client.flow_from_clientsecrets",
"oauth2client.tools.run_flow",
"sys.exc_info"
] | [((695, 723), 'oauth2client.file.Storage', 'file.Storage', (['"""storage.json"""'], {}), "('storage.json')\n", (707, 723), False, 'from oauth2client import file, client, tools\n'), ((2008, 2030), 'pandas.DataFrame', 'pd.DataFrame', (['filesIds'], {}), '(filesIds)\n', (2020, 2030), True, 'import pandas as pd\n'), ((445,... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"azure.cli.core.commands.arm.add_id_parameters",
"azure.cli.core.commands._update_command_definitions",
"yaml.load",
"json.dump",
"os.makedirs",
"importlib.import_module",
"azure.cli.core.application.APPLICATION.configuration.get_command_table",
"os.path.exists",
"pkgutil.iter_modules",
"azclishel... | [((6118, 6141), 'azclishell.configuration.get_config_dir', 'config.get_config_dir', ([], {}), '()\n', (6139, 6141), True, 'import azclishell.configuration as config\n'), ((6159, 6194), 'os.path.join', 'os.path.join', (['azure_folder', '"""cache"""'], {}), "(azure_folder, 'cache')\n", (6171, 6194), False, 'import os\n')... |
# test function gradient
def limetr_gradient():
import numpy as np
from limetr.__init__ import LimeTr
ok = True
# setup test problem
# -------------------------------------------------------------------------
model = LimeTr.testProblem(use_trimming=True,
use_con... | [
"limetr.__init__.LimeTr.testProblem",
"numpy.linalg.norm",
"numpy.random.randn"
] | [((244, 408), 'limetr.__init__.LimeTr.testProblem', 'LimeTr.testProblem', ([], {'use_trimming': '(True)', 'use_constraints': '(True)', 'use_regularizer': '(True)', 'use_uprior': '(True)', 'use_gprior': '(True)', 'know_obs_std': '(False)', 'share_obs_std': '(True)'}), '(use_trimming=True, use_constraints=True, use_regul... |
from common.vec_env.vec_logger import VecLogger
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
GAMMA = 0.99
TAU = 1.00
N_STEPS = 5
CLIP_GRAD = 50
COEF_VALUE = 0.5
COEF_ENTROPY = 0.01
def train(args, venv, model, path, device):
N = args.num_pr... | [
"numpy.expand_dims",
"torch.nn.functional.softmax",
"common.vec_env.vec_logger.VecLogger",
"torch.nn.functional.log_softmax",
"torch.zeros",
"torch.from_numpy"
] | [((521, 546), 'common.vec_env.vec_logger.VecLogger', 'VecLogger', ([], {'N': 'N', 'path': 'path'}), '(N=N, path=path)\n', (530, 546), False, 'from common.vec_env.vec_logger import VecLogger\n'), ((666, 685), 'torch.zeros', 'torch.zeros', (['N', '(512)'], {}), '(N, 512)\n', (677, 685), False, 'import torch\n'), ((706, 7... |
# Copyright (c) 2020 University of Illinois
# 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 source code must retain the above copyright
# notice, this list of conditions and t... | [
"xml.etree.ElementTree.Element"
] | [((6252, 6312), 'xml.etree.ElementTree.Element', 'ElementTree.Element', (['"""component"""'], {'id': 'self.id', 'name': 'self.name'}), "('component', id=self.id, name=self.name)\n", (6271, 6312), False, 'from xml.etree import ElementTree\n'), ((8546, 8606), 'xml.etree.ElementTree.Element', 'ElementTree.Element', (['"""... |
import math
from heapq import heappop, heappush
import pickle
from itertools import islice
k=5
threshhold = 10
doc_length = {}
champion_list = {}
scores = {}
heap_flag = 1
champion_flag = 1
index_elimination_flag = 1
# set into a list
def convert(set):
return sorted(set)
#sort
def sort(list):
return sort... | [
"heapq.heappush",
"math.pow",
"heapq.heappop",
"pickle.load",
"itertools.islice",
"math.log"
] | [((409, 423), 'math.pow', 'math.pow', (['b', 'p'], {}), '(b, p)\n', (417, 423), False, 'import math\n'), ((476, 495), 'math.log', 'math.log', (['number', 'b'], {}), '(number, b)\n', (484, 495), False, 'import math\n'), ((5155, 5171), 'pickle.load', 'pickle.load', (['fp1'], {}), '(fp1)\n', (5166, 5171), False, 'import p... |
import ctypes
import itertools
import windows
import windows.hooks
from windows.generated_def.winstructs import *
class Ressource(object):
def __init__(self, filename, lpName, lpType):
self.filename = filename
self.lpName = lpName
self.lpType = lpType
self.driver_data = None
... | [
"ctypes.c_char_p",
"ctypes.cast",
"windows.hooks.Callback",
"itertools.count"
] | [((1029, 1056), 'itertools.count', 'itertools.count', (['(1111638594)'], {}), '(1111638594)\n', (1044, 1056), False, 'import itertools\n'), ((1060, 1110), 'windows.hooks.Callback', 'windows.hooks.Callback', (['PVOID', 'PVOID', 'PVOID', 'PVOID'], {}), '(PVOID, PVOID, PVOID, PVOID)\n', (1082, 1110), False, 'import window... |
import torch
from torch import nn
from kornia import augmentation as K
from kornia import filters as F
from torchvision import transforms
from .augmenter import RandomAugmentation
from .randaugment import RandAugmentNS
# for type hint
from typing import List, Tuple, Union, Callable
from torch import Tensor
from torch... | [
"kornia.augmentation.RandomResizedCrop",
"kornia.augmentation.ColorJitter",
"kornia.filters.GaussianBlur2d",
"kornia.augmentation.RandomCrop",
"kornia.augmentation.RandomErasing",
"kornia.augmentation.RandomAffine",
"kornia.augmentation.RandomHorizontalFlip",
"torch.tensor"
] | [((2529, 2632), 'kornia.augmentation.RandomCrop', 'K.RandomCrop', ([], {'size': 'image_size', 'padding': 'padding', 'pad_if_needed': 'pad_if_needed', 'padding_mode': '"""reflect"""'}), "(size=image_size, padding=padding, pad_if_needed=pad_if_needed,\n padding_mode='reflect')\n", (2541, 2632), True, 'from kornia impo... |
# code-checked
# server-checked
import os
# NOTE! NOTE! NOTE! make sure you run this code inside the kitti_raw directory (/root/data/kitti_raw)
kitti_depth_path = "/root/data/kitti_depth"
rgb_depth_path = "/root/data/kitti_rgb"
train_dirs = os.listdir(kitti_depth_path + "/train") # (contains "2011_09_26_drive_0001_s... | [
"os.system",
"os.path.join",
"os.listdir"
] | [((244, 283), 'os.listdir', 'os.listdir', (["(kitti_depth_path + '/train')"], {}), "(kitti_depth_path + '/train')\n", (254, 283), False, 'import os\n'), ((347, 384), 'os.listdir', 'os.listdir', (["(kitti_depth_path + '/val')"], {}), "(kitti_depth_path + '/val')\n", (357, 384), False, 'import os\n'), ((441, 478), 'os.pa... |
import warnings
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List
import xarray as xr
from _echopype_version import version as ECHOPYPE_VERSION
from ..core import SONAR_MODELS
from ..qc import coerce_increasing_time, exist_reversed_time
from .echodata import EchoData
def unio... | [
"datetime.datetime.utcnow",
"pathlib.Path",
"warnings.warn",
"xarray.combine_nested"
] | [((6455, 6639), 'xarray.combine_nested', 'xr.combine_nested', (['group_datasets', '[concat_dim]'], {'data_vars': 'concat_data_vars', 'coords': '"""minimal"""', 'combine_attrs': "('drop' if combine_attrs == 'overwrite_conflicts' else combine_attrs)"}), "(group_datasets, [concat_dim], data_vars=concat_data_vars,\n coo... |
from dataclasses import dataclass, field
from typing import Any, Dict, Iterable, Optional, Tuple, Union
from flask import Flask, Blueprint, request, Response
from flask.views import View
from werkzeug.exceptions import MethodNotAllowed
from werkzeug.routing import Map, MapAdapter, Rule
@dataclass
class RouteMeta:
... | [
"flask.request.method.lower",
"werkzeug.routing.Rule",
"dataclasses.field",
"werkzeug.routing.Map",
"werkzeug.exceptions.MethodNotAllowed"
] | [((385, 412), 'dataclasses.field', 'field', ([], {'default_factory': 'dict'}), '(default_factory=dict)\n', (390, 412), False, 'from dataclasses import dataclass, field\n'), ((1189, 1194), 'werkzeug.routing.Map', 'Map', ([], {}), '()\n', (1192, 1194), False, 'from werkzeug.routing import Map, MapAdapter, Rule\n'), ((324... |
import mapel
import mapel.voting.elections.mallows as mallows
from PIL import Image, ImageDraw
from math import sqrt
from sys import argv
def getrgb(value, MAX):
x = int(255 * value / MAX)
return (x, x, x)
def getrgb_uniform(value, MAX):
x = int(255 * value)
return (x, x, x)
def getsqrtrgb(value,... | [
"PIL.ImageDraw.Draw",
"PIL.Image.new",
"mapel.prepare_experiment"
] | [((1256, 1282), 'mapel.prepare_experiment', 'mapel.prepare_experiment', ([], {}), '()\n', (1280, 1282), False, 'import mapel\n'), ((2536, 2575), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(m, m)'], {'color': '"""black"""'}), "('RGB', (m, m), color='black')\n", (2545, 2575), False, 'from PIL import Image, ImageDraw\n... |
#!/usr/bin/env python3
#
# Data pipelines for Edge Computing in Python.
#
# Inspired by Google Media pipelines
#
# Dataflow can be within a "process" and then hook in locally
# But can also be via a "bus" or other communication mechanism
#
# Example: Draw detections
#
# Input 1. Picture
# Input 2. Detections [...]
#
#... | [
"pipeconfig_pb2.CalculatorGraphConfig",
"argparse.ArgumentParser",
"importlib.import_module",
"cv2.waitKey",
"google.protobuf.text_format.Parse",
"time.sleep",
"sched.scheduler",
"time.time",
"cv2.destroyAllWindows",
"sys.exit"
] | [((1068, 1106), 'importlib.import_module', 'importlib.import_module', (['class_info[0]'], {}), '(class_info[0])\n', (1091, 1106), False, 'import importlib\n'), ((1912, 1950), 'sched.scheduler', 'sched.scheduler', (['time.time', 'time.sleep'], {}), '(time.time, time.sleep)\n', (1927, 1950), False, 'import sched\n'), ((3... |
import math, threading, time
from .. import colors
from .. util import deprecated, log
from . import matrix_drawing as md
from . import font
from . layout import MultiLayout
from . geometry import make_matrix_coord_map_multi
from . geometry.matrix import (
make_matrix_coord_map, make_matrix_coord_map_positions)
... | [
"math.sqrt"
] | [((2157, 2180), 'math.sqrt', 'math.sqrt', (['self.numLEDs'], {}), '(self.numLEDs)\n', (2166, 2180), False, 'import math, threading, time\n')] |
import discord
from discord.ext import commands
from core.classes import Cog_Extension
import requests
import os
data_prefix = {
"0": "天氣描述",
"1": "最高溫度",
"2": "最低溫度",
"3": "體感描述",
"4": "降水機率"
}
data_suffix = {
"0": "",
"1": "度",
"2": "度",
"3": "",
"4": "%"
}
time_range_title = {
"0": "時段一",
... | [
"os.environ.get",
"discord.ext.commands.group"
] | [((389, 405), 'discord.ext.commands.group', 'commands.group', ([], {}), '()\n', (403, 405), False, 'from discord.ext import commands\n'), ((643, 683), 'os.environ.get', 'os.environ.get', (['"""PhantomTWWeatherApiKey"""'], {}), "('PhantomTWWeatherApiKey')\n", (657, 683), False, 'import os\n')] |
import fileinput
contents = [x.strip() for x in fileinput.input()]
departure = int(contents[0])
buses = contents[1].split(",")
# dummy big value to start with comparing
closest = 10000000000000000
for bus in buses:
if bus != "x":
bus = int(bus)
next_cycle = ((departure // bus) * bus + bus) - depa... | [
"fileinput.input"
] | [((50, 67), 'fileinput.input', 'fileinput.input', ([], {}), '()\n', (65, 67), False, 'import fileinput\n')] |
"""Training and testing the Pairwise Differentiable Gradient Descent (PDGD) algorithm for unbiased learning to rank.
See the following paper for more information on the Pairwise Differentiable Gradient Descent (PDGD) algorithm.
* Oosterhuis, Harrie, and <NAME>. "Differentiable unbiased online learning to rank." I... | [
"tensorflow.trainable_variables",
"numpy.isnan",
"ultra.utils.hparams.HParams",
"six.moves.zip",
"tensorflow.global_variables",
"tensorflow.Variable",
"numpy.exp",
"tensorflow.clip_by_global_norm",
"numpy.zeros_like",
"numpy.copy",
"tensorflow.placeholder",
"numpy.cumsum",
"tensorflow.exp",
... | [((1873, 1991), 'ultra.utils.hparams.HParams', 'ultra.utils.hparams.HParams', ([], {'learning_rate': '(0.05)', 'tau': '(1)', 'max_gradient_norm': '(1.0)', 'l2_loss': '(0.005)', 'grad_strategy': '"""ada"""'}), "(learning_rate=0.05, tau=1, max_gradient_norm=\n 1.0, l2_loss=0.005, grad_strategy='ada')\n", (1900, 1991),... |
"""
* https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/
You are given an integer array prices where prices[i] is the price of a given stock on the ith day.
Design an algorithm to find the maximum profit. You may complete at most k transactions.
Notice that you may not engage in multiple transactions ... | [
"unittest.TextTestRunner",
"unittest_data_provider.data_provider",
"unittest.TestLoader"
] | [((4424, 4443), 'unittest_data_provider.data_provider', 'data_provider', (['data'], {}), '(data)\n', (4437, 4443), False, 'from unittest_data_provider import data_provider\n'), ((4805, 4828), 'unittest_data_provider.data_provider', 'data_provider', (['big_data'], {}), '(big_data)\n', (4818, 4828), False, 'from unittest... |
from sqlalchemy_utils import EmailType, PhoneNumberType
from flask_ecom_api.api.v1.customers.admin import (
CustomerAdminView,
CustomerShippingAddressAdminView,
)
from flask_ecom_api.api.v1.orders.models import Order
from flask_ecom_api.app import admin, db
class Customer(db.Model):
"""Customer model."""... | [
"flask_ecom_api.api.v1.customers.admin.CustomerAdminView",
"flask_ecom_api.api.v1.customers.admin.CustomerShippingAddressAdminView",
"flask_ecom_api.app.db.relationship",
"sqlalchemy_utils.PhoneNumberType",
"flask_ecom_api.app.db.Column",
"flask_ecom_api.app.db.String",
"flask_ecom_api.app.db.ForeignKey... | [((331, 370), 'flask_ecom_api.app.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (340, 370), False, 'from flask_ecom_api.app import admin, db\n'), ((514, 536), 'flask_ecom_api.app.db.Column', 'db.Column', (['db.DateTime'], {}), '(db.DateTime)\n', (523, 536), Fa... |
import factory
from ipaddr import IPv4Network
from pycroft.model.net import VLAN, Subnet
from tests.factories.base import BaseFactory
class VLANFactory(BaseFactory):
class Meta:
model = VLAN
name = factory.Sequence(lambda n: "vlan{}".format(n+1))
vid = factory.Sequence(lambda n: n+1)
class Sub... | [
"factory.SubFactory",
"ipaddr.IPv4Network",
"factory.Faker",
"factory.Sequence"
] | [((277, 310), 'factory.Sequence', 'factory.Sequence', (['(lambda n: n + 1)'], {}), '(lambda n: n + 1)\n', (293, 310), False, 'import factory\n'), ((438, 473), 'factory.Faker', 'factory.Faker', (['"""ipv4"""'], {'network': '(True)'}), "('ipv4', network=True)\n", (451, 473), False, 'import factory\n'), ((559, 590), 'fact... |
import torch
x = torch.Tensor([0, 1, 2, 3]).requires_grad_()
y = torch.Tensor([4, 5, 6, 7]).requires_grad_()
w = torch.Tensor([1, 2, 3, 4]).requires_grad_()
z = x+y
def hook_fn(grad):
print(grad)
handle_1 = z.register_hook(hook_fn)
o = w.matmul(z)
def hook_fn2(grad):
print('grad')
handle_2 = z.register_ho... | [
"torch.Tensor"
] | [((18, 44), 'torch.Tensor', 'torch.Tensor', (['[0, 1, 2, 3]'], {}), '([0, 1, 2, 3])\n', (30, 44), False, 'import torch\n'), ((66, 92), 'torch.Tensor', 'torch.Tensor', (['[4, 5, 6, 7]'], {}), '([4, 5, 6, 7])\n', (78, 92), False, 'import torch\n'), ((114, 140), 'torch.Tensor', 'torch.Tensor', (['[1, 2, 3, 4]'], {}), '([1... |
import adv.adv_test
from core.advbase import *
from module.bleed import Bleed
from slot.a import *
from slot.d import *
def module():
return Botan
class Botan(Adv):
# comment = "RR+Jewels"
a3 = ('prep_charge',0.05)
conf = {}
conf['slots.a'] = RR() + BN()
conf['slots.d'] = Shinobi()
conf['ac... | [
"module.bleed.Bleed"
] | [((630, 649), 'module.bleed.Bleed', 'Bleed', (['"""g_bleed"""', '(0)'], {}), "('g_bleed', 0)\n", (635, 649), False, 'from module.bleed import Bleed\n'), ((692, 709), 'module.bleed.Bleed', 'Bleed', (['"""s1"""', '(1.46)'], {}), "('s1', 1.46)\n", (697, 709), False, 'from module.bleed import Bleed\n')] |
from django.db import models
import datetime
# Create your models here.
class User(models.Model):
username = models.CharField(max_length=16, primary_key=True)
password = models.CharField(max_length=64)
email = models.EmailField()
is_confirmed = models.BooleanField()
def __unicode__(self):
... | [
"django.db.models.CharField",
"django.db.models.ForeignKey",
"datetime.date.today",
"django.db.models.BooleanField",
"django.db.models.EmailField",
"django.db.models.DateTimeField"
] | [((115, 164), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(16)', 'primary_key': '(True)'}), '(max_length=16, primary_key=True)\n', (131, 164), False, 'from django.db import models\n'), ((180, 211), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(64)'}), '(max_length=64... |
import serial,time
ser = None
def InitSerial(port,baudrate,timeout):
global ser
reply = 'None'
try:
ser = serial.Serial(port,baudrate = baudrate,timeout = timeout) # open serial port
except Exception as e:
reply = e
return reply
def N_Serial():
global ser
n = ser.inWaiti... | [
"serial.Serial"
] | [((129, 184), 'serial.Serial', 'serial.Serial', (['port'], {'baudrate': 'baudrate', 'timeout': 'timeout'}), '(port, baudrate=baudrate, timeout=timeout)\n', (142, 184), False, 'import serial, time\n')] |
# coding=utf-8
# Copyright (C) 2020 ATHENA AUTHORS; <NAME>
# 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
#... | [
"codecs.open",
"sys.exit"
] | [((936, 973), 'codecs.open', 'codecs.open', (['vocab_file', '"""r"""', '"""utf-8"""'], {}), "(vocab_file, 'r', 'utf-8')\n", (947, 973), False, 'import codecs\n'), ((2531, 2541), 'sys.exit', 'sys.exit', ([], {}), '()\n', (2539, 2541), False, 'import sys\n')] |
"""
# 3D high-res brain mesh
Showing a ultra-high resolution mesh of a human brain, acquired with a 7 Tesla MRI.
The data is not yet publicly available.
Data courtesy of <NAME> et al.:
<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
<NAME>, <NAME>, <NAME>, <NAME>, <NAME> and <NAME> (2020)
... | [
"numpy.load",
"datoviz.canvas",
"datoviz.run",
"pathlib.Path",
"numpy.array"
] | [((628, 673), 'datoviz.canvas', 'canvas', ([], {'show_fps': '(True)', 'width': '(1024)', 'height': '(768)'}), '(show_fps=True, width=1024, height=768)\n', (634, 673), False, 'from datoviz import canvas, run, colormap\n'), ((817, 867), 'numpy.load', 'np.load', (["(ROOT / 'data/mesh/brain_highres.vert.npy')"], {}), "(ROO... |
"""Create and use a dataset using an external file.
Note that this example:
- Only works when it's run on the same host as the Kive server and Kive worker
(e.g. in the `dev-env` environment). On a production server, external files
are kept in a network share, so they can be accessed from different hosts.
- Requi... | [
"pathlib.Path",
"kiveapi.KiveAPI",
"pprint.pprint",
"io.StringIO"
] | [((825, 865), 'kiveapi.KiveAPI', 'kiveapi.KiveAPI', (['"""http://localhost:8000"""'], {}), "('http://localhost:8000')\n", (840, 865), False, 'import kiveapi\n'), ((966, 986), 'pathlib.Path', 'pathlib.Path', (['"""/tmp"""'], {}), "('/tmp')\n", (978, 986), False, 'import pathlib\n'), ((1661, 1702), 'pprint.pprint', 'ppri... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-06-07 01:26
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djangoapp', '0006_remove_gallery_slug'),
]
operations = [
migrations.AlterFie... | [
"django.db.models.ImageField"
] | [((400, 475), 'django.db.models.ImageField', 'models.ImageField', ([], {'height_field': '"""height"""', 'upload_to': '""""""', 'width_field': '"""width"""'}), "(height_field='height', upload_to='', width_field='width')\n", (417, 475), False, 'from django.db import migrations, models\n')] |
# coding=utf-8
""" Configuration of nox test automation tool. """
import nox
@nox.session(python=['3.8', '3.9'])
def lint(session):
"""Run static analysis."""
session.run("pipenv", "install", "--dev", external=True)
session.run("pipenv", "run", "flake8", "loganalysis/", "tests/")
@nox.session(python=['... | [
"nox.session"
] | [((81, 115), 'nox.session', 'nox.session', ([], {'python': "['3.8', '3.9']"}), "(python=['3.8', '3.9'])\n", (92, 115), False, 'import nox\n'), ((299, 333), 'nox.session', 'nox.session', ([], {'python': "['3.8', '3.9']"}), "(python=['3.8', '3.9'])\n", (310, 333), False, 'import nox\n')] |
from floodsystem.stationdata import build_station_list,update_water_levels
from floodsystem.flood import stations_highest_rel_level
def run():
stations = build_station_list()
update_water_levels(stations)
N = 10
a = stations_highest_rel_level(stations, N)
for i in a:
print("{}, {}".format(i... | [
"floodsystem.flood.stations_highest_rel_level",
"floodsystem.stationdata.build_station_list",
"floodsystem.stationdata.update_water_levels"
] | [((159, 179), 'floodsystem.stationdata.build_station_list', 'build_station_list', ([], {}), '()\n', (177, 179), False, 'from floodsystem.stationdata import build_station_list, update_water_levels\n'), ((184, 213), 'floodsystem.stationdata.update_water_levels', 'update_water_levels', (['stations'], {}), '(stations)\n', ... |
#<NAME>
#MoTrack Therapy
#Created Mon Oct 14, 2019
#GOAL: Convert standard iOS file names ("IMG_1750.JPG") to MoTrack data image standard names ("IMG_0001_A_RAW.JPG").
#Description:
#Doesn't rename the files in place in case there is a bug. Instead takes input images in one folder, and makes output in another folder
#A... | [
"re.match",
"os.listdir"
] | [((1738, 1771), 'os.listdir', 'os.listdir', (['original_files_folder'], {}), '(original_files_folder)\n', (1748, 1771), False, 'import os\n'), ((1830, 1855), 're.match', 're.match', (['"""IMG_\\\\d{4}"""', 'k'], {}), "('IMG_\\\\d{4}', k)\n", (1838, 1855), False, 'import re\n')] |
# -*- encoding: utf-8 -*-
# Copyright (c) The PyAMF Project.
# See LICENSE.txt for details.
"""
General tests.
@since: 0.1.0
"""
from __future__ import absolute_import
import six
from types import ModuleType
import unittest
import miniamf
from .util import ClassCacheClearingTestCase, replace_dict, Spam
class ASO... | [
"miniamf.get_decoder",
"miniamf.get_type",
"miniamf.remove_error_class",
"six.iteritems",
"miniamf.add_type",
"miniamf.remove_type",
"miniamf.ERROR_CLASS_MAP.copy",
"miniamf.register_class_loader",
"miniamf.register_alias_type",
"miniamf.load_class",
"miniamf.unregister_class",
"miniamf.decode... | [((500, 541), 'miniamf.ASObject', 'miniamf.ASObject', ([], {'spam': '"""eggs"""', 'baz': '"""spam"""'}), "(spam='eggs', baz='spam')\n", (516, 541), False, 'import miniamf\n'), ((727, 745), 'miniamf.ASObject', 'miniamf.ASObject', ([], {}), '()\n', (743, 745), False, 'import miniamf\n'), ((848, 866), 'miniamf.ASObject', ... |
import numpy as np
from sklearn.utils.estimator_checks import check_estimator
from sklearn.utils.testing import assert_array_equal
from sklearn.datasets import load_breast_cancer
from sklearn.svm import SVC
from feature_selection import HarmonicSearch
from feature_selection import GeneticAlgorithm
from feature_selectio... | [
"sklearn.utils.testing.assert_raises",
"feature_selection.SimulatedAnneling",
"sklearn.datasets.load_breast_cancer",
"sklearn.utils.testing.assert_array_equal",
"sklearn.utils.estimator_checks.check_estimator",
"sklearn.svm.SVC"
] | [((1121, 1141), 'sklearn.datasets.load_breast_cancer', 'load_breast_cancer', ([], {}), '()\n', (1139, 1141), False, 'from sklearn.datasets import load_breast_cancer\n'), ((1282, 1299), 'sklearn.svm.SVC', 'SVC', ([], {'gamma': '"""auto"""'}), "(gamma='auto')\n", (1285, 1299), False, 'from sklearn.svm import SVC\n'), ((2... |
import math
from typing import List, Union, Sequence
from pyrep.backend import sim
from pyrep.objects.object import Object, object_type_to_class
import numpy as np
from pyrep.const import ObjectType, PerspectiveMode, RenderMode
class VisionSensor(Object):
"""A camera-type sensor, reacting to light, colors and ima... | [
"pyrep.const.PerspectiveMode",
"pyrep.backend.sim.simGetVisionSensorResolution",
"numpy.ones",
"numpy.arange",
"pyrep.backend.sim.simGetObjectFloatParameter",
"math.radians",
"numpy.transpose",
"numpy.tan",
"numpy.reshape",
"numpy.ones_like",
"pyrep.backend.sim.simSetObjectInt32Parameter",
"py... | [((14652, 14691), 'numpy.transpose', 'np.transpose', (['pixel_y_coords', '(1, 0, 2)'], {}), '(pixel_y_coords, (1, 0, 2))\n', (14664, 14691), True, 'import numpy as np\n'), ((14917, 14948), 'numpy.reshape', 'np.reshape', (['coords', '(h * w, -1)'], {}), '(coords, (h * w, -1))\n', (14927, 14948), True, 'import numpy as n... |
#!/usr/bin/env python
import os
import time
import copy
import json
from datetime import datetime
import threading
import collector
import siteMapping
class NetworkTracerouteCollector(collector.Collector):
def __init__(self):
self.TOPIC = "/topic/perfsonar.raw.packet-trace"
self.INDEX_PREFIX =... | [
"json.loads",
"copy.copy",
"collector.start",
"siteMapping.isProductionThroughput",
"threading.current_thread",
"siteMapping.getPS"
] | [((3086, 3103), 'collector.start', 'collector.start', ([], {}), '()\n', (3101, 3103), False, 'import collector\n'), ((445, 464), 'json.loads', 'json.loads', (['message'], {}), '(message)\n', (455, 464), False, 'import json\n'), ((973, 998), 'siteMapping.getPS', 'siteMapping.getPS', (['source'], {}), '(source)\n', (990,... |
from os.path import dirname, join, isfile
# Constants
PROJECT_ROOT_DIRECTORY = dirname(dirname(__file__))
DUMP_FILE_SUFFIX = "_dump.csv"
def getFullPath(*path):
return join(PROJECT_ROOT_DIRECTORY, *path)
def getUserLastDumpFilePath(userId):
return getFullPath('resources', 'dump_files', "{0}{1}".format(userId... | [
"os.path.dirname",
"os.path.join"
] | [((88, 105), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (95, 105), False, 'from os.path import dirname, join, isfile\n'), ((174, 209), 'os.path.join', 'join', (['PROJECT_ROOT_DIRECTORY', '*path'], {}), '(PROJECT_ROOT_DIRECTORY, *path)\n', (178, 209), False, 'from os.path import dirname, join, isf... |
from keras.callbacks import ModelCheckpoint
from keras.layers import Dense, Flatten, Conv2D
from keras.layers import MaxPooling2D, Dropout
from keras.models import Sequential
from keras.preprocessing.image import ImageDataGenerator
from src.utils.train_utils import post_process
class MathewTrainer:
def __init__(s... | [
"keras.preprocessing.image.ImageDataGenerator",
"keras.callbacks.ModelCheckpoint",
"keras.layers.Dropout",
"keras.layers.Flatten",
"src.utils.train_utils.post_process",
"keras.layers.Dense",
"keras.layers.Conv2D",
"keras.models.Sequential",
"keras.layers.MaxPooling2D"
] | [((576, 588), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (586, 588), False, 'from keras.models import Sequential\n'), ((1565, 1657), 'keras.callbacks.ModelCheckpoint', 'ModelCheckpoint', (['filepath'], {'monitor': '"""val_acc"""', 'verbose': '(1)', 'save_best_only': '(True)', 'mode': '"""max"""'}), "(fi... |
# ==================================================================================================
# Copyright 2014 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | [
"collections.defaultdict"
] | [((1297, 1314), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1308, 1314), False, 'from collections import defaultdict\n')] |
import SimpleITK as sitk
import csv
# Load the Images to be measured
ScalarValuesFile = '~/SimpleITK-MICCAI-2011-Tutorial/Data/FA.png'
ScalarValuesImage = sitk.Cast( sitk.ReadImage(ScalarValuesFile), sitk.sitkUInt32 )
sitk.Show ( ScalarValuesImage )
LabelMapFile = '~/SimpleITK-MICCAI-2011-Tutorial/Data/LB.png'
LabelM... | [
"SimpleITK.Show",
"SimpleITK.ReadImage",
"SimpleITK.LabelStatisticsImageFilter"
] | [((219, 247), 'SimpleITK.Show', 'sitk.Show', (['ScalarValuesImage'], {}), '(ScalarValuesImage)\n', (228, 247), True, 'import SimpleITK as sitk\n'), ((389, 412), 'SimpleITK.Show', 'sitk.Show', (['LabelMapFile'], {}), '(LabelMapFile)\n', (398, 412), True, 'import SimpleITK as sitk\n'), ((443, 476), 'SimpleITK.LabelStatis... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: modules/v2x/proto/v2x_service_obu_to_car.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.pro... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor"
] | [((513, 539), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (537, 539), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((1873, 2186), 'google.protobuf.descriptor.FieldDescriptor', '_descriptor.FieldDescriptor', ([], {'name': '"""status"""', 'full_n... |
import os
import numpy as np
import re
import sys
try:
import h5py
except ImportError:
h5py = None
'''
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
'''
from .. import logger, logging
from .base import MFPackage, MissingFile
from .name import Modflow
... | [
"h5py.File",
"numpy.empty",
"os.path.dirname",
"numpy.dtype",
"os.path.isfile",
"re.findall",
"numpy.fromiter",
"os.path.split",
"os.path.join",
"numpy.fromstring",
"re.compile"
] | [((333, 449), 're.compile', 're.compile', (['"""\\\\((?P<body>(?P<rep>\\\\d*)(?P<symbol>[IEFG][SN]?)(?P<w>\\\\d+)(\\\\.(?P<d>\\\\d+))?|FREE|BINARY)\\\\)"""'], {}), "(\n '\\\\((?P<body>(?P<rep>\\\\d*)(?P<symbol>[IEFG][SN]?)(?P<w>\\\\d+)(\\\\.(?P<d>\\\\d+))?|FREE|BINARY)\\\\)'\n )\n", (343, 449), False, 'import re\... |
from typing import TYPE_CHECKING, List, Optional
import mymax as my
def demo_args_list_float() -> None:
args = [2.5, 3.5, 1.5]
expected = 3.5
result = my.max(*args)
print(args, expected, result, sep='\n')
assert result == expected
if TYPE_CHECKING:
reveal_type(args)
reveal_type... | [
"mymax.max"
] | [((165, 178), 'mymax.max', 'my.max', (['*args'], {}), '(*args)\n', (171, 178), True, 'import mymax as my\n'), ((449, 461), 'mymax.max', 'my.max', (['args'], {}), '(args)\n', (455, 461), True, 'import mymax as my\n'), ((765, 777), 'mymax.max', 'my.max', (['args'], {}), '(args)\n', (771, 777), True, 'import mymax as my\n... |
import logging
from google.cloud import pubsub
from google.cloud import secretmanager
class GCPPubSubService:
_client = None
@classmethod
def get_client(cls):
if cls._client is None:
cls._client = pubsub.PublisherClient()
return cls._client
@classmethod
def publish_m... | [
"google.cloud.secretmanager.SecretManagerServiceClient",
"logging.info",
"logging.error",
"google.cloud.pubsub.PublisherClient"
] | [((233, 257), 'google.cloud.pubsub.PublisherClient', 'pubsub.PublisherClient', ([], {}), '()\n', (255, 257), False, 'from google.cloud import pubsub\n'), ((606, 675), 'logging.info', 'logging.info', (['f"""Published a message to topic {topic_path}: {message}"""'], {}), "(f'Published a message to topic {topic_path}: {me... |
import numpy as np
import scipy
import scipy.stats
import csv
scores = np.load('regional_avgScore_nAD.npy')
print(scores.shape)
pool = [[0 for _ in range(scores.shape[1])] for _ in range(scores.shape[1])]
for i in range(scores.shape[1]-1):
for j in range(i+1, scores.shape[1]):
corr, _ = scipy.stats.pears... | [
"numpy.load",
"csv.writer",
"scipy.stats.pearsonr"
] | [((72, 108), 'numpy.load', 'np.load', (['"""regional_avgScore_nAD.npy"""'], {}), "('regional_avgScore_nAD.npy')\n", (79, 108), True, 'import numpy as np\n'), ((679, 755), 'csv.writer', 'csv.writer', (['csvfile'], {'delimiter': '""" """', 'quotechar': '"""|"""', 'quoting': 'csv.QUOTE_MINIMAL'}), "(csvfile, delimiter=' '... |
#!/usr/bin/env python
# coding=utf-8
__author__ = 'Xevaquor'
__license__ = 'MIT'
from layout import *
from copy import deepcopy
Moves = {
'North' : (0, -1),
'South' : (0, 1),
'East': (1, 0),
'West' : (-1, 0),
'Stop' : (0, 0)
}
class AgentStatus(object):
def __init__(self, pos = (0,0), scared... | [
"copy.deepcopy"
] | [((583, 597), 'copy.deepcopy', 'deepcopy', (['food'], {}), '(food)\n', (591, 597), False, 'from copy import deepcopy\n'), ((1593, 1608), 'copy.deepcopy', 'deepcopy', (['state'], {}), '(state)\n', (1601, 1608), False, 'from copy import deepcopy\n')] |
import tensorflow as tf
import joblib
import numpy as np
import json
import traceback
import sys
import os
class Predictor(object):
def __init__(self):
self.loaded = False
def load(self):
print("Loading model",os.getpid())
self.model = tf.keras.models.load_model('model.h5', compile... | [
"tensorflow.keras.models.load_model",
"os.getpid",
"tensorflow.math.argmax",
"tensorflow.constant",
"json.JSONEncoder.default",
"sys.exc_info",
"joblib.load",
"tensorflow.sigmoid"
] | [((274, 327), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['"""model.h5"""'], {'compile': '(False)'}), "('model.h5', compile=False)\n", (300, 327), True, 'import tensorflow as tf\n'), ((356, 387), 'joblib.load', 'joblib.load', (['"""labelencoder.pkl"""'], {}), "('labelencoder.pkl')\n", (367, 38... |
# Generated by Django 3.2.3 on 2021-05-14 08:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("authentik_core", "0020_source_user_matching_mode"),
]
operations = [
migrations.AlterField(
model_name="application",
... | [
"django.db.models.SlugField"
] | [((353, 440), 'django.db.models.SlugField', 'models.SlugField', ([], {'help_text': '"""Internal application name, used in URLs."""', 'unique': '(True)'}), "(help_text='Internal application name, used in URLs.',\n unique=True)\n", (369, 440), False, 'from django.db import migrations, models\n')] |
# !/usr/bin/dev python
# -*- coding:utf-8 -*-
from datetime import datetime
import sys
def LogFile(logFile, target_url):
filePoint = open('{}'.format(logFile), 'a')
filePoint.write('----------------------------\n\n')
for i in sys.argv:
filePoint.write(i + ' ')
filePoint.write('\n')
filePo... | [
"datetime.datetime.now"
] | [((388, 402), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (400, 402), False, 'from datetime import datetime\n')] |
import matplotlib.pyplot as plt
from typing import List, Tuple, Dict
import pandas as pd
import plotly.graph_objects as go
def plot_alns_history(solution_costs: List[Tuple[int, int]], lined: bool = False, legend: str = "") -> None:
x, y = zip(*solution_costs)
plt.figure(figsize=(10, 7)) # (8, 6) is default
... | [
"pandas.DataFrame",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"pandas.read_csv",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"plotly.graph_objects.Figure",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots"
] | [((270, 297), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 7)'}), '(figsize=(10, 7))\n', (280, 297), True, 'import matplotlib.pyplot as plt\n'), ((323, 367), 'matplotlib.pyplot.scatter', 'plt.scatter', (['x', 'y'], {'s': '(7)', 'alpha': '(0.4)', 'c': '"""black"""'}), "(x, y, s=7, alpha=0.4, c='black... |
"""
Processor for performing named entity tagging.
"""
from stanfordnlp.models.common.pretrain import Pretrain
from stanfordnlp.models.common import doc
from stanfordnlp.models.common.utils import unsort
from stanfordnlp.models.ner.data import DataLoader
from stanfordnlp.models.ner.trainer import Trainer
from stanford... | [
"stanfordnlp.models.ner.data.DataLoader",
"stanfordnlp.models.ner.trainer.Trainer",
"stanfordnlp.models.common.pretrain.Pretrain"
] | [((861, 894), 'stanfordnlp.models.common.pretrain.Pretrain', 'Pretrain', (["config['pretrain_path']"], {}), "(config['pretrain_path'])\n", (869, 894), False, 'from stanfordnlp.models.common.pretrain import Pretrain\n'), ((919, 1023), 'stanfordnlp.models.ner.trainer.Trainer', 'Trainer', ([], {'args': 'self._args', 'pret... |
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="ppt_maker",
version="0.0.1",
author="<NAME>, <NAME>",
author_email="<EMAIL>",
description="Make PowerPoint slides with template and data",
long_description=long_descr... | [
"setuptools.find_packages"
] | [((439, 465), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (463, 465), False, 'import setuptools\n')] |
import os
import argparse
import numpy as np
import pymatgen
from tqdm import tqdm
parser = argparse.ArgumentParser()
parser.add_argument("mp_dir", help="Root directory with Materials Project dataset")
parser.add_argument("radial_cutoff", type=float, help="Radius of sphere that decides neighborhood")
args = parser.pa... | [
"tqdm.tqdm",
"argparse.ArgumentParser",
"pymatgen.Structure.from_file",
"numpy.array",
"os.path.join"
] | [((93, 118), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (116, 118), False, 'import argparse\n'), ((479, 506), 'os.path.join', 'os.path.join', (['mp_dir', '"""cif"""'], {}), "(mp_dir, 'cif')\n", (491, 506), False, 'import os\n'), ((521, 575), 'os.path.join', 'os.path.join', (['mp_dir', 'f"""... |
# Generated by Django 3.0.6 on 2020-07-17 19:31
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('lims', '0059_auto_20200717_1318'),
]
operations = [
migrations.RenameField(
model_name='supportrecord',
old_name='user',
... | [
"django.db.migrations.RenameField"
] | [((224, 315), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""supportrecord"""', 'old_name': '"""user"""', 'new_name': '"""project"""'}), "(model_name='supportrecord', old_name='user',\n new_name='project')\n", (246, 315), False, 'from django.db import migrations\n')] |
"""
Copyright (c) 2018, University of Oxford, Rama Cont and ETH Zurich, <NAME>
This module provides the helper functions and the class LOBSTERReader, a subclass of OBReader to read in limit order book data in lobster format.
"""
######
# Imports
######
import csv
import math
import warnings
import numpy as np
fr... | [
"csv.reader",
"csv.writer",
"numpy.empty",
"numpy.zeros",
"numpy.array",
"numpy.linspace",
"numpy.fromiter",
"warnings.warn"
] | [((6227, 6256), 'numpy.zeros', 'np.zeros', (['(num_levels_calc * 2)'], {}), '(num_levels_calc * 2)\n', (6235, 6256), True, 'import numpy as np\n'), ((6314, 6343), 'numpy.zeros', 'np.zeros', (['(num_levels_calc * 2)'], {}), '(num_levels_calc * 2)\n', (6322, 6343), True, 'import numpy as np\n'), ((9228, 9257), 'numpy.zer... |
from django.contrib.auth.decorators import permission_required
from django.contrib.messages import ERROR, add_message
from django.shortcuts import redirect
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from itdagene.app.comments.forms import CommentForm
from itdagene.app.mail... | [
"django.contrib.auth.decorators.permission_required",
"django.utils.timezone.now",
"itdagene.app.mail.tasks.send_comment_email",
"itdagene.app.comments.forms.CommentForm",
"django.utils.translation.ugettext_lazy"
] | [((356, 399), 'django.contrib.auth.decorators.permission_required', 'permission_required', (['"""comments.add_comment"""'], {}), "('comments.add_comment')\n", (375, 399), False, 'from django.contrib.auth.decorators import permission_required\n'), ((466, 491), 'itdagene.app.comments.forms.CommentForm', 'CommentForm', ([... |
from django.urls import path
from channels.http import AsgiHandler
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.auth import AuthMiddlewareStack
from monitor.consumers import MemoryinfoConsumer
application = ProtocolTypeRouter({
"websocket": AuthMiddlewareStack(
URLRouter([
... | [
"django.urls.path"
] | [((328, 371), 'django.urls.path', 'path', (['"""monitor/stream/"""', 'MemoryinfoConsumer'], {}), "('monitor/stream/', MemoryinfoConsumer)\n", (332, 371), False, 'from django.urls import path\n')] |
from .array import TensorTrainArray
from .slice import TensorTrainSlice
from .dispatch import implement_function
from ..raw import find_balanced_cluster,trivial_decomposition
import numpy as np
def _get_cluster_chi_array(shape,cluster,chi):
if cluster is None:
cluster=find_balanced_cluster(shape)
if isi... | [
"numpy.frombuffer",
"numpy.ones",
"numpy.array",
"numpy.arange",
"numpy.fromiter",
"numpy.fromfunction",
"numpy.issubdtype"
] | [((3271, 3300), 'numpy.ones', 'np.ones', (['m.shape[1:-1]', 'dtype'], {}), '(m.shape[1:-1], dtype)\n', (3278, 3300), True, 'import numpy as np\n'), ((3633, 3660), 'numpy.ones', 'np.ones', (['ms[0].shape', 'dtype'], {}), '(ms[0].shape, dtype)\n', (3640, 3660), True, 'import numpy as np\n'), ((3691, 3723), 'numpy.ones', ... |
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from .views import *
router = DefaultRouter()
router.register('image', ImageViewSet)
router.register('file', FileViewSet)
urlpatterns = [
url(r'', include(router.urls)),
url(r'^upload_image/(?P<filename>[^/]+)$', Image... | [
"django.conf.urls.include",
"rest_framework.routers.DefaultRouter"
] | [((123, 138), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (136, 138), False, 'from rest_framework.routers import DefaultRouter\n'), ((245, 265), 'django.conf.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (252, 265), False, 'from django.conf.urls import url, include\n... |