code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# REQUIRES: bindings_python
# XFAIL: true
# RUN: %PYTHON% %s | FileCheck %s
import mlir
import circt
from circt.design_entry import Input, Output, module
from circt.esi import types
from circt.dialects import comb, hw
import sys
@module
class PolynomialCompute:
"""Module to compute ax^3 + bx^2 + cx + d for desig... | [
"mlir.passmanager.PassManager.parse",
"circt.dialects.hw.ConstantOp",
"circt.support.BackedgeBuilder",
"circt.design_entry.Output",
"mlir.ir.Type.parse",
"circt.design_entry.Input",
"mlir.ir.Module.create",
"circt.dialects.hw.OutputOp",
"circt.dialects.comb.MulOp",
"mlir.ir.InsertionPoint",
"mli... | [((1749, 1772), 'mlir.ir.Module.create', 'mlir.ir.Module.create', ([], {}), '()\n', (1770, 1772), False, 'import mlir\n'), ((2311, 2388), 'mlir.passmanager.PassManager.parse', 'mlir.passmanager.PassManager.parse', (['"""hw-legalize-names,hw.module(hw-cleanup)"""'], {}), "('hw-legalize-names,hw.module(hw-cleanup)')\n", ... |
# Copyright (c) The PyAMF Project.
# See LICENSE.txt for details.
"""
Remoting gateway for Google App Engine.
@since: 0.3.0
"""
from pyamf.remoting.gateway.wsgi import WSGIGateway
from google.appengine.ext.webapp import util
from echo import echo
services = {
'echo': echo,
'echo.echo': echo
}
def main():
... | [
"google.appengine.ext.webapp.util.run_wsgi_app",
"pyamf.remoting.gateway.wsgi.WSGIGateway"
] | [((334, 355), 'pyamf.remoting.gateway.wsgi.WSGIGateway', 'WSGIGateway', (['services'], {}), '(services)\n', (345, 355), False, 'from pyamf.remoting.gateway.wsgi import WSGIGateway\n'), ((361, 387), 'google.appengine.ext.webapp.util.run_wsgi_app', 'util.run_wsgi_app', (['gateway'], {}), '(gateway)\n', (378, 387), False,... |
"""
Module to allow Plotly graphs to interact with IPython widgets.
"""
import uuid
from collections import deque
from pkg_resources import resource_string
from requests.compat import json as _json
# TODO: protected imports?
from IPython.html import widgets
from IPython.utils.traitlets import Unicode
from IPython.di... | [
"IPython.display.Javascript",
"collections.deque",
"IPython.html.widgets.CallbackDispatcher",
"plotly.tools.return_figure_from_figure_or_data",
"uuid.uuid4",
"pkg_resources.resource_string",
"plotly.plotly.plotly.plot",
"plotly.graph_objs.Figure",
"requests.compat.json.dumps",
"IPython.utils.trait... | [((741, 767), 'IPython.display.Javascript', 'Javascript', (['js_widget_code'], {}), '(js_widget_code)\n', (751, 767), False, 'from IPython.display import Javascript, display\n'), ((926, 957), 'IPython.utils.traitlets.Unicode', 'Unicode', (['"""GraphView"""'], {'sync': '(True)'}), "('GraphView', sync=True)\n", (933, 957... |
#!/usr/bin/env python
from sense2vec import Sense2Vec
from sense2vec.util import split_key
from pathlib import Path
import plac
from wasabi import msg
import numpy
def _get_shape(file_):
"""Return a tuple with (number of entries, vector dimensions). Handle
both word2vec/FastText format, which has a header wit... | [
"plac.annotations",
"pathlib.Path",
"wasabi.msg.good",
"numpy.asarray",
"plac.call",
"sense2vec.util.split_key",
"wasabi.msg.fail"
] | [((639, 848), 'plac.annotations', 'plac.annotations', ([], {'in_file': "('Vectors file (text-based)', 'positional', None, str)", 'vocab_file': "('Vocabulary file', 'positional', None, str)", 'out_dir': "('Path to output directory', 'positional', None, str)"}), "(in_file=('Vectors file (text-based)', 'positional', None,... |
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 0.9.3 on Wed Sep 11 13:49:50 2019
#
import wx
# begin wxGlade: dependencies
# end wxGlade
# begin wxGlade: extracode
# end wxGlade
class MyDialog(wx.Dialog):
def __init__(self, *args, **kwds):
# begin wxGlade: MyDialog.__init__
kwds["style"] = kw... | [
"wx.Dialog.__init__",
"wx.BoxSizer",
"wx.StaticText",
"wx.Choice",
"wx.TextCtrl"
] | [((392, 431), 'wx.Dialog.__init__', 'wx.Dialog.__init__', (['self', '*args'], {}), '(self, *args, **kwds)\n', (410, 431), False, 'import wx\n'), ((465, 957), 'wx.StaticText', 'wx.StaticText', (['self', 'wx.ID_ANY', '"""Instructions\n\nSelect the experiment dimension (by Loop name) that contains the Off/On states \nof t... |
"""
<NAME> - November 2020
This program creates stellar mass-selected group catalogs for ECO/RESOLVE-G3 using the new algorithm, described in the readme markdown.
The outline of this code is:
(1) Read in observational data from RESOLVE-B and ECO (the latter includes RESOLVE-A).
(2) Prepare arrays of input parameters... | [
"numpy.log10",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"scipy.interpolate.interp1d",
"numpy.argsort",
"numpy.array",
"numpy.percentile",
"matplotlib.pyplot.errorbar",
"foftools.fast_fof",
"numpy.arange",
"virtools.group_color_gap",
"numpy.where",
"matplotlib.pyplot.xlabel",
"matplot... | [((2094, 2120), 'numpy.percentile', 'np.percentile', (['x', '[84, 16]'], {}), '(x, [84, 16])\n', (2107, 2120), True, 'import numpy as np\n'), ((2298, 2331), 'pandas.read_csv', 'pd.read_csv', (['"""ECOdata_022521.csv"""'], {}), "('ECOdata_022521.csv')\n", (2309, 2331), True, 'import pandas as pd\n'), ((2350, 2387), 'pan... |
#!/usr/bin/python3
import cv2
# capture camera start
cap=cv2.VideoCapture(0)
while cap.isOpened():
status,frame=cap.read()
#converting to HSV
hsvimg=cv2.cvtColor(frame,cv2.COLOR_BGR2HSV)
# MASKING IMAGE for green color
imgmask=cv2.inRange(hsvimg,(40,50,50),(80,255,255))
# for blue color
... | [
"cv2.inRange",
"cv2.bitwise_and",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.waitKey"
] | [((59, 78), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (75, 78), False, 'import cv2\n'), ((590, 613), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (611, 613), False, 'import cv2\n'), ((164, 202), 'cv2.cvtColor', 'cv2.cvtColor', (['frame', 'cv2.COLOR_BGR2HSV'], {}), '(frame, c... |
from types import MappingProxyType
from typing import Any, Union, Mapping, Callable, Optional, Sequence
from scanpy import logging as logg
from dask import delayed
from scipy.ndimage.filters import gaussian_filter as scipy_gf
import numpy as np
import dask.array as da
from skimage.color import rgb2gray
from skimage.... | [
"skimage.color.rgb2gray",
"dask.delayed",
"squidpy._constants._constants.Processing",
"types.MappingProxyType",
"squidpy._constants._pkg_constants.Key.img.process",
"dask.array.asarray",
"numpy.array",
"scanpy.logging.info",
"squidpy._docs.inject_docs"
] | [((1101, 1126), 'squidpy._docs.inject_docs', 'inject_docs', ([], {'p': 'Processing'}), '(p=Processing)\n', (1112, 1126), False, 'from squidpy._docs import d, inject_docs\n'), ((1074, 1087), 'skimage.color.rgb2gray', 'rgb2gray', (['img'], {}), '(img)\n', (1082, 1087), False, 'from skimage.color import rgb2gray\n'), ((15... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created 2022
@author: <NAME>
"""
from Levenshtein import distance as levenshtein_distance
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
print('Now Executing Trastuzumab Train/Val/Test Splitting...')
"""
This script serv... | [
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"Levenshtein.distance",
"numpy.random.seed",
"pandas.DataFrame",
"pandas.concat",
"numpy.round",
"numpy.random.permutation"
] | [((2388, 2438), 'pandas.read_csv', 'pd.read_csv', (["(her2_path_local + 'mHER_H3_AgPos.csv')"], {}), "(her2_path_local + 'mHER_H3_AgPos.csv')\n", (2399, 2438), True, 'import pandas as pd\n'), ((2445, 2495), 'pandas.read_csv', 'pd.read_csv', (["(her2_path_local + 'mHER_H3_AgNeg.csv')"], {}), "(her2_path_local + 'mHER_H3... |
import os
import numpy as np
from nipype.interfaces.base import CommandLine, CommandLineInputSpec #, Info
from nipype.interfaces.base import (TraitedSpec, File, traits, InputMultiPath,isdefined)
class MathsOutput(TraitedSpec):
out_file = File( desc="image to write after calculations")
class MathsInput(Command... | [
"nipype.interfaces.base.isdefined",
"nipype.interfaces.base.traits.Str",
"nipype.interfaces.base.traits.Float",
"nipype.interfaces.base.traits.Bool",
"nipype.interfaces.base.traits.Enum",
"nipype.interfaces.base.File"
] | [((246, 292), 'nipype.interfaces.base.File', 'File', ([], {'desc': '"""image to write after calculations"""'}), "(desc='image to write after calculations')\n", (250, 292), False, 'from nipype.interfaces.base import TraitedSpec, File, traits, InputMultiPath, isdefined\n'), ((351, 442), 'nipype.interfaces.base.File', 'Fi... |
from collections import defaultdict
from xml.etree import ElementTree as Et
class Projects(object):
def __init__(self, source):
self.tree = Et.fromstring(source)
self.pipelines = {}
self.stages = defaultdict(list)
self.jobs = defaultdict(list)
self.parse()
def parse(se... | [
"xml.etree.ElementTree.fromstring",
"collections.defaultdict"
] | [((154, 175), 'xml.etree.ElementTree.fromstring', 'Et.fromstring', (['source'], {}), '(source)\n', (167, 175), True, 'from xml.etree import ElementTree as Et\n'), ((226, 243), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (237, 243), False, 'from collections import defaultdict\n'), ((264, 281), ... |
#!/usr/bin/env python
#
# Copyright 2011 <NAME>
#
# 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 applicabl... | [
"omegacn7500.OmegaCN7500",
"omegacn7500._calculateRegisterAddress",
"omegacn7500._checkStepNumber",
"omegacn7500._checkSetpointValue",
"omegacn7500._checkPatternNumber",
"omegacn7500._checkTimeValue",
"unittest.main",
"sys.stdout.write"
] | [((26253, 26289), 'sys.stdout.write', 'sys.stdout.write', (["(inputstring + '\\n')"], {}), "(inputstring + '\\n')\n", (26269, 26289), False, 'import sys\n'), ((26333, 26348), 'unittest.main', 'unittest.main', ([], {}), '()\n', (26346, 26348), False, 'import unittest\n'), ((3521, 3555), 'omegacn7500._checkPatternNumber'... |
import os
import logging
from zope.dottedname.resolve import resolve
from pkg_resources import resource_exists
from pkg_resources import get_provider
from pkg_resources import get_distribution
from z3c.autoinclude.utils import DistributionManager
from z3c.autoinclude.utils import ZCMLInfo
class DependencyFinder(Distri... | [
"z3c.autoinclude.utils.ZCMLInfo",
"pkg_resources.get_provider",
"logging.getLogger",
"zope.dottedname.resolve.resolve",
"os.path.isfile",
"os.path.dirname",
"pkg_resources.get_distribution"
] | [((1902, 1932), 'pkg_resources.get_distribution', 'get_distribution', (['project_name'], {}), '(project_name)\n', (1918, 1932), False, 'from pkg_resources import get_distribution\n'), ((727, 753), 'z3c.autoinclude.utils.ZCMLInfo', 'ZCMLInfo', (['zcml_to_look_for'], {}), '(zcml_to_look_for)\n', (735, 753), False, 'from ... |
"""
train neural network to detect whether plant flowers or not
"""
import warnings
warnings.filterwarnings('ignore',category=FutureWarning)
from glob import glob
import numpy as np
import pickle
import deepplantphenomics as dpp
from pathlib import Path
import os
import sys
def train(train_dir, label_fn, model_dir, ep... | [
"warnings.filterwarnings",
"pathlib.Path"
] | [((84, 141), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'FutureWarning'}), "('ignore', category=FutureWarning)\n", (107, 141), False, 'import warnings\n'), ((790, 805), 'pathlib.Path', 'Path', (['model_dir'], {}), '(model_dir)\n', (794, 805), False, 'from pathlib import Path\n... |
import click
from globus_cli.login_manager import LoginManager
from globus_cli.parsing import IdentityType, ParsedIdentity, command
from globus_cli.termio import FORMAT_TEXT_RECORD, formatted_print
from globus_cli.types import FIELD_LIST_T
APPROVED_USER_FIELDS: FIELD_LIST_T = [
("Group ID", "group_id"),
("App... | [
"click.UsageError",
"globus_cli.parsing.IdentityType",
"click.argument",
"globus_cli.parsing.command",
"globus_cli.termio.formatted_print",
"globus_cli.login_manager.LoginManager.requires_login"
] | [((401, 466), 'globus_cli.parsing.command', 'command', (['"""approve"""'], {'short_help': '"""Approve a member to join a group"""'}), "('approve', short_help='Approve a member to join a group')\n", (408, 466), False, 'from globus_cli.parsing import IdentityType, ParsedIdentity, command\n'), ((468, 511), 'click.argument... |
from __future__ import division
import fa
import sys
import os
from fa import chunker
if __name__ == "__main__":
from sys import stderr
import argparse
parser = argparse.ArgumentParser(description=(
"Create a set of synthetic genomes consisting "
"of subgroups per tax level. Some kmers are ... | [
"argparse.ArgumentParser",
"fa.gen_seq",
"fa.write_nameid_map",
"fa.chunker",
"fa.write_parent_map",
"sys.stderr.write",
"os.path.isfile",
"os.path.isdir",
"os.mkdir"
] | [((174, 426), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Create a set of synthetic genomes consisting of subgroups per tax level. Some kmers are unique, some are shared, and this provides a case where we can test the efficacy and behavior of our bitmap method."""'}), "(description=\n... |
import json
import os
import re
from yandeley.models.annotations import Annotation
from yandeley.response import SessionResponseObject
class File(SessionResponseObject):
"""
A file attached to a document.
.. attribute:: id
.. attribute:: size
.. attribute:: file_name
.. attribute:: mime_type... | [
"json.dumps",
"os.path.join",
"re.compile"
] | [((468, 499), 're.compile', 're.compile', (['"""filename="(\\\\S+)\\""""'], {}), '(\'filename="(\\\\S+)"\')\n', (478, 499), False, 'import re\n'), ((1852, 1885), 'os.path.join', 'os.path.join', (['directory', 'filename'], {}), '(directory, filename)\n', (1864, 1885), False, 'import os\n'), ((3087, 3109), 'json.dumps', ... |
# Copyright (c) 2020 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the BSD 3-Clause License.
import garnett
import hoomd
import hoomd.hpmc
# Vertices of a cube
cube_verts = [[-1, -1, -1], [-1, -1, 1], [-1, 1, 1], [-1, 1, -1],
[1, -1, -1], [1, -1, 1], ... | [
"hoomd.context.SimulationContext",
"hoomd.init.read_snapshot",
"hoomd.data.make_snapshot",
"hoomd.hpmc.integrate.convex_polyhedron",
"hoomd.run",
"hoomd.group.all",
"hoomd.data.boxdim",
"garnett.read"
] | [((349, 382), 'hoomd.context.SimulationContext', 'hoomd.context.SimulationContext', ([], {}), '()\n', (380, 382), False, 'import hoomd\n'), ((394, 431), 'hoomd.data.boxdim', 'hoomd.data.boxdim', ([], {'L': '(10)', 'dimensions': '(3)'}), '(L=10, dimensions=3)\n', (411, 431), False, 'import hoomd\n'), ((447, 485), 'hoomd... |
"""
Load volumes into vpv from a toml config file. Just load volumes and no overlays
Examples
--------
Example toml file
orientation = 'sagittal'
[top]
specimens = [
'path1.nrrd',
'path2.nrrd',
'path3.nrrd']
[bottom]
specimens = [
'path1.nrrd',
'path2.nrrd',
'path3.nrrd']
"""
import sys
from pathlib import Path
... | [
"vpv.vpv.Vpv",
"PyQt5.QtGui.QApplication",
"toml.load",
"pathlib.Path"
] | [((780, 802), 'PyQt5.QtGui.QApplication', 'QtGui.QApplication', (['[]'], {}), '([])\n', (798, 802), False, 'from PyQt5 import QtGui\n'), ((812, 817), 'vpv.vpv.Vpv', 'Vpv', ([], {}), '()\n', (815, 817), False, 'from vpv.vpv import Vpv\n'), ((1745, 1761), 'toml.load', 'toml.load', (['file_'], {}), '(file_)\n', (1754, 176... |
# coding: utf-8
__author__ = "<NAME>"
import dash_bootstrap_components as dbc
from dash import dcc, no_update
from dash_extensions.enrich import Dash, Output, Input, State, html
import flask
from flask import jsonify
from flask_cors import CORS
from dash import dash_table
import dash_ace
server = flask.Flask(__name__)... | [
"dash_extensions.enrich.Input",
"flask_cors.CORS",
"flask.Flask",
"logging.exception",
"flask.jsonify",
"dash_extensions.enrich.html.Div",
"dash_bootstrap_components.CardImg",
"sqlalchemy.create_engine",
"dash_extensions.enrich.html.P",
"dash_extensions.enrich.Output",
"dash_ace.DashAceEditor",
... | [((299, 320), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (310, 320), False, 'import flask\n'), ((321, 333), 'flask_cors.CORS', 'CORS', (['server'], {}), '(server)\n', (325, 333), False, 'from flask_cors import CORS\n'), ((2756, 2806), 'sqlalchemy.create_engine', 'create_engine', (['"""postgresql:... |
import os, sys
CHOICES = 'ignore', 'fail', 'warn', 'warn_once'
DEFAULT = 'warn_once'
ACTION = None
HELP = """
Specify what to do when a project uses deprecated features:
ignore: do nothing
warn: print warning messages for each feature
warn_once: print a warning message, but only once for each type of feature
... | [
"os.getenv",
"sys.argv.pop"
] | [((1531, 1581), 'os.getenv', 'os.getenv', (['ENVIRONMENT_VARIABLE', '(ACTION or DEFAULT)'], {}), '(ENVIRONMENT_VARIABLE, ACTION or DEFAULT)\n', (1540, 1581), False, 'import os, sys\n'), ((1607, 1625), 'sys.argv.pop', 'sys.argv.pop', (['d[0]'], {}), '(d[0])\n', (1619, 1625), False, 'import os, sys\n')] |
#!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2007-2008 Trolltech ASA. All rights reserved.
##
## This file is part of the example classes of the Qt Toolkit.
##
## Licensees holding a valid Qt License Agreement may use this file in
## accordance... | [
"PySide.phonon.Phonon.Effect",
"PySide.QtGui.QGridLayout",
"PySide.QtGui.QApplication",
"PySide.QtGui.QListWidget",
"PySide.QtGui.QLabel",
"PySide.QtGui.QTreeWidget",
"PySide.QtGui.QListWidgetItem",
"PySide.QtGui.QVBoxLayout",
"PySide.phonon.Phonon.BackendCapabilities.availableMimeTypes",
"PySide.... | [((4873, 4901), 'PySide.QtGui.QApplication', 'QtGui.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (4891, 4901), False, 'from PySide import QtCore, QtGui\n'), ((1028, 1056), 'PySide.QtGui.QApplication', 'QtGui.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (1046, 1056), False, 'from PySide import QtCore, QtGui\... |
from nepc import nepc
from nepc.util import util
import pandas as pd
import os
import pytest
import platform
# TODO: remove dependence on csv; put function in scraper that uses built-in
# readlines function
import csv
# TODO: test that all values in [nepc]/tests/data are in the nepc database
@pytest.mark.usefix... | [
"nepc.nepc.cs_e_sigma",
"pytest.approx",
"os.listdir",
"platform.node",
"nepc.nepc.count_table_rows",
"pandas.read_csv",
"nepc.nepc.table_as_df",
"os.fsencode",
"nepc.nepc.cs_metadata",
"pytest.mark.usefixtures",
"os.fsdecode",
"csv.reader",
"nepc.util.util.wc_fxn"
] | [((302, 356), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""data_config"""', '"""nepc_connect"""'], {}), "('data_config', 'nepc_connect')\n", (325, 356), False, 'import pytest\n'), ((756, 810), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""data_config"""', '"""nepc_connect"""'], {}), "('data... |
# Create your views here.
from django.contrib.auth import get_user_model
from django.db import transaction
from rest_framework import status
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from django.utils.translation import ... | [
"openbook_follows.serializers.FollowSerializer",
"openbook_follows.serializers.ReceivedFollowRequestsRequestSerializer",
"django.contrib.auth.get_user_model",
"openbook_follows.serializers.FollowUserSerializer",
"openbook_follows.serializers.DeleteFollowSerializer",
"django.db.transaction.atomic",
"djan... | [((7146, 7182), 'openbook_common.utils.helpers.normalise_request_data', 'normalise_request_data', (['request_data'], {}), '(request_data)\n', (7168, 7182), False, 'from openbook_common.utils.helpers import normalise_request_data\n'), ((1126, 1184), 'openbook_follows.serializers.ReceivedFollowRequestsRequestSerializer',... |
from .fis import FIS
import numpy as np
try:
import pandas as pd
except ImportError:
pd = None
try:
from sklearn.model_selection import GridSearchCV
except ImportError:
GridSearchCV = None
def _get_vars(fis):
"""Get an encoded version of the parameters of the fuzzy sets in a FIS"""
for vari... | [
"numpy.asarray"
] | [((3461, 3486), 'numpy.asarray', 'np.asarray', (['[]'], {'dtype': 'int'}), '([], dtype=int)\n', (3471, 3486), True, 'import numpy as np\n')] |
import os
import lcd
from Maix import GPIO
from board import board_info
from fpioa_manager import fm
# import uos
S_IFDIR = 0o040000 # directory
# noinspection PyPep8Naming
def S_IFMT(mode):
"""Return the portion of the file's mode that describes the
file type.
"""
return mode & 0o170000
# noin... | [
"os.listdir",
"fpioa_manager.fm.register",
"lcd.rotation",
"lcd.height",
"lcd.width",
"Maix.GPIO",
"lcd.draw_string",
"os.stat",
"lcd.clear",
"lcd.init"
] | [((2871, 2881), 'lcd.init', 'lcd.init', ([], {}), '()\n', (2879, 2881), False, 'import lcd\n'), ((2882, 2897), 'lcd.rotation', 'lcd.rotation', (['(2)'], {}), '(2)\n', (2894, 2897), False, 'import lcd\n'), ((3154, 3205), 'fpioa_manager.fm.register', 'fm.register', (['board_info.BUTTON_A', 'fm.fpioa.GPIOHS21'], {}), '(bo... |
# -*- coding: utf-8 -*-
"""
This Python module provides various service functions.
Updated since version 1.1:
1. Added support for postprocess and visualization.
2. Added file path validation for parameters of all related methods.
Updated since version 1.2: Merge Code and Update GUI
1. Integrate ... | [
"logging.getLogger",
"openwarp.helper.check_not_none_nor_empty",
"multiprocessing.Process",
"openwarp.helper.log_exception",
"openwarp.helper.check_is_directory",
"subprocess.Popen",
"nemoh.utility.write_postprocessing_section",
"fnmatch.fnmatch",
"subprocess.call",
"openwarp.helper.check_is_file"... | [((1050, 1165), 'collections.namedtuple', 'collections.namedtuple', (['"""MeshingParameters"""', '"""infile outfile maxh minh fineness grading usetolerance tolerance"""'], {}), "('MeshingParameters',\n 'infile outfile maxh minh fineness grading usetolerance tolerance')\n", (1072, 1165), False, 'import collections\n'... |
from core.advbase import *
def module():
return Gala_Ranzal
class Gala_Ranzal(Adv):
conf = {}
conf['slots.a'] = [
'The_Shining_Overlord',
'Flash_of_Genius',
'Moonlight_Party',
'The_Plaguebringer',
'Dueling_Dancers'
]
conf['slots.d'] = 'Vayu'
conf['acl'] = '''
`drago... | [
"core.simulate.test_with_argv"
] | [((2034, 2065), 'core.simulate.test_with_argv', 'test_with_argv', (['None', '*sys.argv'], {}), '(None, *sys.argv)\n', (2048, 2065), False, 'from core.simulate import test_with_argv\n')] |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class QiubaiItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
_id = scrapy.Field()
avatar = scrapy... | [
"scrapy.Field"
] | [((286, 300), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (298, 300), False, 'import scrapy\n'), ((314, 328), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (326, 328), False, 'import scrapy\n'), ((348, 362), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (360, 362), False, 'import scrapy\n'), ((374, 388), ... |
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
from libcloud.compute.base import NodeImage
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class AwsAdapter:
def _validate(self,config):
"""
Validate Config di... | [
"logging.basicConfig",
"libcloud.compute.providers.get_driver",
"logging.getLogger"
] | [((153, 192), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (172, 192), False, 'import logging\n'), ((202, 229), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (219, 229), False, 'import logging\n'), ((1117, 1141), 'libcloud.compu... |
import urllib.parse
import uuid
from django.contrib.auth.models import User
from django.test import Client, TestCase
from django.urls import reverse
from dcim.models import Site
from extras.choices import ObjectChangeActionChoices
from extras.models import ConfigContext, ObjectChange, Tag
from utilities.testing impor... | [
"dcim.models.Site",
"utilities.testing.create_test_user",
"extras.models.ConfigContext.objects.first",
"uuid.uuid4",
"extras.models.ObjectChange.objects.first",
"django.urls.reverse",
"django.contrib.auth.models.User.objects.first",
"extras.models.Tag",
"django.test.Client"
] | [((407, 456), 'utilities.testing.create_test_user', 'create_test_user', ([], {'permissions': "['extras.view_tag']"}), "(permissions=['extras.view_tag'])\n", (423, 456), False, 'from utilities.testing import create_test_user\n'), ((479, 487), 'django.test.Client', 'Client', ([], {}), '()\n', (485, 487), False, 'from dja... |
# -*- coding: utf-8 -*-
"""
Single VsOne Chip Match Interface
For VsMany Interaction
Interaction for looking at matches between a single query and database annotation
Main development file
CommandLine:
python -m ibeis.viz.interact.interact_matches --test-show_coverage --show
"""
from __future__ import absolute_i... | [
"utool.get_stats_str",
"utool.embed",
"plottool.gca",
"utool.doctest_funcs",
"multiprocessing.freeze_support",
"ibeis.algo.hots.scoring.get_kpts_distinctiveness",
"ibeis.algo.hots.scoring.get_masks",
"plottool.gcf",
"plottool.interact_helpers.connect_callback",
"plottool.plot_helpers.get_plotdat_d... | [((800, 842), 'utool.inject2', 'ut.inject2', (['__name__', '"""[interact_matches]"""'], {}), "(__name__, '[interact_matches]')\n", (810, 842), True, 'import utool as ut\n'), ((1699, 1739), 'six.add_metaclass', 'six.add_metaclass', (['ut.ReloadingMetaclass'], {}), '(ut.ReloadingMetaclass)\n', (1716, 1739), False, 'impor... |
import argparse
import os
import shutil
from datetime import datetime
from glob import glob
import gym
import sinergym
envs_id = [env_spec.id for env_spec in gym.envs.registry.all()
if env_spec.id.startswith('Eplus')]
parser = argparse.ArgumentParser()
parser.add_argument('--environments', '-envs', defau... | [
"argparse.ArgumentParser",
"gym.envs.registry.all",
"datetime.datetime.now",
"shutil.rmtree",
"gym.make",
"glob.glob",
"os.remove"
] | [((242, 267), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (265, 267), False, 'import argparse\n'), ((1482, 1506), 'glob.glob', 'glob', (['"""Eplus-env-TEST*/"""'], {}), "('Eplus-env-TEST*/')\n", (1486, 1506), False, 'from glob import glob\n'), ((1636, 1678), 'glob.glob', 'glob', (['"""sinerg... |
"""
Abstract base classes used to represent queries
LookupProtocol(Protocol): duck-typing of lookups. They must have
- an attribute name : str (UNIQUE)
- a method query(self) -> Optional[BibtexEntry]
- a method __init__(self, entry: Entry)
- a method get_last_query_info(self) -> Dict[str, JSONType]
wit... | [
"typing.TypeVar"
] | [((930, 962), 'typing.TypeVar', 'TypeVar', (['"""Input"""'], {'covariant': '(True)'}), "('Input', covariant=True)\n", (937, 962), False, 'from typing import ClassVar, Dict, Generic, NamedTuple, Optional, Protocol, Type, TypeVar\n'), ((972, 1005), 'typing.TypeVar', 'TypeVar', (['"""Output"""'], {'covariant': '(True)'}),... |
from text_classification import generate_model, model_validation
from modify_dataset import modify_dataset_and_raw_data_with_percentage_size_to_keep
from modify_dataset import modify_dataset_select_features
from sklearn.svm import SVC
from sklearn.tree import DecisionTreeClassifier
from sklearn.naive_bayes import Comp... | [
"csv.DictReader",
"sklearn.ensemble.AdaBoostClassifier",
"sklearn.neighbors.KNeighborsClassifier",
"time.sleep",
"click.progressbar",
"sklearn.naive_bayes.ComplementNB",
"modify_dataset.modify_dataset_and_raw_data_with_percentage_size_to_keep",
"sklearn.tree.DecisionTreeClassifier",
"modify_dataset.... | [((1118, 1130), 'text_preprocessing._load_data', '_load_data', ([], {}), '()\n', (1128, 1130), False, 'from text_preprocessing import _load_data\n'), ((1151, 1190), 'joblib.load', 'load', (['"""output/preprocessed_data.joblib"""'], {}), "('output/preprocessed_data.joblib')\n", (1155, 1190), False, 'from joblib import l... |
import os
import markdown
from markdown.extensions import Extension
from mako.lookup import TemplateLookup
from mfr.core import extension
class EscapeHtml(Extension):
def extendMarkdown(self, md, md_globals):
del md.preprocessors['html_block']
del md.inlinePatterns['html']
class MdRenderer(ex... | [
"os.path.dirname"
] | [((422, 447), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (437, 447), False, 'import os\n')] |
import array
import pytest
from pdsa.frequency.count_sketch import CountSketch
def test_init():
cs = CountSketch(2, 4)
assert cs.sizeof() == 32, 'Unexpected size in bytes'
with pytest.raises(ValueError) as excinfo:
cs = CountSketch(0, 5)
assert str(excinfo.value) == 'At least one counter arr... | [
"pdsa.frequency.count_sketch.CountSketch",
"pytest.raises",
"array.array",
"pdsa.frequency.count_sketch.CountSketch.create_from_expected_error"
] | [((108, 125), 'pdsa.frequency.count_sketch.CountSketch', 'CountSketch', (['(2)', '(4)'], {}), '(2, 4)\n', (119, 125), False, 'from pdsa.frequency.count_sketch import CountSketch\n'), ((548, 565), 'pdsa.frequency.count_sketch.CountSketch', 'CountSketch', (['(2)', '(4)'], {}), '(2, 4)\n', (559, 565), False, 'from pdsa.fr... |
from shapely.geometry import Point, Polygon
class DataAggregator:
def __init__(self, area_config):
self.id = area_config["id"]
boundary = []
for coordinate in area_config["boundary"]["coordinates"]:
boundary.append(coordinate)
self.polygon = Polygon(boundary)
def l... | [
"shapely.geometry.Polygon",
"shapely.geometry.Point"
] | [((292, 309), 'shapely.geometry.Polygon', 'Polygon', (['boundary'], {}), '(boundary)\n', (299, 309), False, 'from shapely.geometry import Point, Polygon\n'), ((352, 377), 'shapely.geometry.Point', 'Point', (['point[0]', 'point[1]'], {}), '(point[0], point[1])\n', (357, 377), False, 'from shapely.geometry import Point, ... |
#!/usr/bin/env python
# Modules
from pygnmi.client import gNMIclient
# Variables
from inventory import hosts
# Body
if __name__ == "__main__":
paths = ['openconfig-interfaces:interfaces', 'openconfig-network-instance:network-instances']
for host in hosts:
with gNMIclient(target=(host["ip_address"], ... | [
"pygnmi.client.gNMIclient"
] | [((281, 408), 'pygnmi.client.gNMIclient', 'gNMIclient', ([], {'target': "(host['ip_address'], host['port'])", 'username': "host['username']", 'password': "host['password']", 'insecure': '(True)'}), "(target=(host['ip_address'], host['port']), username=host[\n 'username'], password=host['password'], insecure=True)\n"... |
""""""
import os
import re
import sys
import readline
try: # pragma: no cover
from urllib import urlretrieve # NOQA
except ImportError: # pragma: no cover
# PY3K
from urllib.request import urlretrieve # NOQA
import tempfile
from zipfile import ZipFile, is_zipfile
readline # make pyflakes happy, readli... | [
"os.path.exists",
"sys.exit",
"importlib.import_module",
"zipfile.ZipFile",
"re.compile",
"urllib.request.urlretrieve",
"os.makedirs",
"os.path.join",
"os.path.realpath",
"os.path.dirname",
"os.path.isdir",
"tempfile.mkdtemp",
"os.path.commonprefix",
"tempfile.NamedTemporaryFile",
"six.u... | [((697, 736), 're.compile', 're.compile', (['"""^[a-zA-Z_.]+:[a-zA-Z_.]+$"""'], {}), "('^[a-zA-Z_.]+:[a-zA-Z_.]+$')\n", (707, 736), False, 'import re\n'), ((832, 858), 'importlib.import_module', 'import_module', (['module_name'], {}), '(module_name)\n', (845, 858), False, 'from importlib import import_module\n'), ((101... |
# Copyright (c) 2013 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 to in writ... | [
"zaqar.i18n._",
"zaqar.common.decorators.lazy_property",
"zaqar.storage.mongodb.controllers.MessageController",
"zaqar.storage.mongodb.controllers.ClaimController",
"zaqar.storage.mongodb.controllers.FlavorsController",
"zaqar.storage.mongodb.controllers.SubscriptionController",
"osprofiler.profiler.tra... | [((2106, 2131), 'zaqar.storage.mongodb.options._config_options', 'options._config_options', ([], {}), '()\n', (2129, 2131), False, 'from zaqar.storage.mongodb import options\n'), ((5270, 5307), 'zaqar.common.decorators.lazy_property', 'decorators.lazy_property', ([], {'write': '(False)'}), '(write=False)\n', (5294, 530... |
from datasets.models import CityHallBid, CityHallBidEvent
from django.utils.timezone import make_aware
def save_bid(item):
file_url = item["file_urls"][0] if item.get("file_urls") else None
bid, _ = CityHallBid.objects.update_or_create(
session_at=item["session_at"],
public_agency=item["public... | [
"django.utils.timezone.make_aware"
] | [((455, 485), 'django.utils.timezone.make_aware', 'make_aware', (["item['crawled_at']"], {}), "(item['crawled_at'])\n", (465, 485), False, 'from django.utils.timezone import make_aware\n'), ((991, 1021), 'django.utils.timezone.make_aware', 'make_aware', (["item['crawled_at']"], {}), "(item['crawled_at'])\n", (1001, 102... |
import logging
import tkinter as tk
import traceback
from thonny import get_workbench
from thonny import jedi_utils
tree = None
class BaseNameHighlighter:
def __init__(self, text):
self.text = text
self._update_scheduled = False
def get_positions_for(self, source, line, column):
rai... | [
"thonny.jedi_utils.get_version_tuple",
"thonny.jedi_utils.get_parent_scope",
"thonny.get_workbench",
"jedi.Script",
"thonny.jedi_utils.get_statement_of_position",
"logging.warning",
"thonny.jedi_utils.import_python_tree",
"logging.exception",
"thonny.jedi_utils.parse_source",
"thonny.jedi_utils.ge... | [((12918, 12933), 'thonny.get_workbench', 'get_workbench', ([], {}), '()\n', (12931, 12933), False, 'from thonny import get_workbench\n'), ((2356, 2388), 'thonny.jedi_utils.get_params', 'jedi_utils.get_params', (['func_node'], {}), '(func_node)\n', (2377, 2388), False, 'from thonny import jedi_utils\n'), ((10038, 10069... |
"""Example systems created in Python
"""
import numpy as np
from pysim.cythonsystem import Sys
class VanDerPol(Sys):
"""Simple example of a class representing a VanDerPol oscillator.
"""
def __init__(self):
self.add_state_scalar("x", "dx")
self.add_state_scalar("y", "dy")
self.add_... | [
"numpy.zeros",
"numpy.ones"
] | [((2545, 2561), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (2553, 2561), True, 'import numpy as np\n'), ((2711, 2727), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (2719, 2727), True, 'import numpy as np\n'), ((2876, 2892), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (2884, ... |
from mycv.utils.general import disable_multithreads
disable_multithreads()
import os
from pathlib import Path
import argparse
from tqdm import tqdm
import math
import torch
import torch.cuda.amp as amp
from torch.optim.lr_scheduler import LambdaLR
from torch.nn.parallel import DistributedDataParallel as DDP
import wand... | [
"torch.optim.lr_scheduler.LambdaLR",
"torch.nn.CrossEntropyLoss",
"torch.max",
"torch.cuda.device_count",
"wandb.init",
"math.cos",
"torch.utils.data.distributed.DistributedSampler",
"torch.cuda.is_available",
"mycv.models.yolov5.cls.YOLOv5Cls",
"torch.distributed.is_available",
"torch.cuda.amp.... | [((52, 74), 'mycv.utils.general.disable_multithreads', 'disable_multithreads', ([], {}), '()\n', (72, 74), False, 'from mycv.utils.general import disable_multithreads\n'), ((683, 702), 'torch.max', 'torch.max', (['p'], {'dim': '(1)'}), '(p, dim=1)\n', (692, 702), False, 'import torch\n'), ((843, 868), 'argparse.Argumen... |
"""This script downloads all of the data located in the AWS S3 bucket, given the proper
access key and secret key. Assumes that this script will be run from the root of the repository.
Usage: get-data.py --access_key=<access_key> --secret_key=<secret_key>
Options:
--access_key=<access_key> The AWS access key provid... | [
"os.path.exists",
"boto3.client",
"docopt.docopt",
"os.makedirs"
] | [((656, 671), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (662, 671), False, 'from docopt import docopt\n'), ((1175, 1262), 'boto3.client', 'boto3.client', (['"""s3"""'], {'aws_access_key_id': 'access_key', 'aws_secret_access_key': 'secret_key'}), "('s3', aws_access_key_id=access_key, aws_secret_access... |
# -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ classifiers.py ]
# Synopsis [ 'Naive Bayes' and 'Decision Tree' training, testing, and tunning functions ]
# Author [ <NAME> (Andi611) ]
# Copyright [ Copyl... | [
"sklearn.naive_bayes.ComplementNB",
"numpy.arange",
"tqdm.tqdm",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.tree.export_graphviz",
"sklearn.naive_bayes.MultinomialNB",
"sklearn.naive_bayes.BernoulliNB",
"sklearn.naive_bayes.GaussianNB",
"sklearn.metrics.accuracy_score",
"graphviz.Source",
"... | [((863, 879), 'numpy.arange', 'np.arange', (['(1)', '(64)'], {}), '(1, 64)\n', (872, 879), True, 'import numpy as np\n'), ((889, 917), 'numpy.arange', 'np.arange', (['(0.001)', '(1.0)', '(0.001)'], {}), '(0.001, 1.0, 0.001)\n', (898, 917), True, 'import numpy as np\n'), ((936, 966), 'numpy.arange', 'np.arange', (['(0.0... |
import pytest
from hypothesis import given, settings
from hypothesis import strategies as st
from vyper import ast as vy_ast
@pytest.mark.fuzzing
@settings(max_examples=50, deadline=1000)
@given(
idx=st.integers(min_value=0, max_value=9),
array=st.lists(st.integers(), min_size=10, max_size=10),
)
def test_su... | [
"vyper.ast.parse_to_ast",
"hypothesis.settings",
"hypothesis.strategies.integers"
] | [((150, 190), 'hypothesis.settings', 'settings', ([], {'max_examples': '(50)', 'deadline': '(1000)'}), '(max_examples=50, deadline=1000)\n', (158, 190), False, 'from hypothesis import given, settings\n'), ((515, 553), 'vyper.ast.parse_to_ast', 'vy_ast.parse_to_ast', (['f"""{array}[{idx}]"""'], {}), "(f'{array}[{idx}]')... |
"""
@file setup.py
@brief Build and install the pycvm
@author The SCEC/UCVM Developers - <<EMAIL>>
"""
from setuptools import setup
NAME = "ucvm_plotting"
FULLNAME = "ucvm_plotting with pycvm"
AUTHOR = "The SCEC/UCVM Developers"
AUTHOR_EMAIL = "<EMAIL>"
MAINTAINER = AUTHOR
MAINTAINER_EMAIL = AUTHOR_EMAIL
LICE... | [
"setuptools.setup"
] | [((1079, 2167), 'setuptools.setup', 'setup', ([], {'name': 'NAME', 'fullname': 'FULLNAME', 'description': 'DESCRIPTION', 'long_description': 'LONG_DESCRIPTION', 'version': 'VERSION', 'author': 'AUTHOR', 'author_email': 'AUTHOR_EMAIL', 'maintainer': 'MAINTAINER', 'maintainer_email': 'MAINTAINER_EMAIL', 'license': 'LICEN... |
import tensorflow as tf
import matplotlib.pyplot as plt
# MNIST dataset parameters.
num_classes = 10 # 0 to 9 digits
num_features = 784 # 28*28
# Training parameters.
learning_rate = 0.001
training_steps = 1000
batch_size = 256
display_step = 100
# Network parameters.
n_hidden_1 = 128 # 1st layer number of neurons.
... | [
"tensorflow.one_hot",
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow.Variable",
"tensorflow.keras.datasets.mnist.load_data",
"tensorflow.optimizers.SGD",
"tensorflow.math.log",
"tensorflow.GradientTape",
"tensorflow.initializers.RandomNormal",
"tensorflow.argmax",
"tensorflow.clip_by_va... | [((474, 491), 'tensorflow.keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (489, 491), False, 'from tensorflow.keras.datasets import mnist\n'), ((524, 562), 'tensorflow.Variable', 'tf.Variable', (['X_train'], {'dtype': 'tf.float32'}), '(X_train, dtype=tf.float32)\n', (535, 562), True, 'import tenso... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 21 19:43:50 2022
Illustrating a basic transient magnetic diffusion problem, See Jackson Section 5.18
@author: zettergm
"""
import numpy as np
import scipy.sparse.linalg
import scipy.sparse
from scipy.special import erf
import matplotlib.pyplot as ... | [
"numpy.abs",
"numpy.reshape",
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.plot",
"difftools.matrix_kernel",
"numpy.linspace",
"matplotlib.pyplot.figure",
"numpy.zeros",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.title",... | [((549, 579), 'numpy.linspace', 'np.linspace', (['(-5 * a)', '(5 * a)', 'lz'], {}), '(-5 * a, 5 * a, lz)\n', (560, 579), True, 'import numpy as np\n'), ((808, 820), 'numpy.zeros', 'np.zeros', (['lz'], {}), '(lz)\n', (816, 820), True, 'import numpy as np\n'), ((1005, 1033), 'difftools.matrix_kernel', 'matrix_kernel', ([... |
# Copyright 2019 The Android Open Source Project
#
# 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 ag... | [
"os.path.exists",
"emu.utils.mkdir_p",
"re.compile",
"tqdm.tqdm",
"logging.warning",
"logging.info",
"logging.exception",
"docker.from_env",
"os.path.basename",
"shutil.rmtree",
"docker.APIClient",
"sys.stdout.write"
] | [((2507, 2564), 're.compile', 're.compile', (['"""[a-zA-Z0-9][a-zA-Z0-9._-]*:?[a-zA-Z0-9._-]*"""'], {}), "('[a-zA-Z0-9][a-zA-Z0-9._-]*:?[a-zA-Z0-9._-]*')\n", (2517, 2564), False, 'import re\n'), ((2730, 2747), 'docker.from_env', 'docker.from_env', ([], {}), '()\n', (2745, 2747), False, 'import docker\n'), ((3054, 3109)... |
from lightning_plus.api_basebone.drf.routers import SimpleRouter
from .upload import views as upload_views
router = SimpleRouter(custom_base_name="basebone-app")
router.register("upload", upload_views.UploadViewSet)
urlpatterns = router.urls
| [
"lightning_plus.api_basebone.drf.routers.SimpleRouter"
] | [((118, 163), 'lightning_plus.api_basebone.drf.routers.SimpleRouter', 'SimpleRouter', ([], {'custom_base_name': '"""basebone-app"""'}), "(custom_base_name='basebone-app')\n", (130, 163), False, 'from lightning_plus.api_basebone.drf.routers import SimpleRouter\n')] |
# -*- coding: utf-8 -*-
#
# Copyright 2018-2020 Data61, CSIRO
#
# 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 applicabl... | [
"scipy.sparse.lil_matrix",
"numpy.reshape",
"random.shuffle",
"numpy.asarray",
"numpy.asanyarray",
"numpy.array",
"copy.deepcopy"
] | [((9091, 9114), 'copy.deepcopy', 'copy.deepcopy', (['clusters'], {}), '(clusters)\n', (9104, 9114), False, 'import copy\n'), ((12049, 12108), 'numpy.array', 'np.array', (['[node_lookup[n] for n in target_nodes_in_cluster]'], {}), '([node_lookup[n] for n in target_nodes_in_cluster])\n', (12057, 12108), True, 'import num... |
# !/usr/bin/env python
from baselines.common import set_global_seeds, tf_util as U
from baselines import bench
import os.path as osp
import gym, logging
from mpi4py import MPI
import pdb
from gym_extensions.continuous import mujoco
import gym_miniworld
from baselines import logger
import sys
def train(env_id, num_tim... | [
"baselines.common.set_global_seeds",
"baselines.logger.configure",
"argparse.ArgumentParser",
"baselines.Termination_DEOC.cnn_policy.CnnPolicy",
"baselines.logger.get_dir",
"baselines.Termination_DEOC.pposgd_simple.learn",
"mpi4py.MPI.COMM_WORLD.Get_rank",
"sys.exit",
"baselines.common.tf_util.singl... | [((623, 648), 'mpi4py.MPI.COMM_WORLD.Get_rank', 'MPI.COMM_WORLD.Get_rank', ([], {}), '()\n', (646, 648), False, 'from mpi4py import MPI\n'), ((660, 687), 'baselines.common.tf_util.single_threaded_session', 'U.single_threaded_session', ([], {}), '()\n', (685, 687), True, 'from baselines.common import set_global_seeds, t... |
# Copyright 2015-2018 Capital One Services, 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... | [
"c7n_azure.functionapp_utils.FunctionAppUtilities.get_storage_account_connection_string",
"c7n_azure.provisioning.function_app.FunctionAppDeploymentUnit",
"c7n_azure.provisioning.app_insights.AppInsightsUnit",
"c7n_azure.provisioning.storage_account.StorageAccountUnit",
"c7n_azure.provisioning.app_service_p... | [((2518, 2535), 'c7n_azure.provisioning.app_insights.AppInsightsUnit', 'AppInsightsUnit', ([], {}), '()\n', (2533, 2535), False, 'from c7n_azure.provisioning.app_insights import AppInsightsUnit\n'), ((2791, 2811), 'c7n_azure.provisioning.storage_account.StorageAccountUnit', 'StorageAccountUnit', ([], {}), '()\n', (2809... |
from typing import Optional, Any, Dict
import numpy as np
import pandas as pd
from more_itertools import first
from networkx import Graph, to_numpy_matrix
import matplotlib.pyplot as plt
import seaborn as sb
from adam.semantics import Concept, KindConcept, ObjectConcept, ActionConcept
class SemanticsManager:
de... | [
"numpy.mean",
"adam.semantics.ObjectConcept",
"matplotlib.pyplot.savefig",
"adam.semantics.KindConcept",
"seaborn.clustermap",
"networkx.Graph",
"matplotlib.pyplot.close",
"pandas.DataFrame",
"more_itertools.first",
"networkx.to_numpy_matrix"
] | [((2782, 2861), 'more_itertools.first', 'first', (['[n for n in semantics_graph.nodes if n.debug_string == identifier]', 'None'], {}), '([n for n in semantics_graph.nodes if n.debug_string == identifier], None)\n', (2787, 2861), False, 'from more_itertools import first\n'), ((3574, 3638), 'pandas.DataFrame', 'pd.DataFr... |
#
# GSC-18128-1, "Core Flight Executive Version 6.7"
#
# Copyright (c) 2006-2019 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 fi... | [
"pathlib.Path",
"PyQt5.QtWidgets.QMessageBox",
"subprocess.Popen",
"shlex.split",
"PyQt5.QtWidgets.QApplication",
"RoutingService.RoutingService"
] | [((6042, 6064), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (6054, 6064), False, 'from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox\n'), ((1540, 1553), 'PyQt5.QtWidgets.QMessageBox', 'QMessageBox', ([], {}), '()\n', (1551, 1553), False, 'from PyQt5.QtWidgets impo... |
"""test_dataio.py - tests the dataio module
<NAME> (TRI/Austin, Inc.)
"""
__author__ = '<NAME>'
import unittest
from models import dataio
from controllers import pathfinder
from utils.skiptest import skipIfModuleNotInstalled
import h5py
import numpy as np
import numpy.testing
import scipy.misc
import os
import rando... | [
"numpy.fromfile",
"models.dataio.UTWinCscanReader",
"models.dataio.import_dicom",
"unittest.main",
"numpy.genfromtxt",
"os.walk",
"models.dataio.get_txt_data",
"models.dataio.UTWinCScanDataFile",
"os.path.exists",
"models.dataio.get_winspect_data",
"models.dataio.import_winspect",
"os.remove",... | [((6927, 6960), 'utils.skiptest.skipIfModuleNotInstalled', 'skipIfModuleNotInstalled', (['"""dicom"""'], {}), "('dicom')\n", (6951, 6960), False, 'from utils.skiptest import skipIfModuleNotInstalled\n'), ((7764, 7797), 'utils.skiptest.skipIfModuleNotInstalled', 'skipIfModuleNotInstalled', (['"""dicom"""'], {}), "('dico... |
import unittest
from os.path import join
from robot import api, model, parsing, reporting, result, running
from robot.api import parsing as api_parsing
from robot.utils.asserts import assert_equal, assert_true
class TestExposedApi(unittest.TestCase):
def test_execution_result(self):
assert_equal(api.E... | [
"robot.utils.asserts.assert_equal",
"os.path.join",
"robot.parsing.model.Statement._statement_handlers.values",
"unittest.main",
"robot.utils.asserts.assert_true",
"robot.api.TestSuiteBuilder"
] | [((3495, 3510), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3508, 3510), False, 'import unittest\n'), ((302, 359), 'robot.utils.asserts.assert_equal', 'assert_equal', (['api.ExecutionResult', 'result.ExecutionResult'], {}), '(api.ExecutionResult, result.ExecutionResult)\n', (314, 359), False, 'from robot.utils... |
import numpy as np
import matplotlib.pyplot as plt
from scipy import integrate
import reslast
plt.close("all")
# Symmetric network
q,a,p,u,c,n,s = reslast.resu("network")
# Non-symmetric network
qn,an,pn,un,cn,nn,sn = reslast.resu("networknonsym")
plt.show() | [
"matplotlib.pyplot.close",
"reslast.resu",
"matplotlib.pyplot.show"
] | [((96, 112), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (105, 112), True, 'import matplotlib.pyplot as plt\n'), ((150, 173), 'reslast.resu', 'reslast.resu', (['"""network"""'], {}), "('network')\n", (162, 173), False, 'import reslast\n'), ((221, 250), 'reslast.resu', 'reslast.resu', (['""... |
import turtle
ninja = turtle.Turtle()
ninja.speed(10)
for i in range(180):
ninja.forward(100)
ninja.right(30)
ninja.forward(20)
ninja.left(60)
ninja.forward(50)
ninja.right(30)
ninja.penup()
ninja.setposition(0, 0)
ninja.pendown()
ninja.right(2)
... | [
"turtle.done",
"turtle.Turtle"
] | [((26, 41), 'turtle.Turtle', 'turtle.Turtle', ([], {}), '()\n', (39, 41), False, 'import turtle\n'), ((325, 338), 'turtle.done', 'turtle.done', ([], {}), '()\n', (336, 338), False, 'import turtle\n')] |
from torch.utils.data import Dataset
import os
import scipy.io as sio
import numpy as np
import matplotlib.pyplot as plt
import h5py
import pandas as pd
import random
from scipy.io import loadmat
import Utils
from scipy import interpolate
from scipy import signal
import csv
from scipy.signal import butter, lfilter, fre... | [
"pandas.read_csv",
"numpy.array2string",
"matplotlib.pyplot.plot",
"pickle.load",
"h5py.File",
"numpy.max",
"numpy.array",
"numpy.stack",
"numpy.zeros",
"Utils.read_config_file",
"numpy.min",
"time.process_time",
"numpy.transpose",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((6608, 6627), 'time.process_time', 'time.process_time', ([], {}), '()\n', (6625, 6627), False, 'import time\n'), ((2547, 2591), 'h5py.File', 'h5py.File', (['self.brazilian_database_path', '"""r"""'], {}), "(self.brazilian_database_path, 'r')\n", (2556, 2591), False, 'import h5py\n'), ((2616, 2643), 'numpy.array', 'np... |
#!/bin/python
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import numpy as np
import math
# State vector:
# 0-3: quaternions (q0, q1, q2, q3)
# 4-6: Velocity - m/sec (North, East, Down)
# 7-9: Position - m (North, East, Down)
# 10-12: Delta Angle bias - rad (X,Y,Z)
#... | [
"matplotlib.pyplot.figure",
"numpy.genfromtxt",
"matplotlib.pyplot.show"
] | [((1319, 1331), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1329, 1331), True, 'import matplotlib.pyplot as plt\n'), ((1663, 1673), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1671, 1673), True, 'import matplotlib.pyplot as plt\n'), ((539, 791), 'numpy.genfromtxt', 'np.genfromtxt', (['"""S... |
"""
Copyright 2017-present, Airbnb 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, sof... | [
"stream_alert.shared.logger.get_logger",
"json.dumps"
] | [((641, 661), 'stream_alert.shared.logger.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (651, 661), False, 'from stream_alert.shared.logger import get_logger\n'), ((3851, 3876), 'json.dumps', 'json.dumps', (['event_pattern'], {}), '(event_pattern)\n', (3861, 3876), False, 'import json\n')] |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 27 16:54:42 2017
@author: Xiaobo
"""
import numpy as np
from mpi4py import MPI
import commands
import os
import sys
path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(path)
#sys.path.append('/Users/Xiaobo/git/CloudMerge/CloudMerge/cl... | [
"commands.getoutput",
"argparse.ArgumentParser",
"numpy.power",
"os.path.realpath",
"numpy.zeros",
"numpy.linspace",
"sys.path.append",
"multiway_merge.multiway_merger"
] | [((238, 259), 'sys.path.append', 'sys.path.append', (['path'], {}), '(path)\n', (253, 259), False, 'import sys\n'), ((2156, 2209), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""cloudmerge-hpc"""'}), "(description='cloudmerge-hpc')\n", (2179, 2209), False, 'import argparse\n'), ((3580, 3... |
from uwallet.blockchain import unet
from uwallet.blockchain import ArithUint256
GENESIS_BITS = 0x1f07ffff
MAX_TARGET = 0x0007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
N_TARGET_TIMESPAN = 150
def check_bits(bits):
bitsN = (bits >> 24) & 0xff
assert 0x03 <= bitsN <= 0x1f, \
... | [
"uwallet.blockchain.ArithUint256",
"uwallet.blockchain.ArithUint256.SetCompact"
] | [((1482, 1511), 'uwallet.blockchain.ArithUint256.SetCompact', 'ArithUint256.SetCompact', (['bits'], {}), '(bits)\n', (1505, 1511), False, 'from uwallet.blockchain import ArithUint256\n'), ((2284, 2312), 'uwallet.blockchain.ArithUint256.SetCompact', 'ArithUint256.SetCompact', (['rex'], {}), '(rex)\n', (2307, 2312), Fals... |
from typing import List, Set, Dict
import json
import pytumblr
from api_tumblr.pytumblr_wrapper import RateLimitClient
API_KEYS_TYPE = List[str]
class BotSpecificConstants:
"""Values specific to my development environment and/or the social context of my bot, e.g. specific posts IDs where I need apply some overr... | [
"json.load",
"pytumblr.TumblrRestClient"
] | [((5966, 5978), 'json.load', 'json.load', (['f'], {}), '(f)\n', (5975, 5978), False, 'import json\n'), ((6859, 6891), 'pytumblr.TumblrRestClient', 'pytumblr.TumblrRestClient', (['*keys'], {}), '(*keys)\n', (6884, 6891), False, 'import pytumblr\n'), ((7144, 7176), 'pytumblr.TumblrRestClient', 'pytumblr.TumblrRestClient'... |
#!/usr/bin/env python
#
# Author: <NAME> (mmckerns @caltech and @uqfoundation)
# Copyright (c) 2008-2016 California Institute of Technology.
# Copyright (c) 2016-2019 The Uncertainty Quantification Foundation.
# License: 3-clause BSD. The full license text is available at:
# - https://github.com/uqfoundation/dill/blo... | [
"itertools.chain",
"tarfile.open",
"io.BufferedIOBase",
"weakref.WeakSet",
"contextlib.GeneratorContextManager",
"itertools.izip",
"ctypes.c_short",
"operator.itemgetter",
"sets.Set",
"zlib.compressobj",
"weakref.WeakValueDictionary",
"datetime.tzinfo",
"bz2.BZ2Compressor",
"threading.RLoc... | [((542, 604), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'DeprecationWarning'}), "('ignore', category=DeprecationWarning)\n", (565, 604), False, 'import warnings\n'), ((2863, 2884), 'tempfile.mkstemp', 'tempfile.mkstemp', (['"""r"""'], {}), "('r')\n", (2879, 2884), False, 'imp... |
#<NAME>
#Purdue University
#Email: <EMAIL>
#DESCRIPTION: Code written to isolate the magnitudes of harmonics of a
#given f_0 for a given audiofile/stimulus.
#Additional Dependencies: scipy, numpy, matplotlib
# pip3 install scipy
# pip3 install numpy
# pip3 install matplotlib
#May require ffmpeg on Ubuntu/Linux as we... | [
"numpy.multiply",
"numpy.ones",
"numpy.divide",
"numpy.asmatrix",
"matplotlib.pyplot.plot",
"numpy.asarray",
"numpy.max",
"numpy.exp",
"numpy.sum",
"matplotlib.pyplot.figure",
"scipy.io.wavfile.read",
"numpy.cos",
"signal_processing.pure_tone_complex",
"numpy.concatenate",
"numpy.sin",
... | [((514, 533), 'scipy.io.wavfile.read', 'wavfile.read', (['fname'], {}), '(fname)\n', (526, 533), False, 'from scipy.io import wavfile\n'), ((1073, 1089), 'numpy.sum', 'np.sum', (['x_sin', '(1)'], {}), '(x_sin, 1)\n', (1079, 1089), True, 'import numpy as np\n'), ((1104, 1120), 'numpy.sum', 'np.sum', (['x_cos', '(1)'], {... |
from AlbotOnline.Snake import SnakeGame
import AlbotOnline.JsonProtocol as Prot
import random as rand
game = SnakeGame.SnakeGame(Port=int(input("Port:"))) #Connects you to the Client
maxDepth = 2
def stateToScore(state):
if(state == Prot.STATES.ongoing):
return 0.5
if(state == Prot.STATES.... | [
"random.choice"
] | [((1411, 1428), 'random.choice', 'rand.choice', (['temp'], {}), '(temp)\n', (1422, 1428), True, 'import random as rand\n')] |
# Generated by Django 2.2.5 on 2019-10-21 07:13
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('sushi', '0022_sushi_cred... | [
"django.db.migrations.swappable_dependency",
"django.db.models.ForeignKey"
] | [((227, 284), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (258, 284), False, 'from django.db import migrations, models\n'), ((491, 598), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on... |
from django.core.cache import cache
def set_cache(user_no, token):
cache.set('token:userno:' + user_no, token, timeout=None)
cache.set('token:value:'+ token, user_no, timeout=None)
def get_token_from_cache(user_no):
try:
token = cache.get('token:userno:' + user_no)
except:
tok... | [
"django.core.cache.cache.delete",
"django.core.cache.cache.set",
"django.core.cache.cache.get"
] | [((76, 133), 'django.core.cache.cache.set', 'cache.set', (["('token:userno:' + user_no)", 'token'], {'timeout': 'None'}), "('token:userno:' + user_no, token, timeout=None)\n", (85, 133), False, 'from django.core.cache import cache\n'), ((142, 198), 'django.core.cache.cache.set', 'cache.set', (["('token:value:' + token)... |
import numpy as np
from math import inf as infinity
from itertools import product
from collections import defaultdict
import random
import time
# Initializing the Tic-Tac-Toe environment
# Three rows-Three columns, creating an empty list of three empty lists
state_space = [[' ', ' ', ' '], [' ', ' ', ' '], [' ', ' ', ... | [
"numpy.full",
"numpy.loadtxt",
"itertools.product",
"numpy.argmax"
] | [((3773, 3799), 'numpy.full', 'np.full', (['Total_states', '(0.0)'], {}), '(Total_states, 0.0)\n', (3780, 3799), True, 'import numpy as np\n'), ((5312, 5357), 'numpy.loadtxt', 'np.loadtxt', (['"""trained_O.txt"""'], {'dtype': 'np.float64'}), "('trained_O.txt', dtype=np.float64)\n", (5322, 5357), True, 'import numpy as ... |
'''
FastAPI Demo
SQLAlchemy ORM Models
'''
# Standard Imports
# PyPi Imports
from sqlalchemy import (
Boolean,
Column,
Integer,
String
)
# Local Imports
from database.setup import Base
###############################################################################
class User(Base):
'''ORM Models - users'''
_... | [
"sqlalchemy.Column"
] | [((354, 399), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)', 'index': '(True)'}), '(Integer, primary_key=True, index=True)\n', (360, 399), False, 'from sqlalchemy import Boolean, Column, Integer, String\n'), ((412, 439), 'sqlalchemy.Column', 'Column', (['String'], {'unique': '(True)'}), '(String... |
# Plotting tools and utility functions
# Nested GridSpec : https://matplotlib.org/stable/gallery/subplots_axes_and_figures/gridspec_nested.html#sphx-glr-gallery-subplots-axes-and-figures-gridspec-nested-py
# GridSpec : https://matplotlib.org/stable/gallery/subplots_axes_and_figures/gridspec_multicolumn.html#sphx-glr-ga... | [
"matplotlib.pyplot.figure",
"numpy.interp"
] | [((1439, 1462), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'dim'}), '(figsize=dim)\n', (1449, 1462), True, 'from matplotlib import pyplot as plt\n'), ((1203, 1225), 'numpy.interp', 'np.interp', (['value', 'x', 'y'], {}), '(value, x, y)\n', (1212, 1225), True, 'import numpy as np\n')] |
#!/usr/bin/env python
"""Test for the ee.imagecollection module."""
from unittest import mock
import unittest
import ee
from ee import apitestcase
class ImageCollectionTestCase(apitestcase.ApiTestCase):
def testImageCollectionConstructors(self):
"""Verifies that constructors understand valid parameters."""... | [
"ee.Image",
"ee.ApiFunction.lookup",
"ee.ComputedObject",
"ee.ImageCollection",
"ee.apitestcase.UsingCloudApi",
"unittest.main",
"ee.Filter"
] | [((3414, 3429), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3427, 3429), False, 'import unittest\n'), ((335, 361), 'ee.ImageCollection', 'ee.ImageCollection', (['"""abcd"""'], {}), "('abcd')\n", (353, 361), False, 'import ee\n'), ((865, 890), 'ee.ImageCollection', 'ee.ImageCollection', (['"""foo"""'], {}), "('... |
"""
Double DQN
"""
import argparse
from collections import OrderedDict
from typing import Tuple
import pytorch_lightning as pl
import torch
from pl_bolts.losses.rl import double_dqn_loss
from pl_bolts.models.rl.dqn_model import DQN
class DoubleDQN(DQN):
"""
Double Deep Q-network (DDQN)
PyTorch Lightning... | [
"collections.OrderedDict",
"pytorch_lightning.Trainer.add_argparse_args",
"argparse.ArgumentParser",
"pl_bolts.losses.rl.double_dqn_loss",
"pytorch_lightning.Trainer.from_argparse_args"
] | [((3449, 3488), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'add_help': '(False)'}), '(add_help=False)\n', (3472, 3488), False, 'import argparse\n'), ((3522, 3558), 'pytorch_lightning.Trainer.add_argparse_args', 'pl.Trainer.add_argparse_args', (['parser'], {}), '(parser)\n', (3550, 3558), True, 'import ... |
from math import ceil, floor
from collections import Counter
def mean(numLS):
"""
Finds the sum of a list of numbers and divided by the
length of the list leaving the mean.
"""
return sum(numLS) / float(len(numLS))
def median(numLS):
"""
The middle value of a set of ordered data.
"""
... | [
"collections.Counter"
] | [((716, 730), 'collections.Counter', 'Counter', (['numLS'], {}), '(numLS)\n', (723, 730), False, 'from collections import Counter\n')] |
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views import defaults as default_views
from lightning_plus.puzzle.urls import urlpatterns as puzzle_urls
from lightning_plus.graphql.admin.view import graph... | [
"django.conf.urls.include",
"django.conf.urls.static.static",
"django.conf.urls.url"
] | [((1352, 1415), 'django.conf.urls.static.static', 'static', (['settings.STATIC_URL'], {'document_root': 'settings.STATIC_ROOT'}), '(settings.STATIC_URL, document_root=settings.STATIC_ROOT)\n', (1358, 1415), False, 'from django.conf.urls.static import static\n'), ((1268, 1329), 'django.conf.urls.static.static', 'static'... |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/06_cli.ipynb (unless otherwise specified).
__all__ = ['bump_version', 'nbdev_bump_version', 'nbdev_install_git_hooks', 'extract_tgz', 'nbdev_new']
# Cell
from .imports import *
from .export import *
from .sync import *
from .merge import *
from .export2html import *
fro... | [
"tarfile.open"
] | [((2551, 2587), 'tarfile.open', 'tarfile.open', ([], {'mode': '"""r:gz"""', 'fileobj': 'u'}), "(mode='r:gz', fileobj=u)\n", (2563, 2587), False, 'import tarfile\n')] |
from flask import Flask, request, jsonify
from fastai.basic_train import load_learner
from fastai.vision import open_image
from flask_cors import CORS,cross_origin
app = Flask(__name__)
CORS(app, support_credentials=True)
# load the learner
learn = load_learner(path='./models', file='trained_model.pkl')
classes = lear... | [
"fastai.basic_train.load_learner",
"fastai.vision.open_image",
"flask_cors.CORS",
"flask.Flask"
] | [((170, 185), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (175, 185), False, 'from flask import Flask, request, jsonify\n'), ((186, 221), 'flask_cors.CORS', 'CORS', (['app'], {'support_credentials': '(True)'}), '(app, support_credentials=True)\n', (190, 221), False, 'from flask_cors import CORS, cross_o... |
import pytest
from barista.models import Match
def test_both_trigger_and_triggers():
with pytest.raises(ValueError):
Match.parse_obj(
{
"replace": "asd",
"trigger": "asd",
"triggers": ["asd", "abc"],
}
)
def test_neither_tr... | [
"barista.models.Match.parse_obj",
"pytest.raises"
] | [((447, 500), 'barista.models.Match.parse_obj', 'Match.parse_obj', (["{'replace': 'asd', 'trigger': 'ads'}"], {}), "({'replace': 'asd', 'trigger': 'ads'})\n", (462, 500), False, 'from barista.models import Match\n'), ((577, 641), 'barista.models.Match.parse_obj', 'Match.parse_obj', (["{'replace': 'asd', 'triggers': ['a... |
from typing import List
from flask import request
from flask_restx import Namespace, Resource
from CTFd.api.v1.helpers.request import validate_args
from CTFd.api.v1.helpers.schemas import sqlalchemy_to_pydantic
from CTFd.api.v1.schemas import APIDetailedSuccessResponse, APIListSuccessResponse
from CTFd.constants impo... | [
"CTFd.models.db.session.commit",
"CTFd.models.db.session.delete",
"CTFd.schemas.user_rights.UserRightsSchema",
"flask_restx.Namespace",
"CTFd.utils.decorators.access_granted_only",
"CTFd.api.v1.helpers.schemas.sqlalchemy_to_pydantic",
"CTFd.models.UserRights.query.filter_by",
"flask.request.get_json",... | [((561, 632), 'flask_restx.Namespace', 'Namespace', (['"""user_rights"""'], {'description': '"""Endpoint to retrieve UserRights"""'}), "('user_rights', description='Endpoint to retrieve UserRights')\n", (570, 632), False, 'from flask_restx import Namespace, Resource\n'), ((652, 686), 'CTFd.api.v1.helpers.schemas.sqlalc... |
"""Hardening Importer - Import IronBank Hardening Manifests for builds.
This module provides tests for the models building argument strings for build
executors.
"""
import pytest
from hardening_importer.models import HardeningManifest
from .conftest import VALID_MANIFESTS
def test_build_args():
"""Test valid ... | [
"hardening_importer.models.HardeningManifest.from_yaml",
"pytest.raises"
] | [((421, 463), 'hardening_importer.models.HardeningManifest.from_yaml', 'HardeningManifest.from_yaml', (['manifest_file'], {}), '(manifest_file)\n', (448, 463), False, 'from hardening_importer.models import HardeningManifest\n'), ((1053, 1095), 'hardening_importer.models.HardeningManifest.from_yaml', 'HardeningManifest.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
"""Эффект исчезновения фотографии
Кликая на области на фотографии запускаются процессы плавного увеличения
прозрачности пикселей, эффект как круги воды, будут расходиться пока не
закончатся непрозрачные пиксели"""
import sys
import traceback
... | [
"traceback.format_tb",
"sys.exit"
] | [((801, 812), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (809, 812), False, 'import sys\n'), ((709, 732), 'traceback.format_tb', 'traceback.format_tb', (['tb'], {}), '(tb)\n', (728, 732), False, 'import traceback\n')] |
import pdb
import numpy as np
import nose
import cudamat as cm
import learn as cl
def setup():
cm.cublas_init()
def teardown():
cm.cublas_shutdown()
def test_mult_by_sigmoid_deriv():
m = 256
n = 128
c_targets = np.array(np.random.randn(m, n)*10, dtype=np.float32, order='F')
c_acts = np.array(... | [
"cudamat.cublas_init",
"numpy.random.rand",
"learn.mult_by_sigmoid_deriv",
"cudamat.cublas_shutdown",
"cudamat.CUDAMatrix",
"nose.runmodule",
"numpy.random.randn"
] | [((100, 116), 'cudamat.cublas_init', 'cm.cublas_init', ([], {}), '()\n', (114, 116), True, 'import cudamat as cm\n'), ((138, 158), 'cudamat.cublas_shutdown', 'cm.cublas_shutdown', ([], {}), '()\n', (156, 158), True, 'import cudamat as cm\n'), ((388, 412), 'cudamat.CUDAMatrix', 'cm.CUDAMatrix', (['c_targets'], {}), '(c_... |
from fireo.fields import TextField, NumberField
from fireo.models import Model
class City(Model):
name = TextField()
population = NumberField()
def test_issue_126():
city = City.collection.create(name='NYC', population=500000, no_return=True)
assert city == None | [
"fireo.fields.NumberField",
"fireo.fields.TextField"
] | [((110, 121), 'fireo.fields.TextField', 'TextField', ([], {}), '()\n', (119, 121), False, 'from fireo.fields import TextField, NumberField\n'), ((139, 152), 'fireo.fields.NumberField', 'NumberField', ([], {}), '()\n', (150, 152), False, 'from fireo.fields import TextField, NumberField\n')] |
"""python 3.7+
Run allele stage2_var_obj methods.
<NAME> 2019-2022
"""
import sys
import os
import exceptions
from run_scripts.tools import run_mash_screen, create_dataframe, \
apply_filters, create_csv, get_variant_ids
def sort_genes(gene, stage2_var_obj, allele_or_gene, session):
"""
Main r... | [
"os.path.getsize",
"run_scripts.tools.create_dataframe",
"run_scripts.tools.create_csv",
"os.path.join",
"run_scripts.tools.apply_filters",
"sys.stderr.write",
"run_scripts.tools.run_mash_screen",
"sys.exit",
"exceptions.CtvdbError",
"run_scripts.tools.get_variant_ids",
"sys.stdout.write"
] | [((1501, 1575), 'run_scripts.tools.get_variant_ids', 'get_variant_ids', (['hit_genes', 'allele_or_gene', 'stage2_var_obj.grp_id', 'session'], {}), '(hit_genes, allele_or_gene, stage2_var_obj.grp_id, session)\n', (1516, 1575), False, 'from run_scripts.tools import run_mash_screen, create_dataframe, apply_filters, create... |
import logging
from fedml_api.distributed.fedgkt.message_def import MyMessage
from fedml_core.distributed.client.client_manager import ClientManager
from fedml_core.distributed.communication.message import Message
class GKTClientMananger(ClientManager):
def __init__(self, args, trainer, comm=None, rank=0, size=0... | [
"logging.info"
] | [((978, 1034), 'logging.info', 'logging.info', (['f"""handle_message_init. Rank = {self.rank}"""'], {}), "(f'handle_message_init. Rank = {self.rank}')\n", (990, 1034), False, 'import logging\n'), ((1163, 1241), 'logging.info', 'logging.info', (['f"""handle_message_receive_logits_from_server. Rank = {self.rank}"""'], {}... |
import re
from DbxSync.CodeTransformer.LineTransformer.ImportLine import ImportLine
class ImportLineParser:
def parse(self, line):
matches = re.match('^from[ ]+([^ ]+) import ([^ ]+)$', line)
if matches is None:
return None
else:
return ImportLine(matches.group(1),... | [
"re.match"
] | [((155, 205), 're.match', 're.match', (['"""^from[ ]+([^ ]+) import ([^ ]+)$"""', 'line'], {}), "('^from[ ]+([^ ]+) import ([^ ]+)$', line)\n", (163, 205), False, 'import re\n')] |
from spry.http import HTTPFileSync, HTTPSession
def httpget(url, path, persist=True, parts=4, limit=None, timeout=None, restart=False, **kwargs):
session = HTTPFileSync('get', url, path, persist=persist, parts=parts, speed_limit=limit,
timeout=timeout, restart=restart, **kwargs)
ses... | [
"spry.http.HTTPFileSync"
] | [((162, 290), 'spry.http.HTTPFileSync', 'HTTPFileSync', (['"""get"""', 'url', 'path'], {'persist': 'persist', 'parts': 'parts', 'speed_limit': 'limit', 'timeout': 'timeout', 'restart': 'restart'}), "('get', url, path, persist=persist, parts=parts, speed_limit=\n limit, timeout=timeout, restart=restart, **kwargs)\n",... |
import fakeid
import unittest
from json import loads
class FakeIdTestCase(unittest.TestCase):
def setUp(self):
fakeid.app.config['TESTING'] = True
self.app = fakeid.app.test_client()
def test_landing(self):
result = self.app.get('/')
assert result.status_code == 200
def ... | [
"unittest.main",
"json.loads",
"fakeid.app.test_client"
] | [((1178, 1193), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1191, 1193), False, 'import unittest\n'), ((180, 204), 'fakeid.app.test_client', 'fakeid.app.test_client', ([], {}), '()\n', (202, 204), False, 'import fakeid\n'), ((986, 1004), 'json.loads', 'loads', (['result.data'], {}), '(result.data)\n', (991, 10... |
from collections import OrderedDict
import re
from dockerfile_parse import DockerfileParser
from dockerfile_parse.constants import COMMENT_INSTRUCTION
# class CheckovDockerFileParser(DockerfileParser)
from checkov.common.comment.enum import COMMENT_REGEX
def parse(filename):
dfp = DockerfileParser(path=filename... | [
"collections.OrderedDict",
"dockerfile_parse.DockerfileParser",
"re.search"
] | [((290, 321), 'dockerfile_parse.DockerfileParser', 'DockerfileParser', ([], {'path': 'filename'}), '(path=filename)\n', (306, 321), False, 'from dockerfile_parse import DockerfileParser\n'), ((415, 428), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (426, 428), False, 'from collections import OrderedDict\... |
# import pandas as pd
# data = pd.read_csv('deputes-active.csv')
# print(data.head())
from pyprotege.ontology import Ontology
from pyprotege.ontology_class import OntologyClass
from pyprotege.data_property import DataProperty
from pyprotege.object_property import ObjectProperty
from pyprotege.individual import Indivi... | [
"pyprotege.ontology.Ontology",
"pyprotege.object_property.ObjectProperty",
"pyprotege.ontology_class.OntologyClass",
"pyprotege.individual.Individual",
"pyprotege.data_property.DataProperty"
] | [((358, 374), 'pyprotege.ontology.Ontology', 'Ontology', (['"""Test"""'], {}), "('Test')\n", (366, 374), False, 'from pyprotege.ontology import Ontology\n'), ((385, 408), 'pyprotege.ontology_class.OntologyClass', 'OntologyClass', (['"""Person"""'], {}), "('Person')\n", (398, 408), False, 'from pyprotege.ontology_class ... |
from django import forms
from django.utils.safestring import mark_safe
from django.conf import settings
import json
class ImgerWidget(forms.Widget):
def __init__(self, attrs=None, **kwargs):
self.imger_settings = attrs['imger_settings']
super(ImgerWidget, self).__init__(**kwargs)
class Media... | [
"json.dumps",
"django.utils.safestring.mark_safe"
] | [((989, 1015), 'json.dumps', 'json.dumps', (['imger_settings'], {}), '(imger_settings)\n', (999, 1015), False, 'import json\n'), ((1465, 1815), 'django.utils.safestring.mark_safe', 'mark_safe', (['(\'<p>Currently: %s<br/>Change: <span><button data-static_url="%s" data-imger=\\\'%s\\\' class="ImgerBrowseBTN" type="butto... |
import shutil
import sys
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List, Tuple
import pytest
import hesiod.core as hcore
from hesiod import get_cfg_copy, get_out_dir, get_run_name, hcfg, hmain
from hesiod.core import _parse_args
def test_args_kwargs(base_cfg_dir: Path, sim... | [
"hesiod.hcfg",
"hesiod.get_cfg_copy",
"hesiod.get_out_dir",
"pathlib.Path",
"sys.argv.append",
"hesiod.hmain",
"hesiod.core._parse_args",
"datetime.datetime.now",
"pytest.raises",
"shutil.rmtree",
"hesiod.get_run_name"
] | [((354, 451), 'hesiod.hmain', 'hmain', (['base_cfg_dir'], {'run_cfg_file': 'simple_run_file', 'create_out_dir': '(False)', 'parse_cmd_line': '(False)'}), '(base_cfg_dir, run_cfg_file=simple_run_file, create_out_dir=False,\n parse_cmd_line=False)\n', (359, 451), False, 'from hesiod import get_cfg_copy, get_out_dir, g... |
# This is a part of the program which removes the effect of the Differential Reddening from the main sequence of the masive star clusters.
# Reference: <NAME> et al (2012)
# The steps: 1. Plot a CMD, 2. Rotate the main sequence using theta = A_Filter_1/(A_Filter_I - A_Filter_II); A = Absorption Coefficients (Ref. Jans... | [
"numpy.median",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.ylabel",
"numpy.sin",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.figure",
"numpy.linspace",
"numpy.cos",
"matplotlib.pyplot.scatter",
"pandas.DataFra... | [((516, 541), 'numpy.loadtxt', 'np.loadtxt', (['"""cluster.dat"""'], {}), "('cluster.dat')\n", (526, 541), True, 'import numpy as np\n'), ((748, 760), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (758, 760), True, 'import matplotlib.pyplot as plt\n'), ((761, 802), 'matplotlib.pyplot.scatter', 'plt.scatte... |
import numpy as np
import pandas as pd
import pytest
from rs_metrics.metrics import _ndcg_score
from rs_metrics import *
from rs_metrics.statistics import item_pop
def test_dcg_score_1():
assert _ndcg_score([1], [1], 1) == 1
def test_dcg_score_0():
assert _ndcg_score([1], [0], 1) == 0
def test_dcg_score_... | [
"pandas.DataFrame",
"numpy.log2",
"rs_metrics.statistics.item_pop",
"rs_metrics.metrics._ndcg_score"
] | [((759, 822), 'pandas.DataFrame', 'pd.DataFrame', (['[[1, 1], [1, 2]]'], {'columns': "['user_idx', 'item_id']"}), "([[1, 1], [1, 2]], columns=['user_idx', 'item_id'])\n", (771, 822), True, 'import pandas as pd\n'), ((836, 899), 'pandas.DataFrame', 'pd.DataFrame', (['[[1, 1], [1, 0]]'], {'columns': "['user_idx', 'item_i... |
import os, sys
sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
import sa_utils
import netgen_csg
import numpy as np
if __name__ == '__main__':
prefix = 'oht_8layers_3patches'
logger = sa_utils.LogWrapper(prefix+'/'+prefix)
netgen_csg.create_patches(box = np.array([0., 0., ... | [
"os.path.realpath",
"numpy.array",
"sa_utils.LogWrapper"
] | [((226, 268), 'sa_utils.LogWrapper', 'sa_utils.LogWrapper', (["(prefix + '/' + prefix)"], {}), "(prefix + '/' + prefix)\n", (245, 268), False, 'import sa_utils\n'), ((65, 91), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (81, 91), False, 'import os, sys\n'), ((302, 343), 'numpy.array', 'n... |