code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
# -*- coding: utf-8 -*-
import os
import json
import hashlib
from shutil import rmtree
from tempfile import mkdtemp
import mock
from datetime import datetime
from django.contrib.auth.models import Group
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.urlresolvers import reverse
from dja... | [
"geotrek.zoning.factories.DistrictFactory",
"geotrek.tourism.factories.TouristicEventFactory.create_batch",
"django.core.urlresolvers.reverse",
"geotrek.zoning.factories.CityFactory",
"geotrek.common.models.FileType.objects.create",
"geotrek.tourism.factories.TouristicContentType1Factory",
"shutil.rmtre... | [((4929, 4969), 'django.test.utils.override_settings', 'override_settings', ([], {'TOURISM_ENABLED': '(False)'}), '(TOURISM_ENABLED=False)\n', (4946, 4969), False, 'from django.test.utils import override_settings\n'), ((6080, 6144), 'django.test.utils.override_settings', 'override_settings', ([], {'THUMBNAIL_COPYRIGHT_... |
#!/usr/bin/env python3
"""
Tests of ktrain text classification flows
"""
import testenv
import IPython
from unittest import TestCase, main, skip
import numpy as np
import os
os.environ['DISABLE_V2_BEHAVIOR'] = '0'
import ktrain
from ktrain import text as txt
class TestNERClassification(TestCase):
def setUp(self... | [
"unittest.main",
"ktrain.get_predictor",
"ktrain.get_learner",
"ktrain.text.entities_from_txt",
"ktrain.load_predictor",
"ktrain.text.sequence_tagger"
] | [((2049, 2055), 'unittest.main', 'main', ([], {}), '()\n', (2053, 2055), False, 'from unittest import TestCase, main, skip\n'), ((391, 419), 'ktrain.text.entities_from_txt', 'txt.entities_from_txt', (['TDATA'], {}), '(TDATA)\n', (412, 419), True, 'from ktrain import text as txt\n'), ((541, 619), 'ktrain.text.sequence_t... |
#
# Generated with DynamicNodalForceItemBlueprint
from dmt.blueprint import Blueprint
from dmt.dimension import Dimension
from dmt.attribute import Attribute
from dmt.enum_attribute import EnumAttribute
from dmt.blueprint_attribute import BlueprintAttribute
from .segmentreference import SegmentReferenceBlueprint
clas... | [
"dmt.attribute.Attribute",
"dmt.enum_attribute.EnumAttribute",
"dmt.blueprint_attribute.BlueprintAttribute",
"dmt.dimension.Dimension"
] | [((578, 621), 'dmt.attribute.Attribute', 'Attribute', (['"""name"""', '"""string"""', '""""""'], {'default': '""""""'}), "('name', 'string', '', default='')\n", (587, 621), False, 'from dmt.attribute import Attribute\n'), ((651, 701), 'dmt.attribute.Attribute', 'Attribute', (['"""description"""', '"""string"""', '"""""... |
# MIT License
#
# Copyright (c) 2022 Quandela
#
# 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, pub... | [
"perceval.Matrix.random_unitary",
"perceval.BackendFactory",
"perceval.Circuit",
"perceval.BasicState"
] | [((1133, 1163), 'perceval.Matrix.random_unitary', 'pcvl.Matrix.random_unitary', (['(10)'], {}), '(10)\n', (1159, 1163), True, 'import perceval as pcvl\n'), ((1212, 1231), 'perceval.Circuit', 'pcvl.Circuit', (['(10)', 'u'], {}), '(10, u)\n', (1224, 1231), True, 'import perceval as pcvl\n'), ((1170, 1191), 'perceval.Back... |
import os
import shutil
from typing import Optional
import yaml
class Transform:
"""Parent class for transforms, that sets up a lot of default file info
"""
DEFAULT_INPUT_DIR = os.path.join('data', 'raw')
DEFAULT_OUTPUT_DIR = os.path.join('data', 'transformed')
# NLP
DEFAULT_NLP_DIR = os.path... | [
"yaml.load",
"os.makedirs",
"os.path.exists",
"shutil.rmtree",
"os.path.join"
] | [((192, 219), 'os.path.join', 'os.path.join', (['"""data"""', '"""raw"""'], {}), "('data', 'raw')\n", (204, 219), False, 'import os\n'), ((245, 280), 'os.path.join', 'os.path.join', (['"""data"""', '"""transformed"""'], {}), "('data', 'transformed')\n", (257, 280), False, 'import os\n'), ((313, 340), 'os.path.join', 'o... |
# -*- coding: utf-8 -*-
"""Utility functions."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import base64
import csv
from importlib import import_module
import json
import logging
import os... | [
"csv.reader",
"pathlib.Path.home",
"joblib.dump",
"base64.b64decode",
"pathlib.Path",
"os.chdir",
"json.loads",
"json.dump",
"csv.writer",
"importlib.import_module",
"numpy.frombuffer",
"subprocess.check_output",
"PyQt5.QtCore.QByteArray.fromBase64",
"textwrap.dedent",
"os.getcwd",
"ba... | [((455, 482), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (472, 482), False, 'import logging\n'), ((938, 964), 'base64.b64decode', 'base64.b64decode', (['data_b64'], {}), '(data_b64)\n', (954, 964), False, 'import base64\n'), ((3303, 3313), 'pathlib.Path', 'Path', (['path'], {}), '(pat... |
import base64
import subprocess
from subprocess import STDOUT, PIPE
class _SequenceExtractor(object):
"""
Inner python binding to the SequenceExtractor library. It works by executing the jar file as a subprocess
and opening pipes to the standard input and standard output so that messages can be sent and rece... | [
"subprocess.Popen",
"base64.b64encode",
"base64.b64decode"
] | [((1649, 1715), 'subprocess.Popen', 'subprocess.Popen', (['self.cmd'], {'stdin': 'PIPE', 'stdout': 'PIPE', 'stderr': 'STDOUT'}), '(self.cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT)\n', (1665, 1715), False, 'import subprocess\n'), ((2883, 2913), 'base64.b64encode', 'base64.b64encode', (['decodedbytes'], {}), '(decodedby... |
import pytest
from src.dataToCode.languages.toPython.methodToPython import MethodToPython
from src.dataToCode.dataClasses.method import Method
from src.dataToCode.dataClasses.visibility import Visibility
from src.dataToCode.dataClasses.attribute import Attribute
from src.dataToCode.dataClasses.modifier import Modifier
... | [
"src.dataToCode.dataClasses.attribute.Attribute",
"pytest.mark.parametrize",
"src.dataToCode.languages.toPython.methodToPython.MethodToPython",
"src.dataToCode.dataClasses.method.Method"
] | [((1296, 1360), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""visibility, expected"""', 'visibility_data'], {}), "('visibility, expected', visibility_data)\n", (1319, 1360), False, 'import pytest\n'), ((1757, 1820), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""parameters, expected"""', 'par... |
"""Preprocessing mixins."""
import tensorflow as tf
class PerImageStandardizationPreprocessingMixin:
"""Per image standardization preprocessing mixin for NeuralNetwork s."""
# noinspection PyMethodMayBeStatic
def get_raw_fn(self): # noqa: D102
import tensorflow.python.util.deprecation as depreca... | [
"tensorflow.cast",
"tensorflow.python.util.deprecation.silence",
"tensorflow.image.per_image_standardization"
] | [((398, 424), 'tensorflow.cast', 'tf.cast', (['image', 'tf.float32'], {}), '(image, tf.float32)\n', (405, 424), True, 'import tensorflow as tf\n'), ((494, 515), 'tensorflow.python.util.deprecation.silence', 'deprecation.silence', ([], {}), '()\n', (513, 515), True, 'import tensorflow.python.util.deprecation as deprecat... |
from spinn_machine.utilities.progress_bar import ProgressBar
from spinn_storage_handlers.file_data_reader import FileDataReader
import logging
logger = logging.getLogger(__name__)
class FrontEndCommonApplicationDataLoader(object):
def __call__(
self, processor_to_app_data_base_address, transceiver... | [
"spinn_storage_handlers.file_data_reader.FileDataReader",
"logging.getLogger"
] | [((155, 182), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (172, 182), False, 'import logging\n'), ((1775, 1821), 'spinn_storage_handlers.file_data_reader.FileDataReader', 'FileDataReader', (['file_path_for_application_data'], {}), '(file_path_for_application_data)\n', (1789, 1821), Fal... |
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long,import-error
"""Namespace: ``JSON``."""
from zlogging._compat import enum
@enum.unique
class TimestampFormat(enum.IntFlag):
"""Enum: ``JSON::TimestampFormat``.
See Also:
`base/init-bare.zeek <https://docs.zeek.org/en/stable/scripts/base/init-ba... | [
"zlogging._compat.enum.auto"
] | [((602, 613), 'zlogging._compat.enum.auto', 'enum.auto', ([], {}), '()\n', (611, 613), False, 'from zlogging._compat import enum\n'), ((785, 796), 'zlogging._compat.enum.auto', 'enum.auto', ([], {}), '()\n', (794, 796), False, 'from zlogging._compat import enum\n'), ((1067, 1078), 'zlogging._compat.enum.auto', 'enum.au... |
import pytest
import os
import sys
try:
import xdist # noqa
except ImportError:
@pytest.fixture(scope="session")
def worker_id():
return None
testdir = os.path.dirname(__file__)
moddir = os.path.dirname(testdir)
rootdir = os.path.dirname(moddir)
sys.path.append(rootdir)
def pytest_addoption(pars... | [
"sys.path.append",
"Tensile.Tensile.addCommonArguments",
"argparse.ArgumentParser",
"Tensile.Common.restoreDefaultGlobalParameters",
"Tensile.Common.assignGlobalParameters",
"os.path.dirname",
"pytest.fixture",
"datetime.datetime.now",
"Tensile.Tensile.argUpdatedGlobalParameters",
"os.path.join"
] | [((175, 200), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (190, 200), False, 'import os\n'), ((210, 234), 'os.path.dirname', 'os.path.dirname', (['testdir'], {}), '(testdir)\n', (225, 234), False, 'import os\n'), ((245, 268), 'os.path.dirname', 'os.path.dirname', (['moddir'], {}), '(moddir... |
import time
import hashlib
import os
import text_to_image
import progressbar
import zipfile
import binascii
from PIL import Image
def file_to_hex_string(file_path):
with open (file_path, 'rb') as f:
content = f.read()
hex_content = binascii.hexlify(content)
hex_content = hex_content.decode("utf-8")... | [
"os.mkdir",
"os.remove",
"binascii.hexlify",
"text_to_image.encode",
"os.path.exists",
"hashlib.sha256",
"text_to_image.decode",
"progressbar.ProgressBar",
"os.listdir"
] | [((249, 274), 'binascii.hexlify', 'binascii.hexlify', (['content'], {}), '(content)\n', (265, 274), False, 'import binascii\n'), ((424, 479), 'text_to_image.encode', 'text_to_image.encode', (['hex_content', "('images/' + out_path)"], {}), "(hex_content, 'images/' + out_path)\n", (444, 479), False, 'import text_to_image... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
from tqdm import tqdm
from multiprocessing import Pool
from .agent import Agent
from .model import Network
from .env import *
def ES(config):
# Get network dims
cfg = get_cfg(config["env_name"], robot=config["robot"])
cfg... | [
"numpy.argsort",
"numpy.zeros",
"numpy.sum",
"numpy.log"
] | [((501, 510), 'numpy.sum', 'np.sum', (['w'], {}), '(w)\n', (507, 510), True, 'import numpy as np\n'), ((1468, 1493), 'numpy.argsort', 'np.argsort', (['inv_fitnesses'], {}), '(inv_fitnesses)\n', (1478, 1493), True, 'import numpy as np\n'), ((1510, 1521), 'numpy.zeros', 'np.zeros', (['d'], {}), '(d)\n', (1518, 1521), Tru... |
"""Float field class & utilities."""
from gettext import gettext as _
from typing import Any
from typing import Optional
from marshpy.core.constants import UNDEFINED
from marshpy.core.errors import ErrorCode
from marshpy.core.interfaces import ILoadingContext
from marshpy.core.validation import ValidateCallback
from m... | [
"gettext.gettext",
"marshpy.fields.scalar_field.ScalarField._check_in_bounds"
] | [((1563, 1638), 'marshpy.fields.scalar_field.ScalarField._check_in_bounds', 'ScalarField._check_in_bounds', (['context', 'result', 'self._minimum', 'self._maximum'], {}), '(context, result, self._minimum, self._maximum)\n', (1591, 1638), False, 'from marshpy.fields.scalar_field import ScalarField\n'), ((1461, 1496), 'g... |
#
# Copyright (c) 2020 Bitdefender
# SPDX-License-Identifier: Apache-2.0
#
import json
def check_build_info(data, needed_keys):
success = True
for needed_key in needed_keys:
if needed_key not in data.keys():
print(f"ERROR: Missing build information for {needed_key}")
success = ... | [
"json.dump",
"json.load"
] | [((489, 509), 'json.load', 'json.load', (['info_file'], {}), '(info_file)\n', (498, 509), False, 'import json\n'), ((675, 723), 'json.dump', 'json.dump', (['build_info', 'info_file'], {'sort_keys': '(True)'}), '(build_info, info_file, sort_keys=True)\n', (684, 723), False, 'import json\n')] |
import spacy
import pytest
from spacy.language import Language
from spacy.tokens import Doc
from euplexcy_readability import (
Readability,
_get_num_sentences,
_get_num_syllables,
_get_num_words,
)
@pytest.fixture(scope="function")
def nlp():
return spacy.load("en_core_web_sm")
@pytest.fixture(... | [
"euplexcy_readability.Readability",
"euplexcy_readability._get_num_words",
"spacy.tokens.Doc.has_extension",
"pytest.fixture",
"euplexcy_readability._get_num_sentences",
"spacy.load",
"spacy.language.Language.component",
"pytest.mark.parametrize",
"euplexcy_readability._get_num_syllables"
] | [((218, 250), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (232, 250), False, 'import pytest\n'), ((305, 337), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (319, 337), False, 'import pytest\n'), ((339, 365), 'spacy.langu... |
import unittest
import os
from typing import Dict, List
from pysle import phonetics
from pysle.utilities import isle_io
root = os.path.dirname(os.path.realpath(__file__))
dataRoot = os.path.join(root, "files")
def lazyLoadValue(word: str, linesByWord: Dict[str, str]) -> List[phonetics.Entry]:
entryList = [
... | [
"pysle.phonetics.Entry",
"os.path.realpath",
"os.path.join",
"pysle.utilities.isle_io.parseIslePronunciation"
] | [((184, 211), 'os.path.join', 'os.path.join', (['root', '"""files"""'], {}), "(root, 'files')\n", (196, 211), False, 'import os\n'), ((145, 171), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (161, 171), False, 'import os\n'), ((324, 366), 'pysle.utilities.isle_io.parseIslePronunciation', ... |
import sys
import argparse
alignImgDir = "../../../../../../dataset/facedata/lfw/lfw_align_160/"
# romove 1 when same remove 0 when dissame
def get_all_images(filename):
file = open(filename)
lines = file.readlines()
list = []
for line in lines:
line_split = line.strip("\n").split("\t")
... | [
"argparse.ArgumentParser"
] | [((2555, 2580), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2578, 2580), False, 'import argparse\n')] |
# spark-submit kmeans.py data/iris_small.dat 4 10
import matplotlib.pyplot as plt
fig, ax = plt.subplots( nrows=1, ncols=1 ) # create figure & 1 axis
colorPoints = 'b'
colorNoise = 'y'
x = [75.93777663729409, 70.07348262116771, 84.58585910962302, 54.135582071073365, 65.00382517084184, 66.08919934471201, 42.243216... | [
"matplotlib.pyplot.subplots"
] | [((95, 125), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(1)', 'ncols': '(1)'}), '(nrows=1, ncols=1)\n', (107, 125), True, 'import matplotlib.pyplot as plt\n')] |
# -*- coding: utf-8 -*-
'''
Created on Mar 12, 2012
@author: moloch
Copyright 2012 Root the Box
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/licen... | [
"uuid.uuid4",
"sqlalchemy.types.String",
"models.dbsession.query",
"sqlalchemy.ForeignKey",
"sqlalchemy.orm.relationship",
"sqlalchemy.types.Unicode"
] | [((2051, 2091), 'sqlalchemy.orm.relationship', 'relationship', (['"""ThemeFile"""'], {'lazy': '"""joined"""'}), "('ThemeFile', lazy='joined')\n", (2063, 2091), False, 'from sqlalchemy.orm import synonym, relationship\n'), ((1076, 1098), 'sqlalchemy.ForeignKey', 'ForeignKey', (['"""theme.id"""'], {}), "('theme.id')\n", ... |
import os, biothings, config
biothings.config_for_app(config)
from config import DATA_ARCHIVE_ROOT
from biothings.hub.dataload.dumper import LastModifiedHTTPDumper
class ConsensusPathDBDumper(LastModifiedHTTPDumper):
SRC_NAME = "ConsensusPathDB"
SRC_ROOT_FOLDER = os.path.join(DATA_ARCHIVE_ROOT, SRC_NAME)
... | [
"os.path.join",
"biothings.config_for_app"
] | [((29, 61), 'biothings.config_for_app', 'biothings.config_for_app', (['config'], {}), '(config)\n', (53, 61), False, 'import os, biothings, config\n'), ((276, 317), 'os.path.join', 'os.path.join', (['DATA_ARCHIVE_ROOT', 'SRC_NAME'], {}), '(DATA_ARCHIVE_ROOT, SRC_NAME)\n', (288, 317), False, 'import os, biothings, confi... |
from __future__ import print_function, absolute_import
import pandas as pd, numpy as np, matplotlib.pyplot
from .. import misc
from .utils import Utils
class DescribeSeries(Utils):
#############################################################################
# Public Interface
###################... | [
"pandas.Series"
] | [((1056, 1073), 'pandas.Series', 'pd.Series', (['y_pred'], {}), '(y_pred)\n', (1065, 1073), True, 'import pandas as pd, numpy as np, matplotlib.pyplot\n')] |
import datetime
import jwt
class JWTUtil:
ALGORITHMS: str = "HS256"
JWT_ACCESS_TOKEN_VALIDITY_MIN = 1
JWT_REFRESH_TOKEN_VALIDITY_MIN = 60
SECRET = "SECRET____KEY"
def get_token(self, exp: datetime, payload: dict = None, iss=None):
if not payload:
payload = {}
payload["... | [
"datetime.datetime.now",
"jwt.encode",
"datetime.timedelta",
"jwt.decode"
] | [((396, 455), 'jwt.encode', 'jwt.encode', (['payload', 'self.SECRET'], {'algorithm': 'self.ALGORITHMS'}), '(payload, self.SECRET, algorithm=self.ALGORITHMS)\n', (406, 455), False, 'import jwt\n'), ((899, 959), 'jwt.decode', 'jwt.decode', (['token', 'self.SECRET'], {'algorithms': '[self.ALGORITHMS]'}), '(token, self.SEC... |
import json
from .headers import Headers, make_headers
from .types import HeadersType
from .utils import import_from_string
class Config:
"""Baguette application configuration.
Keyword Arguments
-----------------
debug : :class:`bool`
Whether to run the application in debug mode.
... | [
"json.load"
] | [((3624, 3646), 'json.load', 'json.load', (['config_file'], {}), '(config_file)\n', (3633, 3646), False, 'import json\n')] |
# Setting up logging here because this is the root of the module
import logging
__all__ = ['aws_auth', 'client', 'network_util', 'url_util', 'user_auth']
CLIENT_VERSION = '2.5.2'
class CerberusClientException(Exception):
"""Wrap third-party exceptions expected by the Cerberus client."""
pass
# This avoids... | [
"logging.getLogger",
"logging.NullHandler"
] | [((393, 414), 'logging.NullHandler', 'logging.NullHandler', ([], {}), '()\n', (412, 414), False, 'import logging\n'), ((354, 381), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (371, 381), False, 'import logging\n')] |
from torch.utils.tensorboard import SummaryWriter
from pathlib import Path
import datetime
import torch
import git
from inspect import signature
import os
import yaml
class TensorBoardLogger():
def __init__(self, config):
self.dummy = config.no_logging
if config.no_logging:
print(f"Logg... | [
"os.remove",
"yaml.safe_dump",
"os.path.exists",
"git.Repo",
"pathlib.Path",
"inspect.signature",
"datetime.datetime.now"
] | [((1313, 1353), 'git.Repo', 'git.Repo', ([], {'search_parent_directories': '(True)'}), '(search_parent_directories=True)\n', (1321, 1353), False, 'import git\n'), ((1871, 1903), 'yaml.safe_dump', 'yaml.safe_dump', (['self.metadata', 'f'], {}), '(self.metadata, f)\n', (1885, 1903), False, 'import yaml\n'), ((7590, 7626)... |
import FWCore.ParameterSet.Config as cms
# ------------------------------------------------------------------------------
# configure a filter to run only on the events selected by TkAlMinBias AlcaReco
import copy
from HLTrigger.HLTfilters.hltHighLevel_cfi import *
ALCARECOCalMinBiasFilterForSiStripGains = copy.deepco... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.untracked.int32",
"copy.deepcopy",
"FWCore.ParameterSet.Config.untracked.string",
"CalibTracker.SiStripChannelGain.SiStripGainsPCLWorker_cfi.SiStripGainsPCLWorker.clone",
"FWCore.ParameterSet.Config.untracked.bool",
"FWCore.ParameterSet.Co... | [((309, 336), 'copy.deepcopy', 'copy.deepcopy', (['hltHighLevel'], {}), '(hltHighLevel)\n', (322, 336), False, 'import copy\n'), ((571, 613), 'FWCore.ParameterSet.Config.InputTag', 'cms.InputTag', (['"""TriggerResults"""', '""""""', '"""RECO"""'], {}), "('TriggerResults', '', 'RECO')\n", (583, 613), True, 'import FWCor... |
# This file is part of MLDB. Copyright 2015 mldb.ai inc. All rights reserved.
#
# MLDBFB-336-sample_test.py
# 2016-01-01
# This file is part of MLDB. Copyright 2016 mldb.ai inc. All rights reserved.
#
# add this line to testing.mk:
# $(eval $(call mldb_unit_test,MLDBFB-336-sample_test.py,,manual))
import unittest
... | [
"mldb.mldb.run_tests",
"mldb.mldb.get",
"mldb.mldb.create_dataset"
] | [((6451, 6467), 'mldb.mldb.run_tests', 'mldb.run_tests', ([], {}), '()\n', (6465, 6467), False, 'from mldb import mldb, MldbUnitTest, ResponseException\n'), ((620, 681), 'mldb.mldb.create_dataset', 'mldb.create_dataset', (["{'id': 'test', 'type': 'sparse.mutable'}"], {}), "({'id': 'test', 'type': 'sparse.mutable'})\n",... |
import pandas as pd
import altair as alt
import geopandas as gpd
data = pd.read_csv("./data/cleaned_salaries.csv")
def plot_11(xmax):
source = data[(data["Age"]>0) & (data["Salary_USD"]<=xmax[1])]
chart = alt.Chart(source).mark_rect().encode(
x = alt.X("Age:Q", bin=alt.Bin(maxbins=60), tit... | [
"altair.Y",
"altair.vconcat",
"pandas.read_csv",
"altair.Chart",
"pandas.merge",
"altair.Bin",
"altair.Axis",
"altair.Legend",
"altair.X",
"altair.Order",
"altair.Scale",
"geopandas.datasets.get_path",
"altair.Color"
] | [((75, 117), 'pandas.read_csv', 'pd.read_csv', (['"""./data/cleaned_salaries.csv"""'], {}), "('./data/cleaned_salaries.csv')\n", (86, 117), True, 'import pandas as pd\n'), ((875, 909), 'altair.vconcat', 'alt.vconcat', (['chart', 'bar'], {'spacing': '(0)'}), '(chart, bar, spacing=0)\n', (886, 909), True, 'import altair ... |
# -*- coding: utf-8 -*-
import unittest
from gilded_rose import Item, GildedRose
class GildedRoseTest(unittest.TestCase):
def test_aged_brie_increase_quality(self):
items = [Item('Aged Brie', 10, 0)]
gilded_rose = GildedRose(items)
gilded_rose.update_quality()
assert items[0].sell... | [
"unittest.main",
"gilded_rose.GildedRose",
"gilded_rose.Item"
] | [((1711, 1726), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1724, 1726), False, 'import unittest\n'), ((237, 254), 'gilded_rose.GildedRose', 'GildedRose', (['items'], {}), '(items)\n', (247, 254), False, 'from gilded_rose import Item, GildedRose\n'), ((489, 506), 'gilded_rose.GildedRose', 'GildedRose', (['item... |
import aiohttp
from aiohttp.client_exceptions import ClientResponseError
from bs4 import BeautifulSoup
from scts.tracking.adapters.correios.exceptions import CorreiosException
from scts.tracking.domain.models import TrackingEvent
class CorreiosHttpClient:
urlPrefix = 'https://www2.correios.com.br/sistemas/rastr... | [
"bs4.BeautifulSoup",
"scts.tracking.adapters.correios.exceptions.CorreiosException",
"scts.tracking.domain.models.TrackingEvent",
"aiohttp.ClientSession"
] | [((1391, 1427), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html'], {'features': '"""lxml"""'}), "(html, features='lxml')\n", (1404, 1427), False, 'from bs4 import BeautifulSoup\n'), ((2363, 2432), 'scts.tracking.domain.models.TrackingEvent', 'TrackingEvent', (['tracking_code', 'datetime', 'location', 'general_description... |
"""qiskit_sphinx_theme
A Sphinx theme for Qiskit that is based on the
Pytorch Sphinx theme.
"""
from setuptools import setup
DOCLINES = __doc__.split('\n')
DESCRIPTION = DOCLINES[0]
LONG_DESCRIPTION = "\n".join(DOCLINES[2:])
setup(
name = 'qiskit_sphinx_theme',
version = '1.7.5',
author = 'nonhermitian',... | [
"setuptools.setup"
] | [((228, 1432), 'setuptools.setup', 'setup', ([], {'name': '"""qiskit_sphinx_theme"""', 'version': '"""1.7.5"""', 'author': '"""nonhermitian"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/Qiskit/qiskit_sphinx_theme"""', 'description': 'DESCRIPTION', 'long_description': 'LONG_DESCRIPTION', 'py_module... |
from base64 import b64encode
from logging import getLogger
from typing import Any, Dict, List
import requests
from dataclasses import dataclass
@dataclass
class SlackMessage:
channels: List[str]
header: str
title: str
text: str
color: str
def __init__(self, channels: List[str], header: str,... | [
"logging.getLogger"
] | [((771, 805), 'logging.getLogger', 'getLogger', (['self.__class__.__name__'], {}), '(self.__class__.__name__)\n', (780, 805), False, 'from logging import getLogger\n')] |
import os.path
import pexpect
import subprocess
import tempfile
import testlib
import unittest
# Note that gdb comes with its own testsuite. I was unable to figure out how to
# run that testsuite against the spike simulator.
def find_file(path):
for directory in (os.getcwd(), os.path.dirname(testlib.__file__)):
... | [
"pexpect.spawn",
"subprocess.Popen",
"socket.socket"
] | [((1053, 1102), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (1066, 1102), False, 'import socket\n'), ((1780, 1856), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'stdin': 'subprocess.PIPE', 'stdout': 'logfile', 'stderr': 'logfile'}), '... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import os.path
import inflector
from json_to_model.parser import NodeType
from jinja2 import Environment, PackageLoader
type_map = {
NodeType.TYPE_ARRAY: 'NSArray *',
NodeType.TYPE_BOOL: 'BOOL',
NodeType.TYPE_INT: 'NSInteger',
NodeType.TYPE_FLOAT: ... | [
"jinja2.PackageLoader",
"time.ctime",
"inflector.English"
] | [((609, 628), 'inflector.English', 'inflector.English', ([], {}), '()\n', (626, 628), False, 'import inflector\n'), ((1515, 1569), 'jinja2.PackageLoader', 'PackageLoader', (['"""json_to_model.generators"""', '"""templates"""'], {}), "('json_to_model.generators', 'templates')\n", (1528, 1569), False, 'from jinja2 import... |
import argparse
import assembler
import linker
import utils
def main():
parser = argparse.ArgumentParser(prog="mipsal", description='Assemble and link a MIPS assembly program.')
parser.add_argument("files", action="store", nargs="+", type=str, help="list of assembly files to process")
parser.add_argument("... | [
"argparse.ArgumentParser",
"assembler.assemble",
"utils.read_file_to_list",
"linker.link",
"utils.get_file_name",
"utils.write_file_from_list"
] | [((86, 187), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""mipsal"""', 'description': '"""Assemble and link a MIPS assembly program."""'}), "(prog='mipsal', description=\n 'Assemble and link a MIPS assembly program.')\n", (109, 187), False, 'import argparse\n'), ((1414, 1435), 'linker.link'... |
#!/usr/bin/env python
# coding: utf-8
# ### Module Import
# In[1]:
import ice
chocolate=ice.Icecream(size='small')
print(ice.my_fav(chocolate))
print(ice.my_size(chocolate))
# ### Script Execution
# In[2]:
get_ipython().system('python ice_script.py')
| [
"ice.my_fav",
"ice.my_size",
"ice.Icecream"
] | [((92, 118), 'ice.Icecream', 'ice.Icecream', ([], {'size': '"""small"""'}), "(size='small')\n", (104, 118), False, 'import ice\n'), ((126, 147), 'ice.my_fav', 'ice.my_fav', (['chocolate'], {}), '(chocolate)\n', (136, 147), False, 'import ice\n'), ((155, 177), 'ice.my_size', 'ice.my_size', (['chocolate'], {}), '(chocola... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 <NAME> (clarenceho at gmail dot com)
#
# 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 righ... | [
"fetcher.read_http_page",
"json.loads",
"json.dumps"
] | [((8474, 8499), 'fetcher.read_http_page', 'read_http_page', (['query_url'], {}), '(query_url)\n', (8488, 8499), False, 'from fetcher import read_http_page\n'), ((8228, 8253), 'json.dumps', 'json.dumps', (['payload_query'], {}), '(payload_query)\n', (8238, 8253), False, 'import json\n'), ((9536, 9555), 'fetcher.read_htt... |
#!/usr/bin/python3
import getopt
import json
import os
import sys
import time
import urllib
import urllib.parse
import urllib.request
from urllib.error import HTTPError, URLError
def usage(cmd, exit):
print("usage: " + cmd + "[-o <output_dir>] [<collection_id>]...<collection_id>")
sys.exit(exit)
const_urls... | [
"os.remove",
"os.path.abspath",
"getopt.getopt",
"urllib.parse.urlencode",
"os.getcwd",
"os.path.exists",
"urllib.request.urlopen",
"json.dumps",
"time.sleep",
"urllib.request.urlretrieve",
"os.path.isfile",
"os.path.join",
"sys.exit"
] | [((293, 307), 'sys.exit', 'sys.exit', (['exit'], {}), '(exit)\n', (301, 307), False, 'import sys\n'), ((6885, 6910), 'os.path.isfile', 'os.path.isfile', (['save_file'], {}), '(save_file)\n', (6899, 6910), False, 'import os\n'), ((7533, 7544), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (7542, 7544), False, 'import os\n... |
""" This file don't test everything. It only test one past crash error."""
import theano
from theano.gof import Constant
from theano.tensor.type_other import MakeSlice, make_slice, NoneTypeT, NoneConst
def test_make_slice_merge():
# In the past, this was crahsing during compilation.
i = theano.tensor.iscalar(... | [
"theano.tensor.iscalar",
"theano.function",
"theano.tensor.type_other.NoneConst.equals",
"theano.tensor.argmax",
"theano.tensor.type_other.NoneTypeT",
"theano.printing.debugprint",
"cPickle.dumps",
"theano.tensor.type_other.make_slice",
"theano.tensor.vector"
] | [((298, 321), 'theano.tensor.iscalar', 'theano.tensor.iscalar', ([], {}), '()\n', (319, 321), False, 'import theano\n'), ((331, 347), 'theano.tensor.type_other.make_slice', 'make_slice', (['(0)', 'i'], {}), '(0, i)\n', (341, 347), False, 'from theano.tensor.type_other import MakeSlice, make_slice, NoneTypeT, NoneConst\... |
#!/usr/bin/env python3
# coding=utf-8
from __future__ import print_function
import os
import os.path as path
import re
import argparse
from datetime import datetime
script_dir = path.dirname(path.realpath(__file__))
defines = {}
for k, v in os.environ.items():
if k.upper().startswith('V_'):
defines[k[2:]... | [
"argparse.ArgumentParser",
"os.path.realpath",
"os.environ.items",
"datetime.datetime.now",
"os.path.join",
"re.compile"
] | [((244, 262), 'os.environ.items', 'os.environ.items', ([], {}), '()\n', (260, 262), False, 'import os\n'), ((412, 437), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (435, 437), False, 'import argparse\n'), ((193, 216), 'os.path.realpath', 'path.realpath', (['__file__'], {}), '(__file__)\n', (... |
import logging
from .celery_loader import app as celery_app
__all__ = ('celery_app',)
logger = logging.getLogger(name="reddit_dashboard")
| [
"logging.getLogger"
] | [((96, 138), 'logging.getLogger', 'logging.getLogger', ([], {'name': '"""reddit_dashboard"""'}), "(name='reddit_dashboard')\n", (113, 138), False, 'import logging\n')] |
"""
logger.py
Tensor ops-free logger to Tensorboard.
Written by <NAME>
Licensed under the MIT License (see LICENSE for details)
Based on:
- https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514
Written by <NAME>
License: Copyleft
To look at later:
- Display Image1 and Image2 as an animated ... | [
"io.BytesIO",
"matplotlib.pyplot.savefig",
"numpy.sum",
"tensorflow.HistogramProto",
"tensorflow.Summary",
"matplotlib.pyplot.close",
"numpy.expand_dims",
"numpy.histogram",
"tensorflow.summary.FileWriter",
"numpy.array",
"matplotlib.pyplot.imsave",
"numpy.min",
"numpy.max",
"numpy.squeeze... | [((1434, 1477), 'tensorflow.summary.FileWriter', 'tf.summary.FileWriter', (['log_dir'], {'graph': 'graph'}), '(log_dir, graph=graph)\n', (1455, 1477), True, 'import tensorflow as tf\n'), ((3268, 3298), 'tensorflow.Summary', 'tf.Summary', ([], {'value': 'im_summaries'}), '(value=im_summaries)\n', (3278, 3298), True, 'im... |
import json
import logging
import os
import re
import subprocess
import boto3
"""
Aurora Serverless currently cannot dump to S3 from a snapshot. In order to work around this, we've come
up with four steps:
1. Restore a serverless snapshot to a provisioned db. initiated upon receiving
"RDS-EVENT-0169: Auto... | [
"subprocess.check_call",
"json.loads",
"boto3.client",
"re.match",
"json.dumps",
"os.getenv",
"logging.getLogger"
] | [((1501, 1520), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (1518, 1520), False, 'import logging\n'), ((1537, 1573), 'os.getenv', 'os.getenv', (['"""LOG_LEVEL"""', 'logging.INFO'], {}), "('LOG_LEVEL', logging.INFO)\n", (1546, 1573), False, 'import os\n'), ((1764, 1830), 're.match', 're.match', (['"""(.*... |
"""
nbfloat: Jupyter Notebook extension with floating guide
"""
import os
import json
import datetime
from notebook.utils import url_path_join
from notebook.base.handlers import IPythonHandler, path_regex
class NBFloatHandler(IPythonHandler):
# manage connections to various sqlite databases
db_manager_direc... | [
"notebook.utils.url_path_join",
"datetime.now"
] | [((1603, 1677), 'notebook.utils.url_path_join', 'url_path_join', (["web_app.settings['base_url']", "('/api/nbfloat%s' % path_regex)"], {}), "(web_app.settings['base_url'], '/api/nbfloat%s' % path_regex)\n", (1616, 1677), False, 'from notebook.utils import url_path_join\n'), ((653, 667), 'datetime.now', 'datetime.now', ... |
import json
import pytest
from time import sleep
from datahub.cli import delete_cli, ingest_cli
from datahub.cli.cli_utils import guess_entity_type, post_entity, get_aspects_for_entity
from datahub.cli.ingest_cli import get_session_and_host
from datahub.cli.delete_cli import guess_entity_type, delete_one_urn_cmd
from t... | [
"datahub.cli.delete_cli.guess_entity_type",
"datahub.cli.delete_cli.delete_one_urn_cmd",
"datahub.cli.ingest_cli.get_session_and_host",
"pytest.mark.dependency",
"datahub.cli.cli_utils.get_aspects_for_entity",
"json.dumps",
"time.sleep",
"tests.utils.ingest_file_via_rest"
] | [((658, 682), 'pytest.mark.dependency', 'pytest.mark.dependency', ([], {}), '()\n', (680, 682), False, 'import pytest\n'), ((440, 466), 'datahub.cli.delete_cli.guess_entity_type', 'guess_entity_type', ([], {'urn': 'urn'}), '(urn=urn)\n', (457, 466), False, 'from datahub.cli.delete_cli import guess_entity_type, delete_o... |
from aiohttp import web
from guillotina.commands import Command
import asyncio
import sys
try:
import aiohttp_autoreload
HAS_AUTORELOAD = True
except ImportError:
HAS_AUTORELOAD = False
class ServerCommand(Command):
description = 'Guillotina server runner'
profiler = line_profiler = None
d... | [
"sys.stderr.write",
"aiohttp_autoreload.start"
] | [((1307, 1333), 'aiohttp_autoreload.start', 'aiohttp_autoreload.start', ([], {}), '()\n', (1331, 1333), False, 'import aiohttp_autoreload\n'), ((1049, 1220), 'sys.stderr.write', 'sys.stderr.write', (['"""You must install aiohttp_autoreload for the --reload option to work.\nUse `pip install aiohttp_autoreload` to instal... |
from collections import defaultdict
# List of the standard launch parameters for an LTI launch
LAUNCH_DATA_PARAMETERS = [
'context_id',
'context_label',
'context_title',
'context_type',
'launch_presentation_css_url',
'launch_presentation_document_target',
'launch_presentation_height',
'... | [
"collections.defaultdict"
] | [((1696, 1722), 'collections.defaultdict', 'defaultdict', (['(lambda : None)'], {}), '(lambda : None)\n', (1707, 1722), False, 'from collections import defaultdict\n'), ((1748, 1774), 'collections.defaultdict', 'defaultdict', (['(lambda : None)'], {}), '(lambda : None)\n', (1759, 1774), False, 'from collections import ... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import pytz
from odoo import api, fields, models
from odoo.osv import expression
from .lunch_supplier import float_to_time
from datetime import datetime, timedelta
from odoo.addons.base.models.res_partner import _tz_ge... | [
"odoo.fields.Selection",
"odoo.fields.Float",
"odoo.osv.expression.AND",
"odoo.fields.Datetime.now",
"odoo.api.depends",
"odoo.fields.Html",
"odoo.osv.expression.OR",
"odoo.fields.Char",
"odoo.fields.Date.today",
"odoo.fields.Many2many",
"datetime.timedelta",
"pytz.timezone",
"odoo.fields.Da... | [((720, 776), 'odoo.fields.Char', 'fields.Char', (['"""Alert Name"""'], {'required': '(True)', 'translate': '(True)'}), "('Alert Name', required=True, translate=True)\n", (731, 776), False, 'from odoo import api, fields, models\n'), ((791, 844), 'odoo.fields.Html', 'fields.Html', (['"""Message"""'], {'required': '(True... |
# conda install nwani::portaudio nwani::pyaudio
import pyaudio
import wave
chunk = 1024 # Record in chunks of 1024 samples
sample_format = pyaudio.paInt16 # 16 bits per sample
channels = 2
fs = 44100 # Record at 44100 samples per second
p = pyaudio.PyAudio() # Create an interface to PortAudio
print('Recording')
... | [
"pyaudio.PyAudio"
] | [((246, 263), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (261, 263), False, 'import pyaudio\n')] |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
##
# Copyright 2017 FIWARE Foundation, e.V.
# 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.apach... | [
"oauth2client.file.Storage",
"httplib2.Http",
"os.makedirs",
"argparse.ArgumentParser",
"oauth2client.client.flow_from_clientsecrets",
"os.path.exists",
"oauth2client.tools.run_flow",
"googleapiclient.discovery.build",
"os.path.join"
] | [((2160, 2191), 'os.path.join', 'join', (['CODE_HOME', 'CREDENTIAL_DIR'], {}), '(CODE_HOME, CREDENTIAL_DIR)\n', (2164, 2191), False, 'from os.path import join, exists\n'), ((2496, 2538), 'os.path.join', 'join', (['credential_folder', 'GOOGLE_CREDENTIAL'], {}), '(credential_folder, GOOGLE_CREDENTIAL)\n', (2500, 2538), F... |
import contextlib
import copy
import os
import shutil
import tempfile
import mock
import pytest
from pyramid.httpexceptions import HTTPUnprocessableEntity
from pyramid.testing import DummyRequest
from tests.utils import mocked_remote_wps
from weaver.formats import ACCEPT_LANGUAGE_EN_US, ACCEPT_LANGUAGE_FR_CA, CONTENT... | [
"tempfile.NamedTemporaryFile",
"copy.deepcopy",
"os.makedirs",
"pyramid.testing.DummyRequest",
"tests.utils.mocked_remote_wps",
"weaver.wps.utils.map_wps_output_location",
"pytest.fail",
"mock.patch",
"contextlib.ExitStack",
"weaver.wps.utils.get_wps_client",
"os.path.isfile",
"mock.Mock",
"... | [((509, 520), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (518, 520), False, 'import mock\n'), ((537, 548), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (546, 548), False, 'import mock\n'), ((703, 740), 'weaver.wps.utils.set_wps_language', 'set_wps_language', (['wps', '"""ru, fr;q=0.5"""'], {}), "(wps, 'ru, fr;q=0.5')\n... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
# Copyright (c) Ostap developpers.
# =============================================================================
## @file ostap/math/tests/test_math_carlson.py
# Test module for Carlon symmet... | [
"ostap.utils.utils.wait",
"ostap.logger.colorized.attention",
"ostap.core.pyrouts.Ostap.Math.carlson_RG",
"ostap.core.pyrouts.Ostap.Math.carlson_RD",
"ostap.core.pyrouts.Ostap.Math.elliptic_KmE",
"ostap.core.pyrouts.Ostap.Math.PhaseSpace3",
"ostap.math.models.f1_draw",
"math.log",
"ostap.logger.logg... | [((1005, 1041), 'ostap.logger.logger.getLogger', 'getLogger', (['"""ostap.test_math_carlson"""'], {}), "('ostap.test_math_carlson')\n", (1014, 1041), False, 'from ostap.logger.logger import getLogger\n'), ((1084, 1103), 'ostap.logger.logger.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (1093, 1103), Fals... |
from __future__ import annotations
import datetime
import json
import csv
from abc import ABC, abstractmethod
from typing import Union, Dict, List, Any
import sys
import os
from collections import namedtuple, deque
import warnings
import requests
from bs4 import BeautifulSoup
from instascrape.scrapers... | [
"json.dump",
"csv.writer",
"requests.Session",
"instascrape.scrapers.scrape_tools.json_from_soup",
"instascrape.scrapers.scrape_tools.parse_data_from_json",
"instascrape.scrapers.scrape_tools.flatten_dict",
"instascrape.scrapers.scrape_tools.determine_json_type",
"bs4.BeautifulSoup",
"warnings.warn"... | [((1188, 1206), 'requests.Session', 'requests.Session', ([], {}), '()\n', (1204, 1206), False, 'import requests\n'), ((5581, 5604), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (5602, 5604), False, 'import datetime\n'), ((10415, 10458), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html'], {'features'... |
import os
import json
import time
import datetime
from discord_components import DiscordComponents
from discord_components import SelectOption, Select
from discord import Embed
from discord_slash import SlashCommand
import string
import secrets
from discord.ext import commands, tasks
from keep_alive import keep_alive
i... | [
"discord.Embed",
"discord_components.Select",
"datetime.datetime.utcnow",
"discord.Intents",
"discord.ext.commands.Bot",
"discord_components.SelectOption",
"discord_slash.SlashCommand",
"get_users.Get_User",
"embed_manager.User_Embed_Manager",
"json.dump",
"keep_alive.keep_alive",
"discord_com... | [((630, 679), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': '"""."""', 'intents': 'intents'}), "(command_prefix='.', intents=intents)\n", (642, 679), False, 'from discord.ext import commands, tasks\n'), ((688, 728), 'discord_slash.SlashCommand', 'SlashCommand', (['client'], {'sync_commands': '(Tru... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.7
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# +
#v3
#17/8/2019
#modif... | [
"numpy.moveaxis",
"numpy.argmax",
"numpy.ones",
"matplotlib.pyplot.figure",
"torch.device",
"torch.utils.data.DataLoader",
"torch.load",
"albumentations.pytorch.ToTensor",
"torch.cuda.set_device",
"torch.zeros",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show",
"torch.cuda.is_available... | [((2656, 2681), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (2679, 2681), False, 'import torch\n'), ((6307, 6342), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(4)'], {'figsize': '(10, 4)'}), '(1, 4, figsize=(10, 4))\n', (6319, 6342), True, 'import matplotlib.pyplot as plt\n'), ((... |
from esc2pdf import ESC_Device, PDFWriter
from readbin import readbindata
"""
Demonstrates how to put an overlay, e.g. header, over pages
You have to create a generator function which is then passed to the PDFWriter instance.
By design, the generator function will always take two arguments: The reportlab c... | [
"esc2pdf.PDFWriter",
"readbin.readbindata",
"esc2pdf.ESC_Device"
] | [((1013, 1025), 'esc2pdf.ESC_Device', 'ESC_Device', ([], {}), '()\n', (1023, 1025), False, 'from esc2pdf import ESC_Device, PDFWriter\n'), ((1093, 1127), 'esc2pdf.PDFWriter', 'PDFWriter', (['"""out.pdf"""'], {'scaling': '(0.85)'}), "('out.pdf', scaling=0.85)\n", (1102, 1127), False, 'from esc2pdf import ESC_Device, PDF... |
# pylint: disable=missing-module-docstring
import logging
from logging import NullHandler
# Set default handler when policy_sentry is used as library to avoid "No handler found" warnings.
logging.getLogger(__name__).addHandler(NullHandler())
def set_stream_logger(name='policy_sentry', level=logging.DEBUG, format_str... | [
"logging.Formatter",
"logging.StreamHandler",
"logging.getLogger",
"logging.NullHandler"
] | [((228, 241), 'logging.NullHandler', 'NullHandler', ([], {}), '()\n', (239, 241), False, 'from logging import NullHandler\n'), ((1128, 1151), 'logging.getLogger', 'logging.getLogger', (['name'], {}), '(name)\n', (1145, 1151), False, 'import logging\n'), ((1193, 1216), 'logging.StreamHandler', 'logging.StreamHandler', (... |
# using groupby
from itertools import groupby
from operator import itemgetter
# list of dictionaries
my_list = [
{'name': 'joao', 'birth': '20/10/1989'},
{'name': 'maria', 'birth': '15/12/1993'},
{'name': 'pedro', 'birth': '10/13/1991'},
{'name': 'catarina', 'birth': '04/08/1980'},
{'name': 'felipe', 'birth': '1... | [
"operator.itemgetter"
] | [((464, 483), 'operator.itemgetter', 'itemgetter', (['"""birth"""'], {}), "('birth')\n", (474, 483), False, 'from operator import itemgetter\n'), ((580, 599), 'operator.itemgetter', 'itemgetter', (['"""birth"""'], {}), "('birth')\n", (590, 599), False, 'from operator import itemgetter\n')] |
import os
import math
from typing import List, Dict, Any
import pandas as pd
import numpy as np
from pyDOE import lhs
from scipy import stats, special
from scipy.optimize import minimize
from autumn.db import Database
def sample_starting_params_from_lhs(par_priors: List[Dict[str, Any]], n_samples: int):
"""
... | [
"scipy.optimize.minimize",
"math.exp",
"scipy.stats.gamma.pdf",
"math.sqrt",
"scipy.stats.gamma.logpdf",
"scipy.special.erfinv",
"scipy.stats.gamma.ppf",
"scipy.stats.beta.logpdf",
"numpy.mean",
"autumn.db.Database",
"math.log",
"scipy.stats.beta.ppf",
"os.path.join",
"os.listdir",
"scip... | [((7316, 7416), 'os.path.join', 'os.path.join', (['"""../../data"""', '"""outputs"""', '"""calibrate"""', '"""covid_19"""', '"""belgium"""', '"""ef2ee497-2020-07-17"""'], {}), "('../../data', 'outputs', 'calibrate', 'covid_19', 'belgium',\n 'ef2ee497-2020-07-17')\n", (7328, 7416), False, 'import os\n'), ((2232, 2268... |
import datetime
from aioalfacrm.entities import Tariff
def test_init_tariff():
tariff = Tariff(
id=1,
type=1,
name='Name',
price=9.0,
lesson_count=4,
duration=20,
added=datetime.datetime(2021, 11, 12, 22, 58, 0),
branch_ids=[1],
)
assert ta... | [
"datetime.datetime"
] | [((528, 570), 'datetime.datetime', 'datetime.datetime', (['(2021)', '(11)', '(12)', '(22)', '(58)', '(0)'], {}), '(2021, 11, 12, 22, 58, 0)\n', (545, 570), False, 'import datetime\n'), ((232, 274), 'datetime.datetime', 'datetime.datetime', (['(2021)', '(11)', '(12)', '(22)', '(58)', '(0)'], {}), '(2021, 11, 12, 22, 58,... |
import numpy as np
import pandas as pd
from scipy.optimize import curve_fit
from sklearn.linear_model import LinearRegression
from scipy import linalg as LA
from scipy.stats import kstest, chi2, normaltest
from exponents import FindExponents
from _02_msd import generate_theoretical_msd_normal, generate_empirical_msd, ... | [
"numpy.sum",
"numpy.floor",
"_02_msd.generate_theoretical_msd_anomalous_with_noise",
"numpy.mean",
"numpy.arange",
"numpy.exp",
"numpy.nanmean",
"pandas.DataFrame",
"numpy.std",
"_02_msd.generate_theoretical_msd_normal",
"numpy.finfo",
"numpy.max",
"_02_msd.generate_empirical_pvariation",
... | [((1966, 2017), '_02_msd.generate_empirical_msd', 'generate_empirical_msd', (['self.x', 'self.y', 'self.n_list'], {}), '(self.x, self.y, self.n_list)\n', (1988, 2017), False, 'from _02_msd import generate_theoretical_msd_normal, generate_empirical_msd, generate_theoretical_msd_anomalous_log, generate_empirical_pvariati... |
from __future__ import annotations
import pathlib
import numpy as np
from typing import Optional, Tuple, List
from numpy import typing as npt
try:
from pyfftw.interfaces import numpy_fft
except ModuleNotFoundError:
from numpy import fft as numpy_fft
from sigpyproc import timeseries
from sigpyproc.header imp... | [
"numpy.conj",
"numpy.fft.ifft",
"numpy.fft.irfft",
"sigpyproc.core.kernels.rednoise",
"numpy.fromfile",
"numpy.empty",
"numpy.asarray",
"sigpyproc.header.Header.from_inffile",
"sigpyproc.header.Header.from_sigproc",
"pathlib.Path",
"sigpyproc.core.kernels.multiply_fs",
"sigpyproc.core.kernels.... | [((5592, 5622), 'numpy.fft.irfft', 'numpy_fft.irfft', (['self', 'fftsize'], {}), '(self, fftsize)\n', (5607, 5622), True, 'from numpy import fft as numpy_fft\n'), ((6112, 6146), 'sigpyproc.core.kernels.conjugate', 'kernels.conjugate', (['self', 'self.size'], {}), '(self, self.size)\n', (6129, 6146), False, 'from sigpyp... |
import random, torch, os, numpy as np
def seed_everything(seed=42):
os.environ['PYTHONHASHSEED'] = str(seed)
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
torch.backends.cudnn.deterministic = True
torch.backe... | [
"numpy.random.seed",
"torch.manual_seed",
"torch.cuda.manual_seed",
"torch.cuda.manual_seed_all",
"random.seed"
] | [((118, 135), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (129, 135), False, 'import random, torch, os, numpy as np\n'), ((140, 160), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (154, 160), True, 'import random, torch, os, numpy as np\n'), ((165, 188), 'torch.manual_seed', 'torch.ma... |
from bokeh.charts import Bar, output_file, show, vplot, hplot, defaults
from bokeh.sampledata.autompg import autompg as df
df['neg_displ'] = 0 - df['displ']
defaults.width = 350
defaults.height = 250
bar_plot = Bar(df, label='cyl', title="label='cyl'")
bar_plot2 = Bar(df, label='cyl', bar_width=0.4, title="label='c... | [
"bokeh.charts.hplot",
"bokeh.charts.Bar",
"bokeh.charts.output_file"
] | [((214, 255), 'bokeh.charts.Bar', 'Bar', (['df'], {'label': '"""cyl"""', 'title': '"""label=\'cyl\'"""'}), '(df, label=\'cyl\', title="label=\'cyl\'")\n', (217, 255), False, 'from bokeh.charts import Bar, output_file, show, vplot, hplot, defaults\n'), ((269, 339), 'bokeh.charts.Bar', 'Bar', (['df'], {'label': '"""cyl""... |
import torch.nn.functional as F
import torch.nn as nn
import torch as t
class Loss_for_localization(nn.Module):
def __init__(self,obj_coor,obj_confi,no_obj_confi,img_class_weight):
super(Loss_for_localization,self).__init__()
self.obj_coor = obj_coor
self.no_obj_confi = no_obj_confi
... | [
"torch.nn.functional.binary_cross_entropy"
] | [((880, 948), 'torch.nn.functional.binary_cross_entropy', 'F.binary_cross_entropy', (['objects[i, ia, iy, ix]', 'gt[i, ia, 0, iy, ix]'], {}), '(objects[i, ia, iy, ix], gt[i, ia, 0, iy, ix])\n', (902, 948), True, 'import torch.nn.functional as F\n'), ((1041, 1109), 'torch.nn.functional.binary_cross_entropy', 'F.binary_c... |
import os
import xml.etree.ElementTree as ET
import shutil
def copy_clean_images(source_images_path, destiny_path):
if not os.path.exists(source_images_path):
raise ValueError('Source directory does not exist')
if not os.path.exists(os.path.join(source_images_path, "annotations")):
raise Valu... | [
"xml.etree.ElementTree.parse",
"os.path.join",
"os.listdir",
"os.path.exists"
] | [((386, 433), 'os.path.join', 'os.path.join', (['source_images_path', '"""annotations"""'], {}), "(source_images_path, 'annotations')\n", (398, 433), False, 'import os\n'), ((447, 475), 'os.listdir', 'os.listdir', (['annotations_path'], {}), '(annotations_path)\n', (457, 475), False, 'import os\n'), ((129, 163), 'os.pa... |
from nose.tools import assert_equal
from tests.fixtures import DatabaseTest
from wikimetrics.metrics import PagesCreated
from wikimetrics.api import CohortService
class PagesCreatedWikiCohortTest(DatabaseTest):
def setUp(self):
"""
Setup editing data using a regular cohort setup
Setup a W... | [
"wikimetrics.metrics.PagesCreated",
"tests.fixtures.DatabaseTest.setUp",
"nose.tools.assert_equal",
"wikimetrics.api.CohortService"
] | [((416, 440), 'tests.fixtures.DatabaseTest.setUp', 'DatabaseTest.setUp', (['self'], {}), '(self)\n', (434, 440), False, 'from tests.fixtures import DatabaseTest\n'), ((536, 551), 'wikimetrics.api.CohortService', 'CohortService', ([], {}), '()\n', (549, 551), False, 'from wikimetrics.api import CohortService\n'), ((1238... |
'''
5. Longest Palindromic Substring
https://leetcode.com/problems/longest-palindromic-substring/
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.
Example 1:
Input: "babad" Output: "bab"
Note: "aba" is also a valid answer.
Example 2:
Input: "cbbd" Ou... | [
"unittest.main"
] | [((6355, 6370), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6368, 6370), False, 'import unittest\n')] |
from corehq.apps.userreports.extension_points import custom_ucr_expressions
@custom_ucr_expressions.extend()
def abt_ucr_expressions():
return [
('abt_supervisor', 'custom.abt.reports.expressions.abt_supervisor_expression'),
('abt_supervisor_v2', 'custom.abt.reports.expressions.abt_supervisor_v2_e... | [
"corehq.apps.userreports.extension_points.custom_ucr_expressions.extend"
] | [((79, 110), 'corehq.apps.userreports.extension_points.custom_ucr_expressions.extend', 'custom_ucr_expressions.extend', ([], {}), '()\n', (108, 110), False, 'from corehq.apps.userreports.extension_points import custom_ucr_expressions\n')] |
#!/usr/bin/python3
import brownie
from brownie import ZERO_ADDRESS
def test_approve(nft, accounts):
assert nft.getApproved(1) == ZERO_ADDRESS
nft.approve(accounts[1], 1, {"from": accounts[2]})
assert nft.getApproved(1) == accounts[1]
def test_change_approve(nft, accounts):
nft.approve(accounts[1], 1... | [
"brownie.reverts"
] | [((1048, 1097), 'brownie.reverts', 'brownie.reverts', (['"""Not owner nor approved for all"""'], {}), "('Not owner nor approved for all')\n", (1063, 1097), False, 'import brownie\n'), ((1219, 1236), 'brownie.reverts', 'brownie.reverts', ([], {}), '()\n', (1234, 1236), False, 'import brownie\n')] |
# local package imports
from copy import deepcopy
from ..gp.pipeline import GunpowderParameters, build_pipeline
from .gui_helpers import layer_choice_widget, MplCanvas
from ..bioimageio.helpers import get_torch_module
# github repo libraries
import gunpowder as gp
# pip installed libraries
import napari
from napari.q... | [
"copy.deepcopy",
"torch.nn.MSELoss",
"qtpy.QtWidgets.QLabel",
"dataclasses.asdict",
"qtpy.QtWidgets.QVBoxLayout",
"qtpy.QtWidgets.QInputDialog.getText",
"superqt.QCollapsible",
"magicgui.widgets.create_widget",
"qtpy.QtWidgets.QFileDialog",
"pathlib.Path",
"qtpy.QtWidgets.QWidget",
"matplotlib... | [((1632, 1645), 'qtpy.QtWidgets.QVBoxLayout', 'QVBoxLayout', ([], {}), '()\n', (1643, 1645), False, 'from qtpy.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QPushButton, QFileDialog, QInputDialog, QLabel, QFrame\n'), ((1708, 1716), 'qtpy.QtWidgets.QLabel', 'QLabel', ([], {}), '()\n', (1714, 1716), False, 'from qt... |
from setuptools import setup
setup(name='csv_compare',
version='0.1',
description='Simple tool to compare columns of joined rows of two csvs',
url='http://github.com/alejandrodau/csv_compare',
author='<NAME>, <NAME>',
author_email='<EMAIL>',
license='Apache 2.0',
packages=['cs... | [
"setuptools.setup"
] | [((30, 410), 'setuptools.setup', 'setup', ([], {'name': '"""csv_compare"""', 'version': '"""0.1"""', 'description': '"""Simple tool to compare columns of joined rows of two csvs"""', 'url': '"""http://github.com/alejandrodau/csv_compare"""', 'author': '"""<NAME>, <NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': ... |
""" pyfstat tools to generate sfts """
import numpy as np
import logging
import os
import glob
import pkgutil
import lal
import lalpulsar
from pyfstat.core import BaseSearchClass, tqdm, args, predict_fstat
import pyfstat.helper_functions as helper_functions
class KeyboardInterruptError(Exception):
pass
clas... | [
"lal.LIGOTimeGPS",
"numpy.shape",
"os.path.isfile",
"numpy.sin",
"lalpulsar.InitBarycenter",
"numpy.size",
"numpy.ceil",
"pyfstat.helper_functions.match_commandlines",
"numpy.cos",
"numpy.dot",
"lalpulsar.PosVel3D_t",
"numpy.concatenate",
"numpy.all",
"pkgutil.find_loader",
"os.makedirs"... | [((2580, 2627), 'numpy.array', 'np.array', (['[self.phi, self.F0, self.F1, self.F2]'], {}), '([self.phi, self.F0, self.F1, self.F2])\n', (2588, 2627), True, 'import numpy as np\n'), ((6771, 6827), 'logging.info', 'logging.info', (['"""Checking if cached data good to reuse..."""'], {}), "('Checking if cached data good t... |
# coding=utf-8
import codecs
import re
import numpy as np
def calculate(x, y, id2word, id2tag, res = []):
entity=[]
for i in range(len(x)): #for every sen
for j in range(len(x[0])): #for every word
if x[i][j]==0 or y[i][j]==0:
continue
if id2tag[y[i][j]][0]=='B'... | [
"numpy.asarray",
"re.split",
"codecs.open"
] | [((7054, 7073), 'numpy.asarray', 'np.asarray', (['text_id'], {}), '(text_id)\n', (7064, 7073), True, 'import numpy as np\n'), ((5432, 5464), 're.split', 're.split', (['u"""[,。!?、‘’“”()]"""', 'text'], {}), "(u'[,。!?、‘’“”()]', text)\n", (5440, 5464), False, 'import re\n'), ((6302, 6339), 'codecs.open', 'codecs.open', (['... |
from __future__ import annotations
import asyncio
import contextlib
from concurrent.futures.thread import ThreadPoolExecutor
from typing import Optional
from serial import Serial, serial_for_url # type: ignore
class AsyncSerial:
"""Async wrapper around Serial."""
@classmethod
async def create(
... | [
"concurrent.futures.thread.ThreadPoolExecutor",
"serial.serial_for_url",
"asyncio.get_running_loop"
] | [((944, 977), 'concurrent.futures.thread.ThreadPoolExecutor', 'ThreadPoolExecutor', ([], {'max_workers': '(1)'}), '(max_workers=1)\n', (962, 977), False, 'from concurrent.futures.thread import ThreadPoolExecutor\n'), ((898, 924), 'asyncio.get_running_loop', 'asyncio.get_running_loop', ([], {}), '()\n', (922, 924), Fals... |
import os
import io
import spiceypy
import numpy as np
import gnuplotlib as gp
import more_itertools as mit
import matplotlib.pyplot as plt
import subprocess
from io import StringIO
import sys
def gaps(object_frame, target_frame='J2000', minimum_duration='',
mk='', lsk='', sclk='', fk='', ck=''):
i... | [
"spiceypy.furnsh",
"subprocess.Popen",
"os.remove",
"numpy.sum",
"numpy.size",
"spiceypy.et2utc",
"numpy.histogram",
"numpy.array",
"numpy.max",
"spiceypy.kclear"
] | [((794, 886), 'subprocess.Popen', 'subprocess.Popen', (['command'], {'shell': '(True)', 'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.STDOUT'}), '(command, shell=True, stdout=subprocess.PIPE, stderr=\n subprocess.STDOUT)\n', (810, 886), False, 'import subprocess\n'), ((1591, 1614), 'numpy.array', 'np.array', ([... |
# BSD 3-Clause License
#
# Copyright (c) 2019, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list o... | [
"numpy.sum",
"numpy.apply_along_axis",
"numpy.max",
"numpy.min",
"numpy.mean",
"scipy.stats.linregress",
"scipy.stats.t.ppf"
] | [((2060, 2076), 'scipy.stats.linregress', 'linregress', (['x', 'y'], {}), '(x, y)\n', (2070, 2076), False, 'from scipy.stats import probplot, linregress, t\n'), ((2648, 2665), 'scipy.stats.t.ppf', 't.ppf', (['self.p', 'df'], {}), '(self.p, df)\n', (2653, 2665), False, 'from scipy.stats import probplot, linregress, t\n'... |
import graphene
import pytest
from django.contrib.auth.models import Group
from saleor.account.models import User
from saleor.core.permissions import AccountPermissions
from .utils import assert_no_permission, get_graphql_content
PERMISSION_GROUP_CREATE_MUTATION = """
mutation PermissionGroupCreate(
$inp... | [
"saleor.account.models.User.objects.get",
"graphene.Node.to_global_id",
"pytest.raises",
"pytest.mark.parametrize",
"django.contrib.auth.models.Group.objects.get"
] | [((22556, 22694), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""permission_group_filter, count"""', "(({'search': 'Manage user groups'}, 1), ({'search': 'Manage'}, 2), ({}, 3))"], {}), "('permission_group_filter, count', (({'search':\n 'Manage user groups'}, 1), ({'search': 'Manage'}, 2), ({}, 3)))\n",... |
import tkinter as tk
from PIL import Image
from PIL import ImageTk
def tk_img(cv_img):
pil_img = Image.fromarray(cv_img)
tk_img = ImageTk.PhotoImage(pil_img)
return tk_img
def panel_img_show(panel, img, place=None):
if panel is None:
panel = tk.Label(image=img)
panel.image = img
... | [
"PIL.Image.fromarray",
"PIL.ImageTk.PhotoImage",
"tkinter.Label"
] | [((102, 125), 'PIL.Image.fromarray', 'Image.fromarray', (['cv_img'], {}), '(cv_img)\n', (117, 125), False, 'from PIL import Image\n'), ((139, 166), 'PIL.ImageTk.PhotoImage', 'ImageTk.PhotoImage', (['pil_img'], {}), '(pil_img)\n', (157, 166), False, 'from PIL import ImageTk\n'), ((268, 287), 'tkinter.Label', 'tk.Label',... |
import datetime
import time
from threading import Thread
from typing import Optional
from PyQt5 import QtCore, QtGui, QtWidgets
class CountdownTimer(QtWidgets.QLabel):
finished = QtCore.pyqtSignal()
def __init__(self, parent: QtWidgets.QWidget):
super().__init__(parent)
self._end_time: Optio... | [
"PyQt5.QtCore.pyqtSignal",
"threading.Thread",
"PyQt5.QtGui.QColor",
"PyQt5.QtGui.QFont",
"time.sleep",
"datetime.datetime.now"
] | [((186, 205), 'PyQt5.QtCore.pyqtSignal', 'QtCore.pyqtSignal', ([], {}), '()\n', (203, 205), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((1435, 1459), 'threading.Thread', 'Thread', ([], {'target': 'self._run'}), '(target=self._run)\n', (1441, 1459), False, 'from threading import Thread\n'), ((669, 719), 'Py... |
import datetime
import typing
import numpy as np
import pandas as pd
from dateutil.relativedelta import relativedelta
from influxdb import DataFrameClient
import atpy.data.iqfeed.bar_util as bars
from atpy.data.ts_util import slice_periods
class InfluxDBOHLCRequest(object):
def __init__(self, client: DataFrame... | [
"pandas.DataFrame",
"influxdb.DataFrameClient.query",
"atpy.data.iqfeed.bar_util.synchronize_timestamps",
"atpy.data.ts_util.slice_periods"
] | [((8876, 8912), 'influxdb.DataFrameClient.query', 'DataFrameClient.query', (['client', 'query'], {}), '(client, query)\n', (8897, 8912), False, 'from influxdb import DataFrameClient\n'), ((9142, 9156), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (9154, 9156), True, 'import pandas as pd\n'), ((10651, 10726), '... |
import sentencepiece as spm
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--paranmt-file')
parser.add_argument('--name')
parser.add_argument('--lower-case', type=int, default=1)
args = parser.parse_args()
def encode_sp(f, fout, sp_model):
f = open(f, 'r')
lines = f.readli... | [
"argparse.ArgumentParser",
"sentencepiece.SentencePieceProcessor"
] | [((64, 89), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (87, 89), False, 'import argparse\n'), ((363, 391), 'sentencepiece.SentencePieceProcessor', 'spm.SentencePieceProcessor', ([], {}), '()\n', (389, 391), True, 'import sentencepiece as spm\n')] |
# -*- coding: utf-8 -*-
import logging
from pathlib import Path
from flask import Blueprint, current_app, render_template, send_from_directory
from scout import __version__
from scout.server.utils import public_endpoint
LOG = logging.getLogger(__name__)
public_bp = Blueprint(
"public",
__name__,
templat... | [
"flask.Blueprint",
"flask.current_app.config.get",
"pathlib.Path",
"flask.render_template",
"flask.send_from_directory",
"logging.getLogger"
] | [((229, 256), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (246, 256), False, 'import logging\n'), ((270, 391), 'flask.Blueprint', 'Blueprint', (['"""public"""', '__name__'], {'template_folder': '"""templates"""', 'static_folder': '"""static"""', 'static_url_path': '"""/public/static"""... |
#
# Copyright 2018 Analytics Zoo Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"pandas.date_range",
"zoo.orca.stop_orca_context",
"numpy.random.randint",
"zoo.orca.automl.hp.loguniform",
"zoo.orca.automl.hp.choice",
"numpy.random.rand",
"zoo.orca.automl.hp.uniform",
"zoo.orca.init_orca_context",
"zoo.chronos.autots.model.AutoProphet.AutoProphet"
] | [((972, 996), 'numpy.random.randint', 'np.random.randint', (['(2)', '(50)'], {}), '(2, 50)\n', (989, 996), True, 'import numpy as np\n'), ((852, 894), 'pandas.date_range', 'pd.date_range', (['"""20130101"""'], {'periods': 'seq_len'}), "('20130101', periods=seq_len)\n", (865, 894), True, 'import pandas as pd\n'), ((933,... |
import asyncio
from agents.models import Agent
from channels.db import database_sync_to_async
from channels.generic.websocket import AsyncJsonWebsocketConsumer
from django.contrib.auth.models import AnonymousUser
class DashInfo(AsyncJsonWebsocketConsumer):
async def connect(self):
self.user = self.scope... | [
"agents.models.Agent.objects.filter",
"asyncio.sleep"
] | [((2210, 2227), 'asyncio.sleep', 'asyncio.sleep', (['(30)'], {}), '(30)\n', (2223, 2227), False, 'import asyncio\n'), ((1796, 1842), 'agents.models.Agent.objects.filter', 'Agent.objects.filter', ([], {'monitoring_type': '"""server"""'}), "(monitoring_type='server')\n", (1816, 1842), False, 'from agents.models import Ag... |
import os
import numpy
from subprocess import Popen, PIPE
import pymesh
from default_config.global_vars import apbs_bin, pdb2pqr_bin, multivalue_bin
import random
"""
computeAPBS.py: Wrapper function to compute the Poisson Boltzmann electrostatics for a surface using APBS.
<NAME> - LPDI STI EPFL 2019
This file is par... | [
"subprocess.Popen",
"os.path.join",
"os.remove"
] | [((869, 921), 'subprocess.Popen', 'Popen', (['args'], {'stdout': 'PIPE', 'stderr': 'PIPE', 'cwd': 'directory'}), '(args, stdout=PIPE, stderr=PIPE, cwd=directory)\n', (874, 921), False, 'from subprocess import Popen, PIPE\n'), ((1015, 1067), 'subprocess.Popen', 'Popen', (['args'], {'stdout': 'PIPE', 'stderr': 'PIPE', 'c... |
from setuptools import find_packages, setup
with open("README.md") as f:
long_description = f.read()
setup(
author="<NAME>",
author_email="<EMAIL>",
description="A PyPI package to compute multivariate tensor-based orthogonal polynomials for sequence data and map phenotypes onto sequence space.",
n... | [
"setuptools.find_packages"
] | [((421, 436), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (434, 436), False, 'from setuptools import find_packages, setup\n')] |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
import mimetypes
from flexget import plugin
from flexget.event import event
log = logging.getLogger('nzb_size')
# a bit hacky, add nzb as a known mimetype
mime... | [
"flexget.plugin.priority",
"flexget.event.event",
"pynzb.nzb_parser.parse",
"flexget.plugin.register",
"mimetypes.add_type",
"flexget.plugin.DependencyError",
"logging.getLogger"
] | [((242, 271), 'logging.getLogger', 'logging.getLogger', (['"""nzb_size"""'], {}), "('nzb_size')\n", (259, 271), False, 'import logging\n'), ((316, 363), 'mimetypes.add_type', 'mimetypes.add_type', (['"""application/x-nzb"""', '""".nzb"""'], {}), "('application/x-nzb', '.nzb')\n", (334, 363), False, 'import mimetypes\n'... |
import re
re_player = "[\w ]+"
re_quest = "[\w', ]+"
re_num = "[\d\.]+"
re_attack = re.compile("\`(" + re_player + ") "
"attacks (" + re_quest + ") for (" + re_num + ") "
"damage, " + re_quest + " attacks party for (" + re_num + ") damage.\`")
re_find = re.compile("\`(" + re_player + ") found (... | [
"re.compile"
] | [((85, 248), 're.compile', 're.compile', (["('\\\\`(' + re_player + ') attacks (' + re_quest + ') for (' + re_num +\n ') damage, ' + re_quest + ' attacks party for (' + re_num + ') damage.\\\\`')"], {}), "('\\\\`(' + re_player + ') attacks (' + re_quest + ') for (' +\n re_num + ') damage, ' + re_quest + ' attacks... |
# -*- coding: utf-8 -*-
from pyramid.security import Allow
from h.api import resources as api
from h.api.resources import Resource
class UserStreamFactory(Resource):
def __getitem__(self, key):
query = {'q': 'user:{}'.format(key)}
return Stream(query=query)
class TagStreamFactory(Resource):
... | [
"h.api.resources.create_root"
] | [((1346, 1370), 'h.api.resources.create_root', 'api.create_root', (['request'], {}), '(request)\n', (1361, 1370), True, 'from h.api import resources as api\n')] |
from pydm.dmsetup import Dmsetup
from pydm.blockdev import Blockdev
class Table(object):
def __init__(self, name, method, root_helper=''):
self.root_helper = root_helper
self.name = name
self.method = method
self.path = ''
self.dm = Dmsetup(root_helper=root_helper... | [
"pydm.dmsetup.Dmsetup",
"pydm.blockdev.Blockdev"
] | [((289, 321), 'pydm.dmsetup.Dmsetup', 'Dmsetup', ([], {'root_helper': 'root_helper'}), '(root_helper=root_helper)\n', (296, 321), False, 'from pydm.dmsetup import Dmsetup\n'), ((344, 377), 'pydm.blockdev.Blockdev', 'Blockdev', ([], {'root_helper': 'root_helper'}), '(root_helper=root_helper)\n', (352, 377), False, 'from... |
import numpy as np, gzip, pickle
from mlp_io import *
from mlp_train import *
from mlp_predict import *
#====================
# Specify parameters
#====================
# Decision switches
scale_features = True
verbose = True
profile = True
report_test = True
scale_by_range = True # Else by standard deviation
# Inpu... | [
"pickle.load",
"gzip.open",
"numpy.vstack"
] | [((1092, 1118), 'gzip.open', 'gzip.open', (['data_path', '"""rb"""'], {}), "(data_path, 'rb')\n", (1101, 1118), False, 'import numpy as np, gzip, pickle\n'), ((1673, 1723), 'numpy.vstack', 'np.vstack', (['[inputs_train, inputs_val, inputs_test]'], {}), '([inputs_train, inputs_val, inputs_test])\n', (1682, 1723), True, ... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.python.ops.standard_ops.TensorArray",
"tensorflow.core.framework.node_def_pb2.NodeDef",
"tensorflow.python.ops.standard_ops.equal",
"tensorflow.python.ops.standard_ops.group",
"tensorflow.python.ops.standard_ops.reduce_sum",
"tensorflow.python.ops.standard_ops.gradients",
"tensorflow.python.... | [((10005, 10022), 'tensorflow.python.platform.googletest.main', 'googletest.main', ([], {}), '()\n', (10020, 10022), False, 'from tensorflow.python.platform import googletest\n'), ((1482, 1542), 'tensorflow.core.framework.node_def_pb2.NodeDef', 'node_def_pb2.NodeDef', ([], {'name': 'nd.name', 'op': 'nd.op', 'input': 'n... |
# The piwheels project
# Copyright (c) 2017 <NAME> <https://github.com/bennuttall>
# Copyright (c) 2017 <NAME> <<EMAIL>>
#
# 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 ... | [
"voluptuous.Schema",
"collections.namedtuple",
"voluptuous.ExactSequence",
"voluptuous.Any"
] | [((2090, 2130), 'collections.namedtuple', 'namedtuple', (['"""Protocol"""', "('recv', 'send')"], {}), "('Protocol', ('recv', 'send'))\n", (2100, 2130), False, 'from collections import namedtuple\n'), ((3622, 3691), 'voluptuous.ExactSequence', 'ExactSequence', (['[str, int, str, str, str, str, str, str, {str: [str]}]'],... |
from mapclassify import *
def explore(data="census"):
"""Launch an interactive visualization portal.
This function launches an interactive dataset explorer based on plotly's `dash`
Currently it is still experimental, but it provides a set of interactive widgets
and maps that allow users to rapidly cr... | [
"webbrowser.open",
"palettable.colorbrewer.get_map",
"dash.Dash",
"dash_html_components.H2",
"dash_html_components.Div",
"dash_bootstrap_components.DropdownMenuItem",
"dash.dependencies.Input",
"dash_bootstrap_components.NavLink",
"dash_core_components.Dropdown",
"geosnap.datasets.msas",
"geosna... | [((8800, 8852), 'dash.Dash', 'dash.Dash', ([], {'external_stylesheets': 'external_stylesheets'}), '(external_stylesheets=external_stylesheets)\n', (8809, 8852), False, 'import dash\n'), ((8871, 8895), 'dash_html_components.Div', 'html.Div', (['[navbar, body]'], {}), '([navbar, body])\n', (8879, 8895), True, 'import das... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
''' Computational semantics course @ RUG-2019
Lecturer: <EMAIL>
Assignment 4: Natural language inference with first-order logic theorem proving
Usage:
# Run the prover for the train portion of SICK with verbosity 1
python3 nli2foli.py --pmb pmb_SICK/ --... | [
"nltk.sem.Expression.fromstring",
"utils.read_sick_problems",
"knowledge.wn_axioms",
"argparse.ArgumentParser",
"logging.basicConfig",
"clf_referee.get_signature",
"clf_referee.check_clf",
"logging.warning",
"sick_eval.confusion_matrix_scores",
"collections.Counter",
"clf_referee.pr_2rel",
"ut... | [((1659, 1725), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Read the SICK dataset files"""'}), "(description='Read the SICK dataset files')\n", (1682, 1725), False, 'import argparse, re\n'), ((3213, 3306), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(message)s""... |
# -*- coding: utf-8 -*-
r"""
Delsarte (or linear programming) bounds
This module provides LP upper bounds for the parameters of codes, introduced in
[De1973]_.
The exact LP solver PPL is used by default, ensuring that no
rounding/overflow problems occur.
AUTHORS:
- <NAME>. (Dima) Pasechnik (2012-10): initial implem... | [
"sage.rings.integer_ring.ZZ",
"sage.numerical.mip.MixedIntegerLinearProgram",
"sage.arith.srange.srange",
"sage.arith.all.binomial"
] | [((3281, 3297), 'sage.arith.srange.srange', 'srange', (['(1)', '(l + 1)'], {}), '(1, l + 1)\n', (3287, 3297), False, 'from sage.arith.srange import srange\n'), ((4425, 4484), 'sage.numerical.mip.MixedIntegerLinearProgram', 'MixedIntegerLinearProgram', ([], {'maximization': '(True)', 'solver': 'solver'}), '(maximization... |
#!/usr/bin/env python
# coding=utf-8
import unittest
from tests import *
from tests.ligand import *
from tests.AutodockVina import *
from tests.RDkit import *
from tests.rDock import *
from tests.Gold import *
from tests.Schrodinger import *
from tests.OpenEye_Hybrid import *
from tests.Corina import *
from tests.Tau... | [
"unittest.main"
] | [((367, 382), 'unittest.main', 'unittest.main', ([], {}), '()\n', (380, 382), False, 'import unittest\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.