code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
Setup script.
"""
from pathlib import Path
from typing import List
import versioneer
from setuptools import find_packages, setup
def _get_dependencies(requirements_file: Path) -> List[str]:
"""
Return requirements from a requirements file.
This expects a requirements file with no ``--find-links`` l... | [
"versioneer.get_cmdclass",
"setuptools.find_packages",
"versioneer.get_version",
"pathlib.Path"
] | [((522, 546), 'pathlib.Path', 'Path', (['"""requirements.txt"""'], {}), "('requirements.txt')\n", (526, 546), False, 'from pathlib import Path\n'), ((643, 671), 'pathlib.Path', 'Path', (['"""dev-requirements.txt"""'], {}), "('dev-requirements.txt')\n", (647, 671), False, 'from pathlib import Path\n'), ((695, 713), 'pat... |
"""Analysis Classes Base Class"""
import pickle
import json
import pandas as pd
import matplotlib.pyplot as plt
# Base class for analyses
class Analysis:
"""Root class for analysis system classes."""
# Init class with results
def __init__(self, results, t_zone=None, t_unit=None):
"""
Cons... | [
"pickle.dump",
"matplotlib.pyplot.savefig",
"json.dump",
"pandas.to_datetime",
"matplotlib.pyplot.show"
] | [((1691, 1701), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1699, 1701), True, 'import matplotlib.pyplot as plt\n'), ((2079, 2131), 'matplotlib.pyplot.savefig', 'plt.savefig', (['plot_file'], {'dpi': '(600)', 'bbox_inches': '"""tight"""'}), "(plot_file, dpi=600, bbox_inches='tight')\n", (2090, 2131), True,... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-07-15 20:06
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_markdown.models
import taggit.managers
class Migration(migrations.Migration):
d... | [
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((391, 448), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (422, 448), False, 'from django.db import migrations, models\n'), ((639, 732), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
# PRISM CONVERSION FROM ASCII GRIDS -- TASMIN / TASMAX
# header info
# ncols 2015
# nrows 1320
# xllcorner -2301787.7731349
# yllcorner 108069.7858797
# cellsize 2000
# NODATA_value -9999
import rasterio, glob, os
from rasterio import Affine
import numpy as np
from pathos import multipro... | [
"os.path.exists",
"os.makedirs",
"pathos.multiprocessing.Pool",
"numpy.flipud",
"rasterio.open",
"scipy.interpolate.griddata",
"os.path.join",
"os.path.dirname",
"affine.Affine.translation",
"os.path.basename",
"pyproj.Proj",
"os.system",
"numpy.vectorize",
"numpy.arange"
] | [((7696, 7722), 'rasterio.open', 'rasterio.open', (['template_fn'], {}), '(template_fn)\n', (7709, 7722), False, 'import rasterio\n'), ((7764, 7883), 'os.path.join', 'os.path.join', (['"""/workspace/Shared/Tech_Projects/EPSCoR_Southcentral/project_data/prism_v2"""', 'variable', '"""merged"""'], {}), "(\n '/workspace... |
from abc import ABC, abstractmethod
import asyncio
from typing import (
AsyncIterator,
Tuple,
)
from cancel_token import (
CancelToken,
OperationCancelled,
)
from eth.constants import GENESIS_BLOCK_NUMBER
from eth.exceptions import (
HeaderNotFound,
)
from eth_typing import (
BlockNumber,
... | [
"trinity._utils.headers.skip_complete_headers",
"trinity._utils.humanize.humanize_integer_sequence",
"eth_utils.ValidationError",
"eth_utils.encode_hex",
"eth_typing.BlockNumber"
] | [((1946, 2022), 'eth_utils.ValidationError', 'ValidationError', (['"""Cannot check the target hash when there is no active sync"""'], {}), "('Cannot check the target hash when there is no active sync')\n", (1961, 2022), False, 'from eth_utils import encode_hex, ValidationError\n'), ((9488, 9538), 'eth_typing.BlockNumbe... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | [
"ironic.common.hash_ring.HashRingManager",
"ironic.common.config.parse_args",
"eventlet.monkey_patch",
"fixtures.TempHomeDir",
"ironic.objects.base.IronicObjectRegistry.obj_classes",
"oslo_utils.uuidutils.generate_uuid",
"ironic.tests.unit.policy_fixture.PolicyFixture",
"fixtures.EnvironmentVariable",... | [((930, 961), 'eventlet.monkey_patch', 'eventlet.monkey_patch', ([], {'os': '(False)'}), '(os=False)\n', (951, 961), False, 'import eventlet\n'), ((1518, 1548), 'oslo_log.log.register_options', 'logging.register_options', (['CONF'], {}), '(CONF)\n', (1542, 1548), True, 'from oslo_log import log as logging\n'), ((1549, ... |
#!/usr/bin/py2
import cv2
import imutils
import numpy as np
from solver import Solver
from Recognizer import OCR
from skimage.segmentation import clear_border
from imutils.perspective import four_point_transform
class Sudoku(object):
def __init__(self, image):
self.image = image
self.gray = None
def initia... | [
"Recognizer.OCR",
"cv2.drawContours",
"cv2.countNonZero",
"cv2.threshold",
"solver.Solver",
"cv2.arcLength",
"cv2.bitwise_and",
"skimage.segmentation.clear_border",
"imutils.resize",
"cv2.adaptiveThreshold",
"imutils.grab_contours",
"numpy.zeros",
"cv2.approxPolyDP",
"cv2.cvtColor",
"cv2... | [((354, 376), 'cv2.imread', 'cv2.imread', (['self.image'], {}), '(self.image)\n', (364, 376), False, 'import cv2\n'), ((392, 429), 'imutils.resize', 'imutils.resize', (['self.image'], {'width': '(600)'}), '(self.image, width=600)\n', (406, 429), False, 'import imutils\n'), ((486, 530), 'cv2.cvtColor', 'cv2.cvtColor', (... |
import os
import os
import time
import gym
import gym_donkeycar
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
class DonkeyGymEnv(object):
def __init__(self, sim_path, host="127.0.0.1", port=9091, headless=0, env_name="donkey-generated-track-v0", sync="asynchronous", conf={}, r... | [
"os.path.exists",
"os.access",
"time.sleep",
"os.path.isfile",
"gym.make"
] | [((95, 116), 'os.path.isfile', 'os.path.isfile', (['fpath'], {}), '(fpath)\n', (109, 116), False, 'import os\n'), ((121, 146), 'os.access', 'os.access', (['fpath', 'os.X_OK'], {}), '(fpath, os.X_OK)\n', (130, 146), False, 'import os\n'), ((860, 919), 'gym.make', 'gym.make', (['env_name'], {'exe_path': 'sim_path', 'host... |
'''
Copyright (c) 2021-2022 OVGU LIA
Author: <NAME>
This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
This source code may use other Open Source software components (see LICENSE.txt).
'''
try:
import queue as Queue
except ImportError:
import Queue as Queue
class DataManager(object):... | [
"Queue.Queue"
] | [((500, 513), 'Queue.Queue', 'Queue.Queue', ([], {}), '()\n', (511, 513), True, 'import Queue as Queue\n')] |
import numpy as np
from public_tool.form_index import form_index
from XGB_HMM.form_B_matrix_by_XGB import form_B_matrix_by_XGB
from XGB_HMM.predict import self_pred
def pred_proba_XGB(A, model, pi, O, allow_flag, lengths):
# 对dataset形成pred_proba,注意这里的dataset是solve_on_raw_data后的结果,即附带allow_flag的数据
# ou... | [
"XGB_HMM.form_B_matrix_by_XGB.form_B_matrix_by_XGB",
"numpy.zeros",
"XGB_HMM.predict.self_pred",
"public_tool.form_index.form_index"
] | [((397, 429), 'numpy.zeros', 'np.zeros', (['(O.shape[0], n_states)'], {}), '((O.shape[0], n_states))\n', (405, 429), True, 'import numpy as np\n'), ((501, 523), 'public_tool.form_index.form_index', 'form_index', (['lengths', 'i'], {}), '(lengths, i)\n', (511, 523), False, 'from public_tool.form_index import form_index\... |
from flask import Flask, render_template, url_for
app = Flask(__name__)
@app.route('/')
def index():
return render_template("index.html")
@app.route('/top_score')
def top_score():
return render_template("top_score.html")
@app.route('/login')
def login():
return render_template("login.html")
@app.route('/manu... | [
"flask.render_template",
"flask.Flask"
] | [((57, 72), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (62, 72), False, 'from flask import Flask, render_template, url_for\n'), ((112, 141), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (127, 141), False, 'from flask import Flask, render_template, url_for\... |
from setuptools import setup, find_packages
import codecs
import os
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh:
long_description = "\n" + fh.read()
setup(
name='pyqt-svg-icon-text-widget',
version='0.0.1',
author='<NAME>... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((92, 117), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (107, 117), False, 'import os\n'), ((137, 168), 'os.path.join', 'os.path.join', (['here', '"""README.md"""'], {}), "(here, 'README.md')\n", (149, 168), False, 'import os\n'), ((383, 398), 'setuptools.find_packages', 'find_packages', ... |
"""
Software that detects each of the yellow shapes on the video frames and
classifies the shapes into classes: circle, rectangle, triangle.
USAGE: python3 shape_detection.py <video path> <output video path>
"""
import sys
import cv2
import imutils
import numpy as np
from tqdm import tqdm
BOX_COLORS = {
"trian... | [
"numpy.array",
"cv2.approxPolyDP",
"sys.exit",
"cv2.threshold",
"cv2.arcLength",
"numpy.zeros_like",
"cv2.VideoWriter",
"cv2.contourArea",
"imutils.grab_contours",
"cv2.drawContours",
"cv2.putText",
"cv2.morphologyEx",
"cv2.cvtColor",
"cv2.moments",
"cv2.Canny",
"cv2.GaussianBlur",
"... | [((821, 846), 'cv2.Canny', 'cv2.Canny', (['image', '(10)', '(255)'], {}), '(image, 10, 255)\n', (830, 846), False, 'import cv2\n'), ((860, 912), 'cv2.getStructuringElement', 'cv2.getStructuringElement', (['cv2.MORPH_ELLIPSE', '(3, 3)'], {}), '(cv2.MORPH_ELLIPSE, (3, 3))\n', (885, 912), False, 'import cv2\n'), ((932, 98... |
import time
import paramiko
import fixtures
from fabric.api import run, hide, settings
from vn_test import VNFixture
from vm_test import VMFixture
from policy_test import PolicyFixture
from common.policy.config import ConfigPolicy
from common.connections import ContrailConnections
from security_group import SecurityG... | [
"security_group.SecurityGroupFixture"
] | [((479, 646), 'security_group.SecurityGroupFixture', 'SecurityGroupFixture', (['self.inputs', 'self.connections', 'self.inputs.domain_name', 'self.inputs.project_name'], {'secgrp_name': 'name', 'uuid': 'secgrpid', 'secgrp_entries': 'entries'}), '(self.inputs, self.connections, self.inputs.domain_name,\n self.inputs.... |
# -*- coding: utf-8 -*-
# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
# pylint: disable=invalid-name,missing-docstring
from test.python.common import QiskitTestCase
import json
import unittest
... | [
"numpy.trace",
"numpy.sqrt",
"numpy.array",
"qiskit.qasm.Qasm",
"numpy.linalg.norm",
"unittest.main",
"qiskit.QuantumJob",
"qiskit.backends.local.qasm_simulator_cpp.x90_error_matrix",
"qiskit.QuantumCircuit",
"qiskit.backends.local.qasm_simulator_cpp.cx_error_matrix",
"numpy.eye",
"qiskit._com... | [((22521, 22547), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (22534, 22547), False, 'import unittest\n'), ((1345, 1368), 'qiskit.QuantumRegister', 'QuantumRegister', (['(2)', '"""q"""'], {}), "(2, 'q')\n", (1360, 1368), False, 'from qiskit import QuantumRegister\n'), ((1382, 1407),... |
import json
import random
from typing import NamedTuple, Any
import numpy
from numpy.testing import assert_array_almost_equal, assert_almost_equal
import torch
import pytest
from flaky import flaky
from allennlp.common.checks import ConfigurationError
from allennlp.common.testing import AllenNlpTestCase
from allennlp... | [
"allennlp.nn.util.bucket_values",
"allennlp.nn.util.masked_topk",
"numpy.random.rand",
"torch.LongTensor",
"allennlp.nn.util.get_text_field_mask",
"torch.max",
"allennlp.nn.util.get_combined_dim",
"torch.from_numpy",
"allennlp.nn.util.add_sentence_boundary_token_ids",
"numpy.array",
"allennlp.nn... | [((40211, 40242), 'flaky.flaky', 'flaky', ([], {'max_runs': '(3)', 'min_passes': '(1)'}), '(max_runs=3, min_passes=1)\n', (40216, 40242), False, 'from flaky import flaky\n'), ((537, 725), 'torch.tensor', 'torch.tensor', (['[[True, True, True, False, False, False], [True, True, False, False, False,\n False], [True, T... |
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | [
"airflow.api.common.experimental.mark_tasks._create_dagruns",
"airflow.api.common.experimental.mark_tasks.set_dag_run_state",
"airflow.api.common.experimental.mark_tasks.set_state",
"airflow.models.DagBag",
"datetime.timedelta",
"datetime.datetime.now",
"airflow.models.DagRun.find",
"airflow.utils.dat... | [((16431, 16446), 'unittest.main', 'unittest.main', ([], {}), '()\n', (16444, 16446), False, 'import unittest\n'), ((987, 1023), 'airflow.models.DagBag', 'models.DagBag', ([], {'include_examples': '(True)'}), '(include_examples=True)\n', (1000, 1023), False, 'from airflow import models\n'), ((1229, 1335), 'airflow.api.... |
import bs4
html_str = """
<html>
<body>
<ul>
<li>hello</li>
<li>bye</li>
<li>welcome</li>
</ul>
</body>
</html>
"""
bs_obj = bs4.BeautifulSoup(html_str, "html.parser")
ul = bs_obj.find("ul")
lis = ul.findAll("li")
print(lis)
| [
"bs4.BeautifulSoup"
] | [((186, 228), 'bs4.BeautifulSoup', 'bs4.BeautifulSoup', (['html_str', '"""html.parser"""'], {}), "(html_str, 'html.parser')\n", (203, 228), False, 'import bs4\n')] |
from django.urls import path
from rest_framework_nested import routers
from hypha.apply.api.v1.determination.views import SubmissionDeterminationViewSet
from hypha.apply.api.v1.review.views import SubmissionReviewViewSet
from hypha.apply.api.v1.screening.views import (
ScreeningStatusViewSet,
SubmissionScreeni... | [
"rest_framework_nested.routers.NestedSimpleRouter",
"rest_framework_nested.routers.SimpleRouter"
] | [((528, 550), 'rest_framework_nested.routers.SimpleRouter', 'routers.SimpleRouter', ([], {}), '()\n', (548, 550), False, 'from rest_framework_nested import routers\n'), ((859, 929), 'rest_framework_nested.routers.NestedSimpleRouter', 'routers.NestedSimpleRouter', (['router', '"""submissions"""'], {'lookup': '"""submiss... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"keras.backend.track_tf_optimizer",
"keras.utils.generic_utils.serialize_keras_object",
"tensorflow.python.util.tf_export.keras_export",
"keras.optimizer_v1.TFOptimizer",
"keras.utils.generic_utils.deserialize_keras_object"
] | [((1742, 1784), 'tensorflow.python.util.tf_export.keras_export', 'keras_export', (['"""keras.optimizers.serialize"""'], {}), "('keras.optimizers.serialize')\n", (1754, 1784), False, 'from tensorflow.python.util.tf_export import keras_export\n'), ((1857, 1901), 'tensorflow.python.util.tf_export.keras_export', 'keras_exp... |
##
# Copyright (c) 2007-2013 <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
#
# Unless requi... | [
"json.loads",
"cStringIO.StringIO",
"pycalendar.utils.readFoldedLine",
"pycalendar.exceptions.InvalidData",
"pycalendar.vcard.property.Property",
"pycalendar.vcard.property.Property.parseText"
] | [((2596, 2622), 'pycalendar.utils.readFoldedLine', 'readFoldedLine', (['ins', 'lines'], {}), '(ins, lines)\n', (2610, 2622), False, 'from pycalendar.utils import readFoldedLine\n'), ((2340, 2353), 'cStringIO.StringIO', 'StringIO', (['ins'], {}), '(ins)\n', (2348, 2353), False, 'from cStringIO import StringIO\n'), ((466... |
"""PyMC3-ArviZ conversion code."""
import logging
import warnings
from typing import ( # pylint: disable=unused-import
TYPE_CHECKING,
Any,
Dict,
Iterable,
List,
Mapping,
Optional,
Tuple,
Union,
)
import numpy as np
import xarray as xr
from aesara.graph.basic import Constant
from ... | [
"logging.getLogger",
"xarray.IndexVariable",
"arviz.data.base.dict_to_dataset",
"numpy.array",
"pymc3.aesaraf.extract_obs_data",
"numpy.where",
"numpy.ndim",
"numpy.stack",
"warnings.warn",
"pymc3.util.get_default_varnames",
"numpy.any",
"numpy.shape",
"arviz.data.base.generate_dims_coords",... | [((1054, 1080), 'logging.getLogger', 'logging.getLogger', (['"""pymc3"""'], {}), "('pymc3')\n", (1071, 1080), False, 'import logging\n'), ((11415, 11432), 'arviz.data.base.requires', 'requires', (['"""trace"""'], {}), "('trace')\n", (11423, 11432), False, 'from arviz.data.base import generate_dims_coords, make_attrs, r... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2016 <NAME> <<EMAIL>>
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Distribution License v1.0
# which accompanies this distribution.
#
# The Eclipse Distribution License is available at
... | [
"logging.basicConfig",
"paho.mqtt.client.Client",
"logging.getLogger"
] | [((609, 649), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (628, 649), False, 'import logging\n'), ((876, 889), 'paho.mqtt.client.Client', 'mqtt.Client', ([], {}), '()\n', (887, 889), True, 'import paho.mqtt.client as mqtt\n'), ((900, 927), 'logging.getLogge... |
import logging
import unittest
logger = logging.getLogger("aoc2020.day_5")
logger.setLevel(logging.DEBUG)
from aoc2020.day_5 import *
class ParseBinaryTestCase(unittest.TestCase):
def setUp(self):
self.binary = "FBFBBFFRLR"
def test_parse_column(self):
result = parse_binary(self.binary[:7], ... | [
"logging.getLogger"
] | [((41, 75), 'logging.getLogger', 'logging.getLogger', (['"""aoc2020.day_5"""'], {}), "('aoc2020.day_5')\n", (58, 75), False, 'import logging\n')] |
# Copyright 2014 Cisco Systems, Inc.
# 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 requi... | [
"neutron.i18n._LE",
"networking_cisco.plugins.cisco.cfg_agent.device_drivers.cisco_csr_rest_client.CsrRestClient",
"oslo_log.log.getLogger"
] | [((886, 913), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (903, 913), True, 'from oslo_log import log as logging\n'), ((1957, 2002), 'networking_cisco.plugins.cisco.cfg_agent.device_drivers.cisco_csr_rest_client.CsrRestClient', 'cisco_csr_rest_client.CsrRestClient', (['settings'],... |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | [
"urllib.urlencode",
"json.loads",
"json.dumps",
"tempest.exceptions.NotFound"
] | [((1402, 1418), 'json.loads', 'json.loads', (['body'], {}), '(body)\n', (1412, 1418), False, 'import json\n'), ((1682, 1698), 'json.loads', 'json.loads', (['body'], {}), '(body)\n', (1692, 1698), False, 'import json\n'), ((2092, 2133), 'json.dumps', 'json.dumps', (["{'security_group': post_body}"], {}), "({'security_gr... |
"""Tests for the lms module itself."""
import logging
import mimetypes
from django.conf import settings # lint-amnesty, pylint: disable=unused-import
from django.test import TestCase
log = logging.getLogger(__name__)
class LmsModuleTests(TestCase):
"""
Tests for lms module itself.
"""
def test_n... | [
"logging.getLogger",
"mimetypes.guess_type"
] | [((194, 221), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (211, 221), False, 'import logging\n'), ((454, 495), 'mimetypes.guess_type', 'mimetypes.guess_type', (["('test.' + extension)"], {}), "('test.' + extension)\n", (474, 495), False, 'import mimetypes\n')] |
from __future__ import print_function
import json
import os
import requests
from datetime import datetime
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
DEMO_UID = 0
PREDICTION_RESPONSE_KEY_QUERY_ID = "query_id"
PREDICTION_RESPONSE_KEY_OUTPUT = "output"
PREDICTION_RESPONSE_KEY_USED_DEFAULT = "... | [
"numpy.mean",
"json.loads",
"requests.post",
"numpy.sqrt",
"pandas.read_csv",
"os.path.join",
"numpy.array",
"datetime.datetime.now",
"matplotlib.pyplot.subplots",
"numpy.var"
] | [((883, 981), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': 'num_rows', 'ncols': 'imgs_per_row', 'figsize': '(1.5 * imgs_per_row, 1.5 * num_rows)'}), '(nrows=num_rows, ncols=imgs_per_row, figsize=(1.5 *\n imgs_per_row, 1.5 * num_rows))\n', (895, 981), True, 'import matplotlib.pyplot as plt\n'), ((1542... |
"""
Module contains tools for processing files into DataFrames or other objects
"""
from __future__ import annotations
from collections import abc
import csv
import sys
from textwrap import fill
from typing import Any
import warnings
import numpy as np
import pandas._libs.lib as lib
from pandas._libs.parsers import ... | [
"csv.get_dialect",
"pandas.errors.AbstractMethodError",
"pandas.io.common.validate_header_arg",
"pandas.core.dtypes.common.is_file_like",
"pandas.core.dtypes.common.is_list_like",
"sys.getfilesystemencoding",
"pandas.io.parsers.base_parser.is_index_col",
"pandas.core.dtypes.common.is_float",
"csv.li... | [((20583, 20683), 'pandas.util._decorators.deprecate_nonkeyword_arguments', 'deprecate_nonkeyword_arguments', ([], {'version': 'None', 'allowed_args': "['filepath_or_buffer']", 'stacklevel': '(3)'}), "(version=None, allowed_args=[\n 'filepath_or_buffer'], stacklevel=3)\n", (20613, 20683), False, 'from pandas.util._d... |
from leavedemo.leave.models import Account
from datetime import timedelta
def update_hr(workitem):
''' automated and simplistic version of hrform.
'''
instance = workitem.instance
leaverequest = workitem.instance.content_object
if leaverequest.reason_denial:
raise Excep... | [
"leavedemo.leave.models.Account.objects.get"
] | [((551, 590), 'leavedemo.leave.models.Account.objects.get', 'Account.objects.get', ([], {'user': 'instance.user'}), '(user=instance.user)\n', (570, 590), False, 'from leavedemo.leave.models import Account\n')] |
"""
Display information about ctapipe output files (DL1 or DL2)
"""
from pathlib import Path
import tables
import yaml
from astropy.table import Table
from ctapipe.tools.utils import get_parser
def unflatten(dictionary, separator=" "):
""" turn flattened dict keys into nested """
hierarch_dict = dict()
f... | [
"ctapipe.tools.utils.get_parser",
"astropy.table.Table.from_pandas",
"yaml.dump",
"pathlib.Path",
"tables.open_file",
"tables.is_hdf5_file",
"pandas.DataFrame"
] | [((2312, 2332), 'ctapipe.tools.utils.get_parser', 'get_parser', (['fileinfo'], {}), '(fileinfo)\n', (2322, 2332), False, 'from ctapipe.tools.utils import get_parser\n'), ((2095, 2119), 'pandas.DataFrame', 'pd.DataFrame', (['info_total'], {}), '(info_total)\n', (2107, 2119), True, 'import pandas as pd\n'), ((1892, 1917)... |
import os
import time
from selenium import webdriver
if not os.path.exists("ogp"):
os.mkdir("ogp")
PATHS = {
"/?dummy": (959, 500),
"/cards/details-of-confirmed-cases": (959, 500),
"/cards/number-of-confirmed-cases": (959, 500),
"/cards/attributes-of-confirmed-cases": (959, 480),
"/cards/numb... | [
"os.path.exists",
"selenium.webdriver.ChromeOptions",
"selenium.webdriver.Chrome",
"time.sleep",
"os.mkdir"
] | [((968, 993), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (991, 993), False, 'from selenium import webdriver\n'), ((1081, 1114), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'options': 'options'}), '(options=options)\n', (1097, 1114), False, 'from selenium import webdriver... |
from flask import Flask
from .config import Config
from .api import register_api
from .plugins import db, api, ma, login, migrate
def create_app(config=Config):
"""
Initializes the Flask app and Flask plugins.
:param config: configuration for the flask application
:type config: :class:`Con... | [
"flask.Flask"
] | [((450, 465), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (455, 465), False, 'from flask import Flask\n')] |
# -*- coding: utf-8 -*-
# author: itimor
from django.db import models
from django.contrib.auth.models import BaseUserManager, AbstractBaseUser
class UserManager(BaseUserManager):
def create_user(self, username, password=None):
'''username 是唯一标识,没有会报错'''
if not username:
raise ValueErro... | [
"django.db.models.EmailField",
"django.db.models.DateField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.CharField"
] | [((861, 920), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(32)', 'unique': '(True)', 'db_index': '(True)'}), '(max_length=32, unique=True, db_index=True)\n', (877, 920), False, 'from django.db import models\n'), ((933, 991), 'django.db.models.EmailField', 'models.EmailField', ([], {'max_lengt... |
#!/usr/bin/env python3
from litex import RemoteClient
wb = RemoteClient()
wb.open()
# # #
def icap_send(addr, data):
wb.regs.icap_addr.write(addr)
wb.regs.icap_data.write(data)
wb.regs.icap_send.write(1)
while (wb.regs.icap_done.read() == 0):
pass
# iprog
icap_send(0x04, 0x0000000f)
# # #
wb.close()
| [
"litex.RemoteClient"
] | [((61, 75), 'litex.RemoteClient', 'RemoteClient', ([], {}), '()\n', (73, 75), False, 'from litex import RemoteClient\n')] |
from cogs import task, argument, option
import sys, os
@task
class Write_Hello:
name = argument(default=None)
output = option(key='o', default=None)
def __init__(self, name, output):
if name is None:
name = os.environ['USER']
self.name = name
if output is None:
... | [
"cogs.option",
"cogs.argument"
] | [((94, 116), 'cogs.argument', 'argument', ([], {'default': 'None'}), '(default=None)\n', (102, 116), False, 'from cogs import task, argument, option\n'), ((130, 159), 'cogs.option', 'option', ([], {'key': '"""o"""', 'default': 'None'}), "(key='o', default=None)\n", (136, 159), False, 'from cogs import task, argument, o... |
from sims4.tuning.tunable_base import GroupNames
from situations.complex.give_job_object_situation_mixin import GiveJobObjectSituationMixin
from situations.situation import Situation
from situations.situation_complex import SituationComplexCommon, CommonSituationState, SituationStateData, TunableSituationJobAndRoleStat... | [
"situations.situation_complex.TunableSituationJobAndRoleState",
"situations.situation_complex.SituationStateData",
"sims4.log.Logger"
] | [((344, 409), 'sims4.log.Logger', 'sims4.log.Logger', (['"""SuntannerSituation"""'], {'default_owner': '"""msundaram"""'}), "('SuntannerSituation', default_owner='msundaram')\n", (360, 409), False, 'import sims4\n'), ((613, 763), 'situations.situation_complex.TunableSituationJobAndRoleState', 'TunableSituationJobAndRol... |
from brownie import reverts
from fixtures import setup_wallet, owners_2
from eth_abi import encode_abi
from web3 import Web3
from fixtures import ACCOUNTS
from eth_account.messages import encode_defunct
def calculate_transaction_hash(nonce: int, to: str, value: int, data: str='00'):
encoded: bytes = nonce.to_byte... | [
"fixtures.setup_wallet.nonce",
"fixtures.setup_wallet.execute",
"brownie.reverts",
"web3.Web3.keccak"
] | [((481, 501), 'web3.Web3.keccak', 'Web3.keccak', (['encoded'], {}), '(encoded)\n', (492, 501), False, 'from web3 import Web3\n'), ((1134, 1196), 'fixtures.setup_wallet.execute', 'setup_wallet.execute', (['to', 'value', '""""""', 'sigdata', "{'value': value}"], {}), "(to, value, '', sigdata, {'value': value})\n", (1154,... |
from tests.testmodels import Event, Tournament
from tortoise.contrib import test
class TestUpdate(test.TestCase):
async def test_update(self):
await Tournament.create(name="1")
await Tournament.create(name="3")
rows_affected = await Tournament.all().update(name="2")
self.assertEqua... | [
"tests.testmodels.Event.create",
"tests.testmodels.Tournament.create",
"tests.testmodels.Tournament.all",
"tests.testmodels.Event.all",
"tests.testmodels.Tournament.first",
"tests.testmodels.Event.first"
] | [((163, 190), 'tests.testmodels.Tournament.create', 'Tournament.create', ([], {'name': '"""1"""'}), "(name='1')\n", (180, 190), False, 'from tests.testmodels import Event, Tournament\n'), ((205, 232), 'tests.testmodels.Tournament.create', 'Tournament.create', ([], {'name': '"""3"""'}), "(name='3')\n", (222, 232), False... |
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"unittest.mock.mock_open",
"pytest.mark.parametrize"
] | [((718, 916), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""setup_py_contents,release_version,expected"""', '[("version = \'1.0.0\'\\n", \'1.1.0\', "version = \'1.1.0\'\\n"), (\n \'version = "1.0.0"\\n\', \'1.1.0\', """version = "1.1.0\\"\n""")]'], {}), '(\'setup_py_contents,release_version,expected\',... |
import os
import pytest
import sys
import tempfile
import ray
from ray import serve
from ray.experimental.dag import DAGNode
from ray.experimental.dag.utils import DAGNodeNameGenerator
from ray.serve.deployment_graph import RayServeDAGHandle
from ray.serve.deployment_graph import InputNode
from ray.serve.drivers impor... | [
"tempfile.TemporaryDirectory",
"ray.serve.pipeline.generate.transform_ray_dag_to_serve_dag",
"ray.get",
"ray.experimental.dag.plot",
"ray.experimental.dag.vis_utils.dag_to_dot",
"ray.serve.drivers.DAGDriver.bind",
"ray.experimental.dag.utils.DAGNodeNameGenerator",
"os.path.join",
"ray.serve.deployme... | [((3027, 3079), 'ray.experimental.dag.vis_utils.dag_to_dot', 'ray.experimental.dag.vis_utils.dag_to_dot', (['serve_dag'], {}), '(serve_dag)\n', (3068, 3079), False, 'import ray\n'), ((3659, 3711), 'ray.experimental.dag.vis_utils.dag_to_dot', 'ray.experimental.dag.vis_utils.dag_to_dot', (['serve_dag'], {}), '(serve_dag)... |
import numpy as np
import sys
from optparse import OptionParser
from utils import obtain_parameters
from test_models_20news import test20news
from test_models_cifar import testcifar
from test_models_snippets import testsnippets
from test_models_TMC import testtmc
op = OptionParser()
op.add_option("-M", "--model", typ... | [
"optparse.OptionParser"
] | [((271, 285), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (283, 285), False, 'from optparse import OptionParser\n')] |
#!/usr/bin/env python3
exit()
import requests
import json
requests.packages.urllib3.disable_warnings()
src_url = "https://172.21.42.102:8089"
dest_url = "https://172.21.42.103:8089"
def login(url,username,password):
creds_payload = { 'cookie': '1', 'username': username, 'password': password }
s = requests.Session... | [
"requests.packages.urllib3.disable_warnings",
"requests.Session"
] | [((60, 104), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings', ([], {}), '()\n', (102, 104), False, 'import requests\n'), ((304, 322), 'requests.Session', 'requests.Session', ([], {}), '()\n', (320, 322), False, 'import requests\n')] |
import sys
from collections import namedtuple
import mock
import pytest
from pca.packages.errors import ErrorBoundary
PY36 = (3, 6) <= sys.version_info < (3, 7)
Callbacks = namedtuple(
"Callbacks",
[
"log_inner_error",
"should_propagate_exception",
"transform_propagated_exception",... | [
"collections.namedtuple",
"mock.Mock",
"pytest.raises",
"pytest.mark.skipif",
"pca.packages.errors.ErrorBoundary"
] | [((179, 365), 'collections.namedtuple', 'namedtuple', (['"""Callbacks"""', "['log_inner_error', 'should_propagate_exception',\n 'transform_propagated_exception', 'on_no_exception',\n 'on_propagate_exception', 'on_suppress_exception']"], {}), "('Callbacks', ['log_inner_error', 'should_propagate_exception',\n 't... |
# binary classification, missing data, impute with mean
import numpy
from pandas import read_csv
from xgboost import XGBClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.preprocessing import LabelEncoder
from sklearn.impute import SimpleImputer
# loa... | [
"sklearn.preprocessing.LabelEncoder",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.impute.SimpleImputer",
"sklearn.metrics.accuracy_score",
"xgboost.XGBClassifier"
] | [((339, 402), 'pandas.read_csv', 'read_csv', (['"""horse-colic.csv"""'], {'delim_whitespace': '(True)', 'header': 'None'}), "('horse-colic.csv', delim_whitespace=True, header=None)\n", (347, 402), False, 'from pandas import read_csv\n'), ((637, 652), 'sklearn.impute.SimpleImputer', 'SimpleImputer', ([], {}), '()\n', (6... |
import requests_async
import pytest
@pytest.mark.asyncio
async def test_auth(server):
url = "http://127.0.0.1:8000/echo_headers"
response = await requests_async.get(url, auth=("tom", "<PASSWORD>"))
assert response.status_code == 200
assert response.json()["headers"]["authorization"] == "Basic dG9tOnBh... | [
"requests_async.get"
] | [((156, 207), 'requests_async.get', 'requests_async.get', (['url'], {'auth': "('tom', '<PASSWORD>')"}), "(url, auth=('tom', '<PASSWORD>'))\n", (174, 207), False, 'import requests_async\n')] |
import uuid
from django.db.models import Sum
from django.utils.translation import ugettext_lazy as _
from .decorators import report_field_register
from .helpers import get_calculation_annotation
from .registry import field_registry
class SlickReportField(object):
"""
Computation field responsible for making... | [
"django.utils.translation.ugettext_lazy",
"uuid.uuid4"
] | [((11151, 11169), 'django.utils.translation.ugettext_lazy', '_', (['"""first balance"""'], {}), "('first balance')\n", (11152, 11169), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((11691, 11708), 'django.utils.translation.ugettext_lazy', '_', (['"""Sum of value"""'], {}), "('Sum of value')\n", (... |
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2019 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
import numpy as np
import scipy.linalg as spla
from pymor.algorithms.arnoldi import arnoldi
from ... | [
"pymor.algorithms.gram_schmidt.gram_schmidt_biorth",
"pymor.algorithms.gram_schmidt.gram_schmidt",
"numpy.ones",
"numpy.exp",
"numpy.zeros",
"numpy.empty",
"scipy.linalg.norm",
"pymor.algorithms.arnoldi.arnoldi",
"pymor.models.iosys.LTIModel.from_matrices"
] | [((7315, 7350), 'pymor.algorithms.arnoldi.arnoldi', 'arnoldi', (['fom.A', 'fom.E', 'fom.B', 'sigma'], {}), '(fom.A, fom.E, fom.B, sigma)\n', (7322, 7350), False, 'from pymor.algorithms.arnoldi import arnoldi\n'), ((7368, 7415), 'pymor.algorithms.arnoldi.arnoldi', 'arnoldi', (['fom.A', 'fom.E', 'fom.C', 'sigma'], {'tran... |
# coding=utf-8
# Copyright 2019 The Interval Bound Propagation 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 ... | [
"interval_bound_propagation.VerifiableModelWrapper",
"interval_bound_propagation.Losses",
"tensorflow.compat.v1.constant_initializer",
"tensorflow.compat.v1.constant",
"interval_bound_propagation.UntargetedPGDAttack",
"interval_bound_propagation.IntervalBounds",
"tensorflow.compat.v1.test.main",
"inte... | [((3182, 3196), 'tensorflow.compat.v1.test.main', 'tf.test.main', ([], {}), '()\n', (3194, 3196), True, 'import tensorflow.compat.v1 as tf\n'), ((1222, 1259), 'interval_bound_propagation.VerifiableModelWrapper', 'ibp.VerifiableModelWrapper', (['predictor'], {}), '(predictor)\n', (1248, 1259), True, 'import interval_bou... |
from tests.unit.lib.iml_unit_test_case import IMLUnitTestCase
from chroma_core.models import LogMessage, MessageClass
class TestLogMessage(IMLUnitTestCase):
def test_classification(self):
"""
Test the classification code correctly classfies messages.
"""
test_messages = {
... | [
"chroma_core.models.LogMessage.get_message_class"
] | [((1015, 1057), 'chroma_core.models.LogMessage.get_message_class', 'LogMessage.get_message_class', (['test_message'], {}), '(test_message)\n', (1043, 1057), False, 'from chroma_core.models import LogMessage, MessageClass\n')] |
# -*- coding: utf-8 -*-
"""
Postpasses over the LLVM IR.
The signature of each postpass is postpass(env, ee, lmod, lfunc) -> lfunc
"""
from __future__ import print_function, division, absolute_import
import llvmmath
from llvmmath import linking
default_postpasses = {}
def register_default(name):
def dec(f):
... | [
"llvmmath.linking.link_llvm_math_intrinsics",
"llvmmath.get_default_math_lib",
"llvmmath.linking.get_linker"
] | [((838, 869), 'llvmmath.get_default_math_lib', 'llvmmath.get_default_math_lib', ([], {}), '()\n', (867, 869), False, 'import llvmmath\n'), ((883, 919), 'llvmmath.linking.get_linker', 'linking.get_linker', (['default_math_lib'], {}), '(default_math_lib)\n', (901, 919), False, 'from llvmmath import linking\n'), ((924, 10... |
#!/usr/bin/env python
import random
import numpy as np
import tensorflow as tf
import cv2
import matplotlib.pyplot as plt
seed = 0
random.seed(seed)
np.random.seed(seed)
tf.random.set_seed(seed)
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
x_train = x_train[..., None]
x_test = x_test[... | [
"matplotlib.pyplot.imshow",
"tensorflow.random.set_seed",
"matplotlib.pyplot.xticks",
"tensorflow.keras.datasets.mnist.load_data",
"tensorflow.keras.preprocessing.image.ImageDataGenerator",
"random.seed",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.yticks",
"numpy.random.seed",
"matplotlib.pypl... | [((135, 152), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (146, 152), False, 'import random\n'), ((153, 173), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (167, 173), True, 'import numpy as np\n'), ((174, 198), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['seed'], {}), '(see... |
# Copyright 2017 Google 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 to in writing, ... | [
"google.cloud.monitoring.Client",
"time.sleep",
"argparse.ArgumentParser",
"google.cloud.bigtable.Client"
] | [((1026, 1045), 'google.cloud.monitoring.Client', 'monitoring.Client', ([], {}), '()\n', (1043, 1045), False, 'from google.cloud import monitoring\n'), ((2580, 2607), 'google.cloud.bigtable.Client', 'bigtable.Client', ([], {'admin': '(True)'}), '(admin=True)\n', (2595, 2607), False, 'from google.cloud import bigtable\n... |
import requests
from PIL import Image
from io import BytesIO
import numpy as np
import cv2 as cv
from piquery.piq_feature import ImFeature, CropImFeature, ResizeImFeature, ImSim
from piquery.piq_hash import imhash_dct
from piquery.piq_error import DownloadError, ImageFormatError
class ImgDownloader:
@staticmethod... | [
"piquery.piq_error.ImageFormatError",
"piquery.piq_feature.ImFeature",
"piquery.piq_feature.ResizeImFeature",
"piquery.piq_error.DownloadError",
"piquery.piq_feature.ImSim",
"io.BytesIO",
"requests.get",
"cv2.cvtColor",
"piquery.piq_feature.CropImFeature"
] | [((1255, 1295), 'cv2.cvtColor', 'cv.cvtColor', (['img_data', 'cv.COLOR_BGR2GRAY'], {}), '(img_data, cv.COLOR_BGR2GRAY)\n', (1266, 1295), True, 'import cv2 as cv\n'), ((1358, 1373), 'piquery.piq_feature.ImFeature', 'ImFeature', ([], {'k': '(50)'}), '(k=50)\n', (1367, 1373), False, 'from piquery.piq_feature import ImFeat... |
"""Support for Sonarr sensors."""
from datetime import timedelta
import logging
from typing import Any, Callable, Dict, List, Optional
from sonarr import Sonarr, SonarrConnectionError, SonarrError
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import DATA_GIGABYTES
from homeassistant.he... | [
"logging.getLogger",
"homeassistant.util.dt.as_utc",
"homeassistant.util.dt.start_of_local_day",
"datetime.timedelta"
] | [((567, 594), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (584, 594), False, 'import logging\n'), ((8873, 8894), 'homeassistant.util.dt.as_utc', 'dt_util.as_utc', (['local'], {}), '(local)\n', (8887, 8894), True, 'import homeassistant.util.dt as dt_util\n'), ((8917, 8943), 'datetime.ti... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | [
"datetime.datetime",
"nova.db.main.api.instance_destroy",
"nova.compute.instance_list.get_instances_sorted",
"nova.db.main.api.instance_get_all",
"nova.objects.CellMappingList.get_all",
"nova.context.RequestContext",
"nova.objects.InstanceFault",
"nova.objects.Instance",
"nova.compute.instance_list.... | [((982, 1020), 'nova.context.RequestContext', 'context.RequestContext', (['"""fake"""', '"""fake"""'], {}), "('fake', 'fake')\n", (1004, 1020), False, 'from nova import context\n'), ((1097, 1138), 'datetime.datetime', 'datetime.datetime', (['(1985)', '(10)', '(25)', '(1)', '(21)', '(0)'], {}), '(1985, 10, 25, 1, 21, 0)... |
# -*- coding: utf-8 -*-
from flask.ext.assets import Bundle, Environment
css = Bundle(
"libs/bootstrap/dist/css/bootstrap.css",
"libs/dataTables/dataTables.bootstrap.css",
"libs/dataTables/dataTables.tableTools.css",
"libs/font-awesome4/css/font-awesome.css",
"libs/bootstrap-datepicker/css/datepicker3.css",
... | [
"flask.ext.assets.Bundle",
"flask.ext.assets.Environment"
] | [((80, 456), 'flask.ext.assets.Bundle', 'Bundle', (['"""libs/bootstrap/dist/css/bootstrap.css"""', '"""libs/dataTables/dataTables.bootstrap.css"""', '"""libs/dataTables/dataTables.tableTools.css"""', '"""libs/font-awesome4/css/font-awesome.css"""', '"""libs/bootstrap-datepicker/css/datepicker3.css"""', '"""libs/bootstr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Description
# -----------
# Dump abstract informations in a JSON format
# see: abstract_reader.py
import argparse
import sys
import lief
import json
def main():
parser = argparse.ArgumentParser()
parser.add_argument('binary', help = 'A binary')
args = parse... | [
"lief.parse",
"json.dumps",
"argparse.ArgumentParser",
"lief.to_json_from_abstract"
] | [((225, 250), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (248, 250), False, 'import argparse\n'), ((352, 375), 'lief.parse', 'lief.parse', (['args.binary'], {}), '(args.binary)\n', (362, 375), False, 'import lief\n'), ((403, 437), 'lief.to_json_from_abstract', 'lief.to_json_from_abstract', ... |
from piroq.service import Manager
def main():
Manager().run()
| [
"piroq.service.Manager"
] | [((49, 58), 'piroq.service.Manager', 'Manager', ([], {}), '()\n', (56, 58), False, 'from piroq.service import Manager\n')] |
# users/forms.py
# Django modules
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django import forms
class RegisterForm(UserCreationForm):
username = forms.CharField(max_length=50)
email = forms.EmailField(max_length=50)
password1 = forms.CharField(... | [
"django.forms.EmailField",
"django.forms.CharField"
] | [((213, 243), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (228, 243), False, 'from django import forms\n'), ((256, 287), 'django.forms.EmailField', 'forms.EmailField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (272, 287), False, 'from django import forms\n'),... |
from __future__ import unicode_literals
import collections
import itertools
import operator
import time
import functools
from cytoolz import (
dissoc,
assoc
)
from cytoolz.itertoolz import (
remove,
)
from cytoolz.functoolz import (
compose,
excepts,
partial,
)
from eth_utils import (
is_... | [
"cytoolz.functoolz.compose",
"eth_tester.backends.get_chain_backend",
"eth_utils.is_same_address",
"operator.itemgetter",
"eth_tester.exceptions.FilterNotFound",
"cytoolz.assoc",
"eth_tester.utils.transactions.extract_valid_transaction_params",
"functools.wraps",
"eth_tester.utils.transactions.remov... | [((1426, 1447), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (1441, 1447), False, 'import functools\n'), ((3395, 3412), 'itertools.count', 'itertools.count', ([], {}), '()\n', (3410, 3412), False, 'import itertools\n'), ((3586, 3603), 'itertools.count', 'itertools.count', ([], {}), '()\n', (3601, 3... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""planning poker blueprint."""
# from app.models import model
from flask import Blueprint, redirect, render_template, request, url_for, session, escape, jsonify, make_response
from app.models import model
import json
main_blueprint = Blueprint('main', __name__, template_... | [
"flask.render_template",
"flask.Blueprint"
] | [((283, 339), 'flask.Blueprint', 'Blueprint', (['"""main"""', '__name__'], {'template_folder': '"""templates"""'}), "('main', __name__, template_folder='templates')\n", (292, 339), False, 'from flask import Blueprint, redirect, render_template, request, url_for, session, escape, jsonify, make_response\n'), ((456, 502),... |
import pytest
from release_often import flit
class TestVersionFilePath:
"""Tests for release_often.flit.version_file_path()."""
def test_pyproject_does_not_exist(self, data_path):
with pytest.raises(TypeError):
flit.version_file_path(data_path)
def test_pyproject_missing_data(self,... | [
"release_often.flit.change_version",
"release_often.flit.read_version",
"pytest.mark.parametrize",
"pytest.raises",
"release_often.flit.version_file_path"
] | [((445, 633), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""example_name, expected_path"""', "[('src_module', 'src/pkg.py'), ('src_pkg', 'src/pkg/__init__.py'), (\n 'top_module', 'pkg.py'), ('top_pkg', 'pkg/__init__.py')]"], {}), "('example_name, expected_path', [('src_module',\n 'src/pkg.py'), ('sr... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | [
"warnings.warn",
"zope.interface.implementer",
"shutil.rmtree"
] | [((728, 753), 'zope.interface.implementer', 'implementer', (['IFileStorage'], {}), '(IFileStorage)\n', (739, 753), False, 'from zope.interface import implementer\n'), ((1887, 1912), 'zope.interface.implementer', 'implementer', (['IDocsStorage'], {}), '(IDocsStorage)\n', (1898, 1912), False, 'from zope.interface import ... |
# This script shows how to connect to a JIRA instance with a
# username and password over HTTP BASIC authentication.
from collections import Counter
from jira import JIRA
# By default, the client will connect to a JIRA instance started from the Atlassian Plugin SDK.
# See
# https://developer.atlassian.com/display/DOC... | [
"collections.Counter",
"jira.JIRA"
] | [((380, 415), 'jira.JIRA', 'JIRA', ([], {'basic_auth': "('admin', 'admin')"}), "(basic_auth=('admin', 'admin'))\n", (384, 415), False, 'from jira import JIRA\n'), ((760, 815), 'collections.Counter', 'Counter', (['[issue.fields.project.key for issue in issues]'], {}), '([issue.fields.project.key for issue in issues])\n'... |
"""Main application class and user interface helper routines for
'git-cvs'."""
import os.path
import re
from cvsgit.cmd import Cmd
from cvsgit.error import Error
from cvsgit.git import Git
from cvsgit.cvs import CVS
from cvsgit.meta import MetaDb
from cvsgit.i18n import _
from cvsgit.term import Progress
class Comma... | [
"cvsgit.meta.MetaDb",
"cvsgit.term.Progress",
"re.match",
"cvsgit.i18n._",
"cvsgit.cvs.CVS",
"cvsgit.git.Git"
] | [((2575, 2589), 'cvsgit.git.Git', 'Git', (['directory'], {}), '(directory)\n', (2578, 2589), False, 'from cvsgit.git import Git\n'), ((2067, 2120), 'cvsgit.i18n._', '_', (['"""\'cvs.source\' is unset; not a git-cvs repository?"""'], {}), '("\'cvs.source\' is unset; not a git-cvs repository?")\n', (2068, 2120), False, '... |
"""dsl.py unit tests."""
from copy import deepcopy
from io import StringIO
import logging
import pytest
from unittest.mock import call, patch, MagicMock
from tests.common.utils import DeepCopyMagicMock, patch_logger
import ruamel.yaml as yamler
from ruamel.yaml.comments import CommentedMap, CommentedSeq, TaggedScalar
... | [
"pypyr.dsl.PyString.from_yaml",
"ruamel.yaml.YAML",
"pypyr.dsl.PyString",
"copy.deepcopy",
"unittest.mock.patch",
"pypyr.dsl.Step",
"pypyr.dsl.Jsonify",
"ruamel.yaml.comments.CommentedMap",
"unittest.mock.call",
"pypyr.dsl.PyString.to_yaml",
"pypyr.dsl.RetryDecorator",
"io.StringIO",
"unitte... | [((17151, 17189), 'unittest.mock.patch', 'patch', (['"""pypyr.moduleloader.get_module"""'], {}), "('pypyr.moduleloader.get_module')\n", (17156, 17189), False, 'from unittest.mock import call, patch, MagicMock\n'), ((18085, 18123), 'unittest.mock.patch', 'patch', (['"""pypyr.moduleloader.get_module"""'], {}), "('pypyr.m... |
import os, sys
import numpy as np
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
percentages = [0.01, 0.1, 0.2, 0.4, 0.5, 0.6]
for percentage in percentages:
data = []
save_path = '../logs/SOM_weights_MNIST_noise_{}.npy'.format(percentage)
wts = np.load(save_path).reshape(-1, 784)
print ("===... | [
"sklearn.cluster.KMeans",
"numpy.load",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show"
] | [((647, 657), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (655, 657), True, 'import matplotlib.pyplot as plt\n'), ((272, 290), 'numpy.load', 'np.load', (['save_path'], {}), '(save_path)\n', (279, 290), True, 'import numpy as np\n'), ((374, 395), 'sklearn.cluster.KMeans', 'KMeans', ([], {'n_clusters': '(10)'... |
from spinnman.messages.scp.abstract_messages.abstract_scp_request \
import AbstractSCPRequest
from spinnman.messages.sdp.sdp_header import SDPHeader
from spinnman.messages.sdp.sdp_flag import SDPFlag
from spinnman.messages.scp.scp_request_header import SCPRequestHeader
from spinnman.messages.scp.scp_command import ... | [
"spinnman.messages.scp.scp_request_header.SCPRequestHeader",
"spinnman.messages.scp.impl.scp_check_ok_response.SCPCheckOKResponse",
"spinnman.messages.sdp.sdp_header.SDPHeader"
] | [((2039, 2090), 'spinnman.messages.scp.impl.scp_check_ok_response.SCPCheckOKResponse', 'SCPCheckOKResponse', (['"""Flood Fill"""', '"""CMD_NNP:NNP_FFS"""'], {}), "('Flood Fill', 'CMD_NNP:NNP_FFS')\n", (2057, 2090), False, 'from spinnman.messages.scp.impl.scp_check_ok_response import SCPCheckOKResponse\n'), ((1689, 1816... |
import threading
from flask import Flask, jsonify
from src import consts
from src.cv_recogniser import run_cv_recogniser
app = Flask(__name__)
@app.route('/get', methods=['GET'])
def get_counter():
return jsonify({
'total': consts.total,
'out': consts.ppl_out,
'in': consts.ppl_in
})
... | [
"flask.jsonify",
"threading.Thread",
"flask.Flask"
] | [((128, 143), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (133, 143), False, 'from flask import Flask, jsonify\n'), ((326, 368), 'threading.Thread', 'threading.Thread', ([], {'target': 'run_cv_recogniser'}), '(target=run_cv_recogniser)\n', (342, 368), False, 'import threading\n'), ((212, 288), 'flask.js... |
#! /usr/env/bin python
import os
import linecache
import multiprocessing
import numpy as np
from collections import OrderedDict
from CP2K_kit.tools import call
from CP2K_kit.tools import log_info
from CP2K_kit.tools import data_op
from CP2K_kit.tools import traj_info
from CP2K_kit.tools import file_tools
from CP2K_kit... | [
"CP2K_kit.tools.log_info.log_out",
"collections.OrderedDict",
"CP2K_kit.tools.data_op.eval_str",
"CP2K_kit.tools.data_op.str_to_bool",
"CP2K_kit.tools.traj_info.get_traj_info",
"CP2K_kit.tools.data_op.split_str",
"os.getcwd",
"CP2K_kit.tools.log_info.log_error",
"CP2K_kit.tools.data_op.comb_list_2_s... | [((1531, 1617), 'CP2K_kit.tools.log_info.log_error', 'log_info.log_error', (['"""Input error: no model, please set deepff/deepmd_model/model"""'], {}), "(\n 'Input error: no model, please set deepff/deepmd_model/model')\n", (1549, 1617), False, 'from CP2K_kit.tools import log_info\n'), ((5814, 5827), 'collections.Or... |
import matplotlib
matplotlib.use('Agg')
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.pyplot import gcf
from flask import Flask, render_template, request, flash, redirect
import pandas as pd
import librosa
import ffmpeg
import librosa.... | [
"keras.preprocessing.image.img_to_array",
"numpy.argsort",
"numpy.array",
"tensorflow.keras.layers.Dense",
"pandas.read_excel",
"librosa.load",
"tensorflow.keras.models.Model",
"tensorflow.keras.applications.MobileNetV2",
"matplotlib.use",
"matplotlib.pyplot.gcf",
"tensorflow.keras.layers.Dropou... | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((767, 807), 'os.path.join', 'os.path.join', (['THIS_DIR', '"""bird_data.xlsx"""'], {}), "(THIS_DIR, 'bird_data.xlsx')\n", (779, 807), False, 'import os\n'), ((727, 753), 'os.path.realpath', 'os.pa... |
import os
import random
import time
from contextlib import contextmanager
MOCK_LOUCSTFILE_CONTENT = '''
"""This is a mock locust file for unit testing"""
from locust import HttpUser, TaskSet, task, between
def index(l):
l.client.get("/")
def stats(l):
l.client.get("/stats/requests")
class UserTasks(Tas... | [
"os.path.join",
"os.path.abspath",
"time.time",
"random.randint",
"os.remove"
] | [((1039, 1086), 'os.path.join', 'os.path.join', (['mocked.directory', 'mocked.filename'], {}), '(mocked.directory, mocked.filename)\n', (1051, 1086), False, 'import os\n'), ((838, 863), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (853, 863), False, 'import os\n'), ((1217, 1244), 'os.remove... |
# coding=utf-8
"""
This Storage service helps persistent room information given by SearchService.py
Employ a sqlite3 to implement the detail for now.
"""
import sqlite3
from Models import RoomInfo
from LogHelper import Log
from Utils import *
class StorageService:
_DEFAULT_PATH = "./rooms.db"
_TAG = "Storag... | [
"LogHelper.Log.w",
"sqlite3.connect",
"LogHelper.Log.e",
"Models.RoomInfo"
] | [((519, 540), 'sqlite3.connect', 'sqlite3.connect', (['path'], {}), '(path)\n', (534, 540), False, 'import sqlite3\n'), ((1239, 1290), 'LogHelper.Log.e', 'Log.e', (['StorageService._TAG', '"""prepareDB() failed"""', 'e'], {}), "(StorageService._TAG, 'prepareDB() failed', e)\n", (1244, 1290), False, 'from LogHelper impo... |
# @Author : bamtercelboo
# @Datetime : 2018/7/24 10:26
# @File : HierachicalAtten.py
# @Last Modify Time : 2018/7/24 10:26
# @Contact : <EMAIL>, 163.com}
"""
FILE : HierachicalAtten.py
FUNCTION : None
"""
import os
import sys
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.i... | [
"torch.manual_seed",
"torch.mul",
"torch.nn.Dropout",
"torch.nn.Softmax",
"random.seed",
"torch.sum",
"torch.nn.Linear"
] | [((450, 477), 'torch.manual_seed', 'torch.manual_seed', (['seed_num'], {}), '(seed_num)\n', (467, 477), False, 'import torch\n'), ((478, 499), 'random.seed', 'random.seed', (['seed_num'], {}), '(seed_num)\n', (489, 499), False, 'import random\n'), ((1011, 1096), 'torch.nn.Linear', 'nn.Linear', ([], {'in_features': 'sel... |
import paddle.fluid as fluid
from paddle.fluid.initializer import MSRA
from paddle.fluid.param_attr import ParamAttr
class MobileNetSSD:
def __init__(self, img, num_classes, img_shape):
self.img = img
self.num_classes = num_classes
self.img_shape = img_shape
def ssd_net(self, scale=1.... | [
"paddle.fluid.layers.batch_norm",
"paddle.fluid.layers.multi_box_head",
"paddle.fluid.layers.conv2d",
"paddle.fluid.initializer.MSRA"
] | [((1535, 1965), 'paddle.fluid.layers.multi_box_head', 'fluid.layers.multi_box_head', ([], {'inputs': '[module11, module13, module14, module15, module16, module17]', 'image': 'self.img', 'num_classes': 'self.num_classes', 'min_ratio': '(20)', 'max_ratio': '(90)', 'min_sizes': '[60.0, 105.0, 150.0, 195.0, 240.0, 285.0]',... |
import requests
import json
import time
def is_number(s):
try:
int(s)
return True
except ValueError:
return False
def console_print(text):
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
# print(text)
r = requests.post('http://localhost:5000/api/pendi... | [
"json.loads",
"requests.post",
"time.sleep",
"requests.get"
] | [((705, 769), 'requests.get', 'requests.get', (['"""http://localhost:5000/api/pending_server_actions"""'], {}), "('http://localhost:5000/api/pending_server_actions')\n", (717, 769), False, 'import requests\n'), ((1003, 1024), 'json.loads', 'json.loads', (['r.content'], {}), '(r.content)\n', (1013, 1024), False, 'import... |
import os
from pathlib import Path
import cv2
import numpy as np
import pandas as pd
from pandas import DataFrame
from sklearn.model_selection import train_test_split
def create_info_csv(mvtec_dir: Path) -> DataFrame:
df = pd.DataFrame({})
for data_type in ["train", "test"]:
for p in mvtec_dir.glob... | [
"os.path.exists",
"cv2.imwrite",
"os.makedirs",
"pathlib.Path",
"os.rename",
"numpy.zeros",
"pandas.DataFrame",
"cv2.imread"
] | [((231, 247), 'pandas.DataFrame', 'pd.DataFrame', (['{}'], {}), '({})\n', (243, 247), True, 'import pandas as pd\n'), ((1542, 1584), 'os.makedirs', 'os.makedirs', (['"""/data/images"""'], {'exist_ok': '(True)'}), "('/data/images', exist_ok=True)\n", (1553, 1584), False, 'import os\n'), ((1589, 1630), 'os.makedirs', 'os... |
"""Compute integral flux in an energy band for the Fermi diffuse model.
"""
from astropy.units import Quantity
from gammapy.datasets import FermiGalacticCenter
cube = FermiGalacticCenter.diffuse_model()
print(cube)
energy_band = Quantity([10, 50], 'GeV')
image = cube.integral_flux_image(energy_band, energy_bins=100)
... | [
"gammapy.datasets.FermiGalacticCenter.diffuse_model",
"astropy.units.Quantity"
] | [((168, 203), 'gammapy.datasets.FermiGalacticCenter.diffuse_model', 'FermiGalacticCenter.diffuse_model', ([], {}), '()\n', (201, 203), False, 'from gammapy.datasets import FermiGalacticCenter\n'), ((231, 256), 'astropy.units.Quantity', 'Quantity', (['[10, 50]', '"""GeV"""'], {}), "([10, 50], 'GeV')\n", (239, 256), Fals... |
import streamlit as st
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as ss
import numpy as np
import itertools
def cramers_corrected_stat(confusion_matrix):
""" calculate Cramers V statistic for categorical-categorical association.
uses correction from Bergsma and Wich... | [
"streamlit.image",
"pandas.read_csv",
"seaborn.histplot",
"seaborn.catplot",
"seaborn.set_style",
"streamlit.sidebar.header",
"streamlit.sidebar.markdown",
"streamlit.set_page_config",
"pandas.DataFrame",
"streamlit.sidebar.button",
"streamlit.markdown",
"streamlit.write",
"pandas.crosstab",... | [((729, 793), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""Data Science App"""', 'layout': '"""wide"""'}), "(page_title='Data Science App', layout='wide')\n", (747, 793), True, 'import streamlit as st\n'), ((6631, 6669), 'streamlit.write', 'st.write', (['"""\n\t# Data Science App\n\t"""'],... |
import os,sys
sys.path.insert(0, "/mnt/f/dev/git/miRExplore/python/")
import time
from textdb.MiGenRelDB import MiGenRelDB
from textdb.SentenceDB import SentenceDB
from collections import defaultdict
from natsort import natsorted
sentDB, _ = SentenceDB.loadFromFile("./test/", "./development/pmid2sent", returnAll=T... | [
"sys.path.insert",
"textdb.SentenceDB.SentenceDB.loadFromFile",
"collections.Counter",
"textdb.MiGenRelDB.MiGenRelDB.loadFromFile",
"collections.defaultdict",
"natsort.natsorted"
] | [((15, 70), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/mnt/f/dev/git/miRExplore/python/"""'], {}), "(0, '/mnt/f/dev/git/miRExplore/python/')\n", (30, 70), False, 'import os, sys\n'), ((247, 349), 'textdb.SentenceDB.SentenceDB.loadFromFile', 'SentenceDB.loadFromFile', (['"""./test/"""', '"""./development/pmid2s... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.urls import path
from . import views
app_name = 'api'
urlpatterns = [
path('v1/status/', views.status, name='status'),
# organization
path('v1/organization/staff/', views.list_staff_members, name='list_staff_members'),
# Venues
path('v1/... | [
"django.urls.path"
] | [((136, 183), 'django.urls.path', 'path', (['"""v1/status/"""', 'views.status'], {'name': '"""status"""'}), "('v1/status/', views.status, name='status')\n", (140, 183), False, 'from django.urls import path\n'), ((209, 297), 'django.urls.path', 'path', (['"""v1/organization/staff/"""', 'views.list_staff_members'], {'nam... |
# Copyright 2012 Nebula, 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 agree... | [
"nova.tests.api.openstack.fakes.wsgi_app",
"lxml.etree.XML",
"nova.tests.api.openstack.fakes.stub_out_nw_api",
"webob.Request.blank",
"nova.openstack.common.jsonutils.loads"
] | [((1728, 1761), 'nova.tests.api.openstack.fakes.stub_out_nw_api', 'fakes.stub_out_nw_api', (['self.stubs'], {}), '(self.stubs)\n', (1749, 1761), False, 'from nova.tests.api.openstack import fakes\n'), ((2060, 2084), 'webob.Request.blank', 'webob.Request.blank', (['url'], {}), '(url)\n', (2079, 2084), False, 'import web... |
import datetime
import unittest
from collections import Counter
import matplotlib.pyplot as plt
import seaborn as sns
from conflowgen.domain_models.distribution_models.truck_arrival_distribution import TruckArrivalDistribution
from conflowgen.domain_models.distribution_seeders import truck_arrival_distribution_seeder... | [
"datetime.datetime",
"conflowgen.container_flow_data_generation_process.truck_for_export_containers_manager.TruckForExportContainersManager",
"conflowgen.domain_models.distribution_seeders.truck_arrival_distribution_seeder.seed",
"seaborn.kdeplot",
"conflowgen.tests.substitute_peewee_database.setup_sqlite_i... | [((703, 730), 'conflowgen.tests.substitute_peewee_database.setup_sqlite_in_memory_db', 'setup_sqlite_in_memory_db', ([], {}), '()\n', (728, 730), False, 'from conflowgen.tests.substitute_peewee_database import setup_sqlite_in_memory_db\n'), ((821, 861), 'conflowgen.domain_models.distribution_seeders.truck_arrival_distr... |
'''
57-send Email with attachment
using gmail smtp,
You may need to pip install yagmail
'''
import yagmail
# Set up your gmail credentials.
# Any problems could be gmail blocking you
# or wrong password etc. I had to allow unsafe apps
# in my gmail security settings to get
# this to work.
YAG_SMTP = yagmail.... | [
"yagmail.SMTP"
] | [((312, 386), 'yagmail.SMTP', 'yagmail.SMTP', ([], {'user': '"""<EMAIL>"""', 'password': '"""<PASSWORD>"""', 'host': '"""smtp.gmail.com"""'}), "(user='<EMAIL>', password='<PASSWORD>', host='smtp.gmail.com')\n", (324, 386), False, 'import yagmail\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-10-20 12:20
import cms.models.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('links', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='li... | [
"django.db.models.BooleanField"
] | [((621, 699), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'help_text': '"""Open the page in a new window."""'}), "(default=False, help_text='Open the page in a new window.')\n", (640, 699), False, 'from django.db import migrations, models\n')] |
# Import required libraries:
import json
import random
import pickle
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn import svm
from sklearn.tree import DecisionTreeClassifier
from sklearn.naive_bayes import Gau... | [
"sklearn.model_selection.GridSearchCV",
"json.loads",
"pickle.dump",
"random.shuffle",
"sklearn.model_selection.train_test_split",
"sklearn.tree.DecisionTreeClassifier",
"pickle.load",
"sklearn.linear_model.LogisticRegression",
"sklearn.feature_extraction.text.TfidfVectorizer",
"sklearn.naive_baye... | [((2918, 2976), 'sklearn.model_selection.train_test_split', 'train_test_split', (['reviews'], {'test_size': '(0.33)', 'random_state': '(42)'}), '(reviews, test_size=0.33, random_state=42)\n', (2934, 2976), False, 'from sklearn.model_selection import train_test_split, GridSearchCV\n'), ((4432, 4449), 'sklearn.feature_ex... |
import math
import torch
import torch.nn as nn
from onmt.utils.misc import aeq
from onmt.utils.loss import LossComputeBase
def collapse_copy_scores(scores, batch, tgt_vocab, src_vocabs,
batch_dim=1, batch_offset=None):
"""
Given scores from an expanded dictionary
corresponeding t... | [
"torch.mul",
"torch.nn.ConvTranspose1d",
"torch.unsqueeze",
"torch.Tensor",
"onmt.utils.misc.aeq",
"torch.softmax",
"torch.min",
"torch.nn.Linear",
"torch.squeeze",
"torch.div",
"torch.cat",
"torch.where"
] | [((2547, 2581), 'torch.nn.Linear', 'nn.Linear', (['input_size', 'output_size'], {}), '(input_size, output_size)\n', (2556, 2581), True, 'import torch.nn as nn\n'), ((2609, 2633), 'torch.nn.Linear', 'nn.Linear', (['input_size', '(1)'], {}), '(input_size, 1)\n', (2618, 2633), True, 'import torch.nn as nn\n'), ((4213, 424... |
# Copyright (c) 2018, Palo Alto Networks
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS... | [
"json.loads",
"requests.post",
"requests.get"
] | [((2893, 2927), 'requests.get', 'requests.get', (['url'], {'headers': 'headers'}), '(url, headers=headers)\n', (2905, 2927), False, 'import requests\n'), ((3751, 3771), 'json.loads', 'json.loads', (['template'], {}), '(template)\n', (3761, 3771), False, 'import json\n'), ((1731, 1753), 'json.loads', 'json.loads', (['_a... |
import sys
import click
from utilities_common.cli import AbbreviationGroup, pass_db
#
# 'feature' group ('config feature ...')
#
@click.group(cls=AbbreviationGroup, name='feature', invoke_without_command=False)
def feature():
"""Configure features"""
pass
#
# 'state' command ('config feature state ...')
#
@f... | [
"click.group",
"click.Choice",
"click.argument",
"sys.exit"
] | [((132, 217), 'click.group', 'click.group', ([], {'cls': 'AbbreviationGroup', 'name': '"""feature"""', 'invoke_without_command': '(False)'}), "(cls=AbbreviationGroup, name='feature', invoke_without_command=False\n )\n", (143, 217), False, 'import click\n'), ((384, 447), 'click.argument', 'click.argument', (['"""name... |
# Copyright 2011-2012 OpenStack Foundation
# 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... | [
"cinder.tests.unit.scheduler.fakes.FakeHostManager",
"cinder.scheduler.weights.OrderedHostWeightHandler",
"cinder.tests.unit.scheduler.fakes.mock_host_manager_db_calls",
"datetime.datetime.utcnow",
"cinder.context.get_admin_context",
"ddt.data",
"unittest.mock.patch",
"cinder.volume.volume_utils.extra... | [((1558, 1612), 'unittest.mock.patch', 'mock.patch', (['"""cinder.db.sqlalchemy.api.service_get_all"""'], {}), "('cinder.db.sqlalchemy.api.service_get_all')\n", (1568, 1612), False, 'from unittest import mock\n'), ((2494, 2828), 'ddt.data', 'ddt.data', (["{'volume_type': {'extra_specs': {'provisioning:type': 'thin'}}, ... |
# Copyright (c) 2019-2020, NVIDIA CORPORATION.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | [
"cupy.isscalar",
"cupy.issubdtype",
"cupy.arange",
"cupy.take",
"cupy.unique",
"cupy.atleast_1d",
"cupy.where",
"cupy.array",
"cupy.asarray",
"bisect.bisect_left"
] | [((5331, 5341), 'cupy.asarray', 'asarray', (['x'], {}), '(x)\n', (5338, 5341), False, 'from cupy import arange, array, asarray, atleast_1d, intc, integer, isscalar, issubdtype, take, unique, where\n'), ((5785, 5821), 'cupy.where', 'where', (['(axes < 0)', '(axes + x.ndim)', 'axes'], {}), '(axes < 0, axes + x.ndim, axes... |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2014 California Institute of Technology. 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 th... | [
"logging.getLogger",
"isceobj.Catalog.createCatalog",
"isceobj.Util.StringUtils.StringUtils.listify",
"os.path.isfile",
"isceobj.Catalog.recordInputsAndOutputs",
"iscesys.StdOEL.StdOELPy.create_writer",
"os.path.basename",
"isceobj.createDemImage",
"iscesys.ImageUtil.ImageUtil.ImageUtil.copyAttribut... | [((1743, 1788), 'logging.getLogger', 'logging.getLogger', (['"""isce.isceProc.runGeocode"""'], {}), "('isce.isceProc.runGeocode')\n", (1760, 1788), False, 'import logging\n'), ((2410, 2460), 'iscesys.StdOEL.StdOELPy.create_writer', 'create_writer', (['"""log"""', '""""""', '(True)'], {'filename': '"""geo.log"""'}), "('... |
import pandas as pd
# Takes a dataframe, the column to groupby, and a list of columns
# Applies percent change to columns within each group
def apply_pct_change(df: pd.DataFrame, groupby: str,
columns: list) -> pd.DataFrame:
ids = df[groupby].unique()
output_df = pd.DataFrame()
f... | [
"pandas.DataFrame"
] | [((299, 313), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (311, 313), True, 'import pandas as pd\n')] |
import pytest
from pytest_factoryboy import register
from example.factories import BlogFactory, AuthorFactory, AuthorBioFactory, EntryFactory, CommentFactory
register(BlogFactory)
register(AuthorFactory)
register(AuthorBioFactory)
register(EntryFactory)
register(CommentFactory)
@pytest.fixture
def single_entry(blog... | [
"pytest_factoryboy.register"
] | [((160, 181), 'pytest_factoryboy.register', 'register', (['BlogFactory'], {}), '(BlogFactory)\n', (168, 181), False, 'from pytest_factoryboy import register\n'), ((182, 205), 'pytest_factoryboy.register', 'register', (['AuthorFactory'], {}), '(AuthorFactory)\n', (190, 205), False, 'from pytest_factoryboy import registe... |
import platform
import os
import logging.handlers
from lbrynet import build_type, __version__ as lbrynet_version
log = logging.getLogger(__name__)
def get_platform() -> dict:
p = {
"processor": platform.processor(),
"python_version": platform.python_version(),
"platform": platform.platfo... | [
"platform.platform",
"os.environ.get",
"platform.release",
"distro.info",
"platform.system",
"platform.processor",
"platform.python_version"
] | [((210, 230), 'platform.processor', 'platform.processor', ([], {}), '()\n', (228, 230), False, 'import platform\n'), ((258, 283), 'platform.python_version', 'platform.python_version', ([], {}), '()\n', (281, 283), False, 'import platform\n'), ((305, 324), 'platform.platform', 'platform.platform', ([], {}), '()\n', (322... |
import tensorflow as tf
# numpy 是个科学计算的工具包,这里通过Numpy生成模拟数据
from numpy.random import RandomState
# 训练数据batch的大小
batch_size = 8
# 定义神经网络的参数,这里还是沿用3.4.2 小结中给出的神经网络结构
w1 = tf.Variable(tf.random_normal([2, 3], stddev=1, seed=1))
w2 = tf.Variable(tf.random_normal([3, 1], stddev=1, seed=1))
# 在shape的维度上使用None可以方便使用不打的batch... | [
"tensorflow.random_normal",
"tensorflow.Session",
"tensorflow.placeholder",
"tensorflow.global_variables_initializer",
"tensorflow.matmul",
"tensorflow.clip_by_value",
"tensorflow.train.AdamOptimizer",
"numpy.random.RandomState"
] | [((416, 475), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '(None, 2)', 'name': '"""x-input"""'}), "(tf.float32, shape=(None, 2), name='x-input')\n", (430, 475), True, 'import tensorflow as tf\n'), ((481, 540), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '(None, 1)',... |
#!/usr/bin/env python
"""
Copyright (c) 2006-2021 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from lib.core.data import logger
from plugins.generic.enumeration import Enumeration as GenericEnumeration
class Enumeration(GenericEnumeration):
def getBanner(self):
... | [
"lib.core.data.logger.warn"
] | [((391, 411), 'lib.core.data.logger.warn', 'logger.warn', (['warnMsg'], {}), '(warnMsg)\n', (402, 411), False, 'from lib.core.data import logger\n'), ((573, 593), 'lib.core.data.logger.warn', 'logger.warn', (['warnMsg'], {}), '(warnMsg)\n', (584, 593), False, 'from lib.core.data import logger\n'), ((727, 747), 'lib.cor... |
"""Retokenization helpers
This module provides helpers for projecting span annotations from one tokenization to another.
Notes:
* Code is ported from https://github.com/nyu-mll/jiant/blob/master/jiant/utils/retokenize.py
* Please keep this code as a standalone utility; don't make this module depend on jiant m... | [
"numpy.identity",
"numpy.zeros",
"Levenshtein.StringMatcher.StringMatcher",
"nltk.tokenize.util.string_span_tokenize"
] | [((597, 647), 'numpy.zeros', 'np.zeros', (['(n_chars_src, n_chars_tgt)'], {'dtype': '_DTYPE'}), '((n_chars_src, n_chars_tgt), dtype=_DTYPE)\n', (605, 647), True, 'import numpy as np\n'), ((2133, 2168), 'nltk.tokenize.util.string_span_tokenize', 'string_span_tokenize', (['text'], {'sep': 'sep'}), '(text, sep=sep)\n', (2... |
import requests, hashlib
class Ecommerce:
def __init__(
self,
store,
apiKey,
secretCode = '',
collectUrl = 'http://192.168.127.12:8086/api/ecommerce/collect/',
payoutUrl = 'http://192.168.127.12:8086/api/ecommerce/payout/',
depositUrl = 'http://192.168.127.12... | [
"requests.post"
] | [((2461, 2510), 'requests.post', 'requests.post', ([], {'url': 'self.depositUrl', 'params': 'params'}), '(url=self.depositUrl, params=params)\n', (2474, 2510), False, 'import requests, hashlib\n'), ((3834, 3885), 'requests.post', 'requests.post', ([], {'url': 'self.changeKeyUrl', 'params': 'params'}), '(url=self.change... |