code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
#!/usr/bin/env python3
import argparse
import sys
import re
from os import listdir, makedirs, path
import pandas as pd
import spacy
from spacy.matcher import PhraseMatcher
nlp = spacy.load('en_core_web_sm')
def get_caption_texts (filepath):
texts = []
for filename in listdir(filepath):
name, ext = pat... | [
"pandas.DataFrame",
"argparse.ArgumentParser",
"pandas.read_csv",
"os.path.exists",
"spacy.load",
"re.findall",
"os.path.splitext",
"spacy.matcher.PhraseMatcher",
"os.path.join",
"os.listdir",
"sys.exit"
] | [((179, 207), 'spacy.load', 'spacy.load', (['"""en_core_web_sm"""'], {}), "('en_core_web_sm')\n", (189, 207), False, 'import spacy\n'), ((278, 295), 'os.listdir', 'listdir', (['filepath'], {}), '(filepath)\n', (285, 295), False, 'from os import listdir, makedirs, path\n'), ((1694, 1718), 'spacy.matcher.PhraseMatcher', ... |
#
# Import section
#
import numpy
from syned.beamline.beamline_element import BeamlineElement
from syned.beamline.element_coordinates import ElementCoordinates
from wofry.propagator.propagator import PropagationManager, PropagationElements, PropagationParameters
from wofry.propagator.wavefront1D.generic_wavefront im... | [
"numpy.radians",
"wofry.propagator.propagator.PropagationElements",
"syned.beamline.shape.Rectangle",
"wofryimpl.beamline.optical_elements.ideal_elements.lens.WOIdealLens1D",
"wofryimpl.beamline.optical_elements.ideal_elements.screen.WOScreen1D",
"wofryimpl.propagator.propagators1D.fresnel_zoom.FresnelZoo... | [((1172, 1509), 'wofryimpl.propagator.util.undulator_coherent_mode_decomposition_1d.UndulatorCoherentModeDecomposition1D', 'UndulatorCoherentModeDecomposition1D', ([], {'electron_energy': '(6)', 'electron_current': '(0.2)', 'undulator_period': '(0.018)', 'undulator_nperiods': '(138)', 'K': '(1.85108)', 'photon_energy':... |
import os
from .null import NullAdapter
class FileSystemAdapter(NullAdapter):
def __init__(self, path: str):
super(FileSystemAdapter, self).__init__('fs')
self._path = path
self.enabled = True
@property
def name(self) -> str:
return os.path.basename(self._path).lower()
| [
"os.path.basename"
] | [((282, 310), 'os.path.basename', 'os.path.basename', (['self._path'], {}), '(self._path)\n', (298, 310), False, 'import os\n')] |
# coding: utf-8
# pylint: disable = C0103
"""Compatibility"""
from __future__ import absolute_import
import inspect
import sys
import numpy as np
is_py3 = (sys.version_info[0] == 3)
"""compatibility between python2 and python3"""
if is_py3:
string_type = str
numeric_types = (int, float, bool)
integer_ty... | [
"inspect.getargspec",
"inspect.signature"
] | [((449, 472), 'inspect.signature', 'inspect.signature', (['func'], {}), '(func)\n', (466, 472), False, 'import inspect\n'), ((713, 737), 'inspect.getargspec', 'inspect.getargspec', (['func'], {}), '(func)\n', (731, 737), False, 'import inspect\n')] |
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-QoS-Pacer
GUID : 914ed502-b70d-4add-b758-95692854f8a3
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp import Sid
from etl.p... | [
"construct.Bytes",
"construct.Struct",
"etl.parsers.etw.core.guid"
] | [((3765, 3853), 'construct.Struct', 'Struct', (["('NdisMediumType' / Int32ul)", "('FriendlyName' / WString)", "('DeviceName' / WString)"], {}), "('NdisMediumType' / Int32ul, 'FriendlyName' / WString, 'DeviceName' /\n WString)\n", (3771, 3853), False, 'from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, ... |
# -*- coding: utf-8 -*-
import os
import argparse
import logging
import re
import spacy
import jieba
import random
import time
import numpy
import sklearn.model_selection
import torch
import allennlp.modules
import transformers
import flair
from eznlp.io import TabularIO, CategoryFolderIO, ConllIO, JsonIO, KarpathyIO,... | [
"numpy.random.seed",
"eznlp.io.JsonIO",
"eznlp.vectors.Vectors.load",
"transformers.RobertaTokenizer.from_pretrained",
"transformers.AlbertModel.from_pretrained",
"eznlp.io.CategoryFolderIO",
"transformers.AutoModel.from_pretrained",
"eznlp.io.TabularIO",
"torch.optim.lr_scheduler.LambdaLR",
"eznl... | [((552, 579), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (569, 579), False, 'import logging\n'), ((5773, 5838), 'spacy.load', 'spacy.load', (['"""en_core_web_sm"""'], {'disable': "['tagger', 'parser', 'ner']"}), "('en_core_web_sm', disable=['tagger', 'parser', 'ner'])\n", (5783, 5838)... |
"""Simulation script for assignment 2.
The script uses the control defined in file `aer1216_fall2020_hw2_ctrl.py`.
Example
-------
To run the simulation, type in a terminal:
$ python aer1216_fall2020_hw2_sim.py
"""
import time
import random
import numpy as np
import pybullet as p
#### Uncomment the following 2... | [
"numpy.zeros",
"time.time",
"aer1216_fall2020_hw2_ctrl.HW2Control",
"numpy.array",
"numpy.cos",
"gym_pybullet_drones.utils.Logger.Logger",
"gym_pybullet_drones.utils.utils.sync"
] | [((1388, 1438), 'gym_pybullet_drones.utils.Logger.Logger', 'Logger', ([], {'logging_freq_hz': 'ENV.SIM_FREQ', 'num_drones': '(3)'}), '(logging_freq_hz=ENV.SIM_FREQ, num_drones=3)\n', (1394, 1438), False, 'from gym_pybullet_drones.utils.Logger import Logger\n'), ((1560, 1595), 'aer1216_fall2020_hw2_ctrl.HW2Control', 'HW... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-LOG 蓝鲸日志平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-LOG 蓝鲸日志平台 is licensed under the MIT License.
License for BK-LOG 蓝鲸日志平台:
------------------------------------------------... | [
"django.utils.module_loading.import_string"
] | [((5370, 5388), 'django.utils.module_loading.import_string', 'import_string', (['val'], {}), '(val)\n', (5383, 5388), False, 'from django.utils.module_loading import import_string\n'), ((5461, 5480), 'django.utils.module_loading.import_string', 'import_string', (['item'], {}), '(item)\n', (5474, 5480), False, 'from dja... |
import unittest
class TestApp(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_02_rolly_113040087(self):
from Chapter01.rolly113040087 import preparation,training,testing
dataset='Chapter01/dataset/student-por.csv'
d_train_att,d_train_p... | [
"Chapter01.rolly113040087.preparation",
"Chapter01.rolly113040087.training",
"Chapter01.rolly113040087.testing"
] | [((361, 381), 'Chapter01.rolly113040087.preparation', 'preparation', (['dataset'], {}), '(dataset)\n', (372, 381), False, 'from Chapter01.rolly113040087 import preparation, training, testing\n'), ((394, 429), 'Chapter01.rolly113040087.training', 'training', (['d_train_att', 'd_train_pass'], {}), '(d_train_att, d_train_... |
# encoding: utf-8
import pytest
import copy
from ckan import model
from ckan.tests import factories
from ckanext.stats.stats import Stats
@pytest.mark.ckan_config('ckan.plugins', 'stats')
@pytest.mark.usefixtures("with_plugins", "with_request_context")
@pytest.mark.freeze_time
class TestStatsPlugin(object):
@... | [
"pytest.mark.ckan_config",
"ckanext.stats.stats.Stats.top_tags",
"copy.deepcopy",
"ckan.model.Session.query",
"ckan.model.repo.commit_and_remove",
"ckanext.stats.stats.Stats.get_by_week",
"pytest.fixture",
"ckan.tests.factories.Group",
"ckanext.stats.stats.Stats.largest_groups",
"ckanext.stats.sta... | [((145, 193), 'pytest.mark.ckan_config', 'pytest.mark.ckan_config', (['"""ckan.plugins"""', '"""stats"""'], {}), "('ckan.plugins', 'stats')\n", (168, 193), False, 'import pytest\n'), ((195, 258), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""with_plugins"""', '"""with_request_context"""'], {}), "('with_pl... |
#
# Generated with WaveDriftDampingBlueprint
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 sima.sima.blueprints.moao import MOAOBlueprint
class WaveDri... | [
"dmt.attribute.Attribute",
"dmt.enum_attribute.EnumAttribute",
"dmt.dimension.Dimension"
] | [((546, 589), 'dmt.attribute.Attribute', 'Attribute', (['"""name"""', '"""string"""', '""""""'], {'default': '""""""'}), "('name', 'string', '', default='')\n", (555, 589), False, 'from dmt.attribute import Attribute\n'), ((619, 669), 'dmt.attribute.Attribute', 'Attribute', (['"""description"""', '"""string"""', '"""""... |
"""This module creates and registers a flow with the Prefect server.
"""
from prefect import Flow, Parameter
from hello.__main__ import say_hello
def main():
"""Create a simple flow that accepts a name as the parameter and
runs the 'Hello World' task to say the name.
"""
with Flow("Hello Flow") as fl... | [
"prefect.Parameter",
"hello.__main__.say_hello",
"prefect.Flow"
] | [((296, 314), 'prefect.Flow', 'Flow', (['"""Hello Flow"""'], {}), "('Hello Flow')\n", (300, 314), False, 'from prefect import Flow, Parameter\n'), ((339, 356), 'prefect.Parameter', 'Parameter', (['"""name"""'], {}), "('name')\n", (348, 356), False, 'from prefect import Flow, Parameter\n'), ((365, 380), 'hello.__main__.... |
import re
from grblogtools.parsers.barrier import BarrierParser
from grblogtools.parsers.simplex import SimplexParser
from grblogtools.parsers.util import typeconvert_groupdict
class ContinuousParser:
# The pattern indicating the start or the termination of the barrier/simplex
# in case of solving a MIP. In ... | [
"grblogtools.parsers.barrier.BarrierParser",
"grblogtools.parsers.util.typeconvert_groupdict",
"grblogtools.parsers.simplex.SimplexParser",
"re.compile"
] | [((408, 547), 're.compile', 're.compile', (['"""Root relaxation: objective (?P<RelaxObj>[^,]+), (?P<RelaxIterCount>\\\\d+) iterations, (?P<RelaxTime>[^\\\\s]+) seconds"""'], {}), "(\n 'Root relaxation: objective (?P<RelaxObj>[^,]+), (?P<RelaxIterCount>\\\\d+) iterations, (?P<RelaxTime>[^\\\\s]+) seconds'\n )\n", ... |
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
from time import sleep
# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()
# sets a variable with the package's internal name
package = 'info.guardianproject.otr.app.im'
# sets a variable with the ... | [
"com.android.monkeyrunner.MonkeyRunner.waitForConnection",
"time.sleep"
] | [((163, 195), 'com.android.monkeyrunner.MonkeyRunner.waitForConnection', 'MonkeyRunner.waitForConnection', ([], {}), '()\n', (193, 195), False, 'from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice\n'), ((635, 643), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (640, 643), False, 'from time import sleep\n')... |
import asyncio
import atexit
from collections import deque
import functools
import sys
from greenlet import greenlet, getcurrent
class GreenletBridge:
def __init__(self):
self.reset()
self.wait_event = None
def reset(self):
self.starting = False
self.running = False
se... | [
"atexit.register",
"asyncio.isfuture",
"asyncio.get_event_loop",
"asyncio.new_event_loop",
"asyncio.set_event_loop",
"asyncio.Event",
"greenlet.getcurrent",
"greenlet.greenlet",
"asyncio.iscoroutine",
"functools.wraps",
"sys.exc_info",
"collections.deque",
"asyncio.Future"
] | [((3525, 3544), 'functools.wraps', 'functools.wraps', (['fn'], {}), '(fn)\n', (3540, 3544), False, 'import functools\n'), ((4862, 4875), 'greenlet.greenlet', 'greenlet', (['_fn'], {}), '(_fn)\n', (4870, 4875), False, 'from greenlet import greenlet, getcurrent\n'), ((426, 433), 'collections.deque', 'deque', ([], {}), '(... |
import praw
import configparser
import urllib.request
from prawcore.exceptions import Redirect
from prawcore.exceptions import ResponseException
from urllib.error import HTTPError
class ClientInfo:
id = ''
secret = ''
user_agent = 'Reddit_Image_Scraper'
def get_client_info():
config... | [
"configparser.ConfigParser",
"praw.Reddit"
] | [((323, 350), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (348, 350), False, 'import configparser\n'), ((960, 1067), 'praw.Reddit', 'praw.Reddit', ([], {'client_id': 'ClientInfo.id', 'client_secret': 'ClientInfo.secret', 'user_agent': 'ClientInfo.user_agent'}), '(client_id=ClientInfo.id,... |
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... | [
"warnings.warn",
"modin.config.IsExperimental.put"
] | [((1450, 1474), 'modin.config.IsExperimental.put', 'IsExperimental.put', (['(True)'], {}), '(True)\n', (1468, 1474), False, 'from modin.config import IsExperimental\n'), ((1897, 2080), 'warnings.warn', 'warnings.warn', (['"""Thank you for using the Modin Experimental pandas API.\nPlease note that some of these APIs dev... |
import numpy as np
import pytest
from probnum import diffeq
import probnum.problems.zoo.diffeq as diffeq_zoo
@pytest.fixture
def rng():
return np.random.default_rng(seed=123)
@pytest.fixture
def ivp():
y0 = 20.0 * np.ones(2)
return diffeq_zoo.lotkavolterra(t0=0.0, tmax=0.25, y0=y0)
@pytest.mark.param... | [
"probnum.diffeq.perturbsolve_ivp",
"probnum.problems.zoo.diffeq.lotkavolterra",
"numpy.amin",
"numpy.ones",
"numpy.random.default_rng",
"numpy.amax",
"pytest.raises",
"numpy.diff",
"numpy.array",
"pytest.mark.parametrize"
] | [((303, 354), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""method"""', "['RK23', 'RK45']"], {}), "('method', ['RK23', 'RK45'])\n", (326, 354), False, 'import pytest\n'), ((356, 426), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""perturb"""', "['step-lognormal', 'step-uniform']"], {}), "('pe... |
"""Refinement of Bravais settings consistent with the primitive unit cell.
This program takes as input the output of dials.index, i.e. indexed.expt
and indexed.refl files. Full refinement of the crystal and experimental
geometry parameters will be performed (by default) in all Bravais settings
that are consistent with... | [
"os.path.join",
"dials.util.log.config",
"dials.algorithms.indexing.bravais_settings.refined_settings_from_refined_triclinic",
"cctbx.sgtbx.bravais_types.bravais_lattice",
"dials.util.options.reflections_and_experiments_from_files",
"cctbx.sgtbx.space_group_info",
"dxtbx.model.ExperimentList",
"collec... | [((1979, 2042), 'logging.getLogger', 'logging.getLogger', (['"""dials.command_line.refine_bravais_settings"""'], {}), "('dials.command_line.refine_bravais_settings')\n", (1996, 2042), False, 'import logging\n'), ((2456, 2481), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (2479, 2481), False, ... |
"""
Pipeline Steps For Caching
=====================================
..
Copyright 2019, Neuraxio 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/... | [
"os.mkdir",
"pickle.dump",
"hashlib.md5",
"os.makedirs",
"os.path.exists",
"neuraxle.base.BaseStep.__init__",
"pickle.load",
"shutil.rmtree",
"neuraxle.base.MetaStepMixin.__init__",
"os.path.join"
] | [((1602, 1625), 'neuraxle.base.BaseStep.__init__', 'BaseStep.__init__', (['self'], {}), '(self)\n', (1619, 1625), False, 'from neuraxle.base import MetaStepMixin, BaseStep, NonFittableMixin, NonTransformableMixin, ExecutionContext\n'), ((1634, 1671), 'neuraxle.base.MetaStepMixin.__init__', 'MetaStepMixin.__init__', (['... |
import numpy as np
est = dict(
k_eq_model = 0,
phi = 1,
vf = 1,
df = 28,
df_m = 3,
power = 0,
canonical = 1,
rank = 4,
aic = 1.055602138883215,
rc = 0,
p = .0388431588742135,
chi2 = 8.376... | [
"numpy.array"
] | [((3209, 3286), 'numpy.array', 'np.array', (['[32, np.nan, -12.889634222131, 4, 33.779268444263, 39.642212055462]'], {}), '([32, np.nan, -12.889634222131, 4, 33.779268444263, 39.642212055462])\n', (3217, 3286), True, 'import numpy as np\n'), ((7347, 7424), 'numpy.array', 'np.array', (['[32, np.nan, -12.889634222131, 4,... |
# -*- coding: utf-8 -*-
"""Artifact attribute containers."""
from plaso.containers import interface
from plaso.containers import manager
from plaso.lib import definitions
class ArtifactAttributeContainer(interface.AttributeContainer):
"""Base class to represent an artifact attribute container."""
class SystemSub... | [
"plaso.containers.manager.AttributeContainersManager.RegisterAttributeContainers"
] | [((21806, 22099), 'plaso.containers.manager.AttributeContainersManager.RegisterAttributeContainers', 'manager.AttributeContainersManager.RegisterAttributeContainers', (['[EnvironmentVariableArtifact, HostnameArtifact, OperatingSystemArtifact,\n PathArtifact, SourceConfigurationArtifact, SystemConfigurationArtifact,\... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
"ecl.storage.v1.volume.Volume",
"ecl.storage.v1.storage.Storage",
"ecl.storage.v1.availability_zone.AvailabilityZone",
"ecl.storage.v1.snapshot.Snapshot",
"ecl.storage.v1.availability_zone.AvailabilityZoneDetail",
"six.iteritems",
"ecl.storage.version.Version"
] | [((7241, 7259), 'ecl.storage.v1.storage.Storage', '_storage.Storage', ([], {}), '()\n', (7257, 7259), True, 'from ecl.storage.v1 import storage as _storage\n'), ((8028, 8046), 'ecl.storage.v1.storage.Storage', '_storage.Storage', ([], {}), '()\n', (8044, 8046), True, 'from ecl.storage.v1 import storage as _storage\n'),... |
# -*- coding: utf-8 -*-
###############################################################################
# This file is part of metalibm (https://github.com/kalray/metalibm)
###############################################################################
# MIT License
#
# Copyright (c) 2018 Kalray
#
# Permission is hereb... | [
"sollya.Interval"
] | [((5816, 5847), 'sollya.Interval', 'Interval', (['low_bound', 'high_bound'], {}), '(low_bound, high_bound)\n', (5824, 5847), False, 'from sollya import Interval\n')] |
"""Artificial Local Searches Test"""
# Author: <NAME> -- <<EMAIL>>
# License: MIT (c) 2016
from unittest import TestCase
import numpy as np
from artificial import agents, base
from artificial.searches.local import HillClimbing, LocalBeam
random_state = np.random.RandomState(0)
class _TState(base.State):
@pro... | [
"artificial.searches.local.HillClimbing",
"artificial.searches.local.LocalBeam",
"numpy.random.RandomState"
] | [((258, 282), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {}), '(0)\n', (279, 282), True, 'import numpy as np\n'), ((3130, 3215), 'artificial.searches.local.LocalBeam', 'LocalBeam', ([], {'agent': 'self.agent', 'root': 'self.env.current_state', 'strategy': '"""classic"""', 'k': '(2)'}), "(agent=self.... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 6 11:02:22 2019
@author: DiPu
"""
# Impoimport numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
# Importing the dataset (Bivariate Data Set with 3 Clusters)
data = pd.read_csv('data.csv')
data=data.drop(['Subregion','Locale','Locus','Exc... | [
"pandas.read_csv",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.pie"
] | [((247, 270), 'pandas.read_csv', 'pd.read_csv', (['"""data.csv"""'], {}), "('data.csv')\n", (258, 270), True, 'import pandas as pd\n'), ((1092, 1131), 'matplotlib.pyplot.pie', 'plt.pie', (['value'], {'startangle': '(90)', 'radius': '(1)'}), '(value, startangle=90, radius=1)\n', (1099, 1131), True, 'import matplotlib.py... |
#################### Maintained by Hatch ####################
# This file is auto-generated by hatch. If you'd like to customize this file
# please add your changes near the bottom marked for 'USER OVERRIDES'.
# EVERYTHING ELSE WILL BE OVERWRITTEN by hatch.
#############################################################
... | [
"setuptools.setup",
"setuptools.find_packages",
"io.open"
] | [((2035, 2050), 'setuptools.setup', 'setup', ([], {}), '(**kwargs)\n', (2040, 2050), False, 'from setuptools import find_packages, setup\n'), ((391, 426), 'io.open', 'open', (['"""heatflow1d/__init__.py"""', '"""r"""'], {}), "('heatflow1d/__init__.py', 'r')\n", (395, 426), False, 'from io import open\n'), ((618, 659), ... |
# -*- coding: utf-8 -*-
"""
:mod:`orion.client.manual` -- Routines for manual interaction with database
=============================================================================
.. module:: manual
:platform: Unix
:synopsis: Provides a simple interface to log new trials into the database
and link them w... | [
"orion.core.utils.format_trials.tuple_to_trial",
"orion.core.io.experiment_builder.ExperimentBuilder"
] | [((1442, 1461), 'orion.core.io.experiment_builder.ExperimentBuilder', 'ExperimentBuilder', ([], {}), '()\n', (1459, 1461), False, 'from orion.core.io.experiment_builder import ExperimentBuilder\n'), ((1855, 1912), 'orion.core.utils.format_trials.tuple_to_trial', 'format_trials.tuple_to_trial', (['data', 'experiment_vie... |
##############################################################################
#
# Copyright (c) 2006-2007 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THI... | [
"inspect.ismethod",
"zope.interface.implementedBy",
"zope.interface.providedBy",
"sys._getframe",
"martian.error.GrokError"
] | [((2264, 2378), 'martian.error.GrokError', 'GrokError', (["('%r must implement at least one interface (use grok.implements to specify).' %\n class_)", 'class_'], {}), "(\n '%r must implement at least one interface (use grok.implements to specify).'\n % class_, class_)\n", (2273, 2378), False, 'from martian.er... |
import datetime
import itertools
import json
import math
import random
import re
import unicodedata
from base64 import b64encode, b64decode
from collections import Counter, namedtuple, ChainMap
import os
import base64
def _range(*args):
if len(args) == 1:
stop = args[0]
start = 0
step = 1
... | [
"collections.namedtuple"
] | [((2377, 2425), 'collections.namedtuple', 'namedtuple', (['"""base64"""', "('b64encode', 'b64decode')"], {}), "('base64', ('b64encode', 'b64decode'))\n", (2387, 2425), False, 'from collections import Counter, namedtuple, ChainMap\n')] |
#/usr/bin/env python
#coding: utf8
from __future__ import absolute_import, print_function
from bitcron import version
from bitcron.sync.sync_worker import do_sync_from, do_sync_to
from bitcron.sync.core.settings import get_sync_configs
from bitcron.utils.path import join, get_parent_folders, make_sure_path
from bitcro... | [
"bitcron.utils.cli_color.print_with_color",
"os.remove",
"webbrowser.open",
"os.getcwd",
"os.path.isdir",
"bitcron.sync.core.settings.get_sync_configs",
"bitcron.utils.path.join",
"os.path.isfile",
"bitcron.utils.file_utils.delete_file",
"bitcron.utils.path.make_sure_path",
"bitcron.utils.path.g... | [((723, 761), 'bitcron.utils.path.join', 'join', (['site_folder', 'site_token_filename'], {}), '(site_folder, site_token_filename)\n', (727, 761), False, 'from bitcron.utils.path import join, get_parent_folders, make_sure_path\n'), ((769, 799), 'os.path.isfile', 'os.path.isfile', (['token_filepath'], {}), '(token_filep... |
import base64
import pathlib
import pytest
import demapi
@pytest.mark.asyncio
async def test_simple(assets_path, result_photo_base):
result_path = assets_path / "example.png"
config = demapi.Configure(
base_photo=result_path,
title="test",
explanation="test",
)
sync_photo = ... | [
"demapi.Configure",
"base64.b64encode"
] | [((196, 270), 'demapi.Configure', 'demapi.Configure', ([], {'base_photo': 'result_path', 'title': '"""test"""', 'explanation': '"""test"""'}), "(base_photo=result_path, title='test', explanation='test')\n", (212, 270), False, 'import demapi\n'), ((413, 449), 'base64.b64encode', 'base64.b64encode', (['sync_photo.content... |
# -*- coding: utf-8 -*-
import sys
import os
'''
* Ocrend Framework - PHP Code Generator
* @author <NAME> (Prinick) <<EMAIL>> <youtube.com/user/prinick96>
* @copyright 2016 - Ocrend Software
'''
R_MODELS = './core/models/'
R_CONTROLLERS = './core/controllers/'
R_VIEWS = './templates/'
def create_file(route,fil... | [
"os.path.isdir",
"os.mkdir",
"os.path.exists"
] | [((2841, 2879), 'os.path.exists', 'os.path.exists', (['(route + filename + ext)'], {}), '(route + filename + ext)\n', (2855, 2879), False, 'import os\n'), ((2883, 2938), 'os.path.exists', 'os.path.exists', (["(route + filename + '/' + filename + ext)"], {}), "(route + filename + '/' + filename + ext)\n", (2897, 2938), ... |
# -- coding: utf-8 --
# Note that we import as `DjangoRequestFactory` and `DjangoClient` in order
# to make it harder for the user to import the wrong thing without realizing.
from __future__ import unicode_literals
import django
from django.conf import settings
from django.test import testcases
from django.test.clie... | [
"django.utils.encoding.force_bytes",
"django.utils.http.urlencode"
] | [((1742, 1785), 'django.utils.encoding.force_bytes', 'force_bytes', (['data', 'settings.DEFAULT_CHARSET'], {}), '(data, settings.DEFAULT_CHARSET)\n', (1753, 1785), False, 'from django.utils.encoding import force_bytes\n'), ((2860, 2893), 'django.utils.http.urlencode', 'urlencode', (['(data or {})'], {'doseq': '(True)'}... |
# Confidential, Copyright 2020, Sony Corporation of America, All rights reserved.
import dataclasses
from copy import deepcopy
from typing import Optional, List, Sequence, cast
from uuid import uuid4
import numpy as np
from ..interfaces import Person, PersonID, PersonState, LocationID, Risk, Registry, PandemicRegulat... | [
"copy.deepcopy",
"uuid.uuid4",
"typing.cast",
"numpy.random.RandomState",
"dataclasses.asdict",
"dataclasses.replace"
] | [((2516, 2542), 'copy.deepcopy', 'deepcopy', (['self._init_state'], {}), '(self._init_state)\n', (2524, 2542), False, 'from copy import deepcopy\n'), ((3700, 3747), 'dataclasses.asdict', 'dataclasses.asdict', (['self._state.infection_state'], {}), '(self._state.infection_state)\n', (3718, 3747), False, 'import dataclas... |
"""
Pentigree L-System
by <NAME>.
This code was based on <NAME>'s L-System class.
"""
from l_system import LSystem
from pentigree_l_system import PentigreeLSystem
ps = None
def setup():
size(640, 360)
ps = PentigreeLSystem()
ps.simulate(3)
def draw():
background(0)
ps.render()
| [
"pentigree_l_system.PentigreeLSystem"
] | [((223, 241), 'pentigree_l_system.PentigreeLSystem', 'PentigreeLSystem', ([], {}), '()\n', (239, 241), False, 'from pentigree_l_system import PentigreeLSystem\n')] |
# Makes a GUI appear. How fortunate!
import argparse
import cligui
def get_parser():
"""Create a parser that does all the best things."""
p = argparse.ArgumentParser(description='such a good program')
p.add_argument('infile')
p.add_argument('outfile')
return p
def do_the_best_things(args):
""... | [
"cligui.CliGui",
"argparse.ArgumentParser"
] | [((152, 210), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""such a good program"""'}), "(description='such a good program')\n", (175, 210), False, 'import argparse\n'), ((738, 774), 'cligui.CliGui', 'cligui.CliGui', (['p', 'do_the_best_things'], {}), '(p, do_the_best_things)\n', (751, 7... |
"""
Since django 1.8.x, django comes with native multiple template engine support.
It also comes with jinja2 backend, but it is slightly unflexible, and it does
not support by default all django filters and related stuff.
This is an implementation of django backend inteface for use
django_jinja easy with django 1.8.
"... | [
"django.utils.module_loading.import_string",
"django.core.exceptions.ImproperlyConfigured",
"django.utils.functional.SimpleLazyObject",
"importlib.import_module",
"os.path.isdir",
"django.dispatch.receiver",
"os.path.exists",
"django.test.signals.template_rendered.send",
"django.template.TemplateDoe... | [((11585, 11618), 'django.dispatch.receiver', 'receiver', (['signals.setting_changed'], {}), '(signals.setting_changed)\n', (11593, 11618), False, 'from django.dispatch import receiver\n'), ((3538, 3559), 'functools.lru_cache', 'functools.lru_cache', ([], {}), '()\n', (3557, 3559), False, 'import functools\n'), ((6135,... |
from projects.models import Project
from .models import ECSInstance
def app_to_ecs_host(app_id=None, app_name=None, detail=False) -> list:
"""
根据应用 ID 获取对应的机器列表
Args:
app_id: 应用 ID
app_name: 应用名
detail: 是否包含 ECS ID
Returns:
list: 机器列表
"""
if not any([app_id, ap... | [
"projects.models.Project.objects.filter"
] | [((385, 422), 'projects.models.Project.objects.filter', 'Project.objects.filter', ([], {'name': 'app_name'}), '(name=app_name)\n', (407, 422), False, 'from projects.models import Project\n')] |
from unittest import mock
import pytest
from praw.models import Comment, Submission, Subreddit
from ... import IntegrationTest
class TestMultireddit(IntegrationTest):
@mock.patch("time.sleep", return_value=None)
def test_add(self, _):
self.reddit.read_only = False
with self.use_cassette():
... | [
"unittest.mock.patch"
] | [((177, 220), 'unittest.mock.patch', 'mock.patch', (['"""time.sleep"""'], {'return_value': 'None'}), "('time.sleep', return_value=None)\n", (187, 220), False, 'from unittest import mock\n'), ((467, 510), 'unittest.mock.patch', 'mock.patch', (['"""time.sleep"""'], {'return_value': 'None'}), "('time.sleep', return_value=... |
# coding=utf-8
#################
# Utilities
#################
import uuid
from typing import Union
class Singleton(type):
"""
Only allows one instantiation. On subsequent __init__ calls, returns the first instance
"""
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls.... | [
"uuid.uuid4"
] | [((2211, 2223), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (2221, 2223), False, 'import uuid\n')] |
"""Modelo de incapacidad medica"""
# Django
from django.db import models
# Utilidades
from apis.utils.models import ModelUtil
class Inability(ModelUtil):
"""Modelo de incapacidad medica
Extiende del Model Util y agrega campos que permiten generar
la incapidad medica solicitada por el medico correspondi... | [
"django.db.models.ForeignKey",
"django.db.models.TextField",
"django.db.models.DateField"
] | [((348, 410), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""pacient.Pacient"""'], {'on_delete': 'models.CASCADE'}), "('pacient.Pacient', on_delete=models.CASCADE)\n", (365, 410), False, 'from django.db import models\n'), ((423, 481), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""medic.Medic"""']... |
# -*- coding: utf-8 -*-
import pytest
from sqlalchemy_mate import io
from sqlalchemy_mate.tests import (
IS_WINDOWS, engine_sqlite, engine_psql, t_user, BaseTest,
)
def teardown_module(module):
import os
try:
filepath = __file__.replace("test_io.py", "t_user.csv")
os.remove(filepath)
... | [
"sqlalchemy_mate.tests.t_user.delete",
"os.remove",
"os.path.basename",
"sqlalchemy_mate.io.table_to_csv",
"pytest.main",
"pytest.mark.skipif",
"sqlalchemy_mate.tests.t_user.insert"
] | [((1016, 1094), 'pytest.mark.skipif', 'pytest.mark.skipif', (['IS_WINDOWS'], {'reason': '"""no psql service container for windows"""'}), "(IS_WINDOWS, reason='no psql service container for windows')\n", (1034, 1094), False, 'import pytest\n'), ((1232, 1258), 'os.path.basename', 'os.path.basename', (['__file__'], {}), '... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import os.path as osp
import numpy as np
# `pip install easydict` if you don't have it
from easydict import EasyDict as edict
__D = edict()
# Consumers can get config by:
# from fast_rcnn_config im... | [
"ast.literal_eval",
"yaml.load",
"numpy.array",
"easydict.EasyDict"
] | [((253, 260), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (258, 260), True, 'from easydict import EasyDict as edict\n'), ((2013, 2025), 'yaml.load', 'yaml.load', (['f'], {}), '(f)\n', (2022, 2025), False, 'import yaml\n'), ((2456, 2471), 'ast.literal_eval', 'literal_eval', (['v'], {}), '(v)\n', (2468, 2471), False,... |
#!/GPFS/zhangli_lab_permanent/zhuqingjie/env/py3_tf2/bin/python
'''
@Time : 20/11/05 下午 01:56
@Author : zhuqingjie
@User : zhu
@FileName: setup.py
@Software: PyCharm
'''
import setuptools
import easyFlyTracker
'''
国内源找不到该包(或者说更新不及时),一定要使用官方源安装:
pip install -i https://pypi.org/simple/ easyFlyTracker
pip instal... | [
"setuptools.find_packages"
] | [((1027, 1053), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (1051, 1053), False, 'import setuptools\n')] |
from typing import List
import config
def search(numbers: List[str]) -> int:
"""Search for numbers that satisfy `2020 = x + y + z`.
x = num
y = num2
z = diff2
diff = y + z
Args:
numbers (List[str]): a list of numbers in string form
Returns:
int: the product of the numbe... | [
"config.File",
"config.TestFile",
"config.LOGGER.error",
"config.LOGGER.info"
] | [((892, 920), 'config.TestFile', 'config.TestFile', (['test_answer'], {}), '(test_answer)\n', (907, 920), False, 'import config\n'), ((970, 983), 'config.File', 'config.File', ([], {}), '()\n', (981, 983), False, 'import config\n'), ((1044, 1071), 'config.LOGGER.info', 'config.LOGGER.info', (['product'], {}), '(product... |
__author__ = "<NAME>"
__copyright__ = "Copyright 2021, <NAME>"
__email__ = "<EMAIL>"
__license__ = "MIT"
import os
import subprocess as sp
import time
import shutil
from snakemake.exceptions import WorkflowError
from snakemake.logging import logger
from snakemake.utils import os_sync
if not shutil.which("globus-ur... | [
"subprocess.run",
"shutil.which",
"time.sleep",
"snakemake.exceptions.WorkflowError",
"snakemake.utils.os_sync"
] | [((297, 328), 'shutil.which', 'shutil.which', (['"""globus-url-copy"""'], {}), "('globus-url-copy')\n", (309, 328), False, 'import shutil\n'), ((340, 442), 'snakemake.exceptions.WorkflowError', 'WorkflowError', (['"""The globus-url-copy command has to be available for gridftp remote support."""'], {}), "(\n 'The glo... |
"""
:codeauthor: :email:`<NAME> <<EMAIL>`
"""
import os
import re
import shutil
import tempfile
import pytest
import salt.config
import salt.roster
import salt.utils.files
import salt.utils.path
import salt.utils.thin
import salt.utils.yaml
from salt.client import ssh
from tests.support.case import ShellCase
from... | [
"os.makedirs",
"tests.support.mock.call",
"os.path.basename",
"os.path.isdir",
"tests.support.mock.patch",
"tempfile.gettempdir",
"tempfile.mkdtemp",
"re.search",
"shutil.rmtree",
"tests.support.mock.MagicMock",
"os.path.join",
"salt.client.ssh.SSH"
] | [((997, 1046), 'os.path.join', 'os.path.join', (['RUNTIME_VARS.TMP_CONF_DIR', '"""roster"""'], {}), "(RUNTIME_VARS.TMP_CONF_DIR, 'roster')\n", (1009, 1046), False, 'import os\n'), ((1391, 1402), 'tests.support.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (1400, 1402), False, 'from tests.support.mock import MagicMock... |
#!/usr/bin/env python
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Genrate a Fuchsia FAR Archive from an asset manifest and a signing key.
"""
import argparse
import collections
import json
import ... | [
"os.path.exists",
"argparse.ArgumentParser",
"subprocess.check_call"
] | [((536, 586), 'subprocess.check_call', 'subprocess.check_call', (["(pm_command_base + ['build'])"], {}), "(pm_command_base + ['build'])\n", (557, 586), False, 'import subprocess\n'), ((614, 666), 'subprocess.check_call', 'subprocess.check_call', (["(pm_command_base + ['archive'])"], {}), "(pm_command_base + ['archive']... |
import dataclasses
import enum
import math
import typing
from flask_babel import gettext
from airq.lib.choices import IntChoicesEnum
from airq.lib.choices import StrChoicesEnum
@enum.unique
class ConversionFactor(StrChoicesEnum):
"""Determines how we will adjust the determine pm25."""
NONE = "None"
US_... | [
"flask_babel.gettext",
"math.ceil"
] | [((5156, 5255), 'math.ceil', 'math.ceil', (['((concentration - conc_low) / (conc_high - conc_low) * (aqi_high - aqi_low) +\n aqi_low)'], {}), '((concentration - conc_low) / (conc_high - conc_low) * (aqi_high -\n aqi_low) + aqi_low)\n', (5165, 5255), False, 'import math\n'), ((431, 448), 'flask_babel.gettext', 'ge... |
import sys
import numpy as np
if "../" not in sys.path:
sys.path.append('../')
np.random.seed(10)
from env.gridWorld import gridWorld
from dp_policy_evaluation import policy_evaluation
def policy_iteration(env, policy_eval_fn=policy_evaluation, discount_factor=1.0):
"""
Policy Improvement Algorithm. Iter... | [
"sys.path.append",
"env.gridWorld.gridWorld",
"numpy.random.seed",
"numpy.argmax",
"numpy.zeros",
"numpy.ones",
"numpy.eye"
] | [((84, 102), 'numpy.random.seed', 'np.random.seed', (['(10)'], {}), '(10)\n', (98, 102), True, 'import numpy as np\n'), ((61, 83), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (76, 83), False, 'import sys\n'), ((1992, 2003), 'env.gridWorld.gridWorld', 'gridWorld', ([], {}), '()\n', (2001, 200... |
import logging
import re
from swa.spotifyoauthredis import *
from swa.utils import *
from swa.session import *
from swa.spotify_weekly import *
@bottle.get('/')
@bottle.jinja2_view('index.html.j2')
def index():
return {}
@bottle.get('/login')
@bottle.jinja2_view('login.html.j2')
def login():
session_data =... | [
"logging.debug",
"re.compile"
] | [((875, 902), 'logging.debug', 'logging.debug', (['session_data'], {}), '(session_data)\n', (888, 902), False, 'import logging\n'), ((4099, 4163), 're.compile', 're.compile', (['"""^https?://open\\\\.spotify\\\\.com/playlist/(\\\\w+)\\\\??"""'], {}), "('^https?://open\\\\.spotify\\\\.com/playlist/(\\\\w+)\\\\??')\n", (... |
"""Module for handling problem feedback."""
from datetime import datetime
from voluptuous import Length, Required, Schema
import api
from api import check, log_action, PicoException, validate
feedback_schema = Schema({
Required("liked"):
check(("liked must be a boolean", [lambda x: type(x) == bool])),
"... | [
"api.user.get_team",
"api.problem.get_solved_pids",
"api.PicoException",
"voluptuous.Length",
"voluptuous.Required",
"api.db.get_conn",
"api.check",
"datetime.datetime.utcnow",
"api.user.get_user",
"api.validate",
"api.problem.get_problem"
] | [((897, 914), 'api.db.get_conn', 'api.db.get_conn', ([], {}), '()\n', (912, 914), False, 'import api\n'), ((1442, 1459), 'api.db.get_conn', 'api.db.get_conn', ([], {}), '()\n', (1457, 1459), False, 'import api\n'), ((1651, 1677), 'api.user.get_team', 'api.user.get_team', ([], {'uid': 'uid'}), '(uid=uid)\n', (1668, 1677... |
import logging
from spacel.provision.app.alarm.trigger.base import BaseTriggerFactory
from spacel.provision.app.alarm.trigger.metrics import MetricDefinitions
logger = logging.getLogger('spacel.provision.app.alarm.trigger.factory')
class TriggerFactory(BaseTriggerFactory):
def __init__(self):
self._metr... | [
"spacel.provision.app.alarm.trigger.metrics.MetricDefinitions",
"logging.getLogger"
] | [((170, 233), 'logging.getLogger', 'logging.getLogger', (['"""spacel.provision.app.alarm.trigger.factory"""'], {}), "('spacel.provision.app.alarm.trigger.factory')\n", (187, 233), False, 'import logging\n'), ((326, 345), 'spacel.provision.app.alarm.trigger.metrics.MetricDefinitions', 'MetricDefinitions', ([], {}), '()\... |
import hashlib
import pickle
from pandas import DataFrame
from src.cache.models import LabelledLog, LoadedLog
from src.jobs.models import Job
from src.split.models import Split
def get_digested(candidate_path: str) -> str:
return hashlib.sha256(candidate_path.encode('utf-8')).hexdigest()
def load_from_cache(p... | [
"src.cache.models.LabelledLog.objects.create",
"src.cache.models.LabelledLog.objects.filter",
"pickle.dump",
"src.cache.models.LoadedLog.objects.filter",
"pickle.load",
"src.cache.models.LoadedLog.objects.create"
] | [((1058, 1255), 'src.cache.models.LoadedLog.objects.create', 'LoadedLog.objects.create', ([], {'train_log': "('cache/loaded_log_cache/' + split.train_log.name)", 'test_log': "('cache/loaded_log_cache/' + split.test_log.name)", 'additional_columns': 'split.additional_columns'}), "(train_log='cache/loaded_log_cache/' + s... |
import unittest
from os import EX_OSERR, EX_OK
from unittest.mock import patch
from buoy.client.internet_connection import IsInternetConectionDaemon
class IsInternetConectionDaemonTest(unittest.TestCase):
def setUp(self):
config = {
'service': {
'path_pidfile': './test/logs/',... | [
"unittest.mock.patch",
"unittest.mock.patch.object",
"unittest.main",
"buoy.client.internet_connection.IsInternetConectionDaemon"
] | [((774, 864), 'unittest.mock.patch', 'patch', (['"""buoy.client.internet_connection.is_connected_to_internet"""'], {'side_effect': '[False]'}), "('buoy.client.internet_connection.is_connected_to_internet',\n side_effect=[False])\n", (779, 864), False, 'from unittest.mock import patch\n'), ((1091, 1186), 'unittest.mo... |
# coding=utf-8
import requests
from ._base_recorder import BaseRecorder
class KuaishouRecorder(BaseRecorder):
def __init__(self, short_id, **args):
BaseRecorder.__init__(self, short_id, **args)
self.liver = 'kuaishou'
def getRoomInfo(self):
roomInfo = {}
roomIn... | [
"requests.post"
] | [((2181, 2240), 'requests.post', 'requests.post', (['url'], {'timeout': '(10)', 'headers': 'headers', 'data': 'param'}), '(url, timeout=10, headers=headers, data=param)\n', (2194, 2240), False, 'import requests\n'), ((3473, 3537), 'requests.post', 'requests.post', (['url'], {'timeout': '(10)', 'headers': 'headers', 'da... |
import gym
import torch
from ray import tune
from ray.tune.schedulers import ASHAScheduler
from ray.tune.suggest.bayesopt import BayesOptSearch
from pysnn.network import SNNNetwork
from pysnn.neuron import AdaptiveLIFNeuron, LIFNeuron
from pysnn.connection import Linear
from pysnn.learning import MSTDPET
###########... | [
"ray.tune.suggest.bayesopt.BayesOptSearch",
"gym.make",
"pysnn.neuron.AdaptiveLIFNeuron",
"ray.tune.track.log",
"ray.tune.run",
"ray.tune.schedulers.ASHAScheduler",
"pysnn.connection.Linear",
"pysnn.neuron.LIFNeuron",
"torch.from_numpy"
] | [((4406, 4429), 'gym.make', 'gym.make', (['"""CartPole-v1"""'], {}), "('CartPole-v1')\n", (4414, 4429), False, 'import gym\n'), ((5956, 6085), 'ray.tune.suggest.bayesopt.BayesOptSearch', 'BayesOptSearch', (['space'], {'max_concurrent': '(6)', 'metric': '"""reward"""', 'mode': '"""max"""', 'utility_kwargs': "{'kind': 'u... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This Python script formats nginx configuration files in consistent way.
Originally published under https://github.com/1connect/nginx-config-formatter
"""
import argparse
import codecs
import re
__author__ = "<NAME>"
__license__ = "Apache 2.0"
__version__ = "1.0.2"
... | [
"codecs.open",
"re.split",
"argparse.ArgumentParser",
"re.sub"
] | [((794, 820), 're.split', 're.split', (['"""\\""""', 'single_line'], {}), '(\'"\', single_line)\n', (802, 820), False, 'import re\n'), ((1176, 1304), 're.sub', 're.sub', (['"""\\\\${\\\\s*(\\\\w+)\\\\s*}"""', "(TEMPLATE_VARIABLE_OPENING_TAG + '\\\\1' + TEMPLATE_VARIABLE_CLOSING_TAG)", 'line'], {'flags': 're.UNICODE'}),... |
r"""
Optimization of molecular geometries
====================================
.. meta::
:property="og:description": Find the equilibrium geometry of a molecule
:property="og:image": https://pennylane.ai/qml/_images/fig_pes.png
.. related::
tutorial_quantum_chemistry Quantum Chemistry with PennyLane
tut... | [
"matplotlib.pyplot.yscale",
"pennylane.numpy.zeros_like",
"matplotlib.pyplot.show",
"pennylane.numpy.linalg.norm",
"pennylane.qchem.hf_state",
"pennylane.BasisState",
"matplotlib.pyplot.yticks",
"pennylane.DoubleExcitation",
"pennylane.expval",
"pennylane.GradientDescentOptimizer",
"matplotlib.p... | [((5350, 5440), 'pennylane.numpy.array', 'np.array', (['[0.028, 0.054, 0.0, 0.986, 1.61, 0.0, 1.855, 0.002, 0.0]'], {'requires_grad': '(True)'}), '([0.028, 0.054, 0.0, 0.986, 1.61, 0.0, 1.855, 0.002, 0.0],\n requires_grad=True)\n', (5358, 5440), True, 'from pennylane import numpy as np\n'), ((9128, 9171), 'pennylane... |
from tasks.cephfs.cephfs_test_case import CephFSTestCase
from teuthology.orchestra import run
import logging
log = logging.getLogger(__name__)
class TestFragmentation(CephFSTestCase):
CLIENTS_REQUIRED = 1
MDSS_REQUIRED = 1
def get_splits(self):
return self.fs.mds_asok(['perf', 'dump', 'mds'])[... | [
"teuthology.orchestra.run.Raw",
"logging.getLogger"
] | [((118, 145), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (135, 145), False, 'import logging\n'), ((2122, 2147), 'teuthology.orchestra.run.Raw', 'run.Raw', (['"""splitdir/file*"""'], {}), "('splitdir/file*')\n", (2129, 2147), False, 'from teuthology.orchestra import run\n')] |
from est8.backend.player import Player
from est8.backend.definitions import GameDefinition
from est8.backend.neighbourhood import Neighbourhood
from est8.frontend.input_handler import InputHandler
from est8.frontend.neighbourhood import NeighbourhoodDisplay
from est8.frontend.deck import FreeChoiceDeckDisplay, RandomDe... | [
"est8.frontend.neighbourhood.NeighbourhoodDisplay",
"est8.frontend.input_handler.InputHandler",
"est8.frontend.deck.RandomDeckDisplay",
"est8.backend.player.Player.new",
"est8.frontend.deck.FreeChoiceDeckDisplay"
] | [((601, 628), 'est8.backend.player.Player.new', 'Player.new', (['game_definition'], {}), '(game_definition)\n', (611, 628), False, 'from est8.backend.player import Player\n'), ((653, 682), 'est8.frontend.input_handler.InputHandler', 'InputHandler', (['game_definition'], {}), '(game_definition)\n', (665, 682), False, 'f... |
from ipaddress import IPv4Address, IPv6Address
import pytest
from iperon import contrib
@pytest.mark.asyncio
async def test_ipv4(client):
request = client.build_request(method='GET', url='/', headers={'X-Real-IP': '8.8.8.8'})
ipaddr = await contrib.ip.get(reqeust=request)
assert ipaddr.ip == IPv4Address... | [
"ipaddress.IPv6Address",
"ipaddress.IPv4Address",
"iperon.contrib.ip.get"
] | [((253, 284), 'iperon.contrib.ip.get', 'contrib.ip.get', ([], {'reqeust': 'request'}), '(reqeust=request)\n', (267, 284), False, 'from iperon import contrib\n'), ((309, 331), 'ipaddress.IPv4Address', 'IPv4Address', (['"""8.8.8.8"""'], {}), "('8.8.8.8')\n", (320, 331), False, 'from ipaddress import IPv4Address, IPv6Addr... |
import datetime
from imap_tools import EmailAddress
DATA = dict(
subject='Saying Hello',
from_='<EMAIL>',
to=('<EMAIL>',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(1997, 11, 21, 9, 55, 6, tzinfo=datetime.timezone(datetime.timedelta(-1, 64800))),
date_str='Fri, 21 Nov 1997 09:5... | [
"datetime.timedelta",
"imap_tools.EmailAddress"
] | [((664, 717), 'imap_tools.EmailAddress', 'EmailAddress', (['"""<NAME>"""', '"""<EMAIL>"""', '"""<NAME> <<EMAIL>>"""'], {}), "('<NAME>', '<EMAIL>', '<NAME> <<EMAIL>>')\n", (676, 717), False, 'from imap_tools import EmailAddress\n'), ((734, 787), 'imap_tools.EmailAddress', 'EmailAddress', (['"""<NAME>"""', '"""<EMAIL>"""... |
# Copyright 2018 Google LLC
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
import json
import paths
def test_vectors(ch):
with (paths.top / "test_vectors" / "other" / "poly1305.json").open() as f:
for t i... | [
"json.load"
] | [((322, 334), 'json.load', 'json.load', (['f'], {}), '(f)\n', (331, 334), False, 'import json\n')] |
from django.core.management.base import BaseCommand
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from allauth.account.models import EmailAddress
class Command(BaseCommand):
help = 'Setup Site'
def add_arguments(self, parser):
parser.add_argument('domain')
... | [
"django.contrib.sites.models.Site.objects.first",
"allauth.account.models.EmailAddress.objects.all",
"django.contrib.auth.models.User.objects.all"
] | [((409, 429), 'django.contrib.sites.models.Site.objects.first', 'Site.objects.first', ([], {}), '()\n', (427, 429), False, 'from django.contrib.sites.models import Site\n'), ((543, 561), 'django.contrib.auth.models.User.objects.all', 'User.objects.all', ([], {}), '()\n', (559, 561), False, 'from django.contrib.auth.mod... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
import json
from flexget import plugin
from flexget.event import event
from flexget.utils.requests import RequestException
log = logging.getLogger('kodi_li... | [
"flexget.plugin.PluginError",
"flexget.plugin.priority",
"flexget.event.event",
"json.dumps",
"flexget.plugin.register",
"logging.getLogger"
] | [((294, 327), 'logging.getLogger', 'logging.getLogger', (['"""kodi_library"""'], {}), "('kodi_library')\n", (311, 327), False, 'import logging\n'), ((2781, 2805), 'flexget.event.event', 'event', (['"""plugin.register"""'], {}), "('plugin.register')\n", (2786, 2805), False, 'from flexget.event import event\n'), ((963, 9... |
import sys
import os.path
import logging
import warnings
from . import PACKAGEDIR
from contextlib import contextmanager
from matplotlib.backends.backend_pdf import PdfPages
import copy
import numpy as np
import pandas as pd
import lightkurve as lk
import matplotlib.pyplot as plt
from lightkurve import MPLSTYLE
from as... | [
"pandas.DataFrame",
"numpy.zeros_like",
"numpy.array"
] | [((2272, 2323), 'numpy.array', 'np.array', (['[p.pl_orbper.value for p in self.planets]'], {}), '([p.pl_orbper.value for p in self.planets])\n', (2280, 2323), True, 'import numpy as np\n'), ((2353, 2408), 'numpy.array', 'np.array', (['[p.pl_orbpererr1.value for p in self.planets]'], {}), '([p.pl_orbpererr1.value for p ... |
"""Configuration management."""
import configparser
import logging
import os
import shutil
from boto3facade import __dir__
from .exceptions import InvalidConfiguration
AWS_CONFIG_DIR = os.path.expanduser('~/.aws')
AWS_CONFIG_FILE = os.path.join(AWS_CONFIG_DIR, 'config')
# Defaults for the Config constructor
DEFAUL... | [
"os.path.join",
"os.makedirs",
"os.path.basename",
"os.path.isdir",
"os.path.isfile",
"shutil.copyfile",
"configparser.ConfigParser",
"os.path.expanduser",
"logging.getLogger"
] | [((189, 217), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.aws"""'], {}), "('~/.aws')\n", (207, 217), False, 'import os\n'), ((236, 274), 'os.path.join', 'os.path.join', (['AWS_CONFIG_DIR', '"""config"""'], {}), "(AWS_CONFIG_DIR, 'config')\n", (248, 274), False, 'import os\n'), ((476, 503), 'logging.getLogger',... |
import pandas as pd
import time
from collections import (
deque,
OrderedDict
)
import inspect
from typing import List, Dict
from hummingbot import check_dev_mode
from hummingbot.logger.application_warning import ApplicationWarning
from hummingbot.connector.connector_base import ConnectorBase
from hummingbot.cor... | [
"inspect.iscoroutinefunction",
"hummingbot.user.user_balances.UserBalances.validate_ethereum_wallet",
"pandas.Timestamp",
"hummingbot.client.config.security.Security.is_decryption_done",
"hummingbot.check_dev_mode",
"collections.deque",
"time.time",
"hummingbot.client.config.global_config_map.global_c... | [((1188, 1199), 'time.time', 'time.time', ([], {}), '()\n', (1197, 1199), False, 'import time\n'), ((3473, 3529), 'inspect.iscoroutinefunction', 'inspect.iscoroutinefunction', (['self.strategy.format_status'], {}), '(self.strategy.format_status)\n', (3500, 3529), False, 'import inspect\n'), ((5247, 5290), 'hummingbot.c... |
"""Constants.
Constants are kept here for easy modifications whenever needed.
"""
import torch
from PIL import ImageDraw
from os import path, pardir
NUM_CLASSES = 80
IMAGE_SIZE = (640, 800)
#
# if torch.cuda.is_available():
# DEVICE = torch.device("cuda")
# CUDA_COUNT = torch.cuda.device_count()
# else:
# ... | [
"torch.ones",
"torch.cat",
"torch.arange",
"torch.device"
] | [((382, 401), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (394, 401), False, 'import torch\n'), ((899, 944), 'torch.ones', 'torch.ones', (['[1, IMAGE_SIZE[0], IMAGE_SIZE[1]]'], {}), '([1, IMAGE_SIZE[0], IMAGE_SIZE[1]])\n', (909, 944), False, 'import torch\n'), ((952, 997), 'torch.cat', 'torch.cat'... |
# This file is part of Hypothesis, which may be found at
# https://github.com/HypothesisWorks/hypothesis/
#
# Most of this work is copyright (C) 2013-2021 <NAME>
# (<EMAIL>), but it contains contributions by others. See
# CONTRIBUTING.rst for a full list of people who may hold copyright, and
# consult the git log if yo... | [
"math.ceil",
"math.floor",
"statistics.mean",
"collections.Counter",
"hypothesis.utils.dynamicvariables.DynamicVariable"
] | [((735, 756), 'hypothesis.utils.dynamicvariables.DynamicVariable', 'DynamicVariable', (['None'], {}), '(None)\n', (750, 756), False, 'from hypothesis.utils.dynamicvariables import DynamicVariable\n'), ((2679, 2714), 'collections.Counter', 'Counter', (["(t['status'] for t in cases)"], {}), "(t['status'] for t in cases)\... |
import torch
import time
import arcsim
class CollisionFunc(torch.autograd.Function):
@staticmethod
def forward(ctx, inp_xold, inp_w, inp_n, zone):
ans = arcsim.apply_inelastic_projection_forward(inp_xold, inp_w, inp_n, zone)
ctx.intermediate = zone
ctx.save_for_backward(*ans)
return ans[0]
@staticmet... | [
"arcsim.apply_inelastic_projection_backward",
"arcsim.apply_inelastic_projection_forward",
"time.time"
] | [((159, 230), 'arcsim.apply_inelastic_projection_forward', 'arcsim.apply_inelastic_projection_forward', (['inp_xold', 'inp_w', 'inp_n', 'zone'], {}), '(inp_xold, inp_w, inp_n, zone)\n', (200, 230), False, 'import arcsim\n'), ((357, 368), 'time.time', 'time.time', ([], {}), '()\n', (366, 368), False, 'import time\n'), (... |
import argparse
import json
import logging
import os
import sys
import numpy as np
import pandas as pd
import torch
import torch.distributed as dist
import torch.utils.data
import torch.utils.data.distributed
from torch.utils.data import DataLoader, RandomSampler, TensorDataset
from transformers import AdamW, BertForS... | [
"numpy.sum",
"argparse.ArgumentParser",
"torch.utils.data.RandomSampler",
"numpy.argmax",
"torch.utils.data.TensorDataset",
"torch.distributed.get_world_size",
"torch.device",
"torch.no_grad",
"os.path.join",
"transformers.BertForSequenceClassification.from_pretrained",
"json.loads",
"torch.ut... | [((367, 394), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (384, 394), False, 'import logging\n'), ((583, 653), 'transformers.BertTokenizer.from_pretrained', 'BertTokenizer.from_pretrained', (['"""bert-base-uncased"""'], {'do_lower_case': '(True)'}), "('bert-base-uncased', do_lower_case... |
"""Defines common spec input and output classes."""
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | [
"typing.NewType",
"dataclasses.dataclass"
] | [((765, 787), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (774, 787), False, 'from dataclasses import dataclass\n'), ((1462, 1484), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (1471, 1484), False, 'from dataclasses import dataclass\n'), (... |
import tensorflow as tf
_FLOATX = tf.float32
def get_weight_variable(name, shape=None, initial_value=None):
if shape is None:
return tf.get_variable(name)
if initial_value is None:
initializer = tf.contrib.layers.xavier_initializer_conv2d()
W = tf.get_variable(name, shape=shape, dtype... | [
"tensorflow.contrib.layers.xavier_initializer_conv2d",
"tensorflow.constant_initializer",
"tensorflow.get_collection",
"tensorflow.variable_scope",
"tensorflow.shape",
"tensorflow.Variable",
"tensorflow.nn.convolution",
"tensorflow.squeeze",
"tensorflow.tanh",
"tensorflow.image.resize",
"tensorf... | [((471, 520), 'tensorflow.constant_initializer', 'tf.constant_initializer', ([], {'value': '(0.0)', 'dtype': '_FLOATX'}), '(value=0.0, dtype=_FLOATX)\n', (494, 520), True, 'import tensorflow as tf\n'), ((534, 608), 'tensorflow.get_variable', 'tf.get_variable', (['name'], {'shape': 'shape', 'dtype': '_FLOATX', 'initiali... |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from indico.modules.attachments.api.util import build_folders_api... | [
"indico.modules.events.sessions.Session.query.with_parent",
"indico.modules.events.contributions.models.contributions.Contribution.query.with_parent",
"indico.modules.events.contributions.models.subcontributions.SubContribution.query.with_parent",
"indico.modules.attachments.api.util.build_folders_api_data",
... | [((1135, 1192), 'indico.modules.events.Event.get', 'Event.get', (["self._pathParams['event_id']"], {'is_deleted': '(False)'}), "(self._pathParams['event_id'], is_deleted=False)\n", (1144, 1192), False, 'from indico.modules.events import Event\n'), ((1237, 1271), 'indico.web.http_api.responses.HTTPAPIError', 'HTTPAPIErr... |
# -*- coding: utf-8 -*-
"""typeidea URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.ho... | [
"config.views.LinkListView.as_view",
"blog.views.PostDetailView.as_view",
"blog.views.AuthorView.as_view",
"comment.views.CommentView.as_view",
"django.conf.urls.include",
"blog.views.SearchView.as_view",
"blog.rss.LatestPostFeed",
"blog.views.IndexView.as_view",
"blog.views.CategoryView.as_view",
... | [((1614, 1629), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (1627, 1629), False, 'from rest_framework.routers import DefaultRouter\n'), ((3239, 3300), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, docu... |
import asyncio
from typing import (
Any,
Awaitable,
Callable,
Dict,
Hashable,
List,
Optional,
Set,
Type,
Union,
cast,
)
from loguru import logger
from pydantic import BaseModel
from rich.console import Console
from rich.logging import RichHandler
from rich.status import Stat... | [
"rich.status.Status",
"asyncio.gather",
"asyncio.sleep",
"asyncio.Event",
"loguru.logger.warning",
"avilla.core.config.AvillaConfig",
"asyncio.get_running_loop",
"loguru.logger.info",
"avilla.core.config.direct",
"asyncio.wait",
"rich.console.Console",
"rich.logging.RichHandler",
"asyncio.ne... | [((1085, 1094), 'rich.console.Console', 'Console', ([], {}), '()\n', (1092, 1094), False, 'from rich.console import Console\n'), ((4025, 4125), 'loguru.logger.info', 'logger.info', (['"""[green bold]components prepared, switch to mainlines and block main thread."""'], {}), "(\n '[green bold]components prepared, swit... |
import PySAM.BatteryStateful as bt
def test_stateful():
b = bt.new()
params = {"control_mode": 0, "input_current": 1, "chem": 1, "nominal_energy": 10, "nominal_voltage": 500,
"initial_SOC": 50.000, "maximum_SOC": 95.000, "minimum_SOC": 5.000, "dt_hr": 1.000, "leadacid_tn": 0.000,
"... | [
"PySAM.BatteryStateful.new"
] | [((65, 73), 'PySAM.BatteryStateful.new', 'bt.new', ([], {}), '()\n', (71, 73), True, 'import PySAM.BatteryStateful as bt\n')] |
from docx import Document # package name: python-docx
from docx.enum.style import WD_STYLE_TYPE
from docx.shared import RGBColor
from docx.shared import Pt, Cm
from docx.enum.text import WD_LINE_SPACING, WD_PARAGRAPH_ALIGNMENT
import re
def create_total_docx(chunks, path):
# CONFIG
indentation = 0.5
tibe... | [
"docx.shared.Cm",
"re.split",
"docx.Document",
"docx.shared.Pt",
"docx.shared.RGBColor"
] | [((682, 692), 'docx.Document', 'Document', ([], {}), '()\n', (690, 692), False, 'from docx import Document\n'), ((893, 918), 'docx.shared.Pt', 'Pt', (["tibetan_style['size']"], {}), "(tibetan_style['size'])\n", (895, 918), False, 'from docx.shared import Pt, Cm\n'), ((1229, 1255), 'docx.shared.RGBColor', 'RGBColor', ([... |
# Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"cirq.study.ParamResolver",
"sympy.Symbol"
] | [((5308, 5343), 'cirq.study.ParamResolver', 'study.ParamResolver', (['param_resolver'], {}), '(param_resolver)\n', (5327, 5343), False, 'from cirq import study\n'), ((4104, 4122), 'sympy.Symbol', 'sympy.Symbol', (['name'], {}), '(name)\n', (4116, 4122), False, 'import sympy\n')] |
import unittest
from eventreminder.crontime import CronTime
class MyTestCase(unittest.TestCase):
def test_eq_simple(self):
c1 = CronTime('*', '*', '*')
c2 = CronTime('*', '*', '*')
c3 = CronTime('1', '*', '*')
self.assertNotEqual(c1, 'Hello world')
self.assertEqual(c1, c2... | [
"unittest.main",
"eventreminder.crontime.CronTime",
"eventreminder.crontime.CronTime.from_string"
] | [((3670, 3685), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3683, 3685), False, 'import unittest\n'), ((144, 167), 'eventreminder.crontime.CronTime', 'CronTime', (['"""*"""', '"""*"""', '"""*"""'], {}), "('*', '*', '*')\n", (152, 167), False, 'from eventreminder.crontime import CronTime\n'), ((181, 204), 'even... |
# Copyright 2019 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.keras.backend.get_graph",
"tensorflow.python.keras.backend.symbolic_learning_phase",
"tensorflow.python.keras.optimizers.get",
"tensorflow.python.keras.backend.function",
"tensorflow.python.keras.backend.name_scope"
] | [((7082, 7110), 'tensorflow.python.keras.optimizers.get', 'optimizers.get', (['optimizer[0]'], {}), '(optimizer[0])\n', (7096, 7110), False, 'from tensorflow.python.keras import optimizers\n'), ((7138, 7166), 'tensorflow.python.keras.optimizers.get', 'optimizers.get', (['optimizer[1]'], {}), '(optimizer[1])\n', (7152, ... |
from fmpy import simulate_fmu
import unittest
from fmpy.util import download_file
import os
from fmpy.util import compile_platform_binary, create_cmake_project
class CCodeTest(unittest.TestCase):
""" Test compilation of source code FMUs from various vendors """
url = 'https://github.com/modelica/... | [
"unittest.main",
"os.makedirs",
"os.path.basename",
"os.path.isdir",
"fmpy.util.download_file",
"fmpy.util.compile_platform_binary",
"subprocess.list2cmdline",
"fmpy.util.create_cmake_project",
"subprocess.call",
"os.path.splitext",
"shutil.rmtree",
"os.path.join",
"fmpy.simulate_fmu"
] | [((2687, 2702), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2700, 2702), False, 'import unittest\n'), ((614, 643), 'fmpy.util.download_file', 'download_file', (['(self.url + fmu)'], {}), '(self.url + fmu)\n', (627, 643), False, 'from fmpy.util import download_file\n'), ((670, 691), 'os.path.basename', 'os.path... |
from yawinpty import Pty, SpawnConfig
from prompt_toolkit.eventloop.future import Future
from .base import Backend
from .win32_pipes import PipeReader, PipeWriter
__all__ = [
"Win32Backend",
]
class Win32Backend(Backend):
"""
Terminal backend for Windows, on top of winpty.
"""
def __init__(sel... | [
"yawinpty.SpawnConfig",
"yawinpty.Pty",
"prompt_toolkit.eventloop.future.Future"
] | [((343, 348), 'yawinpty.Pty', 'Pty', ([], {}), '()\n', (346, 348), False, 'from yawinpty import Pty, SpawnConfig\n'), ((372, 380), 'prompt_toolkit.eventloop.future.Future', 'Future', ([], {}), '()\n', (378, 380), False, 'from prompt_toolkit.eventloop.future import Future\n'), ((2098, 2188), 'yawinpty.SpawnConfig', 'Spa... |
"""
Railroad model.
"""
import numpy as np
from pydantic.dataclasses import dataclass
from api.models.train_model import TrainModel
from api.models.wagons import WagonsByFleet
from api.models.locomotives import LocomotivesBySeries
@dataclass
class Railroad:
train_models: list[TrainModel]
wagons: list[WagonsB... | [
"numpy.array"
] | [((424, 491), 'numpy.array', 'np.array', (['[train_model.wagons for train_model in self.train_models]'], {}), '([train_model.wagons for train_model in self.train_models])\n', (432, 491), True, 'import numpy as np\n'), ((646, 718), 'numpy.array', 'np.array', (['[train_model.locomotives for train_model in self.train_mode... |
from dexy.commands.utils import default_config
from dexy.utils import defaults
from dexy.utils import file_exists
import dexy.exceptions
import inspect
import json
import os
import yaml
def conf_command(
conf=defaults['config_file'], # name of config file to write to
p=False # whether to print to stdou... | [
"json.dump",
"yaml.dump",
"dexy.commands.utils.default_config",
"dexy.utils.file_exists",
"inspect.cleandoc"
] | [((616, 632), 'dexy.commands.utils.default_config', 'default_config', ([], {}), '()\n', (630, 632), False, 'from dexy.commands.utils import default_config\n'), ((727, 964), 'inspect.cleandoc', 'inspect.cleandoc', (['"""# YAML config file for dexy.\n # You can delete any lines you don\'t wish to customize.\n ... |
# -*- coding: utf-8 -*-
"""Copy of Copy of paulo_svm_ex1_adaptado_para_base_Churn_Modelling.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1SOayCr0K6MghlFMqjZMXA4JbM9XFtOxq
"""
# Support Vector Machine (SVM)
# from https://www.superdatascience.c... | [
"sklearn.preprocessing.StandardScaler",
"os.makedirs",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"os.path.isdir",
"six.moves.urllib.request.urlretrieve",
"sklearn.svm.SVC",
"sklearn.metrics.confusion_matrix"
] | [((1057, 1098), 'pandas.read_csv', 'pd.read_csv', (['(DATA_PATH + FILE_TO_DOWNLOAD)'], {}), '(DATA_PATH + FILE_TO_DOWNLOAD)\n', (1068, 1098), True, 'import pandas as pd\n'), ((1360, 1414), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.25)', 'random_state': '(0)'}), '(X, ... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import hydra
from hydra.utils import instantiate
import logging
from overlap.train_net import train_net
from overlap.test_net import test_net
... | [
"numpy.load",
"numpy.random.seed",
"hydra.utils.instantiate",
"torch.manual_seed",
"os.path.exists",
"overlap.train_net.train_net",
"overlap.test_corrupt_net.test_corrupt_net",
"overlap.utils.logging.log_json_stats",
"omegaconf.open_dict",
"numpy.linalg.norm",
"hydra.main",
"overlap.test_net.t... | [((548, 575), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (565, 575), False, 'import logging\n'), ((578, 635), 'hydra.main', 'hydra.main', ([], {'config_path': '"""conf/feature_corrupt_error.yaml"""'}), "(config_path='conf/feature_corrupt_error.yaml')\n", (588, 635), False, 'import hyd... |
# -*- coding: utf-8 -*-
from model.group import Group
from model.contact import Contact
from fixture.orm import ORMFixture
import random
orm = ORMFixture(host="127.0.0.1", name="addressbook", user="root", password="")
def test_del_contact_in_group(app, db):
if len(db.get_groups_with_contacts()) == 0:
if... | [
"model.contact.Contact",
"random.choice",
"fixture.orm.ORMFixture",
"model.group.Group"
] | [((145, 219), 'fixture.orm.ORMFixture', 'ORMFixture', ([], {'host': '"""127.0.0.1"""', 'name': '"""addressbook"""', 'user': '"""root"""', 'password': '""""""'}), "(host='127.0.0.1', name='addressbook', user='root', password='')\n", (155, 219), False, 'from fixture.orm import ORMFixture\n'), ((964, 999), 'random.choice'... |
from rest_framework import serializers
from goods.models import Goods, Order, MyCollection
from myuser.serializers import MyUserSerializer
class GoodsSerializer(serializers.ModelSerializer):
picture = serializers.SerializerMethodField(read_only=True)
type = serializers.SerializerMethodField(read_only=True)
... | [
"myuser.serializers.MyUserSerializer",
"rest_framework.serializers.SerializerMethodField"
] | [((208, 257), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {'read_only': '(True)'}), '(read_only=True)\n', (241, 257), False, 'from rest_framework import serializers\n'), ((269, 318), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField'... |
"""
This module includes different energy functions.
"""
import ase
import ase.calculators.dftb as adftb
import scipy as sp
import scipy.spatial
import numpy as np
class Energy_function:
"""Template for energy_functions to be used within this module"""
def __init__(self, arg):
self.arg = arg
... | [
"ase.calculators.dftb.Dftb",
"numpy.sum",
"scipy.spatial.distance_matrix",
"numpy.triu_indices_from",
"ase.Atoms"
] | [((651, 711), 'scipy.spatial.distance_matrix', 'sp.spatial.distance_matrix', (['state.positions', 'state.positions'], {}), '(state.positions, state.positions)\n', (677, 711), True, 'import scipy as sp\n'), ((967, 997), 'numpy.sum', 'np.sum', (['(repulsive + attractive)'], {}), '(repulsive + attractive)\n', (973, 997), ... |
#!/usr/bin/env python3
import base64
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
def encrypt(data: str, passphrase: str) -> bytes:
"""
Encrypt ... | [
"cryptography.hazmat.backends.default_backend",
"cryptography.fernet.Fernet",
"cryptography.hazmat.primitives.hashes.SHA256"
] | [((1056, 1067), 'cryptography.fernet.Fernet', 'Fernet', (['key'], {}), '(key)\n', (1062, 1067), False, 'from cryptography.fernet import Fernet\n'), ((865, 880), 'cryptography.hazmat.primitives.hashes.SHA256', 'hashes.SHA256', ([], {}), '()\n', (878, 880), False, 'from cryptography.hazmat.primitives import hashes\n'), (... |
import argparse
from ast import parse
from ...pipeline import SmartTagger
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="SmartTagging of free text.")
parser.add_argument("text", nargs="?", default="We studied mice with genetic ablation of the ERK1 gene in brain and muscle.", help="The... | [
"argparse.ArgumentParser"
] | [((115, 180), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""SmartTagging of free text."""'}), "(description='SmartTagging of free text.')\n", (138, 180), False, 'import argparse\n')] |
from revscoring.datasources.meta import vectorizers, mappers
from revscoring.features import wikitext
from revscoring.features.meta import aggregators
ukwiki_kvs = vectorizers.word2vec.load_gensim_kv(
filename="ukwiki-20201201-learned_vectors.50_cell.10k.kv", mmap='r')
def vectorize_words(words):
... | [
"revscoring.datasources.meta.mappers.lower_case",
"revscoring.features.meta.aggregators.mean",
"revscoring.datasources.meta.vectorizers.word2vec.vectorize_words",
"revscoring.datasources.meta.vectorizers.word2vec.load_gensim_kv"
] | [((171, 280), 'revscoring.datasources.meta.vectorizers.word2vec.load_gensim_kv', 'vectorizers.word2vec.load_gensim_kv', ([], {'filename': '"""ukwiki-20201201-learned_vectors.50_cell.10k.kv"""', 'mmap': '"""r"""'}), "(filename=\n 'ukwiki-20201201-learned_vectors.50_cell.10k.kv', mmap='r')\n", (206, 280), False, 'from... |
from os.path import exists
from threading import RLock
from cachetools import LFUCache, cached
class _FilePointerCache(LFUCache):
"""
A least-frequently-used file pointer cache class with an eviction method
that closes open files.
"""
def popitem(self):
"""
Evict a cache item.
... | [
"threading.RLock",
"os.path.exists",
"cachetools.cached"
] | [((1527, 1534), 'threading.RLock', 'RLock', ([], {}), '()\n', (1532, 1534), False, 'from threading import RLock\n'), ((1545, 1592), 'cachetools.cached', 'cached', (['self._filePointerCache'], {'lock': 'self._lock'}), '(self._filePointerCache, lock=self._lock)\n', (1551, 1592), False, 'from cachetools import LFUCache, c... |
# This file has been modified from the original
import os
from setuptools import setup
setup(name='Bikesurvey',
version='1.0.0',
author='<NAME>',
author_email='<EMAIL>',
description='Records biker info for the University of Maryland, ' +
'College Park, bike survey',
in... | [
"setuptools.setup"
] | [((90, 317), 'setuptools.setup', 'setup', ([], {'name': '"""Bikesurvey"""', 'version': '"""1.0.0"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': "('Records biker info for the University of Maryland, ' +\n 'College Park, bike survey')", 'install_requires': "['Django==1.7']"}), "(name='B... |
from quant_mo_memory_profiler import *
import numpy as np
def reshapeSave(file_s):
tempArr = np.array([], dtype=int)
if diff:
# This will need to be modified in the future
assert len(file_s) >= 2
[a_date, a_arr] = np.load(files[0])
[b_date, b_arr] = np.load(files[1])
u_a... | [
"numpy.load",
"numpy.average",
"numpy.array",
"numpy.concatenate"
] | [((98, 121), 'numpy.array', 'np.array', (['[]'], {'dtype': 'int'}), '([], dtype=int)\n', (106, 121), True, 'import numpy as np\n'), ((247, 264), 'numpy.load', 'np.load', (['files[0]'], {}), '(files[0])\n', (254, 264), True, 'import numpy as np\n'), ((291, 308), 'numpy.load', 'np.load', (['files[1]'], {}), '(files[1])\n... |
import os
import tests.unit.cli.commands.command_testing as command_testing
import lmctl.drivers.lm.base as lm_drivers
import lmctl.cli.commands.lifecycledriver as lifecycledriver_cmds
from unittest.mock import patch
from tests.common.simulations.lm_simulator import LmSimulator
class TestLifecycleDriverCommands(comman... | [
"unittest.mock.patch",
"tests.common.simulations.lm_simulator.LmSimulator",
"os.path.dirname",
"lmctl.drivers.lm.base.LmDriverException"
] | [((545, 589), 'unittest.mock.patch', 'patch', (['"""lmctl.cli.ctlmgmt.create_lm_session"""'], {}), "('lmctl.cli.ctlmgmt.create_lm_session')\n", (550, 589), False, 'from unittest.mock import patch\n'), ((7767, 7811), 'lmctl.drivers.lm.base.LmDriverException', 'lm_drivers.LmDriverException', (['"""Mocked error"""'], {}),... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.