code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import numpy as np
import random
import matplotlib.pyplot as plt
n = 10
s = 0.5
S = 2
demand = []
replenish = []
x = [0]
y = [-s]
lambdas = np.array([1,2])
p = np.array([0.5,0.5])
for i in range(n):
demand.append(random.uniform(0,1))
if x[-1] < s:
y.append(S - s)
replenish.append(S - x[-1])
... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"random.uniform",
"matplotlib.pyplot.legend",
"numpy.array"
] | [((141, 157), 'numpy.array', 'np.array', (['[1, 2]'], {}), '([1, 2])\n', (149, 157), True, 'import numpy as np\n'), ((161, 181), 'numpy.array', 'np.array', (['[0.5, 0.5]'], {}), '([0.5, 0.5])\n', (169, 181), True, 'import numpy as np\n'), ((467, 478), 'matplotlib.pyplot.plot', 'plt.plot', (['x'], {}), '(x)\n', (475, 47... |
# emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and license terms.
#
# ## ### ##... | [
"datalad.downloaders.providers.Providers.from_config_files",
"unittest.SkipTest"
] | [((669, 711), 'datalad.downloaders.providers.Providers.from_config_files', 'Providers.from_config_files', ([], {'reload': 'reload'}), '(reload=reload)\n', (696, 711), False, 'from datalad.downloaders.providers import Providers\n'), ((1095, 1182), 'unittest.SkipTest', 'SkipTest', (["('This test requires known credential... |
import sqlite3
import datetime
import sys
import csv
# Parses notes from the com.example.android.notepad app, can export lines from a subset of these to a csv file
# In solid explorer, navigate to /data/data/com.example.android.notepad, put the note_pad.db next to this script
db_file = 'note_pad.db'
connec... | [
"sqlite3.connect",
"csv.writer",
"datetime.datetime.fromtimestamp"
] | [((327, 351), 'sqlite3.connect', 'sqlite3.connect', (['db_file'], {}), '(db_file)\n', (342, 351), False, 'import sqlite3\n'), ((531, 577), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimestamp', (['(row[3] / 1000)'], {}), '(row[3] / 1000)\n', (562, 577), False, 'import datetime\n'), ((988, 1034), 'datetim... |
from django.conf import settings
from django.views.generic import TemplateView
from product.views.extra import picture_carousel
class HomePageView(TemplateView):
template_name = 'home.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
if hasattr(settings... | [
"product.views.extra.picture_carousel"
] | [((386, 450), 'product.views.extra.picture_carousel', 'picture_carousel', (['settings.HOMEPAGE_PICTURE_CAROUSEL', '"""carousel"""'], {}), "(settings.HOMEPAGE_PICTURE_CAROUSEL, 'carousel')\n", (402, 450), False, 'from product.views.extra import picture_carousel\n')] |
import hashlib
import os
import json
import requests
from pymongo import MongoClient
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
db = SQLAlchemy(app)
from models import People
app.config['CONFIG_SHA1'] = ''
app.config['PEOPLE_NAMES'] = list()
def _check_sha1(file):
BLO... | [
"models.People.__table__.insert",
"hashlib.sha1",
"flask.Flask",
"json.dumps",
"flask_sqlalchemy.SQLAlchemy",
"requests.get",
"models.People.query.all"
] | [((156, 171), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (161, 171), False, 'from flask import Flask\n'), ((177, 192), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (187, 192), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((346, 360), 'hashlib.sha1', 'hashlib.sha1', ([]... |
"""Setup file for sopel-remind. See ``setup.cfg`` for setup config."""
from setuptools import setup
setup()
| [
"setuptools.setup"
] | [((101, 108), 'setuptools.setup', 'setup', ([], {}), '()\n', (106, 108), False, 'from setuptools import setup\n')] |
#!/usr/bin/env python3
# exprs.py ---
#
# Filename: exprs.py
# Author: <NAME>
# Created: Wed Aug 19 15:47:31 2015 (-0400)
#
#
# Copyright (c) 2015, <NAME>, University of Pennsylvania
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that... | [
"exprs.exprtypes.IntType",
"utils.basetypes.UnhandledCaseError",
"z3.And",
"random.shuffle",
"utils.utils.print_module_misuse_and_exit",
"random.choice",
"exprs.exprtypes.StringType",
"exprs.exprtypes.BoolType",
"z3.Solver",
"collections.namedtuple",
"z3.BitVecVal",
"utils.utils.bitvector_to_s... | [((2637, 2728), 'collections.namedtuple', 'collections.namedtuple', (['"""VariableExpression"""', "['expr_kind', 'variable_info', 'expr_id']"], {}), "('VariableExpression', ['expr_kind', 'variable_info',\n 'expr_id'])\n", (2659, 2728), False, 'import collections\n'), ((2872, 3023), 'collections.namedtuple', 'collect... |
import os
import string
import time
import vim
RConsole = 0
Rterm = False
try:
import win32api
import win32clipboard
import win32com.client
import win32con
import win32gui
except ImportError:
import platform
myPyVersion = platform.python_version()
myArch = platform.architecture()
v... | [
"platform.python_version",
"win32api.PostMessage",
"os.path.isfile",
"win32gui.GetForegroundWindow",
"win32api.RegCloseKey",
"win32gui.SetForegroundWindow",
"platform.architecture",
"os.spawnv",
"win32api.RegOpenKeyEx",
"vim.command",
"win32api.RegEnumValue",
"os.startfile",
"win32clipboard.... | [((552, 582), 'win32gui.GetForegroundWindow', 'win32gui.GetForegroundWindow', ([], {}), '()\n', (580, 582), False, 'import win32gui\n'), ((607, 623), 'time.sleep', 'time.sleep', (['(0.05)'], {}), '(0.05)\n', (617, 623), False, 'import time\n'), ((659, 725), 'win32gui.SendMessage', 'win32gui.SendMessage', (['RConsole', ... |
from dateutil import parser
import re
import shutil
import subprocess as sp
import time
import pytest
from .utils import (
gen_basic_wf,
gen_basic_wf_with_threadcount,
gen_basic_wf_with_threadcount_concurrent,
)
from ..core import Workflow
from ..task import ShellCommandTask
from ..submitter import Submit... | [
"subprocess.run",
"subprocess.Popen",
"dateutil.parser.parse",
"shutil.which",
"time.sleep",
"datetime.datetime.strptime",
"pytest.mark.skipif",
"pytest.mark.flaky",
"pytest.raises",
"pathlib.Path",
"re.search"
] | [((3556, 3583), 'pytest.mark.flaky', 'pytest.mark.flaky', ([], {'reruns': '(2)'}), '(reruns=2)\n', (3573, 3583), False, 'import pytest\n'), ((4163, 4190), 'pytest.mark.flaky', 'pytest.mark.flaky', ([], {'reruns': '(2)'}), '(reruns=2)\n', (4180, 4190), False, 'import pytest\n'), ((4912, 4981), 'pytest.mark.skipif', 'pyt... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2015 <NAME>. All rights reserved.
# Copyright (c) 2015 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you ma... | [
"oslo_log.log.getLogger",
"manila.scheduler.rpcapi.SchedulerAPI",
"manila.data.rpcapi.DataAPI",
"manila.exception.InvalidShare",
"manila.exception.InvalidShareAccess",
"manila.share.share_types.parse_boolean_extra_spec",
"manila.exception.ShareBusyException",
"manila.share.utils.extract_host",
"mani... | [((2093, 2116), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (2106, 2116), False, 'from oslo_log import log\n'), ((1513, 1876), 'oslo_config.cfg.BoolOpt', 'cfg.BoolOpt', (['"""use_scheduler_creating_share_from_snapshot"""'], {'default': '(False)', 'help': '"""If set to False, then shar... |
# Copyright (c) 2006-2013 Regents of the University of Minnesota.
# For licensing terms, see the file LICENSE.
import sys
import conf
import g
from item import item_base
from item.util import revision
from item.util.item_type import Item_Type
from util_ import db_glue
from util_ import misc
__all__ = ['One', 'Many'... | [
"item.item_base.One.__init__",
"item.item_base.Many.__init__",
"g.log.getLogger",
"item.item_base.One.attr_defns_reduce_for_gwis",
"g.assurt"
] | [((329, 359), 'g.log.getLogger', 'g.log.getLogger', (['"""item_helper"""'], {}), "('item_helper')\n", (344, 359), False, 'import g\n'), ((801, 853), 'item.item_base.One.attr_defns_reduce_for_gwis', 'item_base.One.attr_defns_reduce_for_gwis', (['attr_defns'], {}), '(attr_defns)\n', (841, 853), False, 'from item import i... |
# -*- coding: utf-8 -*-
from qgis.core import QgsProject, QgsField
from PyQt5.QtWidgets import QFileDialog
from PyQt5.QtCore import QVariant
def node_has_child_name(node, child_name):
for c in node.children():
if child_name == c.name():
return True
return False
def add_group(group_name, ... | [
"PyQt5.QtWidgets.QFileDialog.getOpenFileName",
"qgis.core.QgsField",
"qgis.core.QgsProject.instance",
"PyQt5.QtWidgets.QFileDialog.getExistingDirectory"
] | [((2158, 2195), 'PyQt5.QtWidgets.QFileDialog.getOpenFileName', 'QFileDialog.getOpenFileName', ([], {}), '(**kwargs)\n', (2185, 2195), False, 'from PyQt5.QtWidgets import QFileDialog\n'), ((2381, 2415), 'PyQt5.QtWidgets.QFileDialog.getExistingDirectory', 'QFileDialog.getExistingDirectory', ([], {}), '()\n', (2413, 2415)... |
import asyncio
import requests, time, aiohttp, json, pprint,mydb
import lime_torrent, glodls_torrent, thepiratebay_torrent,x1337_torrent
import nyaasi_torrent, anidex_torrent, nyaapantsu_torrent, evztv_torrent
import galaxy_torrent
from random import randint
torrent_services = [
'thepiratebay_torrent',
'nyaas... | [
"asyncio.get_event_loop",
"random.randint",
"asyncio.sleep",
"time.time",
"pprint.pprint",
"requests.get",
"asyncio.wait"
] | [((741, 754), 'random.randint', 'randint', (['(0)', '(3)'], {}), '(0, 3)\n', (748, 754), False, 'from random import randint\n'), ((794, 830), 'requests.get', 'requests.get', (['url'], {'proxies': 'proxyDict'}), '(url, proxies=proxyDict)\n', (806, 830), False, 'import requests, time, aiohttp, json, pprint, mydb\n'), ((9... |
#Here we can add mutliple files in single Add button
from tkinter.filedialog import *
from tkinter import messagebox
import PyPDF2
from PDFDragDrop import *
#NOTE: WE can move the below CLASS and load_pdf function to another python file and import the things
#NOTE2: I have imported the Drag and Drop functions fro... | [
"PyPDF2.PdfFileReader",
"tkinter.messagebox.askyesno",
"tkinter.messagebox.showerror",
"PyPDF2.PdfFileWriter"
] | [((844, 867), 'PyPDF2.PdfFileReader', 'PyPDF2.PdfFileReader', (['f'], {}), '(f)\n', (864, 867), False, 'import PyPDF2\n'), ((1508, 1530), 'PyPDF2.PdfFileWriter', 'PyPDF2.PdfFileWriter', ([], {}), '()\n', (1528, 1530), False, 'import PyPDF2\n'), ((1950, 2027), 'tkinter.messagebox.askyesno', 'messagebox.askyesno', (['"""... |
"""
Copyright 2014 Sotera Defense Solutions, 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... | [
"datawakeio.data_connector.ExtractedDataConnector.__init__"
] | [((1173, 1210), 'datawakeio.data_connector.ExtractedDataConnector.__init__', 'ExtractedDataConnector.__init__', (['self'], {}), '(self)\n', (1204, 1210), False, 'from datawakeio.data_connector import ExtractedDataConnector\n')] |
#
# Copyright (c) 2017, Massachusetts Institute of Technology All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list o... | [
"subprocess.Popen",
"sys.exec_info",
"os.open",
"sys.stdout.close",
"struct.unpack",
"time.sleep",
"select.select",
"tempfile.mkdtemp",
"sys.stdout.flush"
] | [((1840, 1882), 'struct.unpack', 'struct.unpack', (['"""Iihbbbbbbiiiiiiii"""', 'header'], {}), "('Iihbbbbbbiiiiiiii', header)\n", (1853, 1882), False, 'import struct\n'), ((2567, 2603), 'select.select', 'select.select', (['[fd]', '[]', '[]', 'timeout'], {}), '([fd], [], [], timeout)\n', (2580, 2603), False, 'import sel... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
from numpy.testing import assert_allclose
import pytest
from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.tests.helper import assert_qu... | [
"astropy.tests.helper.assert_quantity_allclose",
"pytest.fixture",
"astropy.utils.data.get_pkg_data_filename",
"astropy.io.fits.getheader",
"astropy.wcs.WCS",
"pytest.mark.skipif",
"numpy.testing.assert_allclose",
"astropy.coordinates.SkyCoord"
] | [((694, 725), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (708, 725), False, 'import pytest\n'), ((752, 801), 'astropy.utils.data.get_pkg_data_filename', 'get_pkg_data_filename', (['"""data/example_header.fits"""'], {}), "('data/example_header.fits')\n", (773, 801), Fals... |
import fresnel
import rowan
from ... import draw
from .FresnelPrimitive import FresnelPrimitiveSolid
class Spheropolygons(FresnelPrimitiveSolid, draw.Spheropolygons):
__doc__ = draw.Spheropolygons.__doc__
def render(self, scene):
geometry = fresnel.geometry.Polygon(
scene=scene,
... | [
"rowan.normalize",
"fresnel.color.linear"
] | [((478, 511), 'fresnel.color.linear', 'fresnel.color.linear', (['self.colors'], {}), '(self.colors)\n', (498, 511), False, 'import fresnel\n'), ((423, 457), 'rowan.normalize', 'rowan.normalize', (['self.orientations'], {}), '(self.orientations)\n', (438, 457), False, 'import rowan\n')] |
from __future__ import division, absolute_import, print_function
import sys
import numpy as np
from numpy.testing import (
TestCase, run_module_suite, assert_, assert_raises,
assert_array_equal
)
class TestTake(TestCase):
def test_simple(self):
a = [[1, 2], [3, 4]]
a_str = [[b'1', b'2'],... | [
"numpy.testing.run_module_suite",
"numpy.testing.assert_raises",
"numpy.testing.assert_array_equal",
"numpy.empty",
"numpy.dtype",
"sys.getrefcount",
"numpy.testing.assert_",
"numpy.arange",
"numpy.array",
"numpy.issubdtype"
] | [((3676, 3694), 'numpy.testing.run_module_suite', 'run_module_suite', ([], {}), '()\n', (3692, 3694), False, 'from numpy.testing import TestCase, run_module_suite, assert_, assert_raises, assert_array_equal\n'), ((2943, 2956), 'numpy.arange', 'np.arange', (['(10)'], {}), '(10)\n', (2952, 2956), True, 'import numpy as n... |
"""Magnetic Module engage command request, result, and implementation models."""
from __future__ import annotations
from typing import Optional, TYPE_CHECKING
from typing_extensions import Literal, Type
from pydantic import BaseModel, Field
from ..command import AbstractCommandImpl, BaseCommand, BaseCommandCreate
... | [
"pydantic.Field"
] | [((676, 809), 'pydantic.Field', 'Field', (['...'], {'description': '"""The ID of the Magnetic Module whose magnets you want to raise, from a prior `loadModule` command."""'}), "(..., description=\n 'The ID of the Magnetic Module whose magnets you want to raise, from a prior `loadModule` command.'\n )\n", (681, 80... |
#!/usr/bin/env python
from __future__ import print_function
import time
import numpy as np
import numpy.linalg as la
import roslib; roslib.load_manifest('team_wpi')
import rospy
from std_msgs.msg import Header
import heapq
import math
from other_toolbox import *
# Import standard priority queue definitions
class Pr... | [
"heapq.heappush",
"math.ceil",
"heapq.heappop",
"time.time",
"roslib.load_manifest"
] | [((133, 165), 'roslib.load_manifest', 'roslib.load_manifest', (['"""team_wpi"""'], {}), "('team_wpi')\n", (153, 165), False, 'import roslib\n'), ((1758, 1769), 'time.time', 'time.time', ([], {}), '()\n', (1767, 1769), False, 'import time\n'), ((497, 544), 'heapq.heappush', 'heapq.heappush', (['self.elements', '(priorit... |
import tensorflow as tf
import numpy as np, h5py
import scipy.io as sio
import sys
import random
import kNN
import re
import os
from numpy import *
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def bias_variable(shape):
initial = tf.constant(0... | [
"numpy.random.shuffle",
"scipy.io.loadmat",
"tensorflow.global_variables_initializer",
"numpy.asarray",
"tensorflow.Session",
"tensorflow.constant",
"tensorflow.placeholder",
"tensorflow.cast",
"tensorflow.Variable",
"numpy.array",
"tensorflow.matmul",
"tensorflow.square",
"tensorflow.nn.l2_... | [((1074, 1119), 'scipy.io.loadmat', 'sio.loadmat', (['"""./data/CUB_data/train_attr.mat"""'], {}), "('./data/CUB_data/train_attr.mat')\n", (1085, 1119), True, 'import scipy.io as sio\n'), ((1124, 1149), 'numpy.array', 'np.array', (["f['train_attr']"], {}), "(f['train_attr'])\n", (1132, 1149), True, 'import numpy as np,... |
from flask import Flask, jsonify
server = Flask(__name__) #flask 객체
movies = [
{
"name": "The Shawshank Redemption",
"casts": ["<NAME>", "<NAME>", "<NAME>", "<NAME>"],
"genres": ["Drama"]
},
{
"name": "The Godfather ",
"casts": ["<NAME>", "<NAME>", "<NAME>", "<NAME>"],
... | [
"flask.jsonify",
"flask.Flask"
] | [((43, 58), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (48, 58), False, 'from flask import Flask, jsonify\n'), ((496, 511), 'flask.jsonify', 'jsonify', (['movies'], {}), '(movies)\n', (503, 511), False, 'from flask import Flask, jsonify\n')] |
import os
import random
import numpy as np
from torch.utils.data import Dataset
from PIL import Image
from utils.cartoongan import smooth_image_edges
class CartoonDataset(Dataset):
def __init__(self, data_dir, src_style='real', tar_style='gongqijun', src_transform=None, tar_transform=None):
self.data_dir ... | [
"random.randint",
"numpy.asarray",
"PIL.Image.fromarray",
"os.path.join",
"numpy.random.shuffle"
] | [((1307, 1339), 'numpy.random.shuffle', 'np.random.shuffle', (['self.src_data'], {}), '(self.src_data)\n', (1324, 1339), True, 'import numpy as np\n'), ((1348, 1380), 'numpy.random.shuffle', 'np.random.shuffle', (['self.tar_data'], {}), '(self.tar_data)\n', (1365, 1380), True, 'import numpy as np\n'), ((3718, 3749), 'P... |
from mhcgnomes import Allele
from nose.tools import eq_
def test_allele_get_A0201():
allele = Allele.get("HLA", "A", "02", "01")
assert allele is not None
assert type(allele) is Allele
eq_(allele.species_prefix, "HLA")
eq_(allele.gene_name, "A")
eq_(list(allele.allele_fields), ["02", "01"])
... | [
"mhcgnomes.Allele.get",
"nose.tools.eq_"
] | [((99, 133), 'mhcgnomes.Allele.get', 'Allele.get', (['"""HLA"""', '"""A"""', '"""02"""', '"""01"""'], {}), "('HLA', 'A', '02', '01')\n", (109, 133), False, 'from mhcgnomes import Allele\n'), ((202, 235), 'nose.tools.eq_', 'eq_', (['allele.species_prefix', '"""HLA"""'], {}), "(allele.species_prefix, 'HLA')\n", (205, 235... |
"""Generic utils."""
import os
import json
import shutil
import numpy as np
from artifice.log import logger
def divup(a, b):
return (a + b - 1) // b
def listwrap(val):
"""Wrap `val` as a list.
:param val: iterable or constant
:returns: `list(val)` if `val` is iterable, else [val]
"""
if isinstance(v... | [
"os.remove",
"artifice.log.logger.info",
"os.path.isdir",
"os.path.exists",
"json.dumps",
"os.path.isfile",
"shutil.rmtree"
] | [((1864, 1884), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (1878, 1884), False, 'import os\n'), ((2012, 2043), 'artifice.log.logger.info', 'logger.info', (['f"""removed {path}."""'], {}), "(f'removed {path}.')\n", (2023, 2043), False, 'from artifice.log import logger\n'), ((1826, 1846), 'os.path.ex... |
import asyncio
import logging
from time import sleep
from learn_asyncio import configure_logging
def non_awaitable_io_bound_function(task_id: int, seconds: int):
logging.info("Task %d started", task_id)
sleep(seconds)
logging.info("Task %d done", task_id)
return f"result from Task {task_id}"
async ... | [
"logging.error",
"learn_asyncio.configure_logging",
"time.sleep",
"logging.info",
"asyncio.to_thread"
] | [((1566, 1585), 'learn_asyncio.configure_logging', 'configure_logging', ([], {}), '()\n', (1583, 1585), False, 'from learn_asyncio import configure_logging\n'), ((169, 209), 'logging.info', 'logging.info', (['"""Task %d started"""', 'task_id'], {}), "('Task %d started', task_id)\n", (181, 209), False, 'import logging\n... |
import numpy as np
import re
from hls4ml.model.optimizer import OptimizerPass
from hls4ml.model.hls_model import Conv1D, Conv2D, register_layer
from hls4ml.templates import templates
class PointwiseConv1D(Conv1D):
''' Optimized Conv1D implementation for 1x1 kernels. '''
# Nothing to do, will pick up function... | [
"hls4ml.templates.templates.get_backend",
"hls4ml.model.hls_model.register_layer"
] | [((1041, 1091), 'hls4ml.model.hls_model.register_layer', 'register_layer', (['"""PointwiseConv1D"""', 'PointwiseConv1D'], {}), "('PointwiseConv1D', PointwiseConv1D)\n", (1055, 1091), False, 'from hls4ml.model.hls_model import Conv1D, Conv2D, register_layer\n'), ((1092, 1142), 'hls4ml.model.hls_model.register_layer', 'r... |
"""
Script calculates the mean January-April sea ice extent for the Bering Sea
over the 1850 to 2018 period and 1979-2018 period
Notes
-----
Author : <NAME>
Date : 24 March 2019
"""
### Import modules
import numpy as np
import matplotlib.pyplot as plt
import datetime
import scipy.stats as sts
### Define di... | [
"numpy.savetxt",
"numpy.genfromtxt",
"scipy.stats.pearsonr",
"numpy.isnan",
"numpy.arange",
"numpy.round",
"datetime.datetime.now"
] | [((441, 464), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (462, 464), False, 'import datetime\n'), ((749, 777), 'numpy.arange', 'np.arange', (['(1850)', '(2018 + 1)', '(1)'], {}), '(1850, 2018 + 1, 1)\n', (758, 777), True, 'import numpy as np\n'), ((784, 812), 'numpy.arange', 'np.arange', (['(19... |
"""Configures pytest (beyond the ini file)."""
import matplotlib as mpl
import numpy
import pytest
from matplotlib import pyplot as plt
from dapper.dpr_config import rc
@pytest.fixture(autouse=True)
def add_sci(doctest_namespace):
"""Add numpy as np for doctests."""
doctest_namespace["np"] = numpy
doctes... | [
"pytest.fixture"
] | [((173, 201), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (187, 201), False, 'import pytest\n')] |
import os
import time
import numpy as np
# from IPython import embed
print("perform experiments on amazoncat 13K (multilabel)")
leaf_example_multiplier = 2
lr = 1
bits = 30
alpha = 0.1 # 0.3
passes = 4
learn_at_leaf = True
use_oas = True
# num_queries = 1 #does not really use
dream_at_update = 1
# hal_version = 1 #... | [
"numpy.log",
"os.path.exists",
"os.system",
"time.time"
] | [((971, 982), 'time.time', 'time.time', ([], {}), '()\n', (980, 982), False, 'import time\n'), ((1471, 1494), 'os.system', 'os.system', (['command_line'], {}), '(command_line)\n', (1480, 1494), False, 'import os\n'), ((1560, 1571), 'time.time', 'time.time', ([], {}), '()\n', (1569, 1571), False, 'import time\n'), ((651... |
"""
The things we need to do using SSH
"""
import os
import time
from fabric import Connection
class ssh:
"""
ssh connection
"""
def __init__(self, ip, username, password):
self.ip = ip
self.username = username
self.password = password
pass
def execute(self,... | [
"fabric.Connection",
"time.sleep"
] | [((744, 757), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (754, 757), False, 'import time\n'), ((1273, 1286), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (1283, 1286), False, 'import time\n'), ((438, 516), 'fabric.Connection', 'Connection', (['self.ip', 'self.username'], {'connect_kwargs': "{'password',... |
# -*- coding: utf-8 -*-
'''
Author: TJUZQC
Date: 2020-10-25 13:07:30
LastEditors: TJUZQC
LastEditTime: 2020-11-20 19:21:52
Description: None
'''
import torch
import torch.nn as nn
from .modules import *
"""
Recurrent U-Net
"""
class R2U_Net(nn.Module):
def __init__(self, n_channels=3, n_classes=1, t=2, bilinear... | [
"torch.nn.MaxPool2d",
"torch.nn.Upsample",
"torch.nn.Conv2d",
"torch.cat"
] | [((497, 534), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', ([], {'kernel_size': '(2)', 'stride': '(2)'}), '(kernel_size=2, stride=2)\n', (509, 534), True, 'import torch.nn as nn\n'), ((559, 586), 'torch.nn.Upsample', 'nn.Upsample', ([], {'scale_factor': '(2)'}), '(scale_factor=2)\n', (570, 586), True, 'import torch.nn as nn\n... |
class Fetcher(object):
def fetch_addr(self, ref, app, facilities, auto_extract=False):
from caty.util.path import is_mafs_path
from caty.core.command import VarStorage
from caty.core.command.param import Option, Argument
from caty.core.script.interpreter.executor import CommandExecu... | [
"caty.core.exception.throw_caty_exception",
"caty.jsontools.untagged",
"caty.core.command.VarStorage",
"caty.core.script.builder.CommandBuilder",
"caty.core.command.param.Argument",
"caty.core.script.interpreter.executor.CommandExecutor"
] | [((613, 631), 'caty.jsontools.untagged', 'json.untagged', (['ref'], {}), '(ref)\n', (626, 631), True, 'import caty.jsontools as json\n'), ((1247, 1277), 'caty.core.script.builder.CommandBuilder', 'CommandBuilder', (['facilities', '{}'], {}), '(facilities, {})\n', (1261, 1277), False, 'from caty.core.script.builder impo... |
# Generated by Django 3.1.2 on 2020-11-18 01:33
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('zonas', '0003_grupozona_zonaengrupo'),
]
operations = [
migrations.AlterUniqueTogether(
name='zonaengrupo',
unique_together=... | [
"django.db.migrations.AlterUniqueTogether"
] | [((228, 320), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""zonaengrupo"""', 'unique_together': "{('grupo', 'zona')}"}), "(name='zonaengrupo', unique_together={(\n 'grupo', 'zona')})\n", (258, 320), False, 'from django.db import migrations\n')] |
# Generated by Django 3.1 on 2020-08-08 12:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('retro_news', '0002_blogarticle'),
]
operations = [
migrations.RemoveField(
model_name='blogarticle',
name='date_create... | [
"django.db.migrations.RemoveField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((229, 298), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""blogarticle"""', 'name': '"""date_created"""'}), "(model_name='blogarticle', name='date_created')\n", (251, 298), False, 'from django.db import migrations, models\n'), ((448, 483), 'django.db.models.DateTimeField', 'mode... |
#-*- coding:utf-8 _*-
"""
@author:charlesXu
@file: urls.py
@desc: 接口url
@time: 2019/05/10
"""
# ===============
#
# apis 下面的路由
#
# ===============
from django.urls import path
from Chatbot_Rest.Api.intent_detection.intent_rest_controller import intent_controller
from Chatbot_Rest.Api.info_extraction.entity_e... | [
"django.urls.path"
] | [((705, 742), 'django.urls.path', 'path', (['"""entity"""', 'entity_ext_controller'], {}), "('entity', entity_ext_controller)\n", (709, 742), False, 'from django.urls import path\n'), ((755, 788), 'django.urls.path', 'path', (['"""intent"""', 'intent_controller'], {}), "('intent', intent_controller)\n", (759, 788), Fal... |
import os
import re
import subprocess
from mgstest import require_apache_modules, require_match
from unittest import SkipTest
def prepare_env():
require_apache_modules('mod_http2.so')
curl = os.environ['HTTP_CLI']
if curl == 'no':
raise SkipTest('curl not found!')
proc = subprocess.run([curl, ... | [
"subprocess.run",
"mgstest.require_apache_modules",
"unittest.SkipTest",
"re.search",
"re.compile"
] | [((151, 189), 'mgstest.require_apache_modules', 'require_apache_modules', (['"""mod_http2.so"""'], {}), "('mod_http2.so')\n", (173, 189), False, 'from mgstest import require_apache_modules, require_match\n'), ((298, 373), 'subprocess.run', 'subprocess.run', (["[curl, '-V']"], {'stdout': 'subprocess.PIPE', 'check': '(Tr... |
# Generated by Django 2.1 on 2018-09-11 23:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_app', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='users',
name='portfolio_picture',
... | [
"django.db.models.ImageField"
] | [((336, 436), 'django.db.models.ImageField', 'models.ImageField', ([], {'blank': '(True)', 'default': '"""media/images/defaultuser.png"""', 'upload_to': '"""media/images/"""'}), "(blank=True, default='media/images/defaultuser.png',\n upload_to='media/images/')\n", (353, 436), False, 'from django.db import migrations... |
from django.test import TestCase
from django.contrib.auth.models import User
from tastypie.test import ResourceTestCaseMixin
from tastypie.models import ApiKey
import json
# Create your tests here.
class Resourcetest(ResourceTestCaseMixin, TestCase):
def setUp(self):
super().setUp()
user = User.obj... | [
"tastypie.models.ApiKey.objects.create",
"django.contrib.auth.models.User.objects.create_user"
] | [((312, 377), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', (['"""api_client_1"""', '"""<EMAIL>"""', '"""<PASSWORD>"""'], {}), "('api_client_1', '<EMAIL>', '<PASSWORD>')\n", (336, 377), False, 'from django.contrib.auth.models import User\n'), ((463, 508), 'tastypie.models.ApiKey.obj... |
import pytest
from pytest import raises
from vyper import compiler
from vyper.exceptions import SyntaxException, TypeMismatch
fail_list = [
("""
@public
def foo():
x: bytes[9] = raw_call(0x1234567890123456789012345678901234567890, b"cow", outsize=4, outsize=9)
""", SyntaxException),
"""
@public
def fo... | [
"pytest.mark.parametrize",
"pytest.raises",
"vyper.compiler.compile_code"
] | [((649, 695), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""bad_code"""', 'fail_list'], {}), "('bad_code', fail_list)\n", (672, 695), False, 'import pytest\n'), ((1643, 1691), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""good_code"""', 'valid_list'], {}), "('good_code', valid_list)\n", (166... |
import numpy as np
import pandas as pd
from sklearn.ensemble import ExtraTreesRegressor
from sklearn.pipeline import make_pipeline, make_union
from sklearn.preprocessing import Binarizer, MinMaxScaler
from sklearn.tree import DecisionTreeRegressor
from tpot.builtins import StackingEstimator, ZeroCount
from tpot.export_... | [
"tpot.builtins.ZeroCount",
"metstab_shap.config.parse_task_config",
"metstab_shap.config.parse_data_config",
"tpot.export_utils.set_param_recursive",
"sklearn.tree.DecisionTreeRegressor",
"sklearn.preprocessing.MinMaxScaler",
"sklearn.ensemble.ExtraTreesRegressor",
"metstab_shap.data.load_data",
"sk... | [((616, 657), 'metstab_shap.config.parse_data_config', 'parse_data_config', (['"""configs/data/rat.cfg"""'], {}), "('configs/data/rat.cfg')\n", (633, 657), False, 'from metstab_shap.config import parse_data_config, parse_representation_config, parse_task_config\n'), ((669, 722), 'metstab_shap.config.parse_representatio... |
import bs4
import click
import logging
import requests
from utils.now import now
from request_with_fake_headers import request_with_fake_headers
# from crawl_none_category import crawl_none_category_dictionary
from utils.soup_library import (
crawl_from_internals,
get_a_soup_of_difference,
get_external_url... | [
"utils.url_library.is_internal_url",
"click.option",
"click.echo",
"utils.soup_library.get_a_soup_of_difference",
"urllib.parse.urlparse",
"logging.error",
"logging.warning",
"request_with_fake_headers.request_with_fake_headers",
"click.command",
"utils.url_library.validate_url",
"utils.soup_lib... | [((738, 839), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""crawl.log"""', 'level': 'logging.DEBUG', 'format': '"""%(asctime)s %(message)s"""'}), "(filename='crawl.log', level=logging.DEBUG, format=\n '%(asctime)s %(message)s')\n", (757, 839), False, 'import logging\n'), ((10442, 10457), 'click... |
from django.db import models
from django.contrib.auth.models import User
from ckeditor.fields import RichTextField
import uuid
#This needs to be shareable
class Mumble(models.Model):
parent =models.ForeignKey("self", on_delete=models.CASCADE, null=True, blank=True)
#For re-mumble (Share) functionality
rem... | [
"django.db.models.ManyToManyField",
"django.db.models.UUIDField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.ImageField",
"django.db.models.IntegerField",
"ckeditor.fields.RichTextField",
"django.db.models.DateTimeField"
] | [((197, 271), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""self"""'], {'on_delete': 'models.CASCADE', 'null': '(True)', 'blank': '(True)'}), "('self', on_delete=models.CASCADE, null=True, blank=True)\n", (214, 271), False, 'from django.db import models\n'), ((328, 433), 'django.db.models.ForeignKey', 'mode... |
import random
import sys
import heapq
from typing import Callable, Iterator, List, Tuple, Any, Optional, TYPE_CHECKING
import numpy as np
if TYPE_CHECKING:
import pandas
import pyarrow
from ray.data.impl.sort import SortKeyT
from ray.data.aggregate import AggregateFn
from ray.data.block import (
Bloc... | [
"pandas.DataFrame",
"random.sample",
"random.shuffle",
"numpy.random.RandomState",
"ray.data.impl.size_estimator.SizeEstimator",
"numpy.array",
"sys.getsizeof",
"ray.data.block.BlockExecStats.builder"
] | [((667, 682), 'ray.data.impl.size_estimator.SizeEstimator', 'SizeEstimator', ([], {}), '()\n', (680, 682), False, 'from ray.data.impl.size_estimator import SizeEstimator\n'), ((1746, 1780), 'numpy.random.RandomState', 'np.random.RandomState', (['random_seed'], {}), '(random_seed)\n', (1767, 1780), True, 'import numpy a... |
# -*- coding:utf-8 -*-
from preprocessing import Tokenizer
import random
import csv
import json
import numpy as np
import sentencepiece as spm
from konlpy.tag import Okt
import torch
from torch.utils.data import Dataset, DataLoader
class BertLMDataset(Dataset):
def __init__(self, dataset, token... | [
"numpy.zeros_like",
"json.load",
"torch.utils.data.DataLoader",
"torch.LongTensor",
"random.shuffle",
"random.choice",
"numpy.array",
"torch.from_numpy"
] | [((4787, 4835), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset'], {'batch_size': '(1)', 'shuffle': '(False)'}), '(dataset, batch_size=1, shuffle=False)\n', (4797, 4835), False, 'from torch.utils.data import Dataset, DataLoader\n'), ((974, 1005), 'torch.LongTensor', 'torch.LongTensor', (['masked_tokens'], {}), ... |
# 자작 문제풀이
# Question number. 004
# Author: <NAME>
# Github name: zao95
# ========== Question ==========
# 철수는 현재 아래 지도에서 좌상단에 위치하고 있다.
# 철수는 지금부터 우하단에 위치한 집을 향해 가는데,
# 최단거리로 가는 전제하에 가는 길의 숫자와 연산자로 계산하면서 간다면,
# 최소값과 최대값은 얼마이고, 그 길은 어떤 길인가?
# route_map = [
# ['1', '-', '2', '-', '5', ],
# ['-', '4', '*', '8', '... | [
"modules.mq004_module.route_change"
] | [((997, 1055), 'modules.mq004_module.route_change', 'mq004_module.route_change', (['move_sequence', 'move_count', 'j', 'k'], {}), '(move_sequence, move_count, j, k)\n', (1022, 1055), False, 'from modules import mq004_module\n')] |
from collections import defaultdict
from typing import Dict, List, Type
from pydantic import BaseModel
from typing_extensions import Literal
from ...models import DOCUMENT_CLASSIFICATION, SEQ2SEQ, SEQUENCE_LABELING
from . import examples
encodings = Literal[
'Auto',
'ascii',
'big5',
'big5hkscs',
... | [
"collections.defaultdict"
] | [((3173, 3190), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (3184, 3190), False, 'from collections import defaultdict\n')] |
from fastapi import FastAPI, Request, HTTPException
from fastapi.staticfiles import StaticFiles
from fastapi.responses import HTMLResponse
from bson import ObjectId
from datetime import datetime as dt
from .router import router as api_router
from .router import templates
app = FastAPI()
app.mount("/static", StaticFil... | [
"fastapi.staticfiles.StaticFiles",
"fastapi.HTTPException",
"datetime.datetime.strptime",
"bson.ObjectId",
"fastapi.FastAPI"
] | [((280, 289), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (287, 289), False, 'from fastapi import FastAPI, Request, HTTPException\n'), ((311, 342), 'fastapi.staticfiles.StaticFiles', 'StaticFiles', ([], {'directory': '"""static"""'}), "(directory='static')\n", (322, 342), False, 'from fastapi.staticfiles import Sta... |
#! /usr/bin/env python
"""
This tool combines results from the dna_pipeline.py and/or rna_pipeline.py
to create an unified table with all the variants (filtered) and their epitopes (for each effect).
The table contains useful information for post-analysis.
@author: <NAME> <<EMAIL>>
"""
import statistics
from argparse ... | [
"os.path.abspath",
"argparse.ArgumentParser",
"pandas.read_csv",
"collections.defaultdict",
"sys.stderr.write",
"sys.exit"
] | [((1602, 1619), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1613, 1619), False, 'from collections import defaultdict\n'), ((3499, 3517), 'collections.defaultdict', 'defaultdict', (['float'], {}), '(float)\n', (3510, 3517), False, 'from collections import defaultdict\n'), ((10021, 10106), 'arg... |
import pytest
from scipy.sparse import csr_matrix
from FasterSpMV.cuda_spmv import *
from FasterSpMV.matrix_tools import *
def test_spmv():
# define matrix parameters
n_row = n_col = 10
slice_height = 2
# generate a sparse matrix fill with random value
sp_matrix, nnz_count, row_max_nnz = random_... | [
"scipy.sparse.csr_matrix",
"pytest.approx"
] | [((778, 845), 'scipy.sparse.csr_matrix', 'csr_matrix', (['(csr_val, csr_colidx, csr_rowptr)'], {'shape': '(n_row, n_col)'}), '((csr_val, csr_colidx, csr_rowptr), shape=(n_row, n_col))\n', (788, 845), False, 'from scipy.sparse import csr_matrix\n'), ((2200, 2242), 'pytest.approx', 'pytest.approx', (['csr_y'], {'rel': '(... |
import configparser
import psycopg2
from sql_queries import create_table_queries, drop_table_queries#, copy_table_queries, insert_table_queries
def get_queryName(query, searchTermStart='from', searchTermEnd=' ', toLower=True):
'''
Retrieve table name being processed
Parameters
----------
query : s... | [
"configparser.ConfigParser"
] | [((2816, 2843), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (2841, 2843), False, 'import configparser\n')] |
# -*- coding: utf-8 -*-
'''
Managing software RAID with mdadm
==================================
A state module for creating or destroying software RAID devices.
.. code-block:: yaml
/dev/md0:
raid.present:
- level: 5
- devices:
- /dev/xvdd
- /dev/xvde
- /dev/x... | [
"logging.getLogger"
] | [((545, 572), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (562, 572), False, 'import logging\n')] |
import os
from datetime import datetime
from typing import List
import redis
from rq import Connection, Worker
class NBWorker(Worker):
"""Extensions of the default Worker class to set ip_address"""
def set_ip_address(self, ip_address):
self.ip_address = ip_address
def inactive_time(self):
... | [
"datetime.datetime.utcnow",
"redis.from_url",
"rq.Connection",
"os.getpid"
] | [((649, 674), 'redis.from_url', 'redis.from_url', (['redis_dsn'], {}), '(redis_dsn)\n', (663, 674), False, 'import redis\n'), ((685, 696), 'os.getpid', 'os.getpid', ([], {}), '()\n', (694, 696), False, 'import os\n'), ((447, 464), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (462, 464), False, 'from... |
import re
import csv
types = ['CS',
'SS',
'ALLOY',
'PPL',
'TITANIUM',
'HASTELLOY',
'CORTEN',
'ALUMINUM',
'COPPER',
'BRONZE',
'IRON',
'GS',
'BURNING BARS',
'SX',
'COAL',
'BRICK',
... | [
"csv.reader",
"re.search"
] | [((654, 674), 're.search', 're.search', (['"""\\\\d"""', 'lm'], {}), "('\\\\d', lm)\n", (663, 674), False, 'import re\n'), ((1042, 1076), 'csv.reader', 'csv.reader', (['f'], {'dialect': '"""excel-tab"""'}), "(f, dialect='excel-tab')\n", (1052, 1076), False, 'import csv\n')] |
import numpy as np
import tensorflow as tf
import pandas as pd
import matplotlib.pyplot as plt
# First we load the entire CSV file into an m x n matrix
D = np.matrix(pd.read_csv("linreg-scaling-synthetic.csv", header=None).values)
# Make a convenient variable to remember the number of input columns
n = 2
# We extrac... | [
"tensorflow.reduce_sum",
"tensorflow.global_variables_initializer",
"pandas.read_csv",
"tensorflow.Session",
"tensorflow.placeholder",
"tensorflow.matmul",
"tensorflow.train.AdamOptimizer",
"tensorflow.get_variable"
] | [((704, 747), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '(n, None)'}), '(tf.float32, shape=(n, None))\n', (718, 747), True, 'import tensorflow as tf\n'), ((752, 795), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '(1, None)'}), '(tf.float32, shape=(1, None))\n', (76... |
import http
from typing import List, Optional
from fastapi import APIRouter, Depends, Query
from app.dependencies import get_current_user
from app.models.user import User
from app.schemas.stars import StarCreateSchema, StarSchema
from app.services.stars import create_star, delete_star, get_stars
router = APIRouter()... | [
"app.services.stars.delete_star",
"app.services.stars.get_stars",
"fastapi.Query",
"app.services.stars.create_star",
"fastapi.Depends",
"fastapi.APIRouter"
] | [((309, 320), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (318, 320), False, 'from fastapi import APIRouter, Depends, Query\n'), ((551, 576), 'fastapi.Depends', 'Depends', (['get_current_user'], {}), '(get_current_user)\n', (558, 576), False, 'from fastapi import APIRouter, Depends, Query\n'), ((815, 840), 'fas... |
# -*- coding: utf-8 -*-
"""Standard sequence-to-sequence model."""
import six
import tensorflow as tf
from opennmt import constants
from opennmt import inputters
from opennmt import layers
from opennmt.layers import noise
from opennmt.layers import reducer
from opennmt.models.model import Model
from opennmt.utils ... | [
"opennmt.utils.misc.shape_list",
"tensorflow.contrib.seq2seq.tile_batch",
"opennmt.utils.misc.merge_dict",
"tensorflow.reduce_sum",
"opennmt.layers.noise.WordNoiser",
"tensorflow.gather_nd",
"tensorflow.logging.warning",
"tensorflow.reshape",
"tensorflow.get_variable_scope",
"tensorflow.string_spl... | [((1332, 1394), 'tensorflow.constant', 'tf.constant', (['[constants.START_OF_SENTENCE_ID]'], {'dtype': 'ids.dtype'}), '([constants.START_OF_SENTENCE_ID], dtype=ids.dtype)\n', (1343, 1394), True, 'import tensorflow as tf\n'), ((1403, 1463), 'tensorflow.constant', 'tf.constant', (['[constants.END_OF_SENTENCE_ID]'], {'dty... |
#!/usr/bin/env python
"""
setup the disperion database file structure and configuration file
"""
import os
import tempfile
import numpy as np
from dispersion import Material, Writer, Interpolation, Catalogue
from dispersion.config import default_config, write_config
def get_root_dir(conf):
"""
get the root dir... | [
"os.mkdir",
"tempfile.TemporaryDirectory",
"dispersion.Material",
"dispersion.Writer",
"os.path.isdir",
"dispersion.config.default_config",
"dispersion.config.write_config",
"dispersion.Interpolation",
"numpy.array",
"git.Repo.clone_from",
"dispersion.Catalogue",
"os.path.join"
] | [((3971, 4062), 'numpy.array', 'np.array', (['[[400.0, 1.7, 0.1], [500.0, 1.6, 0.05], [600.0, 1.5, 0.0], [700.0, 1.4, 0.0]]'], {}), '([[400.0, 1.7, 0.1], [500.0, 1.6, 0.05], [600.0, 1.5, 0.0], [700.0,\n 1.4, 0.0]])\n', (3979, 4062), True, 'import numpy as np\n'), ((4143, 4221), 'dispersion.Material', 'Material', ([]... |
import os
import math
import torch
from torch import nn, optim
import logging
import numpy as np
import torch.nn.functional as F
from torch.autograd import Variable
import utils
from contrastqg import (T5ForConditionalGeneration)
logger = logging.getLogger()
class QGenerator(object):
def __init__(self, args, toke... | [
"torch.load",
"contrastqg.T5ForConditionalGeneration.from_pretrained",
"torch.nn.DataParallel",
"utils.select_gen_input_refactor",
"logging.getLogger"
] | [((240, 259), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (257, 259), False, 'import logging\n'), ((351, 423), 'contrastqg.T5ForConditionalGeneration.from_pretrained', 'T5ForConditionalGeneration.from_pretrained', (['args.pretrain_generator_type'], {}), '(args.pretrain_generator_type)\n', (393, 423), Fa... |
import sys
sys.path.append("utils")
sys.path.append("models")
from file_io import *
from train_utils import *
import numpy as np
import pandas as pd
import matplotlib as mp
import matplotlib.pyplot as plt
import time
from test import init_test
from pathlib import Path
import torch
from torch.utils.data import Datase... | [
"sys.path.append",
"torch.no_grad",
"os.makedirs",
"numpy.zeros",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"time.time",
"dataloaders.get_double_scan_v1_loader",
"random_word.RandomWords",
"torch.utils.tensorboard.SummaryWriter",
"test.init_test",
"os.path.join",
"os.listdir",
"torch.ten... | [((11, 35), 'sys.path.append', 'sys.path.append', (['"""utils"""'], {}), "('utils')\n", (26, 35), False, 'import sys\n'), ((36, 61), 'sys.path.append', 'sys.path.append', (['"""models"""'], {}), "('models')\n", (51, 61), False, 'import sys\n'), ((1356, 1373), 'numpy.zeros', 'np.zeros', (['classes'], {}), '(classes)\n',... |
import logging
import datetime
import base64
import uuid
import os
from datetime import datetime, timedelta
from django import forms
from django.core.files.base import ContentFile
from django.forms import modelformset_factory
from django.forms.formsets import BaseFormSet
from django.contrib.auth.models import User
fro... | [
"nadine.models.organization.OrganizationMember",
"nadine.models.membership.SubscriptionDefault",
"nadine.models.usage.CoworkingDay.objects.filter",
"django.forms.EmailField",
"nadine.models.resource.Room.objects.get",
"django.forms.FloatField",
"django.contrib.auth.models.User",
"django.contrib.auth.m... | [((1288, 1315), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1305, 1315), False, 'import logging\n'), ((1422, 1439), 'django.forms.DateField', 'forms.DateField', ([], {}), '()\n', (1437, 1439), False, 'from django import forms\n'), ((1450, 1467), 'django.forms.DateField', 'forms.DateFi... |
import pymc as pm
#import numpy as np
import matplotlib.pyplot as plt
np.set_printoptions(precision=3, suppress=True)
c_data = np.genfromtxt("d:/data/challenger_data.csv", skip_header=1, usecols=[1,2], missing_values='NA', delimiter=',')
c_data = c_data[~np.isnan(c_data[:,1])]
print("TEMP, O-RING failure?")
print(c_da... | [
"pymc.MAP",
"pymc.Model",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"pymc.MCMC",
"pymc.Bernoulli",
"pymc.Normal"
] | [((531, 543), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (541, 543), True, 'import matplotlib.pyplot as plt\n'), ((685, 721), 'pymc.Normal', 'pm.Normal', (['"""beta"""', '(0)', '(0.001)'], {'value': '(0)'}), "('beta', 0, 0.001, value=0)\n", (694, 721), True, 'import pymc as pm\n'), ((730, 767), 'pymc.N... |
from math import cos, sin, tan, radians
an = int(input('Digite um ângulo: '))
s = sin(radians(an))
c = cos(radians(an))
t = tan(radians(an))
print('o valor do seno é:{:.2f} \n o valor do cosseno é: {:.2f} \n o valor da tangente é: {:.2f} '.format(s, c, t))
| [
"math.radians"
] | [((86, 97), 'math.radians', 'radians', (['an'], {}), '(an)\n', (93, 97), False, 'from math import cos, sin, tan, radians\n'), ((107, 118), 'math.radians', 'radians', (['an'], {}), '(an)\n', (114, 118), False, 'from math import cos, sin, tan, radians\n'), ((128, 139), 'math.radians', 'radians', (['an'], {}), '(an)\n', (... |
"""
"""
import os
file_name = "exercise10"
result_fle_name = "exercise10-result"
result = []
# Obtenemos la ruta absoluta del directorio en el que estamos trabajando
script_directory = os.path.dirname(__file__)
def get_file_content():
try:
file_path = f"{script_directory}/{file_name}.txt"
return ... | [
"os.path.dirname"
] | [((188, 213), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (203, 213), False, 'import os\n')] |
import unittest
def return_42():
return 42
def raise_exception():
raise Exception("This is exception!")
class TestUnittest(unittest.TestCase):
def test_assert_equal(self):
self.assertEqual(return_42(), 42)
def test_assert_true(self):
boolean_list = [False, False, True]
self.a... | [
"unittest.main"
] | [((616, 631), 'unittest.main', 'unittest.main', ([], {}), '()\n', (629, 631), False, 'import unittest\n')] |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import multiprocessing
import numpy as np
import time
from common.pilot_gloval_variable import MPVariable
from planning import pure_pursuit
class MPPlanning():
def __init__(self, cfg):
self.__m = multiprocessing.Process(target=self.__process, \
... | [
"multiprocessing.Process",
"traceback.print_exc",
"planning.pure_pursuit.pure_pursuit",
"time.time"
] | [((255, 340), 'multiprocessing.Process', 'multiprocessing.Process', ([], {'target': 'self.__process', 'args': "(cfg['planning_interval'],)"}), "(target=self.__process, args=(cfg['planning_interval'],)\n )\n", (278, 340), False, 'import multiprocessing\n'), ((646, 657), 'time.time', 'time.time', ([], {}), '()\n', (65... |
import time
import datetime
import sys
import getopt, argparse
from collections import defaultdict
import unicodedata
import operator
import json
import unicodecsv
def remove_control_characters(s):
return "".join(ch for ch in s if unicodedata.category(ch)[0]!="C")
def stripped(x):
return "".join([i for i in x... | [
"json.loads",
"argparse.ArgumentParser",
"unicodecsv.DictWriter",
"unicodedata.category",
"json.dumps",
"collections.defaultdict",
"operator.itemgetter"
] | [((354, 414), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""combine_item_data_sources.py"""'}), "(prog='combine_item_data_sources.py')\n", (377, 414), False, 'import getopt, argparse\n'), ((1752, 1784), 'json.dumps', 'json.dumps', (['topj'], {'sort_keys': '(True)'}), '(topj, sort_keys=True)\n'... |
from ExcelGenerator import ExcelGenerator
import os
class DirectoryExplore:
def __init__(self, directory_path):
self.directory_path = directory_path
def patse_directory(self, file_name):
excel_generator = ExcelGenerator(file_name)
browse_count = 0
directory_count = 0
fo... | [
"ExcelGenerator.ExcelGenerator",
"os.walk",
"os.path.join"
] | [((231, 256), 'ExcelGenerator.ExcelGenerator', 'ExcelGenerator', (['file_name'], {}), '(file_name)\n', (245, 256), False, 'from ExcelGenerator import ExcelGenerator\n'), ((365, 393), 'os.walk', 'os.walk', (['self.directory_path'], {}), '(self.directory_path)\n', (372, 393), False, 'import os\n'), ((1296, 1333), 'os.pat... |
from utils import get_contract_from_blockchain
from compiler import compile_into_ast
from analyze import analyze_ast
import argparse
import json
parser = argparse.ArgumentParser(description="Analyze Tacos")
parser.add_argument("--get-file", help="Use a local file path to analyze")
parser.add_argument("--get-... | [
"analyze.analyze_ast",
"compiler.compile_into_ast",
"argparse.ArgumentParser",
"utils.get_contract_from_blockchain"
] | [((163, 215), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Analyze Tacos"""'}), "(description='Analyze Tacos')\n", (186, 215), False, 'import argparse\n'), ((900, 926), 'compiler.compile_into_ast', 'compile_into_ast', (['src_path'], {}), '(src_path)\n', (916, 926), False, 'from compile... |
import argparse
from timeit import default_timer as timer
import numpy as np
import tensorflow as tf
import tbpf_tf
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--degree", help="Degree of polynomial features", default=2, type=int)
parser.add_argument("-i", "--iterations", help="Number of iterations ... | [
"numpy.sum",
"argparse.ArgumentParser",
"tensorflow.random.normal",
"timeit.default_timer",
"numpy.savetxt",
"tensorflow.concat",
"tensorflow.config.experimental.set_memory_growth",
"numpy.min",
"numpy.mean",
"numpy.max",
"tbpf_tf.mask_matrix",
"tensorflow.config.experimental.list_logical_devi... | [((128, 153), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (151, 153), False, 'import argparse\n'), ((679, 730), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (723, 730), True, 'import tensorflow as tf... |
import numpy as np
def pdist(source_mtx, target_mtx):
distance_matrix = -2 * source_mtx.dot(target_mtx.transpose()) \
+ (source_mtx ** 2).sum(axis=1).reshape(-1, 1) \
+ (target_mtx ** 2).sum(axis=1).reshape(1, -1)
return distance_matrix
def get_acc(query_emb, quer... | [
"numpy.sum",
"numpy.zeros",
"numpy.argsort",
"numpy.mean",
"numpy.where"
] | [((2160, 2180), 'numpy.mean', 'np.mean', (['self.values'], {}), '(self.values)\n', (2167, 2180), True, 'import numpy as np\n'), ((2409, 2466), 'numpy.zeros', 'np.zeros', (['(self.data_num, self.vec_dim)'], {'dtype': 'np.float16'}), '((self.data_num, self.vec_dim), dtype=np.float16)\n', (2417, 2466), True, 'import numpy... |
import sys
import geopandas as gpd
import pandas as pd
SITE_ID = "SiteFunctionalLocation"
PROPERTIES_TO_RETAIN_GRID_AND_PRIMARY = [
"SiteName",
SITE_ID,
"SiteVoltage",
"Total_Generation",
]
PROPERTIES_TO_RETAIN_HEADROOM = [SITE_ID, "Headroom"]
CURRENT_YEAR = 2021
DNO_UKPN = "UKPN"
def main():
... | [
"pandas.read_csv",
"geopandas.GeoDataFrame",
"geopandas.points_from_xy"
] | [((461, 506), 'pandas.read_csv', 'pd.read_csv', (['grid_and_primary_sites_file_name'], {}), '(grid_and_primary_sites_file_name)\n', (472, 506), True, 'import pandas as pd\n'), ((548, 588), 'pandas.read_csv', 'pd.read_csv', (['headroom_capacity_file_name'], {}), '(headroom_capacity_file_name)\n', (559, 588), True, 'impo... |
#!/pxrpythonsubst
#
# Copyright 2021 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
... | [
"unittest.main",
"pxr.Pcp.LayerStackIdentifier",
"os.path.dirname",
"pxr.Plug.Registry",
"pxr.Sdf.Layer.GetLoadedLayers",
"pxr.Sdf.Layer.FindOrOpen",
"pxr.Pcp._TestChangeProcessor"
] | [((3357, 3372), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3370, 3372), False, 'import os, unittest\n'), ((2231, 2287), 'pxr.Sdf.Layer.FindOrOpen', 'Sdf.Layer.FindOrOpen', (['"""root.testpcpstreaminglayerreload"""'], {}), "('root.testpcpstreaminglayerreload')\n", (2251, 2287), False, 'from pxr import Sdf, Pcp... |
from django import template
from django.conf import settings
from pettycash.models import PettycashBalanceCache
from django.core.exceptions import ObjectDoesNotExist
from django.utils import timezone
from datetime import datetime, timedelta
register = template.Library()
@register.filter(name="has_group")
def has_gr... | [
"django.template.Library",
"datetime.datetime.now",
"datetime.timedelta",
"pettycash.models.PettycashBalanceCache.objects.get"
] | [((254, 272), 'django.template.Library', 'template.Library', ([], {}), '()\n', (270, 272), False, 'from django import template\n'), ((1002, 1047), 'pettycash.models.PettycashBalanceCache.objects.get', 'PettycashBalanceCache.objects.get', ([], {'owner': 'user'}), '(owner=user)\n', (1035, 1047), False, 'from pettycash.mo... |
import logging
import numpy as np
from bokeh import plotting
from bokeh.layouts import gridplot
L = logging.getLogger(__name__)
def bokeh_plot(data, var_name, results, title, module, test_name):
plot = bokeh_plot_var(data, var_name, results, title, module, test_name)
return gridplot([[plot]], sizing_mode='f... | [
"bokeh.plotting.figure",
"numpy.ma.masked_where",
"logging.getLogger",
"bokeh.layouts.gridplot"
] | [((102, 129), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (119, 129), False, 'import logging\n'), ((287, 326), 'bokeh.layouts.gridplot', 'gridplot', (['[[plot]]'], {'sizing_mode': '"""fixed"""'}), "([[plot]], sizing_mode='fixed')\n", (295, 326), False, 'from bokeh.layouts import gridpl... |
"""
byceps.services.user_group.dbmodels
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 <NAME>
:License: Revised BSD (see `LICENSE` file for details)
"""
from datetime import datetime
from typing import Optional
from sqlalchemy.ext.associationproxy import association_proxy
from ...database import db, gene... | [
"sqlalchemy.ext.associationproxy.association_proxy"
] | [((1137, 1177), 'sqlalchemy.ext.associationproxy.association_proxy', 'association_proxy', (['"""memberships"""', '"""user"""'], {}), "('memberships', 'user')\n", (1154, 1177), False, 'from sqlalchemy.ext.associationproxy import association_proxy\n')] |
"""
The tool to check the availability or syntax of domain, IP or URL.
::
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ █████╗ ██║ ██║██╔██╗ ██║██║ █████╗ █... | [
"tempfile.NamedTemporaryFile",
"PyFunceble.cli.utils.stdout.print_single_line",
"csv.DictReader",
"PyFunceble.helpers.file.FileHelper",
"functools.wraps",
"csv.DictWriter"
] | [((2457, 2478), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (2472, 2478), False, 'import functools\n'), ((2914, 2942), 'PyFunceble.helpers.file.FileHelper', 'FileHelper', (['self.source_file'], {}), '(self.source_file)\n', (2924, 2942), False, 'from PyFunceble.helpers.file import FileHelper\n'), (... |
import ctypes
import ctypes.util
from geneprog.cdefs import (cgp_data)
def load_library():
libgp_path = ctypes.util.find_library('libgeneprog.0.dylib')
libgp = ctypes.CDLL(str(libgp_path))
return libgp
library = load_library()
cgp_data.load(library)
| [
"ctypes.util.find_library",
"geneprog.cdefs.cgp_data.load"
] | [((243, 265), 'geneprog.cdefs.cgp_data.load', 'cgp_data.load', (['library'], {}), '(library)\n', (256, 265), False, 'from geneprog.cdefs import cgp_data\n'), ((110, 157), 'ctypes.util.find_library', 'ctypes.util.find_library', (['"""libgeneprog.0.dylib"""'], {}), "('libgeneprog.0.dylib')\n", (134, 157), False, 'import ... |
# Python version of cmdlib.sh
"""
Houses helper code for python based coreos-assembler commands.
"""
import hashlib
import json
import os
import shutil
import subprocess
import sys
import tempfile
import gi
from botocore.exceptions import (
ConnectionClosedError,
ConnectTimeoutError,
IncompleteReadError,
... | [
"tenacity.stop_after_attempt",
"os.unlink",
"subprocess.list2cmdline",
"datetime.datetime.utcnow",
"os.path.isfile",
"os.path.join",
"gi.repository.RpmOstree.get_basearch",
"subprocess.check_call",
"tempfile.TemporaryDirectory",
"os.path.dirname",
"hashlib.sha256",
"json.dump",
"tenacity.ret... | [((433, 471), 'gi.require_version', 'gi.require_version', (['"""RpmOstree"""', '"""1.0"""'], {}), "('RpmOstree', '1.0')\n", (451, 471), False, 'import gi\n'), ((564, 584), 'tenacity.stop_after_delay', 'stop_after_delay', (['(10)'], {}), '(10)\n', (580, 584), False, 'from tenacity import stop_after_delay, stop_after_att... |
from sh import riscv64_unknown_elf_gcc as gcc
from sh import riscv64_unknown_elf_objdump as objdump
from sh import rm
import re
gcc("test.S", "-c", "-o", "test.o", "-march=rv32ima", "-mabi=ilp32")
for line in objdump("-d", "test.o"):
m = re.match(r"^\s+([0-9a-f]+):\s+([0-9a-f]+)\s+(.*)$", line)
if m:
... | [
"sh.rm",
"sh.riscv64_unknown_elf_gcc",
"sh.riscv64_unknown_elf_objdump",
"re.match"
] | [((132, 200), 'sh.riscv64_unknown_elf_gcc', 'gcc', (['"""test.S"""', '"""-c"""', '"""-o"""', '"""test.o"""', '"""-march=rv32ima"""', '"""-mabi=ilp32"""'], {}), "('test.S', '-c', '-o', 'test.o', '-march=rv32ima', '-mabi=ilp32')\n", (135, 200), True, 'from sh import riscv64_unknown_elf_gcc as gcc\n'), ((214, 237), 'sh.ri... |
import os
from qtpy import QtCore as QC
from qtpy import QtGui as QG
from qtpy import QtWidgets as QW
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusGlobals as HG
from hydrus.core import HydrusPaths
from hydrus.core import HydrusText
from hydrus.client import ClientExporting
from hydrus.... | [
"hydrus.client.ClientExporting.GenerateExportFilename",
"hydrus.core.HydrusText.DeserialiseNewlinedTexts",
"hydrus.client.ClientExporting.ParseExportPhrase",
"qtpy.QtGui.QDrag",
"qtpy.QtCore.QObject.__init__",
"qtpy.QtCore.QUrl.fromLocalFile",
"os.path.exists",
"hydrus.client.gui.QtPorting.CallAfter",... | [((1191, 1207), 'qtpy.QtGui.QDrag', 'QG.QDrag', (['window'], {}), '(window)\n', (1199, 1207), True, 'from qtpy import QtGui as QG\n'), ((809, 836), 'qtpy.QtCore.QMimeData.__init__', 'QC.QMimeData.__init__', (['self'], {}), '(self)\n', (830, 836), True, 'from qtpy import QtCore as QC\n'), ((4863, 4896), 'qtpy.QtCore.QOb... |
#!/usr/bin/env python3
import h5py
import numpy
from numpy import sin, cos, pi, degrees
from ext import hdf5handler
from matplotlib import pyplot as plt
#MKS
G = 6.67384e-11 # m^3 kg^-1 s^-2
MSun = 1.9891e30 # kg^1
AU = 149597870700 # m^1
DAY = 3600*24 # s^1
YEAR = DAY*365.25 # s^1
def rk4... | [
"h5py.File",
"ext.hdf5handler.HDF5Handler",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.array",
"numpy.arange",
"numpy.cos",
"matplotlib.pyplot.savefig"
] | [((881, 914), 'numpy.array', 'numpy.array', (['[da, de, df, dw, dM]'], {}), '([da, de, df, dw, dM])\n', (892, 914), False, 'import numpy\n'), ((1067, 1100), 'numpy.array', 'numpy.array', (['[a0, e0, f0, w0, M0]'], {}), '([a0, e0, f0, w0, M0])\n', (1078, 1100), False, 'import numpy\n'), ((1664, 1686), 'h5py.File', 'h5py... |
#!/usr/bin/env python
from nose.tools import assert_equal
from mediagoblin import processing
class TestProcessing(object):
def run_fill(self, input, format, output=None):
builder = processing.FilenameBuilder(input)
result = builder.fill(format)
if output is None:
return result... | [
"nose.tools.assert_equal",
"mediagoblin.processing.FilenameBuilder"
] | [((196, 229), 'mediagoblin.processing.FilenameBuilder', 'processing.FilenameBuilder', (['input'], {}), '(input)\n', (222, 229), False, 'from mediagoblin import processing\n'), ((329, 357), 'nose.tools.assert_equal', 'assert_equal', (['output', 'result'], {}), '(output, result)\n', (341, 357), False, 'from nose.tools im... |
#!/usr/bin/env python3
import math
import shm
from mission.framework.movement import Depth, Heading, Pitch, VelocityX, VelocityY
from mission.framework.primitive import Zero, Log, FunctionTask, Fail
from mission.framework.task import Task
from mission.framework.timing import Timer, Timed
'''
Oh no you're using jank.... | [
"shm.desires.sway_speed.get",
"mission.framework.primitive.Zero",
"mission.framework.movement.VelocityX",
"shm.jank_pos.x.get",
"shm.jank_pos.y.get",
"shm.jank_pos.x.set",
"shm.desires.speed.get",
"shm.jank_pos.y.set",
"mission.framework.primitive.Log",
"mission.framework.movement.VelocityY"
] | [((733, 765), 'shm.jank_pos.y.set', 'shm.jank_pos.y.set', (['self.vel_add'], {}), '(self.vel_add)\n', (751, 765), False, 'import shm\n'), ((1059, 1091), 'shm.jank_pos.x.set', 'shm.jank_pos.x.set', (['self.vel_add'], {}), '(self.vel_add)\n', (1077, 1091), False, 'import shm\n'), ((1505, 1539), 'shm.jank_pos.x.set', 'shm... |
import json
import re
from .exceptions import InvalidParameterException
from moto.core.responses import BaseResponse
from .models import logs_backends
# See http://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/Welcome.html
REGEX_LOG_GROUP_NAME = r"[-._\/#A-Za-z0-9]+"
def validate_param(
param_... | [
"re.fullmatch",
"json.loads",
"json.dumps"
] | [((4553, 4616), 'json.dumps', 'json.dumps', (["{'metricFilters': filters, 'nextToken': next_token}"], {}), "({'metricFilters': filters, 'nextToken': next_token})\n", (4563, 4616), False, 'import json\n'), ((6391, 6409), 'json.dumps', 'json.dumps', (['result'], {}), '(result)\n', (6401, 6409), False, 'import json\n'), (... |
# -*- coding: utf-8 -*-
import numpy as np
eps = np.finfo(float).eps
def infnorm(x):
return np.linalg.norm(x, np.inf)
def scaled_tol(n):
tol = 5e1*eps if n < 20 else np.log(n)**2.5*eps
return tol
# bespoke test generators
def infNormLessThanTol(a, b, tol):
def asserter(self):
self.assertLes... | [
"numpy.log",
"numpy.finfo",
"numpy.sin",
"numpy.linalg.norm",
"numpy.exp",
"numpy.cos"
] | [((51, 66), 'numpy.finfo', 'np.finfo', (['float'], {}), '(float)\n', (59, 66), True, 'import numpy as np\n'), ((99, 124), 'numpy.linalg.norm', 'np.linalg.norm', (['x', 'np.inf'], {}), '(x, np.inf)\n', (113, 124), True, 'import numpy as np\n'), ((654, 663), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (660, 663), True, ... |
import yaml
import sys
import os
from jinja2 import Template
import argparse
backend = {
'cpu': {
'pass1': 'ffmpeg -hide_banner -loglevel error -y -i {{ input_file }} -an -c:v libx264 -preset:v {{ preset }} -threads 0 -r {{ fps }} -g {{ gop }} -keyint_min {{ gop }} -sc_threshold 0 -x264opts bframes=1 -pass... | [
"jinja2.Template",
"yaml.load",
"argparse.ArgumentParser",
"os.path.exists",
"os.system",
"sys.exit"
] | [((1554, 1579), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1577, 1579), False, 'import argparse\n'), ((1760, 1800), 'jinja2.Template', 'Template', (["backend[args.backend]['pass1']"], {}), "(backend[args.backend]['pass1'])\n", (1768, 1800), False, 'from jinja2 import Template\n'), ((1809, ... |
from ..models import Label
import pytest
from mixer.backend.django import mixer
pytestmark = pytest.mark.django_db
class TestBoard:
def test_model(self):
board = mixer.blend('boards.Board')
assert board.pk == 1, 'Should create a Board instance'
def test_str(self):
board = mixer.blend(... | [
"mixer.backend.django.mixer.blend"
] | [((176, 203), 'mixer.backend.django.mixer.blend', 'mixer.blend', (['"""boards.Board"""'], {}), "('boards.Board')\n", (187, 203), False, 'from mixer.backend.django import mixer\n'), ((308, 335), 'mixer.backend.django.mixer.blend', 'mixer.blend', (['"""boards.Board"""'], {}), "('boards.Board')\n", (319, 335), False, 'fro... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | [
"logging.getLogger"
] | [((885, 912), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (902, 912), False, 'import logging\n')] |
#!/usr/bin/env python3
from functools import reduce
from random import randint, choices
def main():
k, total_genomes, n = list(map(int, input().split()))
genomes = []
for _ in range(total_genomes):
genomes.append(input().upper())
best_motifs = summarized_gibbs_motif_search(k, genomes, n, 20)... | [
"random.choices"
] | [((2612, 2640), 'random.choices', 'choices', (['mers', 'probabilities'], {}), '(mers, probabilities)\n', (2619, 2640), False, 'from random import randint, choices\n')] |
import json
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_noop as _
from django.template.defaultfilters import slugify
from django.core.exceptions import ValidationError
from django.core import serializers
from positions.fields import PositionFie... | [
"json.loads",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.core.serializers.serialize",
"django.db.models.BooleanField",
"django.db.models.SlugField",
"json.dumps",
"positions.fields.PositionField",
"django.template.defaultfilters.slugify",
"django.db.models.DateTimeField",... | [((3036, 3068), 'django.db.models.SlugField', 'models.SlugField', ([], {'editable': '(False)'}), '(editable=False)\n', (3052, 3068), False, 'from django.db import models\n'), ((9575, 9623), 'django.db.models.ForeignKey', 'models.ForeignKey', (['JoyRide'], {'related_name': '"""steps"""'}), "(JoyRide, related_name='steps... |
import pytest
import numpy as np
import pandas as pd
from pandas import Categorical, Series, CategoricalIndex
from pandas.core.dtypes.concat import union_categoricals
from pandas.util import testing as tm
class TestUnionCategoricals(object):
def test_union_categorical(self):
# GH 13361
data = [
... | [
"pandas.core.dtypes.concat.union_categoricals",
"pandas.Timestamp",
"pandas.date_range",
"pandas.period_range",
"pandas.util.testing.assert_raises_regex",
"pytest.raises",
"numpy.array",
"pandas.Series",
"pandas.util.testing.assert_categorical_equal",
"pandas.Categorical",
"pandas.CategoricalInd... | [((1665, 1693), 'pandas.Categorical', 'Categorical', (["['x', 'y', 'z']"], {}), "(['x', 'y', 'z'])\n", (1676, 1693), False, 'from pandas import Categorical, Series, CategoricalIndex\n'), ((1707, 1735), 'pandas.Categorical', 'Categorical', (["['a', 'b', 'c']"], {}), "(['a', 'b', 'c'])\n", (1718, 1735), False, 'from pand... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Basic Implementation of a multi layer perceptron.
"""
from __future__ import division, print_function
import ConfigSpace as CS
import ConfigSpace.hyperparameters as CSH
import torch.nn as nn
from autoPyTorch.components.networks.base_net import BaseFeatureNet
__auth... | [
"torch.nn.Dropout",
"ConfigSpace.ConfigurationSpace",
"ConfigSpace.hyperparameters.CategoricalHyperparameter",
"ConfigSpace.AndConjunction",
"torch.nn.Sequential",
"ConfigSpace.hyperparameters.UniformIntegerHyperparameter",
"ConfigSpace.CategoricalHyperparameter",
"ConfigSpace.GreaterThanCondition",
... | [((1305, 1327), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (1318, 1327), True, 'import torch.nn as nn\n'), ((1693, 1716), 'ConfigSpace.ConfigurationSpace', 'CS.ConfigurationSpace', ([], {}), '()\n', (1714, 1716), True, 'import ConfigSpace as CS\n'), ((2034, 2138), 'ConfigSpace.hyperparame... |
"""
This Module define the main services of the Test Session Coordinator in charge of the testing session.
"""
#################################################################################
# MIT License
#
# Copyright (c) 2018, <NAME>, Universitat Oberta de Catalunya (UOC),
# Universidad de la Republica Oriental del... | [
"user_interface.ui_reports.ButtonInputField",
"user_interface.ui_reports.RPCRequest",
"lorawan.sessions.EndDevice",
"user_interface.ui_reports.TextInputField",
"user_interface.ui_reports.ParagraphField",
"lorawan.parsing.configuration.DeviceID",
"user_interface.ui_reports.InputFormBody",
"conformance_... | [((1890, 1917), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1907, 1917), False, 'import logging\n'), ((6650, 6710), 'user_interface.ui_reports.InputFormBody', 'ui_reports.InputFormBody', ([], {'title': '"""Start LoRaWAN testing tool"""'}), "(title='Start LoRaWAN testing tool')\n", (66... |
#!/usr/bin/python3
import re
from prettytable import PrettyTable
x = PrettyTable(field_names=["Key", "Value", "Operation"],sortby="Operation",reversesort=True)
x.align = "l"
x.add_row(["Adelaide", 1295, 0])
x.add_row(["Brisbane", 5905, 1])
x.add_row(["Darwin", 112, 1])
x.add_row(["Hobart", 1357, 0])
x.add_row(["S... | [
"prettytable.PrettyTable",
"re.compile"
] | [((74, 170), 'prettytable.PrettyTable', 'PrettyTable', ([], {'field_names': "['Key', 'Value', 'Operation']", 'sortby': '"""Operation"""', 'reversesort': '(True)'}), "(field_names=['Key', 'Value', 'Operation'], sortby='Operation',\n reversesort=True)\n", (85, 170), False, 'from prettytable import PrettyTable\n'), ((4... |
import numpy as np
import keras
from keras.layers import *
from keras.models import Sequential,Model
from keras import backend as K
from base_networks import *
import tensorflow as tf
def my_KL_loss(y_true, y_pred):
y_pred = K.clip(y_pred, K.epsilon(), 1)
return - K.sum(y_true*K.log(y_pred), axis=-1)
def my_... | [
"tensorflow.reduce_sum",
"keras.backend.random_uniform",
"keras.backend.epsilon",
"keras.activations.sigmoid",
"tensorflow.reshape",
"keras.backend.sum",
"keras.backend.exp",
"keras.models.Model",
"keras.backend.abs",
"tensorflow.transpose",
"keras.backend.log",
"keras.backend.shape",
"keras... | [((792, 806), 'keras.backend.relu', 'K.relu', (['logits'], {}), '(logits)\n', (798, 806), True, 'from keras import backend as K\n'), ((896, 911), 'keras.backend.sum', 'K.sum', (['loss_vec'], {}), '(loss_vec)\n', (901, 911), True, 'from keras import backend as K\n'), ((1739, 1755), 'keras.models.Model', 'Model', (['x', ... |
from pymatgen.io.vasp.sets import MPRelaxSet
from pymatgen.core.structure import Structure
#from atomate.vasp.workflows.base.core import get_wf
from atomate.vasp.powerups import add_small_gap_multiply, add_stability_check, add_modify_incar, \
add_wf_metadata, add_common_powerups
from quantumML.fireworks import Stat... | [
"atomate.vasp.powerups.add_common_powerups",
"os.path.abspath",
"quantumML.fireworks.StaticFW2D",
"fireworks.Workflow",
"pymatgen.io.vasp.sets.MPRelaxSet",
"atomate.vasp.powerups.add_wf_metadata",
"quantumML.fireworks.OptimizeFW2D",
"atomate.vasp.powerups.add_small_gap_multiply",
"atomate.vasp.power... | [((778, 809), 'os.path.join', 'os.path.join', (['module_dir', 'fname'], {}), '(module_dir, fname)\n', (790, 809), False, 'import os\n'), ((1304, 1370), 'pymatgen.io.vasp.sets.MPRelaxSet', 'MPRelaxSet', (['structure'], {'force_gamma': '(True)', 'user_incar_settings': 'incar'}), '(structure, force_gamma=True, user_incar_... |
"""Tests of endgame.py
"""
import unittest
import os
import time
from reversi.board import BitBoard
from reversi.strategies.common import Timer, Measure, CPU_TIME
from reversi.strategies import _EndGame_, _EndGame, EndGame_, EndGame, _AlphaBeta_, _AlphaBeta, AlphaBeta_, AlphaBeta
import reversi.strategies.coordinator... | [
"reversi.strategies.EndGame",
"os.getpid",
"importlib.reload",
"reversi.board.BitBoard",
"reversi.strategies._EndGame_",
"reversi.strategies._EndGame"
] | [((2359, 2370), 'reversi.strategies._EndGame_', '_EndGame_', ([], {}), '()\n', (2368, 2370), False, 'from reversi.strategies import _EndGame_, _EndGame, EndGame_, EndGame, _AlphaBeta_, _AlphaBeta, AlphaBeta_, AlphaBeta\n'), ((2552, 2562), 'reversi.board.BitBoard', 'BitBoard', ([], {}), '()\n', (2560, 2562), False, 'fro... |
import sys
sys.path.append("/home/gaoxiang/data/CuAssembler")
from CuAsm.CubinFile import CubinFile
binname = sys.argv[1]
cf = CubinFile(binname)
asmname = binname.replace('.cubin', '.cuasm')
cf.saveAsCuAsm(asmname)
| [
"sys.path.append",
"CuAsm.CubinFile.CubinFile"
] | [((13, 63), 'sys.path.append', 'sys.path.append', (['"""/home/gaoxiang/data/CuAssembler"""'], {}), "('/home/gaoxiang/data/CuAssembler')\n", (28, 63), False, 'import sys\n'), ((130, 148), 'CuAsm.CubinFile.CubinFile', 'CubinFile', (['binname'], {}), '(binname)\n', (139, 148), False, 'from CuAsm.CubinFile import CubinFile... |