code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
import numpy as np
import numpy.random as nr
import matplotlib.pyplot as plt
def testGrid(X, kernel, resolution=None, count=None, bounds=None):
'''Generate a misc grid to evaluate kernel functions against.
Arguments:
X (Nx2 array) : kernel basis elements
kernel : kernel to use
... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.hold",
"matplotlib.pyplot.legend",
"time.sleep",
"matplotlib.pyplot.figure",
"numpy.min",
"matplotlib.pyplot.contour",
"numpy.max",
"numpy.linspace",
"numpy.arange",
"... | [((2223, 2237), 'matplotlib.pyplot.hold', 'plt.hold', (['(True)'], {}), '(True)\n', (2231, 2237), True, 'import matplotlib.pyplot as plt\n'), ((2348, 2386), 'matplotlib.pyplot.contour', 'plt.contour', (["tGrid['X']", "tGrid['Y']", 'Z'], {}), "(tGrid['X'], tGrid['Y'], Z)\n", (2359, 2386), True, 'import matplotlib.pyplot... |
import uuid
from django.db import models
from django.contrib.auth import get_user_model
from django.core.validators import RegexValidator
User = get_user_model()
class Profile(models.Model):
user = models.OneToOneField(
User, verbose_name='User',
related_name='user_profile',
on_delete=mo... | [
"django.db.models.OneToOneField",
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.contrib.auth.get_user_model",
"django.db.models.EmailField",
"django.core.validators.RegexValidator",
"django.db.models.UUIDField"
] | [((147, 163), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (161, 163), False, 'from django.contrib.auth import get_user_model\n'), ((206, 312), 'django.db.models.OneToOneField', 'models.OneToOneField', (['User'], {'verbose_name': '"""User"""', 'related_name': '"""user_profile"""', 'on_delet... |
#!/usr/bin/env python3
import re
import sys
def check_words(string=None):
"""
Check your input string for specific words
such as "Britain", "Ireland", "Wales", "Scotland"
"""
if string is None:
print("We need a string to work on.")
sys.exit(-1)
else:
# IMPORTANT: DO ... | [
"sys.exit",
"re.compile"
] | [((273, 285), 'sys.exit', 'sys.exit', (['(-1)'], {}), '(-1)\n', (281, 285), False, 'import sys\n'), ((458, 502), 're.compile', 're.compile', (['"""Britain|Ireland|Wales|Scotland"""'], {}), "('Britain|Ireland|Wales|Scotland')\n", (468, 502), False, 'import re\n')] |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 SamsungSDS, Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... | [
"os.path.basename",
"os.path.isdir",
"synaps.version.canonical_version_string",
"sphinx.setup_command.BuildDoc.run",
"setuptools.command.sdist.sdist.run",
"glob.glob",
"synaps.openstack.common.setup.write_git_changelog",
"setuptools.find_packages"
] | [((1436, 1465), 'glob.glob', 'glob.glob', (["('%s/*' % (srcdir,))"], {}), "('%s/*' % (srcdir,))\n", (1445, 1465), False, 'import glob\n'), ((1176, 1210), 'synaps.openstack.common.setup.write_git_changelog', 'common_setup.write_git_changelog', ([], {}), '()\n', (1208, 1210), True, 'from synaps.openstack.common import se... |
import discord
from risk.model.database import *
from risk.command import Command
from risk.util import Manager
class Client(discord.Client):
def __init__(self, config, database):
self.config = config
self.database: Manager = database
self.command = Command(self, self.config, self.databa... | [
"risk.command.Command",
"discord.Game"
] | [((282, 323), 'risk.command.Command', 'Command', (['self', 'self.config', 'self.database'], {}), '(self, self.config, self.database)\n', (289, 323), False, 'from risk.command import Command\n'), ((505, 529), 'discord.Game', 'discord.Game', (['game.value'], {}), '(game.value)\n', (517, 529), False, 'import discord\n')] |
import cv2
import numpy as np
import matplotlib.pylab as plt
#--①이미지 읽어서 YUV 컬러스페이스로 변경
img = cv2.imread('../img/bright.jpg')
img_yuv = cv2.cvtColor(img, cv2.COLOR_BGR2YUV)
#--② 밝기 채널에 대해서 이퀄라이즈 적용
img_eq = img_yuv.copy()
img_eq[:,:,0] = cv2.equalizeHist(img_eq[:,:,0])
img_eq = cv2.cvtColor(img_eq, cv2.COLOR_YUV2BGR)... | [
"cv2.equalizeHist",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.imread",
"cv2.createCLAHE",
"cv2.imshow"
] | [((95, 126), 'cv2.imread', 'cv2.imread', (['"""../img/bright.jpg"""'], {}), "('../img/bright.jpg')\n", (105, 126), False, 'import cv2\n'), ((137, 173), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2YUV'], {}), '(img, cv2.COLOR_BGR2YUV)\n', (149, 173), False, 'import cv2\n'), ((240, 273), 'cv2.equalizeHist', '... |
import os
from ._vars import _BASE_URL
import requests as _requests
from .errors import BadRequestError as _BadRequestError, UrlNotFoundError as _UrlNotFoundError, \
UnauthorizedError as _UnauthorizedError, ServiceUnavailableError as _ServiceUnavailableError, \
InvalidPath as _InvalidPath
class Common... | [
"requests.post",
"os.path.isfile",
"requests.get"
] | [((1176, 1253), 'requests.post', '_requests.post', ([], {'url': "(_BASE_URL + '/file/download')", 'data': "{'file_key': file_key}"}), "(url=_BASE_URL + '/file/download', data={'file_key': file_key})\n", (1190, 1253), True, 'import requests as _requests\n'), ((3202, 3277), 'requests.post', '_requests.post', ([], {'url':... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="myknn",
version="0.0.3",
author="Robert",
author_email="<EMAIL>",
description="Knn implementation",
long_description=long_description,
long_description_content_type="text/markdown"... | [
"setuptools.setup"
] | [((88, 535), 'setuptools.setup', 'setuptools.setup', ([], {'name': '"""myknn"""', 'version': '"""0.0.3"""', 'author': '"""Robert"""', 'author_email': '"""<EMAIL>"""', 'description': '"""Knn implementation"""', 'long_description': 'long_description', 'long_description_content_type': '"""text/markdown"""', 'url': '"""htt... |
# coding: utf-8
from __future__ import unicode_literals
import itertools
from .common import InfoExtractor
class StoryFireIE(InfoExtractor):
_VALID_URL = r'(?:(?:https?://(?:www\.)?storyfire\.com/video-details)|(?:https://storyfire.app.link))/(?P<id>[^/\s]+)'
_TESTS = [{
'url': 'https://storyfire.com... | [
"itertools.count"
] | [((5345, 5363), 'itertools.count', 'itertools.count', (['(1)'], {}), '(1)\n', (5360, 5363), False, 'import itertools\n')] |
from copy import deepcopy
from time import time
from utils.print import print_block
import pandas as pd
import numpy as np
class DiCECounterfactaulWrapper(object):
'''
Wrapper class to generate DiCE cf
'''
def __init__(self, dice_explainer, feature_names):
self.dice_explainer__ = dice_explain... | [
"pandas.DataFrame",
"copy.deepcopy",
"time.time",
"numpy.array",
"utils.print.print_block"
] | [((442, 456), 'copy.deepcopy', 'deepcopy', (['case'], {}), '(case)\n', (450, 456), False, 'from copy import deepcopy\n'), ((534, 569), 'numpy.array', 'np.array', (["[case['original_vector']]"], {}), "([case['original_vector']])\n", (542, 569), True, 'import numpy as np\n'), ((591, 597), 'time.time', 'time', ([], {}), '... |
import csv
import unittest
class MyTestCase(unittest.TestCase):
def test_read(self):
with open('employee_file.csv') as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
line_count = 0
for row in csv_reader:
if line_count == 0:
... | [
"unittest.main",
"csv.reader",
"csv.writer"
] | [((1121, 1136), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1134, 1136), False, 'import unittest\n'), ((168, 203), 'csv.reader', 'csv.reader', (['csv_file'], {'delimiter': '""","""'}), "(csv_file, delimiter=',')\n", (178, 203), False, 'import csv\n'), ((774, 841), 'csv.writer', 'csv.writer', (['employee_file']... |
import re
import string
import numpy as np
from yt._typing import KnownFieldsT
from yt.fields.field_info_container import FieldInfoContainer
from yt.frontends.boxlib.misc import BoxlibSetupParticleFieldsMixin
from yt.units import YTQuantity
from yt.utilities.physical_constants import amu_cgs, boltzmann_constant_cgs, ... | [
"yt.units.YTQuantity",
"numpy.sqrt",
"re.compile"
] | [((504, 540), 're.compile', 're.compile', (['""".*\\\\((\\\\D*)(\\\\d*)\\\\).*"""'], {}), "('.*\\\\((\\\\D*)(\\\\d*)\\\\).*')\n", (514, 540), False, 'import re\n'), ((4366, 4431), 'numpy.sqrt', 'np.sqrt', (["(p2 * c ** 2 + data[ptype, 'particle_mass'] ** 2 * c ** 4)"], {}), "(p2 * c ** 2 + data[ptype, 'particle_mass'] ... |
#!/usr/bin/env python3
import pytest
from vecrec import Rect
from glooey import drawing, UsageError
def test_no_cells():
cells = drawing.make_grid(
Rect.null()
)
assert cells == {}
def test_one_cell():
cells = drawing.make_grid(
Rect.from_size(10, 10),
num_rows=1,
... | [
"glooey.drawing.Grid",
"vecrec.Rect.null",
"pytest.raises",
"vecrec.Rect",
"vecrec.Rect.from_size"
] | [((9426, 9440), 'glooey.drawing.Grid', 'drawing.Grid', ([], {}), '()\n', (9438, 9440), False, 'from glooey import drawing, UsageError\n'), ((10035, 10049), 'glooey.drawing.Grid', 'drawing.Grid', ([], {}), '()\n', (10047, 10049), False, 'from glooey import drawing, UsageError\n'), ((10801, 10815), 'glooey.drawing.Grid',... |
import sys
import threading
from niveristand import nivs_rt_sequence, NivsParam
from niveristand import realtimesequencetools
from niveristand.clientapi import I32Value
from niveristand.clientapi import RealTimeSequence
from niveristand.errors import TranslateError, VeristandError
from niveristand.library import multit... | [
"threading.Thread",
"niveristand.library.nivs_yield",
"niveristand.clientapi.RealTimeSequence",
"testutilities.rtseqrunner.run_rtseq_in_VM",
"testutilities.validation.test_validate",
"pytest.raises",
"niveristand.clientapi.I32Value",
"niveristand.library.task",
"niveristand.library._tasks.get_schedu... | [((10240, 10328), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""func_name, params, expected_result"""', 'run_tests'], {'ids': 'idfunc'}), "('func_name, params, expected_result', run_tests,\n ids=idfunc)\n", (10263, 10328), False, 'import pytest\n'), ((10416, 10504), 'pytest.mark.parametrize', 'pytest.m... |
# Copyright (c) 2020 <NAME>
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php
from moneysocket.protocol.provider.nexus import ProviderNexus
from moneysocket.protocol.layer import ProtocolLayer
class ProviderLayer(ProtocolLayer):
... | [
"moneysocket.protocol.provider.nexus.ProviderNexus"
] | [((585, 617), 'moneysocket.protocol.provider.nexus.ProviderNexus', 'ProviderNexus', (['below_nexus', 'self'], {}), '(below_nexus, self)\n', (598, 617), False, 'from moneysocket.protocol.provider.nexus import ProviderNexus\n')] |
import unittest
from stats import Statistics
import mission
class StatisticsTestCase(unittest.TestCase):
"""Tests for Statistics class."""
def test_win(self):
"""Test recording a win statistic."""
stats = Statistics()
stats.update(mission.WIN)
self.assertEqual(stats.wins, 1)
... | [
"stats.Statistics"
] | [((232, 244), 'stats.Statistics', 'Statistics', ([], {}), '()\n', (242, 244), False, 'from stats import Statistics\n'), ((408, 420), 'stats.Statistics', 'Statistics', ([], {}), '()\n', (418, 420), False, 'from stats import Statistics\n'), ((601, 613), 'stats.Statistics', 'Statistics', ([], {}), '()\n', (611, 613), Fals... |
#!/usr/bin/python
# MIT License
# Copyright (c) 2018 <NAME>
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# 00 - Fech Reserved - 00000 - -----------
# 01 - ADD Rx, Ry - 00001 - XXXYYY-----
# 02 - ADC Rx, Ry - 00010 - XXXYYY-----
# 03 - SUB Rx, Ry - 00011 - XXXYYY-----
# 04 - AN... | [
"sys.exit"
] | [((12540, 12551), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (12548, 12551), False, 'import sys\n'), ((9324, 9335), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (9332, 9335), False, 'import sys\n'), ((9125, 9136), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (9133, 9136), False, 'import sys\n')] |
'''OpenGL extension VERSION.GL_4_1
This module customises the behaviour of the
OpenGL.raw.GL.VERSION.GL_4_1 to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/VERSION/GL_4_1.txt
'''
from OpenGL import platform, constant, arrays
fro... | [
"OpenGL.wrapper.wrapper",
"OpenGL.extensions.hasGLExtension"
] | [((655, 697), 'OpenGL.extensions.hasGLExtension', 'extensions.hasGLExtension', (['_EXTENSION_NAME'], {}), '(_EXTENSION_NAME)\n', (680, 697), False, 'from OpenGL import extensions\n'), ((1444, 1476), 'OpenGL.wrapper.wrapper', 'wrapper.wrapper', (['glProgramBinary'], {}), '(glProgramBinary)\n', (1459, 1476), False, 'from... |
from pybricks.iodevices import PUPDevice
from pybricks.parameters import Port
from uerrno import ENODEV
# Dictionary of device identifiers along with their name.
device_names = {
34: "Wedo 2.0 Tilt Sensor",
35: "Wedo 2.0 Infrared Sensor",
37: "BOOST Color Distance Sensor",
38: "BOOST Interactive Motor"... | [
"pybricks.iodevices.PUPDevice"
] | [((1088, 1103), 'pybricks.iodevices.PUPDevice', 'PUPDevice', (['port'], {}), '(port)\n', (1097, 1103), False, 'from pybricks.iodevices import PUPDevice\n')] |
# Generated by Django 2.1.1 on 2019-03-11 21:50
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | [
"django.db.models.TextField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.PositiveIntegerField",
"django.db.models.AutoField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField",
"django.db.migrations.Alte... | [((247, 304), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (278, 304), False, 'from django.db import migrations, models\n'), ((2976, 3068), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether',... |
from __future__ import print_function
import os
import torch
import utils
import numpy as np
def has_checkpoint(checkpoint_path, rb_path):
"""check if a checkpoint exists"""
if not (os.path.exists(checkpoint_path) and os.path.exists(rb_path)):
return False
if 'model.pyth' not in os.listdir(checkpo... | [
"torch.load",
"os.path.exists",
"torch.save",
"numpy.array",
"utils.ReplayBuffer",
"os.path.join",
"os.listdir"
] | [((2662, 2705), 'os.path.join', 'os.path.join', (['checkpoint_path', '"""model.pyth"""'], {}), "(checkpoint_path, 'model.pyth')\n", (2674, 2705), False, 'import os\n'), ((2743, 2772), 'torch.save', 'torch.save', (['checkpoint', 'fpath'], {}), '(checkpoint, fpath)\n', (2753, 2772), False, 'import torch\n'), ((3131, 3172... |
from ..config import BaseProposalCreatorConfig
import json
from grant.proposal.models import Proposal, ProposalRevision
from grant.utils.enums import ProposalChange
from ..test_data import test_team
test_milestones_a = [
{
"title": "first milestone a",
"content": "content a",
"daysEstimat... | [
"grant.proposal.models.ProposalRevision.calculate_milestone_changes",
"grant.proposal.models.Proposal.query.get",
"grant.proposal.models.ProposalRevision.calculate_proposal_changes",
"json.dumps"
] | [((3274, 3309), 'grant.proposal.models.Proposal.query.get', 'Proposal.query.get', (['old_proposal_id'], {}), '(old_proposal_id)\n', (3292, 3309), False, 'from grant.proposal.models import Proposal, ProposalRevision\n'), ((3333, 3368), 'grant.proposal.models.Proposal.query.get', 'Proposal.query.get', (['new_proposal_id'... |
#Script to Run Mask-RCNN on a sequence of frame images
#Needs to be run from the src/preprocessing folder for the paths to be correct
#Imports and Global paths
import os
import sys
# Root directory of the project
ROOT_DIR = os.path.abspath("../")
sys.path.append(ROOT_DIR)
sys.path.append(os.path.join(ROOT_DIR,"Mask_R... | [
"sys.path.append",
"os.path.abspath",
"h5py.File",
"Mask_RCNN.mrcnn.model.MaskRCNN",
"os.makedirs",
"Mask_RCNN.mrcnn.visualize.save_instances",
"os.walk",
"os.path.exists",
"random.choice",
"numpy.string_",
"Mask_RCNN.mrcnn.visualize.display_instances",
"os.path.join"
] | [((226, 248), 'os.path.abspath', 'os.path.abspath', (['"""../"""'], {}), "('../')\n", (241, 248), False, 'import os\n'), ((249, 274), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (264, 274), False, 'import sys\n'), ((573, 626), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""Mask_RCNN/mas... |
import splunk.admin as admin
import splunk.entity as entity
confFileName = "nrql_connections"
class ConfigApp(admin.MConfigHandler):
def setup(self):
if self.requestedAction == admin.ACTION_EDIT:
for arg in ["apiEndpoint", "accountId", "queryKey"]:
self.supportedArgs.addOptArg... | [
"splunk.admin.init"
] | [((912, 953), 'splunk.admin.init', 'admin.init', (['ConfigApp', 'admin.CONTEXT_NONE'], {}), '(ConfigApp, admin.CONTEXT_NONE)\n', (922, 953), True, 'import splunk.admin as admin\n')] |
import os
import socket
from userelaina._th import throws
from rsap2p._sc import RSAclient,RSAserver
from rsap2p._config import *
CORE=os.cpu_count()
THREAD=CORE<<1
SIZE=65536
class TCPclient(RSAclient):
def __init__(self,server_addr:tuple,myname:str='tcpclient',gname:str='tcpserver'):
RSAcl... | [
"rsap2p._sc.RSAserver.close",
"rsap2p._sc.RSAserver.__init__",
"socket.socket",
"rsap2p._sc.RSAclient.__init__",
"userelaina._th.throws",
"os.cpu_count",
"rsap2p._sc.RSAclient.close"
] | [((142, 156), 'os.cpu_count', 'os.cpu_count', ([], {}), '()\n', (154, 156), False, 'import os\n'), ((315, 367), 'rsap2p._sc.RSAclient.__init__', 'RSAclient.__init__', (['self', 'server_addr', 'myname', 'gname'], {}), '(self, server_addr, myname, gname)\n', (333, 367), False, 'from rsap2p._sc import RSAclient, RSAserver... |
# -*- coding: utf-8 -*-
"""
.. _tut-erp:
==============================================
EEG analysis - Event-Related Potentials (ERPs)
==============================================
This tutorial shows how to perform standard ERP analyses in MNE-Python. Most of
the material here is covered in other tutorials too, but... | [
"pandas.DataFrame",
"mne.io.read_raw_fif",
"mne.viz.plot_compare_evokeds",
"pandas.option_context",
"mne.grand_average",
"mne.channels.combine_channels",
"mne.Epochs",
"mne.pick_channels",
"numpy.array",
"mne.read_events",
"mne.viz.use_browser_backend",
"mne.datasets.sample.data_path",
"matp... | [((1065, 1109), 'mne.io.read_raw_fif', 'mne.io.read_raw_fif', (['raw_file'], {'preload': '(False)'}), '(raw_file, preload=False)\n', (1084, 1109), False, 'import mne\n'), ((1179, 1207), 'mne.read_events', 'mne.read_events', (['events_file'], {}), '(events_file)\n', (1194, 1207), False, 'import mne\n'), ((6813, 6837), '... |
import logging
from .notifier import Notifier
from .global_notifier import get_global_notifier
def _log_record_attrs():
record = logging.LogRecord("", logging.ERROR, "", 0, "", None, None)
attrs = set()
for k in vars(record).keys():
attrs.add(k)
attrs.add("message") # set by Formatter
re... | [
"logging.Handler.__init__",
"logging.LogRecord"
] | [((136, 195), 'logging.LogRecord', 'logging.LogRecord', (['""""""', 'logging.ERROR', '""""""', '(0)', '""""""', 'None', 'None'], {}), "('', logging.ERROR, '', 0, '', None, None)\n", (153, 195), False, 'import logging\n'), ((643, 686), 'logging.Handler.__init__', 'logging.Handler.__init__', (['self'], {'level': 'level'}... |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | [
"polyaxon.pql.builder.CallbackCondition"
] | [((6555, 6620), 'polyaxon.pql.builder.CallbackCondition', 'CallbackCondition', (['callback_conditions.in_artifact_kind_condition'], {}), '(callback_conditions.in_artifact_kind_condition)\n', (6572, 6620), False, 'from polyaxon.pql.builder import ArrayCondition, BoolCondition, CallbackCondition, ComparisonCondition, Dat... |
#!/usr/bin/env python
# coding: utf-8
#Author: <NAME>.
#Date: 04/04/2020.
from astropy.table import Table
from photutils.datasets import make_gaussian_sources_image
import numpy as np
class Star_Flux_Distribution:
def __init__(self, ccd_info, star_flux, gaussian_stddev):
self.t_exp = ccd_info['t... | [
"numpy.array",
"photutils.datasets.make_gaussian_sources_image",
"astropy.table.Table"
] | [((1719, 1726), 'astropy.table.Table', 'Table', ([], {}), '()\n', (1724, 1726), False, 'from astropy.table import Table\n'), ((2348, 2389), 'photutils.datasets.make_gaussian_sources_image', 'make_gaussian_sources_image', (['shape', 'table'], {}), '(shape, table)\n', (2375, 2389), False, 'from photutils.datasets import ... |
from builtins import bytes
from optparse import OptionParser
import logging
import select
import socket
import sys
import random
import time
from pymidi import packets
from pymidi import protocol
from pymidi import utils
from pymidi.utils import b2h
from construct import ConstructError
try:
import coloredlogs
ex... | [
"random.randint",
"pymidi.utils.b2h",
"socket.socket",
"pymidi.packets.AppleMIDIExchangePacket.parse",
"logging.getLogger",
"time.time",
"pymidi.packets.AppleMIDITimestampPacket.create"
] | [((371, 405), 'logging.getLogger', 'logging.getLogger', (['"""pymidi.client"""'], {}), "('pymidi.client')\n", (388, 405), False, 'import logging\n'), ((977, 1025), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (990, 1025), False, 'import socket... |
from datasets.datasets import load_data
import os
from utils.utils import load_parameters, set_parameter
import time
import pickle
if __name__ == "__main__":
saved_vectors_directory = "sample_dataset_saved_feature_vectors"
if not os.path.exists(saved_vectors_directory):
os.mkdir(saved_vectors_directo... | [
"os.mkdir",
"utils.utils.set_parameter",
"datasets.datasets.load_data",
"os.path.exists",
"utils.utils.load_parameters",
"os.path.join"
] | [((357, 407), 'os.path.join', 'os.path.join', (['saved_vectors_directory', '"""malicious"""'], {}), "(saved_vectors_directory, 'malicious')\n", (369, 407), False, 'import os\n'), ((437, 484), 'os.path.join', 'os.path.join', (['saved_vectors_directory', '"""benign"""'], {}), "(saved_vectors_directory, 'benign')\n", (449... |
import os
from itertools import chain
import numpy as np
from six import StringIO
from gym import spaces, Env
from .env_map import EnvMap
class WolfHuntEnv(Env):
metadata = {'render.modes': ['ansi'], 'state.modes': ['linear', 'grid', 'channels']}
LEFT, RIGHT, UP, DOWN, NOOP = [0, 1, 2, 3, 4]
ACTIONS = [L... | [
"numpy.stack",
"os.path.realpath",
"numpy.zeros",
"gym.spaces.Discrete",
"six.StringIO",
"numpy.random.choice",
"os.path.join",
"numpy.prod"
] | [((633, 651), 'gym.spaces.Discrete', 'spaces.Discrete', (['(5)'], {}), '(5)\n', (648, 651), False, 'from gym import spaces, Env\n'), ((1666, 1681), 'numpy.zeros', 'np.zeros', (['shape'], {}), '(shape)\n', (1674, 1681), True, 'import numpy as np\n'), ((1842, 1857), 'numpy.zeros', 'np.zeros', (['shape'], {}), '(shape)\n'... |
# coding: utf-8
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from anchore_engine.services.policy_engine.api.models.base_model_ import Model
from anchore_engine.services.policy_engine.api.models.legacy_vulnerability_report_multi import LegacyVulnerabilityReportMulti ... | [
"anchore_engine.services.policy_engine.api.util.deserialize_model"
] | [((1323, 1356), 'anchore_engine.services.policy_engine.api.util.deserialize_model', 'util.deserialize_model', (['dikt', 'cls'], {}), '(dikt, cls)\n', (1345, 1356), False, 'from anchore_engine.services.policy_engine.api import util\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-01-26 06:06
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('objects', '0012_auto_20180123_1057'),
]
operations = [
migrations.RemoveField(
... | [
"django.db.migrations.RemoveField"
] | [((292, 377), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""contactmessage"""', 'name': '"""contactmessagae_type"""'}), "(model_name='contactmessage', name='contactmessagae_type'\n )\n", (314, 377), False, 'from django.db import migrations\n'), ((417, 496), 'django.db.migratio... |
from neo.Storage.Common.DataCache import DataCache
class Snapshot:
def __init__(self):
self.PersistingBlock = None
self.Blocks = DataCache()
self.Transactions = DataCache()
self.Accounts = DataCache()
self.UnspentCoins = DataCache()
self.SpentCoins = DataCache()
... | [
"neo.Storage.Common.DataCache.DataCache"
] | [((152, 163), 'neo.Storage.Common.DataCache.DataCache', 'DataCache', ([], {}), '()\n', (161, 163), False, 'from neo.Storage.Common.DataCache import DataCache\n'), ((192, 203), 'neo.Storage.Common.DataCache.DataCache', 'DataCache', ([], {}), '()\n', (201, 203), False, 'from neo.Storage.Common.DataCache import DataCache\... |
import torch
from torch.utils.data import Dataset
from torch.utils.data import DataLoader
from data_process.transform import *
import random
import pandas as pd
def read_txt(txt):
f = open(txt, 'r')
lines = f.readlines()
f.close()
return [tmp.strip() for tmp in lines]
class SaltDataset(Dataset):
d... | [
"torch.FloatTensor",
"random.randint",
"torch.utils.data.DataLoader"
] | [((4762, 4849), 'torch.utils.data.DataLoader', 'DataLoader', ([], {'dataset': 'dataset', 'batch_size': 'batch_size', 'num_workers': '(4)', 'shuffle': 'shuffle'}), '(dataset=dataset, batch_size=batch_size, num_workers=4, shuffle=\n shuffle)\n', (4772, 4849), False, 'from torch.utils.data import DataLoader\n'), ((4359... |
# -*- coding: utf-8 -*-
# tests/test_dates.py
# tests for nfl.dates module
import datetime
import logging
import random
import pytest
import nfl.seasons as ns
logging.basicConfig(level=logging.INFO)
@pytest.fixture
def seas():
return random.choice(range(2009, 2020))
@pytest.fixture
def week():
return ra... | [
"logging.basicConfig",
"nfl.seasons.get_season",
"nfl.seasons.week_start",
"datetime.datetime.now",
"datetime.datetime",
"logging.info",
"nfl.seasons.all_seasons",
"nfl.seasons.fantasylabs_week",
"nfl.seasons.current_season_year",
"nfl.seasons.season_week",
"nfl.seasons.week_end"
] | [((163, 202), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (182, 202), False, 'import logging\n'), ((424, 440), 'nfl.seasons.all_seasons', 'ns.all_seasons', ([], {}), '()\n', (438, 440), True, 'import nfl.seasons as ns\n'), ((557, 581), 'nfl.seasons.current_se... |
#utils
import os
import random
import numpy as np
from shutil import copyfile
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt # plt 用于显示图片
# TensorFlow and tf.keras
import tensorflow as tf
from keras.callbacks import TensorBoard, ModelCheckpoint, ReduceLROnPlateau, EarlyStopping
from tensorflow.keras im... | [
"tensorflow.compat.v1.keras.backend.max",
"numpy.random.seed",
"numpy.maximum",
"yolo_utils.scale_boxes",
"numpy.argmax",
"numpy.floor",
"yolo_utils.generate_colors",
"matplotlib.pyplot.figure",
"tensorflow.compat.v1.keras.backend.gather",
"keras.layers.Input",
"yolo3.model.yolo_head",
"matplo... | [((1032, 1057), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1047, 1057), False, 'import os\n'), ((10717, 10786), 'yolo_utils.read_classes', 'yolo_utils.read_classes', (["(current_path + '/model_data/voc_classes.txt')"], {}), "(current_path + '/model_data/voc_classes.txt')\n", (10740, 1078... |
# -*- coding: utf-8 -*-
"""
drupan.deployment.s3sub
Deploy your site to AWS S3. The AWS cli tool is called via subprocess.
Requirement:
Filesystem writer
"""
import subprocess
from hashlib import md5
import json
from io import open
import os
from urllib.parse import urljoin
class Deploy(object)... | [
"subprocess.Popen",
"hashlib.md5",
"urllib.parse.urljoin",
"json.loads",
"os.walk",
"json.dumps",
"os.path.isfile",
"io.open",
"os.path.join"
] | [((2163, 2181), 'os.walk', 'os.walk', (['self.path'], {}), '(self.path)\n', (2170, 2181), False, 'import os\n'), ((2954, 2991), 'os.path.join', 'os.path.join', (['self.md5_path', 'filename'], {}), '(self.md5_path, filename)\n', (2966, 2991), False, 'import os\n'), ((3432, 3469), 'os.path.join', 'os.path.join', (['self.... |
import unittest
from records_mover.db.bigquery.load_job_config_options import load_job_config
from records_mover.records.load_plan import RecordsLoadPlan
from records_mover.records.processing_instructions import ProcessingInstructions
from records_mover.records.records_format import DelimitedRecordsFormat
class Test... | [
"records_mover.records.records_format.DelimitedRecordsFormat",
"records_mover.records.load_plan.RecordsLoadPlan",
"records_mover.db.bigquery.load_job_config_options.load_job_config",
"records_mover.records.processing_instructions.ProcessingInstructions"
] | [((443, 529), 'records_mover.records.records_format.DelimitedRecordsFormat', 'DelimitedRecordsFormat', ([], {'variant': '"""bigquery"""', 'hints': "{'encoding': 'somethingunusual'}"}), "(variant='bigquery', hints={'encoding':\n 'somethingunusual'})\n", (465, 529), False, 'from records_mover.records.records_format im... |
# Generated by Django 2.2.13 on 2020-06-16 08:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("licences", "0004_auto_20200616_0836"),
]
operations = [
migrations.AlterField(
model_name="licence",
name="referenc... | [
"django.db.models.CharField"
] | [((347, 407), 'django.db.models.CharField', 'models.CharField', ([], {'editable': '(False)', 'max_length': '(30)', 'unique': '(True)'}), '(editable=False, max_length=30, unique=True)\n', (363, 407), False, 'from django.db import migrations, models\n')] |
from random import randint
def rand_xy():
x = randint(0, 7)
y = randint(0, 7)
return x, y
def rand_list(size=6):
my_list = []
for _ in range(size):
x, y = rand_xy()
my_list.append((x, y))
return my_list
def rand_in_area(cx, cy, rr, size=10):
my_list = []
for _ in ra... | [
"random.randint"
] | [((52, 65), 'random.randint', 'randint', (['(0)', '(7)'], {}), '(0, 7)\n', (59, 65), False, 'from random import randint\n'), ((74, 87), 'random.randint', 'randint', (['(0)', '(7)'], {}), '(0, 7)\n', (81, 87), False, 'from random import randint\n'), ((348, 364), 'random.randint', 'randint', (['(-rr)', 'rr'], {}), '(-rr,... |
from django.db import models
# Create your models here.
class CurrentAlbum(models.Model):
"""Model representing top albums I am currently listening to."""
title = models.CharField(max_length=200, help_text='Album name')
artist = models.CharField(max_length=200, help_text='Album artist')
img_url = models.CharField... | [
"django.db.models.CharField"
] | [((167, 223), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'help_text': '"""Album name"""'}), "(max_length=200, help_text='Album name')\n", (183, 223), False, 'from django.db import models\n'), ((234, 292), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', ... |
# /mpcutilities/mpcutilities/phys_const.py
"""
--------------------------------------------------------------
Oct 2018
Payne
Functions related to
(i) Physical Constants
(ii) Unit-Conversions
If efficient, might want to replace some of this with the JPL/SPICE stuff
Or novas
Or astropy
Or ... | [
"numpy.dot",
"numpy.sin",
"numpy.array",
"numpy.cos"
] | [((1259, 1270), 'numpy.cos', 'np.cos', (['ecl'], {}), '(ecl)\n', (1265, 1270), True, 'import numpy as np\n'), ((1280, 1292), 'numpy.sin', 'np.sin', (['(-ecl)'], {}), '(-ecl)\n', (1286, 1292), True, 'import numpy as np\n'), ((1306, 1364), 'numpy.array', 'np.array', (['[[1.0, 0.0, 0.0], [0.0, ce, se], [0.0, -se, ce]]'], ... |
# -*- mode:python; coding:utf-8 -*-
# Copyright (c) 2021 IBM Corp. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | [
"pytest.raises",
"pathlib.Path",
"trestle_fedramp.core.format_convert.JsonXmlConverter"
] | [((946, 964), 'trestle_fedramp.core.format_convert.JsonXmlConverter', 'JsonXmlConverter', ([], {}), '()\n', (962, 964), False, 'from trestle_fedramp.core.format_convert import JsonXmlConverter\n'), ((1288, 1306), 'trestle_fedramp.core.format_convert.JsonXmlConverter', 'JsonXmlConverter', ([], {}), '()\n', (1304, 1306),... |
import pandas as pd
import json
from datetime import datetime, date, time
from Package.reader import Reader
ALL_INDEX = False
ALL_GENERAL = False
class SnapchatChatReader(Reader):
def read(self):
'''
This function returns a dataframe from snapchat's json file named 'chathistory.json':
-->... | [
"datetime.datetime.strptime",
"json.load",
"pandas.DataFrame.from_dict"
] | [((1503, 1537), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['outputdict'], {}), '(outputdict)\n', (1525, 1537), True, 'import pandas as pd\n'), ((807, 827), 'json.load', 'json.load', (['json_data'], {}), '(json_data)\n', (816, 827), False, 'import json\n'), ((1664, 1697), 'datetime.datetime.strptime', 'da... |
#! /g/kreshuk/pape/Work/software/conda/miniconda3/envs/cluster_env37/bin/python
import os
import json
import luigi
from cluster_tools import MulticutSegmentationWorkflow
def run_mc(input_path, tmp_folder, max_jobs,
n_scales=1, have_watershed=True, target='local',
from_affinities=False, invert_... | [
"json.dump",
"cluster_tools.MulticutSegmentationWorkflow.get_config",
"cluster_tools.MulticutSegmentationWorkflow",
"os.makedirs"
] | [((2184, 2225), 'cluster_tools.MulticutSegmentationWorkflow.get_config', 'MulticutSegmentationWorkflow.get_config', ([], {}), '()\n', (2223, 2225), False, 'from cluster_tools import MulticutSegmentationWorkflow\n'), ((2260, 2301), 'os.makedirs', 'os.makedirs', (['config_folder'], {'exist_ok': '(True)'}), '(config_folde... |
# -*- coding: utf-8 -*-
from odoo import _, api, fields, models
class ResUsers(models.Model):
_inherit = "res.users"
latitude = fields.Float("Latitude", digits=0)
longitude = fields.Float("Longitude", digits=0)
max_distance = fields.Float(
"Events Maximum Distance (km)",
help="Displa... | [
"odoo._",
"odoo.fields.Float"
] | [((140, 174), 'odoo.fields.Float', 'fields.Float', (['"""Latitude"""'], {'digits': '(0)'}), "('Latitude', digits=0)\n", (152, 174), False, 'from odoo import _, api, fields, models\n'), ((191, 226), 'odoo.fields.Float', 'fields.Float', (['"""Longitude"""'], {'digits': '(0)'}), "('Longitude', digits=0)\n", (203, 226), Fa... |
#!/usr/bin/env python
from django.core.urlresolvers import reverse
from pyhn.libs.tests.base import AnonymousTestCase
class AnonymousListTestCase(AnonymousTestCase):
def test_list_default(self):
response = self.client.get(reverse('news:index'))
self.assertEqual(response.status_code, 200)
... | [
"django.core.urlresolvers.reverse"
] | [((240, 261), 'django.core.urlresolvers.reverse', 'reverse', (['"""news:index"""'], {}), "('news:index')\n", (247, 261), False, 'from django.core.urlresolvers import reverse\n'), ((391, 439), 'django.core.urlresolvers.reverse', 'reverse', (['"""news:list"""'], {'kwargs': "{'cur_page_num': 1}"}), "('news:list', kwargs={... |
from phaseportrait import Trajectory2D, Trajectory3D
from matplotlib import pyplot as plt
import numpy as np
"""
IMPORTANT:
For each example, 3 or 4 plots will be created. In order to prevent your PC from hyperventillating, be sure that your programming environment doesn't plot all
of a sudden every example. If that ... | [
"matplotlib.pyplot.show",
"phaseportrait.Trajectory2D",
"numpy.sin",
"numpy.exp",
"phaseportrait.Trajectory3D"
] | [((575, 670), 'phaseportrait.Trajectory2D', 'Trajectory2D', (['dF'], {'n_points': '(1300)', 'size': '(2)', 'mark_start_position': '(True)', 'Title': '"""Just an example"""'}), "(dF, n_points=1300, size=2, mark_start_position=True, Title=\n 'Just an example')\n", (587, 670), False, 'from phaseportrait import Trajecto... |
import numpy as np
import tensorflow as tf
# The export path contains the name and the version of the model
tf.keras.backend.set_learning_phase(0) # Ignore dropout at inference
model = tf.keras.models.load_model('./model/variety_prediction_zh.h5')
print(model.input, model.outputs)
export_path = './model/VarietyPr... | [
"tensorflow.keras.backend.set_learning_phase",
"tensorflow.keras.models.load_model",
"tensorflow.keras.backend.get_session",
"tensorflow.saved_model.simple_save"
] | [((110, 148), 'tensorflow.keras.backend.set_learning_phase', 'tf.keras.backend.set_learning_phase', (['(0)'], {}), '(0)\n', (145, 148), True, 'import tensorflow as tf\n'), ((189, 251), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['"""./model/variety_prediction_zh.h5"""'], {}), "('./model/variet... |
# Copyright (c) 2015 <NAME>.
# Cura is released under the terms of the LGPLv3 or higher.
from . import ImageReader
from UM.i18n import i18nCatalog
i18n_catalog = i18nCatalog("cura")
def getMetaData():
return {
"mesh_reader": [
{
"extension": "jpg",
"description... | [
"UM.i18n.i18nCatalog"
] | [((164, 183), 'UM.i18n.i18nCatalog', 'i18nCatalog', (['"""cura"""'], {}), "('cura')\n", (175, 183), False, 'from UM.i18n import i18nCatalog\n')] |
# -*- encoding: utf-8 -*-
from cooka.core.analyzer import PandasAnalyzer
from cooka.common.model import AnalyzeJobConf, SampleConf
import unittest
class TestAnalyzer(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.data_path = "cooka/test/dataset/diabetes_10k_datetime.csv"
def te... | [
"cooka.core.analyzer.PandasAnalyzer",
"cooka.common.model.AnalyzeJobConf.load_dict",
"cooka.common.model.SampleConf"
] | [((380, 471), 'cooka.common.model.SampleConf', 'SampleConf', ([], {'sample_strategy': 'SampleConf.Strategy.RandomRows', 'percentage': 'None', 'n_rows': '(200)'}), '(sample_strategy=SampleConf.Strategy.RandomRows, percentage=None,\n n_rows=200)\n', (390, 471), False, 'from cooka.common.model import AnalyzeJobConf, Sa... |
#
# Copyright (c) 2021 Incisive Technology Ltd
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pu... | [
"typing.cast",
"kubernetes.config.load_kube_config",
"pytest.fixture"
] | [((1923, 1967), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'autouse': '(True)'}), "(scope='module', autouse=True)\n", (1937, 1967), False, 'import pytest\n'), ((1358, 1422), 'kubernetes.config.load_kube_config', 'config.load_kube_config', ([], {'config_file': '"""/etc/rancher/k3s/k3s.yaml"""'}),... |
"""Tests for orion frontend.
Needs backend and frontend to be loaded first.
Selenium needs geckodriver to run Firefox browser (2022/06/06):
https://selenium-python.readthedocs.io/installation.html#drivers
"""
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdrive... | [
"selenium.webdriver.firefox.options.Options",
"time.sleep",
"selenium.webdriver.Firefox"
] | [((422, 431), 'selenium.webdriver.firefox.options.Options', 'Options', ([], {}), '()\n', (429, 431), False, 'from selenium.webdriver.firefox.options import Options\n'), ((504, 538), 'selenium.webdriver.Firefox', 'webdriver.Firefox', ([], {'options': 'options'}), '(options=options)\n', (521, 538), False, 'from selenium ... |
from django.db import models
from django.contrib.auth import get_user_model
from posts.models import Post
User = get_user_model()
# W: Anyone | R: Anyone
class SavePost(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='saved_posts')
post = models.ForeignKey(Post, on_delete=mod... | [
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"django.contrib.auth.get_user_model",
"django.db.models.UniqueConstraint"
] | [((115, 131), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (129, 131), False, 'from django.contrib.auth import get_user_model\n'), ((196, 273), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'on_delete': 'models.CASCADE', 'related_name': '"""saved_posts"""'}), "(User, on_de... |
import typing
import numpy as np
def solve(
n: int,
a: typing.List[np.array],
b: np.array,
) -> typing.NoReturn:
g = np.zeros(n, dtype=int)
for i, x in enumerate(a):
x = np.array(x)[1:] - 1
g[x] = i
b -= 1
diff = g[b[:-1]] != g[b[1:]]
print(
np.count_nonzero(diff) + 1
)
def main() ... | [
"numpy.count_nonzero",
"numpy.zeros",
"numpy.array"
] | [((127, 149), 'numpy.zeros', 'np.zeros', (['n'], {'dtype': 'int'}), '(n, dtype=int)\n', (135, 149), True, 'import numpy as np\n'), ((275, 297), 'numpy.count_nonzero', 'np.count_nonzero', (['diff'], {}), '(diff)\n', (291, 297), True, 'import numpy as np\n'), ((186, 197), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', ... |
import re
import matplotlib.pyplot as plt
import sys
import numpy as np
from matplotlib.ticker import FuncFormatter
import math
from collections import defaultdict
from matplotlib.patches import Patch
import brewer2mpl
import subprocess
log_time = 0.0
elgamal_time = 0.0
punc_enc_time = 0.0
baseline_time = 0.0
cmd = ... | [
"subprocess.Popen"
] | [((399, 456), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'shell': '(True)', 'stdout': 'subprocess.PIPE'}), '(cmd, shell=True, stdout=subprocess.PIPE)\n', (415, 456), False, 'import subprocess\n'), ((1119, 1205), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'shell': '(True)', 'stdout': 'subprocess.PIPE', '... |
#!/usr/bin/python3
import os
import datetime
import json
import time
class RTXConfiguration:
_GET_FILE_CMD = "scp <EMAIL>:configv2.json "
# ### Constructor
def __init__(self):
self.version = "ARAX 0.7.0"
file_path = os.path.dirname(os.path.abspath(__file__)) + '/configv2.json'
... | [
"os.path.abspath",
"json.loads",
"os.stat",
"os.path.exists",
"os.system",
"datetime.datetime",
"datetime.datetime.now"
] | [((411, 437), 'os.path.exists', 'os.path.exists', (['local_path'], {}), '(local_path)\n', (425, 437), False, 'import os\n'), ((1068, 1091), 'json.loads', 'json.loads', (['config_data'], {}), '(config_data)\n', (1078, 1091), False, 'import json\n'), ((266, 291), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), ... |
import numpy as np
from mctspy.tree.nodes import TwoPlayersGameMonteCarloTreeSearchNode
from mctspy.tree.search import MonteCarloTreeSearch
from mctspy.games.examples.fourinrow import FourInRowGameState
from mctspy.games.examples.fourinrow import FourInRowMove
import threading,time
from functools import partial
from mu... | [
"threading.Thread",
"mctspy.games.examples.fourinrow.FourInRowMove",
"mctspy.tree.search.MonteCarloTreeSearch",
"numpy.zeros",
"mctspy.games.examples.fourinrow.FourInRowGameState",
"pgzrun.go",
"multiprocessing.Pool",
"mctspy.tree.nodes.TwoPlayersGameMonteCarloTreeSearchNode"
] | [((368, 375), 'multiprocessing.Pool', 'Pool', (['(8)'], {}), '(8)\n', (372, 375), False, 'from multiprocessing import Pool\n'), ((384, 400), 'numpy.zeros', 'np.zeros', (['(7, 7)'], {}), '((7, 7))\n', (392, 400), True, 'import numpy as np\n'), ((414, 461), 'mctspy.games.examples.fourinrow.FourInRowGameState', 'FourInRow... |
import ast
import datetime
import kubernetes
import logging
import os
import sys
from enum import Enum
from statsd import StatsClient
from kubernetes.config import ConfigException
from kubee2etests import __version__
LOGGER = logging.getLogger(__name__)
ANTI_AFFINITY_KEY = "failure-domain.beta.kubernetes.io/zone"... | [
"statsd.StatsClient",
"logging.error",
"logging.debug",
"kubernetes.config.load_incluster_config",
"os.environ.get",
"kubernetes.config.load_kube_config",
"datetime.datetime.strptime",
"sys.exit",
"datetime.datetime.now",
"logging.getLogger"
] | [((231, 258), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (248, 258), False, 'import logging\n'), ((424, 479), 'statsd.StatsClient', 'StatsClient', ([], {'port': 'STATSD_PORT', 'prefix': 'PROMETHEUS_PREFIX'}), '(port=STATSD_PORT, prefix=PROMETHEUS_PREFIX)\n', (435, 479), False, 'from s... |
import urllib.request
import os
import time
path = "../datasets/intraQuarter"
def Check_Yahoo():
statspath = path + "/_KeyStats"
stock_list = [x[0] for x in os.walk(statspath)]
# Added a counter to call out how many files we've already added
counter = 0
for e in stock_list[1:]:
... | [
"os.walk",
"time.sleep"
] | [((175, 193), 'os.walk', 'os.walk', (['statspath'], {}), '(statspath)\n', (182, 193), False, 'import os\n'), ((1772, 1785), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (1782, 1785), False, 'import time\n')] |
#!/usr/bin/env python
# coding=utf8
"""Processing toolbox methods.
This module contains the processing methods.
"""
from __future__ import division
import logging
import re
import numpy as np
import scipy as sp
from scipy import signal
from sklearn.covariance import LedoitWolf as LW
logging.basicConfig(level=lo... | [
"scipy.fftpack.rfftfreq",
"numpy.abs",
"scipy.fftpack.rfft",
"numpy.empty",
"numpy.argsort",
"scipy.hanning",
"numpy.mean",
"numpy.arange",
"numpy.tile",
"numpy.linalg.pinv",
"numpy.unique",
"scipy.signal.lfilter",
"scipy.linalg.inv",
"numpy.linspace",
"numpy.intersect1d",
"numpy.cov",... | [((292, 333), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.NOTSET'}), '(level=logging.NOTSET)\n', (311, 333), False, 'import logging\n'), ((343, 370), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (360, 370), False, 'import logging\n'), ((4756, 4782), 'numpy.mean... |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.fsl.utils import RobustFOV
def test_RobustFOV_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(nohash=True... | [
"nipype.interfaces.fsl.utils.RobustFOV.output_spec",
"nipype.interfaces.fsl.utils.RobustFOV.input_spec"
] | [((633, 655), 'nipype.interfaces.fsl.utils.RobustFOV.input_spec', 'RobustFOV.input_spec', ([], {}), '()\n', (653, 655), False, 'from nipype.interfaces.fsl.utils import RobustFOV\n'), ((916, 939), 'nipype.interfaces.fsl.utils.RobustFOV.output_spec', 'RobustFOV.output_spec', ([], {}), '()\n', (937, 939), False, 'from nip... |
# ----------------------------------------------------------------
# Copyright 2016 Cisco Systems
#
# 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/LICENS... | [
"ydkgen.common.get_include_guard_name",
"ydkgen.common.sort_classes_at_same_level"
] | [((1401, 1449), 'ydkgen.common.get_include_guard_name', 'get_include_guard_name', (['package.name', 'file_index'], {}), '(package.name, file_index)\n', (1423, 1449), False, 'from ydkgen.common import sort_classes_at_same_level, get_include_guard_name\n'), ((3246, 3281), 'ydkgen.common.sort_classes_at_same_level', 'sort... |
import doctest
import pytest
from insights.parsers import avc_cache_threshold, ParseException
from insights.parsers.avc_cache_threshold import AvcCacheThreshold
from insights.tests import context_wrap
AVC_CACHE_THRESHOLD = """
512
""".strip()
AVC_CACHE_THRESHOLD_INVALID = """
invalid
invalid
invalid
""".strip()
def... | [
"insights.tests.context_wrap",
"pytest.raises",
"doctest.testmod"
] | [((864, 911), 'doctest.testmod', 'doctest.testmod', (['avc_cache_threshold'], {'globs': 'env'}), '(avc_cache_threshold, globs=env)\n', (879, 911), False, 'import doctest\n'), ((409, 442), 'insights.tests.context_wrap', 'context_wrap', (['AVC_CACHE_THRESHOLD'], {}), '(AVC_CACHE_THRESHOLD)\n', (421, 442), False, 'from in... |
'''
:class:`GlycanComposition`, :class:`MonosaccharideResidue`, and :class:`SubstituentResidue` are
useful for working with bag-of-residues where topology and connections are not relevant, but
the aggregate composition is known. These types work with a subset of the IUPAC three letter code
for specifying compositions.
... | [
"glypy.composition.Composition",
"glypy.composition.composition_transform.strip_derivatization",
"glypy.composition.composition_transform._derivatize_reducing_end",
"glypy.io.nomenclature.identity.is_a",
"glypy._c.structure.glycan_composition._CompositionBase.__setitem__",
"glypy.io.iupac.monosaccharide_r... | [((5394, 5457), 'glypy.structure.monosaccharide.Monosaccharide.register_serializer', 'Monosaccharide.register_serializer', (['"""iupac_lite"""', 'to_iupac_lite'], {}), "('iupac_lite', to_iupac_lite)\n", (5428, 5457), False, 'from glypy.structure.monosaccharide import Monosaccharide, ReducedEnd\n'), ((7931, 7960), 'glyp... |
import tempfile
from pathlib import Path
import pytest
from judge.schema import CompareMode
from judge.tools import testing
@pytest.mark.offline
@pytest.mark.parametrize("job", [None, 2])
def test_judge_status(job):
with tempfile.TemporaryDirectory() as _tempdir:
tempdir = Path(_tempdir) / "abc000_a"
... | [
"judge.tools.testing.test",
"tempfile.TemporaryDirectory",
"judge.tools.testing.get_testcases",
"pathlib.Path",
"pytest.mark.parametrize",
"judge.schema.CompareMode",
"judge.tools.testing.GetTestCasesArgs",
"judge.tools.testing.TestingArgs"
] | [((150, 191), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""job"""', '[None, 2]'], {}), "('job', [None, 2])\n", (173, 191), False, 'import pytest\n'), ((3163, 3204), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""job"""', '[None, 2]'], {}), "('job', [None, 2])\n", (3186, 3204), False, 'import... |
import iam_floyd as statement
import importlib
import os
import sys
import inspect
currentdir = os.path.dirname(os.path.abspath(
inspect.getfile(inspect.currentframe())))
helperDir = '%s/../../helper/python' % currentdir
sys.path.insert(0, helperDir)
test = importlib.import_module('python_test')
out = getattr(tes... | [
"iam_floyd.S3",
"sys.path.insert",
"importlib.import_module",
"inspect.currentframe"
] | [((226, 255), 'sys.path.insert', 'sys.path.insert', (['(0)', 'helperDir'], {}), '(0, helperDir)\n', (241, 255), False, 'import sys\n'), ((264, 302), 'importlib.import_module', 'importlib.import_module', (['"""python_test"""'], {}), "('python_test')\n", (287, 302), False, 'import importlib\n'), ((150, 172), 'inspect.cur... |
import torch
import glob
import code
import argparse
import csv
from dataset import ExampleDataset, batchify
from dataloader import DocDataset
import json
import pickle
import numpy as np
import torch
import os
import code
from torch.utils.data import (DataLoader, RandomSampler, SequentialSampler,
... | [
"dataset.ExampleDataset",
"numpy.stack",
"json.dump",
"numpy.sum",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"pytorch_pretrained_bert.BertTokenizer.from_pretrained",
"prepro.get_features",
"numpy.unique",
"torch.load",
"numpy.argsort",
"torch.utils.data.SequentialSampler",
"t... | [((1076, 1101), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1099, 1101), False, 'import argparse\n'), ((2857, 2994), 'pytorch_pretrained_bert.BertForSequenceClassification.from_pretrained', 'BertForSequenceClassification.from_pretrained', (['"""models/bert-large-uncased-whole-word-masking/"... |
# Silly script that simulates buying and selling crypto
import os
import sys
import traceback
import requests
import json
import argparse
import hashlib
from urllib.parse import quote_plus
START_BALANCE_USD = 100000
PAIRS = {
'XBTUSD': ('XBT', 'USD'),
}
def _wallet_name(target_name):
return "wallet_{}.j... | [
"json.load",
"argparse.ArgumentParser",
"os.path.exists",
"json.dumps",
"requests.get",
"sys.exit"
] | [((1312, 1406), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Fetch crypto prices and output a normalized value."""'}), "(description=\n 'Fetch crypto prices and output a normalized value.')\n", (1335, 1406), False, 'import argparse\n'), ((4119, 4130), 'sys.exit', 'sys.exit', (['(2)'... |
#!/usr/bin/env python3
import sys
import base64
import yaml
def read_contents(path):
with open(path, 'rb') as f:
return base64.b64encode(f.read()).decode('utf8')
def replace_path_with_contents(obj, key):
path = obj.get(key)
if path:
obj[key + '-data'] = read_contents(path)
del obj[key]
def replace_... | [
"yaml.load",
"yaml.dump"
] | [((593, 637), 'yaml.load', 'yaml.load', (['sys.stdin'], {'Loader': 'yaml.SafeLoader'}), '(sys.stdin, Loader=yaml.SafeLoader)\n', (602, 637), False, 'import yaml\n'), ((946, 975), 'yaml.dump', 'yaml.dump', (['config', 'sys.stdout'], {}), '(config, sys.stdout)\n', (955, 975), False, 'import yaml\n')] |
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | [
"torch.set_num_threads",
"torch.no_grad",
"collections.namedtuple",
"torch.multiprocessing.Pool"
] | [((1095, 1150), 'collections.namedtuple', 'namedtuple', (['"""KaolinDatasetItem"""', "['data', 'attributes']"], {}), "('KaolinDatasetItem', ['data', 'attributes'])\n", (1105, 1150), False, 'from collections import namedtuple\n'), ((851, 875), 'torch.set_num_threads', 'torch.set_num_threads', (['(1)'], {}), '(1)\n', (87... |
"""CLI management commands."""
import click
from flask import Flask
from flask.cli import with_appcontext
from db import db
@click.command("init-db")
@with_appcontext
def init_db() -> None:
"""Initialize database."""
# Import models so SQLAlchemy can create tables for them.
from models import User # py... | [
"db.db.create_all",
"click.echo",
"db.db.drop_all",
"click.command"
] | [((129, 153), 'click.command', 'click.command', (['"""init-db"""'], {}), "('init-db')\n", (142, 153), False, 'import click\n'), ((351, 364), 'db.db.drop_all', 'db.drop_all', ([], {}), '()\n', (362, 364), False, 'from db import db\n'), ((369, 384), 'db.db.create_all', 'db.create_all', ([], {}), '()\n', (382, 384), False... |
from query_filter_builder.sql.sql_filters import convert_to_sql_with_params
simple_obj = {
"version": 0.1,
"filters": [
{
"col": "col1",
"value": "asd",
},
{
"col": "col2",
"value": "~asd",
},
{
"col": "col3",
... | [
"query_filter_builder.sql.sql_filters.convert_to_sql_with_params"
] | [((1277, 1315), 'query_filter_builder.sql.sql_filters.convert_to_sql_with_params', 'convert_to_sql_with_params', (['simple_obj'], {}), '(simple_obj)\n', (1303, 1315), False, 'from query_filter_builder.sql.sql_filters import convert_to_sql_with_params\n'), ((1602, 1640), 'query_filter_builder.sql.sql_filters.convert_to_... |
# Copyright 2016 OVH SAS
#
# 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 ... | [
"oslo_log.log.getLogger",
"neutron._i18n._LI",
"neutron.agent.linux.tc_lib.TcCommand"
] | [((906, 929), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (919, 929), False, 'from oslo_log import log\n'), ((1872, 1928), 'neutron.agent.linux.tc_lib.TcCommand', 'tc_lib.TcCommand', (["port['device']", 'cfg.CONF.QOS.kernel_hz'], {}), "(port['device'], cfg.CONF.QOS.kernel_hz)\n", (188... |
import time
import pudb
import sys
from munch import Munch
import numpy as np
from plaster.tools.zlog.zlog import (
spy,
add_log_fields,
tell,
)
from plaster.tools.zlog.profile import prof_start, prof_stop, prof
from plaster.tools.zlog import zlog
from logging import getLogger
import tempfile
import logging... | [
"munch.Munch",
"plaster.tools.zlog.zlog.add_log_fields",
"plaster.tools.zlog.zlog.spy",
"plaster.tools.zlog.profile.prof",
"tempfile.NamedTemporaryFile",
"pudb.set_trace",
"plaster.tools.zlog.zlog.add_handler",
"logging.StreamHandler",
"time.sleep",
"plaster.tools.zlog.zlog.TypeAwareJsonFormatter"... | [((328, 347), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (337, 347), False, 'from logging import getLogger\n'), ((579, 592), 'plaster.tools.zlog.zlog.spy', 'spy', (['a', '(a + 1)'], {}), '(a, a + 1)\n', (582, 592), False, 'from plaster.tools.zlog.zlog import spy, add_log_fields, tell\n'), ((6... |
import pendulum
locale = "fo"
def test_diff_for_humans():
with pendulum.test(pendulum.datetime(2016, 8, 29)):
diff_for_humans()
def diff_for_humans():
d = pendulum.now().subtract(seconds=1)
assert d.diff_for_humans(locale=locale) == "1 sekund síðan"
d = pendulum.now().subtract(seconds=2)
... | [
"pendulum.now",
"pendulum.datetime"
] | [((1794, 1808), 'pendulum.now', 'pendulum.now', ([], {}), '()\n', (1806, 1808), False, 'import pendulum\n'), ((85, 115), 'pendulum.datetime', 'pendulum.datetime', (['(2016)', '(8)', '(29)'], {}), '(2016, 8, 29)\n', (102, 115), False, 'import pendulum\n'), ((177, 191), 'pendulum.now', 'pendulum.now', ([], {}), '()\n', (... |
from abc import ABCMeta, abstractmethod
import torch
import torch.nn as nn
from mmcv.cnn import normal_init, ConvModule, kaiming_init
from mmcv.runner import auto_fp16, force_fp32
from mmseg.models.builder import GENERATOR_HEAD
from mmseg.ops import resize, Upsample
import torch.nn.functional as F
class DoubleConv(nn... | [
"torch.nn.ConvTranspose2d",
"torch.nn.ModuleList",
"mmseg.ops.Upsample",
"mmseg.models.builder.GENERATOR_HEAD.register_module",
"mmcv.cnn.ConvModule",
"torch.nn.functional.pad"
] | [((3884, 3916), 'mmseg.models.builder.GENERATOR_HEAD.register_module', 'GENERATOR_HEAD.register_module', ([], {}), '()\n', (3914, 3916), False, 'from mmseg.models.builder import GENERATOR_HEAD\n'), ((7847, 7879), 'mmseg.models.builder.GENERATOR_HEAD.register_module', 'GENERATOR_HEAD.register_module', ([], {}), '()\n', ... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... | [
"numpy.random.rand",
"mindspore.context.set_context",
"mindspore.ops.operations.DynamicGRUV2"
] | [((835, 903), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.GRAPH_MODE', 'device_target': '"""Ascend"""'}), "(mode=context.GRAPH_MODE, device_target='Ascend')\n", (854, 903), True, 'import mindspore.context as context\n'), ((1031, 1047), 'mindspore.ops.operations.DynamicGRUV2', 'P.Dynam... |
# This code is modified from <NAME>, Carles, & <NAME>. (2019, August 5). Swiss-Polar-Institute/science-cruise-data-management v0.1.0 (Version 0.1.0). Zenodo. http://doi.org/10.5281/zenodo.3360649
# Also available at: https://github.com/Swiss-Polar-Institute/science-cruise-data-management
from django.core.management.ba... | [
"csv.DictReader",
"project_core.models.CountryUid.objects.get_or_create",
"project_core.models.Country",
"project_core.models.Source.objects.get_or_create"
] | [((906, 929), 'csv.DictReader', 'csv.DictReader', (['csvfile'], {}), '(csvfile)\n', (920, 929), False, 'import csv\n'), ((961, 1009), 'project_core.models.Source.objects.get_or_create', 'Source.objects.get_or_create', ([], {'source': 'source_name'}), '(source=source_name)\n', (989, 1009), False, 'from project_core.mode... |
import numpy as np
import pytest
from adjoint_test import check_adjoint_test_tight
adjoint_parametrizations = []
# Main functionality
adjoint_parametrizations.append(
pytest.param(
np.arange(0, 3), [1, 3, 1, 1], # P_x_ranks, P_x_shape
np.arange(0, 2), [1, 2, 1, 1], # P_y_ranks, P_y_shape
... | [
"distdl.utilities.slicing.compute_subshape",
"distdl.nn.conv_channel.DistributedChannelConv2d",
"pytest.mark.mpi",
"numpy.asarray",
"distdl.backends.mpi.partition.MPIPartition",
"torch.randn",
"numpy.arange",
"adjoint_test.check_adjoint_test_tight",
"torch.zeros",
"pytest.mark.parametrize",
"dis... | [((2406, 2598), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""P_x_ranks, P_x_shape,P_y_ranks, P_y_shape,P_w_ranks, P_w_shape,x_global_shape,comm_split_fixture"""', 'adjoint_parametrizations'], {'indirect': "['comm_split_fixture']"}), "(\n 'P_x_ranks, P_x_shape,P_y_ranks, P_y_shape,P_w_ranks, P_w_shape,... |
# Generated by Django 3.2.9 on 2022-01-23 12:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0003_auto_20220121_1002'),
]
operations = [
migrations.AlterField(
model_name='site',
name='long',
... | [
"django.db.models.URLField"
] | [((328, 345), 'django.db.models.URLField', 'models.URLField', ([], {}), '()\n', (343, 345), False, 'from django.db import migrations, models\n'), ((464, 502), 'django.db.models.URLField', 'models.URLField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (479, 502), False, 'from django.db impo... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from machina.apps.forum_tracking.abstract_models import AbstractForumReadTrack
from machina.apps.forum_tracking.abstract_models import AbstractTopicReadTrack
from machina.core.db.models import model_factory
ForumReadTrack = model_factory(AbstractForumR... | [
"machina.core.db.models.model_factory"
] | [((292, 329), 'machina.core.db.models.model_factory', 'model_factory', (['AbstractForumReadTrack'], {}), '(AbstractForumReadTrack)\n', (305, 329), False, 'from machina.core.db.models import model_factory\n'), ((347, 384), 'machina.core.db.models.model_factory', 'model_factory', (['AbstractTopicReadTrack'], {}), '(Abstr... |
import signal
from os import path as ospath, remove as osremove, execl as osexecl
from subprocess import run as srun
from psutil import disk_usage, cpu_percent, swap_memory, cpu_count, virtual_memory, net_io_counters, Process as psprocess
from time import time
from pyrogram import idle
from sys import executable
from ... | [
"psutil.virtual_memory",
"os.remove",
"os.execl",
"bot.bot.sendMessage",
"bot.dispatcher.add_handler",
"os.path.isfile",
"bot.alive.kill",
"psutil.cpu_count",
"psutil.swap_memory",
"psutil.disk_usage",
"psutil.net_io_counters",
"telegram.ext.CommandHandler",
"bot.bot.edit_message_text",
"b... | [((14727, 14738), 'bot.app.start', 'app.start', ([], {}), '()\n', (14736, 14738), False, 'from bot import bot, app, dispatcher, updater, botStartTime, IGNORE_PENDING_REQUESTS, PORT, alive, web, AUTHORIZED_CHATS, LOGGER, Interval, rss_session, a2c\n'), ((14746, 14752), 'pyrogram.idle', 'idle', ([], {}), '()\n', (14750, ... |
import json
import os
import unittest
from typing import Callable
from dict_compare import dict_compare
from jsonasobj2 import as_json_obj, as_dict, as_json, get, setdefault, JsonObj, keys, items, values
from jsonasobj2 import loads as jso_loads, load as jso_load
CWD = os.path.dirname(__file__)
INPUT_DIR = os.path.... | [
"unittest.main",
"jsonasobj2.setdefault",
"jsonasobj2.as_json_obj",
"json.load",
"jsonasobj2.keys",
"jsonasobj2.as_dict",
"jsonasobj2.as_json",
"os.path.dirname",
"jsonasobj2.get",
"jsonasobj2.JsonObj",
"jsonasobj2.load",
"jsonasobj2.values",
"jsonasobj2.items",
"os.path.join",
"os.listd... | [((274, 299), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (289, 299), False, 'import os\n'), ((312, 338), 'os.path.join', 'os.path.join', (['CWD', '"""input"""'], {}), "(CWD, 'input')\n", (324, 338), False, 'import os\n'), ((4558, 4573), 'unittest.main', 'unittest.main', ([], {}), '()\n', ... |
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# Licensed under Microsoft Incubation License Agreement:
import json
import os
import typing
import shutil
from enum import Enum
from pprint import pprint
from dagcontext.authentication.identityprovider import IdentitySelector
from dagcontext.authentication... | [
"os.remove",
"dagcontext.context.inflight.InflightTracker",
"os.makedirs",
"json.loads",
"os.walk",
"os.path.exists",
"json.dumps",
"pprint.pprint",
"dagcontext.configurations.airflowctx_config.AirflowContextConfiguration",
"shutil.rmtree",
"os.path.join"
] | [((2124, 2160), 'dagcontext.configurations.airflowctx_config.AirflowContextConfiguration', 'AirflowContextConfiguration', (['context'], {}), '(context)\n', (2151, 2160), False, 'from dagcontext.configurations.airflowctx_config import AirflowContextConfiguration\n'), ((14471, 14501), 'os.path.exists', 'os.path.exists', ... |
"""
Thermodynamic properties:
-------------------------
Thermodynamic properties of different species (NASA Glenn coefficients).
Creates an object with
MRodriguez. 2020
"""
import os
import numpy as np
class ThermoProperties():
def __init__(self, species=None):
"""
"""
... | [
"numpy.zeros",
"os.path.dirname",
"os.path.join"
] | [((338, 363), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (353, 363), False, 'import os\n'), ((396, 439), 'os.path.join', 'os.path.join', (['thermoprop_dir', '"""./nasa9.dat"""'], {}), "(thermoprop_dir, './nasa9.dat')\n", (408, 439), False, 'import os\n'), ((3223, 3257), 'numpy.zeros', 'np... |
import re
import logging
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from product_spiders.items import Product, ProductLoaderWithNameStrip as Pro... | [
"product_spiders.items.Product",
"scrapy.http.Request",
"scrapy.selector.HtmlXPathSelector"
] | [((558, 585), 'scrapy.selector.HtmlXPathSelector', 'HtmlXPathSelector', (['response'], {}), '(response)\n', (575, 585), False, 'from scrapy.selector import HtmlXPathSelector\n'), ((795, 822), 'scrapy.selector.HtmlXPathSelector', 'HtmlXPathSelector', (['response'], {}), '(response)\n', (812, 822), False, 'from scrapy.se... |
# Copyright 2018 <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 applicable law or agreed to in writing, softw... | [
"galini.core.SumExpression",
"galini.expression_relaxation.expression_relaxation.ExpressionRelaxationResult"
] | [((2792, 2819), 'galini.core.SumExpression', 'SumExpression', (['new_children'], {}), '(new_children)\n', (2805, 2819), False, 'from galini.core import SumExpression\n'), ((2835, 2894), 'galini.expression_relaxation.expression_relaxation.ExpressionRelaxationResult', 'ExpressionRelaxationResult', (['new_expression', 'ne... |
# -*- coding: utf-8 -*-
from copy import deepcopy
from ._base import Base
from ..objects import Component
from tkinter import Frame
class If(Base):
def __init__(self, master, cond:str, component:Component):
super().__init__(Frame, master)
self.cond, self.component = cond, component
def rende... | [
"copy.deepcopy"
] | [((1851, 1874), 'copy.deepcopy', 'deepcopy', (['child.options'], {}), '(child.options)\n', (1859, 1874), False, 'from copy import deepcopy\n')] |
import re
import sys
import logging
import numpy as np
from albert_emb.config import LOG_LEVEL
has_point = re.compile(r'\.[\s*]$')
def eval_ending(text):
text = text.strip()
if text.endswith("..."):
text += " ."
elif not text.endswith("."):
text += "."
return text
def paragraphs_jo... | [
"numpy.float16",
"numpy.float32",
"logging.Formatter",
"logging.getLogger",
"re.compile"
] | [((109, 133), 're.compile', 're.compile', (['"""\\\\.[\\\\s*]$"""'], {}), "('\\\\.[\\\\s*]$')\n", (119, 133), False, 'import re\n'), ((499, 522), 'logging.getLogger', 'logging.getLogger', (['name'], {}), '(name)\n', (516, 522), False, 'import logging\n'), ((842, 915), 'logging.Formatter', 'logging.Formatter', (['"""%(a... |
#!/usr/bin/env python
import os
import sys
import shutil
import subprocess
#image editting
from PIL import Image
# parallel stuff
import multiprocessing
from joblib import Parallel, delayed
## this script will convert your TIFS to lower quality/sized JPGs for quicker QC. It will also make a folder and move all the J... | [
"os.mkdir",
"os.getcwd",
"subprocess.call",
"os.path.join",
"os.listdir",
"os.scandir"
] | [((357, 368), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (366, 368), False, 'import os\n'), ((485, 562), 'subprocess.call', 'subprocess.call', (['p3'], {'stdout': 'subprocess.PIPE', 'shell': '(True)', 'preexec_fn': 'os.setsid'}), '(p3, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setsid)\n', (500, 562), False, 'i... |
import numpy as np
import openravepy as orpy
import toppra as ta
import matplotlib.pyplot as plt
import os, argparse
import logging
import following
logger = logging.getLogger(__name__)
def main(env=None, verbose=False, savefig=False):
# Setup Logging
if verbose:
logging.basicConfig(level="DEBUG")
... | [
"matplotlib.pyplot.title",
"toppra.constraint.RobustCanonicalLinearConstraint",
"following.try_load_denso",
"numpy.random.seed",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"logging.basicConfig",
"numpy.random.randn",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.legend",
"openravepy.E... | [((158, 185), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (175, 185), False, 'import logging\n'), ((558, 587), 'following.try_load_denso', 'following.try_load_denso', (['env'], {}), '(env)\n', (582, 587), False, 'import following\n'), ((623, 641), 'numpy.random.seed', 'np.random.seed',... |
"""Demo the viewer used in conjunction with data acquisition."""
def main():
"""Creates a sample client that reads data from a sample TCP server
(see demo/server.py). Data is written to a buffer.db sqlite3 database
and streamed through a GUI. These files are written in whichever directory
the script w... | [
"bcipy.acquisition.devices.supported_device",
"bcipy.gui.viewer.data_viewer.main",
"bcipy.acquisition.datastream.lsl_server.LslDataServer"
] | [((598, 621), 'bcipy.acquisition.devices.supported_device', 'supported_device', (['"""LSL"""'], {}), "('LSL')\n", (614, 621), False, 'from bcipy.acquisition.devices import supported_device\n'), ((635, 673), 'bcipy.acquisition.datastream.lsl_server.LslDataServer', 'LslDataServer', ([], {'device_spec': 'device_spec'}), '... |
from sqlalchemy import Column, String, Integer
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
engine = create_engine("sqlite:///news.db")
session = sessionmaker(bind=engine)
class News(Base):
__tablen... | [
"sqlalchemy.create_engine",
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.Column"
] | [((189, 207), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (205, 207), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((217, 251), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite:///news.db"""'], {}), "('sqlite:///news.db')\n", (230, 251), False, '... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 09 13:01:42 2015
@author: <NAME>
The MIT License (MIT)
Copyright (c) 2015
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restri... | [
"os.makedirs",
"matplotlib.pyplot.ioff",
"os.getcwd",
"matplotlib.pyplot.close",
"os.path.exists",
"tkinter.filedialog.Tk",
"tkinter.filedialog.askdirectory",
"astropy.io.fits.open",
"glob.glob",
"matplotlib.pyplot.subplots"
] | [((1415, 1431), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (1424, 1431), True, 'import matplotlib.pyplot as plt\n'), ((1442, 1449), 'tkinter.filedialog.Tk', 'tk.Tk', ([], {}), '()\n', (1447, 1449), True, 'from tkinter import filedialog as tk\n'), ((1479, 1490), 'os.getcwd', 'os.getcwd', (... |
from os.path import join, abspath, dirname, pardir
# Directories
BASE_DIR = abspath(join(dirname(__file__), pardir))
outputdir = join(BASE_DIR, 'split/results/')
randomoutputdir = join(BASE_DIR, 'split/randomresults/')
logdir = join(BASE_DIR,'split/')
# Files
confdir = join(BASE_DIR, 'conf.ini')
# Logging format
LOG_... | [
"os.path.dirname",
"os.path.join"
] | [((130, 162), 'os.path.join', 'join', (['BASE_DIR', '"""split/results/"""'], {}), "(BASE_DIR, 'split/results/')\n", (134, 162), False, 'from os.path import join, abspath, dirname, pardir\n'), ((181, 219), 'os.path.join', 'join', (['BASE_DIR', '"""split/randomresults/"""'], {}), "(BASE_DIR, 'split/randomresults/')\n", (... |
from tabulate import tabulate
from pyhttptest.constants import (
SLICE_TO_INDEX,
PRINTER_HEADERS,
PRINTER_HEADERS_DATA_KEYS
)
from pyhttptest.utils import extract_properties_values_from_json
def _slice_str_args(*args, slice_to=SLICE_TO_INDEX):
"""Given `str` arguments are sliced to the specified leng... | [
"tabulate.tabulate",
"pyhttptest.utils.extract_properties_values_from_json"
] | [((1568, 1619), 'tabulate.tabulate', 'tabulate', (['list_data', 'headers'], {'tablefmt': '"""fancy_grid"""'}), "(list_data, headers, tablefmt='fancy_grid')\n", (1576, 1619), False, 'from tabulate import tabulate\n'), ((1993, 2062), 'pyhttptest.utils.extract_properties_values_from_json', 'extract_properties_values_from_... |
import re
import pytest
from fairypptx import TextRange
from fairypptx import Color
from fairypptx import Shape
from fairypptx import constants
@pytest.mark.parametrize(
"mode, s1, s2, expected",
[
("after", "First", "Suffix", "FirstSuffix"),
("before", "First", "Prefix", "PrefixFirst"),
]... | [
"fairypptx.Color",
"re.split",
"fairypptx.Shape.make",
"fairypptx.TextRange.make_itemization",
"pytest.main",
"fairypptx.TextRange.make",
"pytest.mark.parametrize",
"fairypptx.TextRange"
] | [((147, 293), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mode, s1, s2, expected"""', "[('after', 'First', 'Suffix', 'FirstSuffix'), ('before', 'First', 'Prefix',\n 'PrefixFirst')]"], {}), "('mode, s1, s2, expected', [('after', 'First',\n 'Suffix', 'FirstSuffix'), ('before', 'First', 'Prefix', 'Pr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.