code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
import sqlite3
from ipywidgets import (
VBox, HBox, Label, Layout, interactive_output, Dropdown, Output,
Button, ToggleButtons, FloatRangeSlider, Accordion, Text
)
from .prototype_pane import ExplorerPane
from IPython.display import display, HTML
from ..database import Database
import __main__
c... | [
"os.path.exists",
"sqlite3.connect",
"ipywidgets.Dropdown",
"ipywidgets.Text",
"os.path.abspath",
"IPython.display.HTML"
] | [((860, 932), 'ipywidgets.Dropdown', 'Dropdown', ([], {'options': "[' ']", 'value': '""" """', 'description': '"""Scope:"""', 'disabled': '(False)'}), "(options=[' '], value=' ', description='Scope:', disabled=False)\n", (868, 932), False, 'from ipywidgets import VBox, HBox, Label, Layout, interactive_output, Dropdown,... |
"""
Understand
Note: For some reason, it's failing one of the tests. I
think it's because the test case didn't sort their output.
In that case, the test is wrong :)
Drawing graphs via text are a pain, so I'm just gonna use the example given
Plan
1. Translate the problem into graph terminology
- Each index in the lis... | [
"collections.deque"
] | [((1018, 1025), 'collections.deque', 'deque', ([], {}), '()\n', (1023, 1025), False, 'from collections import deque\n')] |
from app import db
from app.models import User
def test():
users=User.query.all()
for user in users:
print(user.username)
if __name__ == "__main__":
test() | [
"app.models.User.query.all"
] | [((69, 85), 'app.models.User.query.all', 'User.query.all', ([], {}), '()\n', (83, 85), False, 'from app.models import User\n')] |
import unittest
from sample.Planety import *
class PlanetyParameterizedFile(unittest.TestCase):
def test_from_file(self):
fileTest = open("./data/planety_data_test")
tmp = Planety()
for line in fileTest:
if line.startswith("#") or line.startswith(" ") or line.startswith("\n"):
... | [
"unittest.main"
] | [((592, 607), 'unittest.main', 'unittest.main', ([], {}), '()\n', (605, 607), False, 'import unittest\n')] |
""" This component provides Switches for Unifi Protect."""
import logging
try:
from homeassistant.components.switch import SwitchEntity as SwitchDevice
except ImportError:
# Prior to HA v0.110
from homeassistant.components.switch import SwitchDevice
from homeassistant.const import ATTR_ATTRIBUTION
from ho... | [
"logging.getLogger"
] | [((734, 761), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (751, 761), False, 'import logging\n')] |
import logging
import requests
import ask_sdk_core.utils as ask_utils
from ask_sdk_core.skill_builder import SkillBuilder
from ask_sdk_core.dispatch_components import AbstractRequestHandler
from ask_sdk_core.dispatch_components import AbstractExceptionHandler
from ask_sdk_core.handler_input import HandlerInput
... | [
"logging.getLogger",
"requests.get",
"ask_sdk_core.skill_builder.SkillBuilder",
"ask_sdk_core.utils.is_request_type",
"ask_sdk_core.utils.is_intent_name"
] | [((370, 397), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (387, 397), False, 'import logging\n'), ((6223, 6237), 'ask_sdk_core.skill_builder.SkillBuilder', 'SkillBuilder', ([], {}), '()\n', (6235, 6237), False, 'from ask_sdk_core.skill_builder import SkillBuilder\n'), ((623, 665), 'ask... |
# Results plotter.
#
# https://github.com/stefanvanberkum/CD-ABSC
import numpy as np
import pandas as pd
import statsmodels.formula.api as sm
from plotnine import aes, element_text, geom_point, ggplot, stat_smooth, theme
global embedding_dim, rest_path, target_path, ft_path, save_path
def main():
"""
Plots ... | [
"plotnine.stat_smooth",
"plotnine.ggplot",
"plotnine.aes",
"plotnine.element_text",
"statsmodels.formula.api.ols",
"plotnine.geom_point",
"pandas.DataFrame",
"numpy.divide"
] | [((5549, 5569), 'pandas.DataFrame', 'pd.DataFrame', (['result'], {}), '(result)\n', (5561, 5569), True, 'import pandas as pd\n'), ((1741, 1765), 'plotnine.stat_smooth', 'stat_smooth', ([], {'method': '"""lm"""'}), "(method='lm')\n", (1752, 1765), False, 'from plotnine import aes, element_text, geom_point, ggplot, stat_... |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [
"oci.config.from_file",
"oci.retry.NoneRetryStrategy",
"oci.retry.RetryStrategyBuilder",
"oci.identity.IdentityClient"
] | [((587, 609), 'oci.config.from_file', 'oci.config.from_file', ([], {}), '()\n', (607, 609), False, 'import oci\n'), ((1912, 1947), 'oci.identity.IdentityClient', 'oci.identity.IdentityClient', (['config'], {}), '(config)\n', (1939, 1947), False, 'import oci\n'), ((697, 1146), 'oci.retry.RetryStrategyBuilder', 'oci.retr... |
from typing import List
from robocorp_ls_core.protocols import IDocument
import pytest
from robotframework_ls.impl.robot_version import get_robot_major_version
def check(found, expected):
from robotframework_ls.impl.semantic_tokens import decode_semantic_tokens
from robotframework_ls.impl.completion_context i... | [
"robot.get_version",
"robotframework_ls.impl.completion_context.CompletionContext",
"robotframework_ls.impl.semantic_tokens.decode_semantic_tokens",
"robotframework_ls.impl.robot_version.get_robot_major_version",
"io.StringIO",
"robotframework_ls.impl.semantic_tokens.semantic_tokens_full"
] | [((504, 555), 'robotframework_ls.impl.semantic_tokens.decode_semantic_tokens', 'decode_semantic_tokens', (['semantic_tokens_as_int', 'doc'], {}), '(semantic_tokens_as_int, doc)\n', (526, 555), False, 'from robotframework_ls.impl.semantic_tokens import decode_semantic_tokens\n'), ((1464, 1510), 'robotframework_ls.impl.c... |
# Generated by Django 2.0 on 2018-02-03 22:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0023_auto_20180131_1821'),
]
operations = [
migrations.AlterField(
model_name='dayplan',
name='dayplan_water_qt... | [
"django.db.models.CharField"
] | [((347, 390), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""L"""', 'max_length': '(6)'}), "(default='L', max_length=6)\n", (363, 390), False, 'from django.db import migrations, models\n'), ((538, 582), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""L"""', 'max_length': '... |
from datetime import timedelta
from rest_framework.test import APITestCase, APIRequestFactory, URLPatternsTestCase, \
force_authenticate
from rest_framework import status
from django.contrib.auth import get_user_model
from django.utils import timezone
from django.urls import include, path, reverse
from votec... | [
"django.contrib.auth.get_user_model",
"rest_framework.test.force_authenticate",
"core.models.models.Poll.objects.count",
"django.urls.include",
"django.utils.timezone.now",
"core.views.admin_poll_view.AdminListOrCreatePoll.as_view",
"django.urls.reverse",
"rest_framework.test.APIRequestFactory",
"da... | [((851, 867), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (865, 867), False, 'from django.contrib.auth import get_user_model\n'), ((1035, 1054), 'rest_framework.test.APIRequestFactory', 'APIRequestFactory', ([], {}), '()\n', (1052, 1054), False, 'from rest_framework.test import APITestCase... |
from neuron import h
import itertools
# aliases to avoid repeatedly doing multiple hash-table lookups
_h_section_ref = h.SectionRef
_h_allsec = h.allsec
_h_parent_connection = h.parent_connection
_h_section_orientation = h.section_orientation
_itertools_combinations = itertools.combinations
def parent(sec):
"""Re... | [
"neuron.h.Section",
"neuron.h.topology"
] | [((3735, 3747), 'neuron.h.topology', 'h.topology', ([], {}), '()\n', (3745, 3747), False, 'from neuron import h\n'), ((3254, 3281), 'neuron.h.Section', 'h.Section', ([], {'name': "('s[%d]' % i)"}), "(name='s[%d]' % i)\n", (3263, 3281), False, 'from neuron import h\n')] |
import asyncio
import dicom2nifti
from pydicom import dcmread
from pydicom.tag import Tag
import os
import pathlib
from pydcmq import *
import dicom2nifti.settings as settings
settings.disable_validate_orthogonal()
settings.disable_validate_slice_increment()
settings.enable_resampling()
settings.set_resample_spline_i... | [
"dicom2nifti.settings.enable_resampling",
"pathlib.Path",
"dicom2nifti.settings.set_resample_padding",
"os.scandir",
"os.path.join",
"dicom2nifti.settings.set_resample_spline_interpolation_order",
"dicom2nifti.dicom_series_to_nifti",
"pydicom.tag.Tag",
"dicom2nifti.settings.disable_validate_slice_in... | [((178, 216), 'dicom2nifti.settings.disable_validate_orthogonal', 'settings.disable_validate_orthogonal', ([], {}), '()\n', (214, 216), True, 'import dicom2nifti.settings as settings\n'), ((217, 260), 'dicom2nifti.settings.disable_validate_slice_increment', 'settings.disable_validate_slice_increment', ([], {}), '()\n',... |
from pytest import raises
from .brain.jobs import verify_state, transition_success, transition_fail, \
transition, InvalidStateTransition, InvalidState, JobsError
from .brain.jobs import STATES, SUCCESS, FAILURE, TRANSITION, BEGIN, READY, ERROR
INVALID_STATE = "INVALID SATE"
def test_states_verify():
for sta... | [
"pytest.raises"
] | [((1540, 1560), 'pytest.raises', 'raises', (['InvalidState'], {}), '(InvalidState)\n', (1546, 1560), False, 'from pytest import raises\n'), ((1653, 1673), 'pytest.raises', 'raises', (['InvalidState'], {}), '(InvalidState)\n', (1659, 1673), False, 'from pytest import raises\n'), ((1775, 1792), 'pytest.raises', 'raises',... |
from abc import ABCMeta, abstractmethod
import random
from environment import Environment
class GridMap(object):
def __init__(self, agent_pos_default, reward_pos_default):
self.data = None
self.ylen = -1
self.xlen = -1
self.agent_pos_default = agent_pos_default
self.agen... | [
"random.choice",
"random.randint"
] | [((2152, 2179), 'random.choice', 'random.choice', (['self.as_list'], {}), '(self.as_list)\n', (2165, 2179), False, 'import random\n'), ((712, 744), 'random.randint', 'random.randint', (['(1)', '(self.xlen - 2)'], {}), '(1, self.xlen - 2)\n', (726, 744), False, 'import random\n'), ((775, 807), 'random.randint', 'random.... |
import logging
from aiotasks import run_with_exceptions_and_logs, SharedConfig
def test_run_with_exceptions_and_logs_oks(monkeypatch):
logger = logging.getLogger("aiotasks")
class CustomLogger(logging.StreamHandler):
def __init__(self):
super(CustomLogger, self).__init__()
s... | [
"logging.getLogger",
"aiotasks.run_with_exceptions_and_logs"
] | [((152, 181), 'logging.getLogger', 'logging.getLogger', (['"""aiotasks"""'], {}), "('aiotasks')\n", (169, 181), False, 'import logging\n'), ((478, 522), 'aiotasks.run_with_exceptions_and_logs', 'run_with_exceptions_and_logs', (['(lambda x: x)', '(0)'], {}), '(lambda x: x, 0)\n', (506, 522), False, 'from aiotasks import... |
# -*- coding: UTF-8 -*-
import os
import sys
import django
import random
import datetime
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
django.setup()
from django.contrib.auth.models import User, Group, Permission
user = User.objects.create_superu... | [
"os.environ.setdefault",
"django.contrib.auth.models.User.objects.create_superuser",
"django.setup"
] | [((121, 187), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""mysite.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'mysite.settings')\n", (142, 187), False, 'import os\n'), ((192, 206), 'django.setup', 'django.setup', ([], {}), '()\n', (204, 206), False, 'import django\n'), ((2... |
from snovault import (
AuditFailure,
audit_checker,
)
from .formatter import (
audit_link,
path_to_text,
)
from .item import STATUS_LEVEL
def audit_read_count_compare(value, system):
'''
We check fastq metadata against the expected values based on the
library protocol used to generate the... | [
"snovault.AuditFailure",
"snovault.audit_checker"
] | [((5057, 5201), 'snovault.audit_checker', 'audit_checker', (['"""AnalysisFile"""'], {'frame': "['derived_from', 'derived_from.derived_from', 'quality_metrics',\n 'libraries', 'libraries.protocol']"}), "('AnalysisFile', frame=['derived_from',\n 'derived_from.derived_from', 'quality_metrics', 'libraries',\n 'lib... |
#!/usr/bin/env python3
import signal, sys, os, logging, glob
def signal_handler( signal, frame ):
print( "You pressed Ctrl+C. Exiting...")
sys.exit( 0 )
from functools import reduce
mainDir = reduce(lambda x,y: os.path.dirname( x ), range(2),
os.path.abspath( __file__ ) )
sys.path.append( main... | [
"logging.basicConfig",
"PyQt4.QtGui.QApplication",
"qdarkstyle.load_stylesheet_pyqt",
"os.path.join",
"optparse.OptionParser",
"os.path.dirname",
"plexcore.plexcore.checkServerCredentials",
"plextvdb.get_token",
"sys.exit",
"os.path.abspath",
"sys.path.append",
"os.path.expanduser"
] | [((299, 323), 'sys.path.append', 'sys.path.append', (['mainDir'], {}), '(mainDir)\n', (314, 323), False, 'import signal, sys, os, logging, glob\n'), ((522, 565), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.config/howdy/tests"""'], {}), "('~/.config/howdy/tests')\n", (540, 565), False, 'import signal, sys, os, ... |
from __future__ import absolute_import
from sentry.models import AuditLogEntry
from sentry.web.frontend.base import OrganizationView
class OrganizationAuditLogView(OrganizationView):
required_scope = 'org:write'
def get(self, request, organization):
queryset = AuditLogEntry.objects.filter(
... | [
"sentry.models.AuditLogEntry.objects.filter"
] | [((281, 336), 'sentry.models.AuditLogEntry.objects.filter', 'AuditLogEntry.objects.filter', ([], {'organization': 'organization'}), '(organization=organization)\n', (309, 336), False, 'from sentry.models import AuditLogEntry\n')] |
# To run this script:
# > python getwaveform_silwal2016.py
import obspy
import copy
import getwaveform_iris
from obspy.clients.fdsn import Client
from obspy.core.event import Event, Origin, Magnitude
import numpy as np
import util_helpers as uh
# Catalog file
filename = '/home/carltape/REPOSITORIES/manuscripts/vipul/p... | [
"obspy.core.event.Origin",
"numpy.array",
"util_helpers.eid2otime",
"obspy.core.event.Event",
"getwaveform_iris.run_get_waveform",
"obspy.clients.fdsn.Client",
"obspy.core.event.Magnitude"
] | [((646, 659), 'numpy.array', 'np.array', (['iex'], {}), '(iex)\n', (654, 659), True, 'import numpy as np\n'), ((2313, 2330), 'util_helpers.eid2otime', 'uh.eid2otime', (['eid'], {}), '(eid)\n', (2325, 2330), True, 'import util_helpers as uh\n'), ((2582, 2596), 'obspy.clients.fdsn.Client', 'Client', (['"""IRIS"""'], {}),... |
from functools import partial
import numpy as np
from tqdm import tqdm
from .experiment_linear_balance_classes import ExperimentLinearBalanced
from .experiment_linear_exploit_partial import ExperimentLinearExploitPartial
from ..models.linear import Linear_S, Linear_M, Linear_L
from .training_args import LMMixupOutsid... | [
"tqdm.tqdm",
"numpy.take",
"functools.partial",
"numpy.concatenate",
"numpy.random.permutation"
] | [((1064, 1097), 'functools.partial', 'partial', (['convert2vec'], {'dtype': 'float'}), '(convert2vec, dtype=float)\n', (1071, 1097), False, 'from functools import partial\n'), ((2626, 2651), 'tqdm.tqdm', 'tqdm', ([], {'total': 'outside.steps'}), '(total=outside.steps)\n', (2630, 2651), False, 'from tqdm import tqdm\n')... |
from Task import Task
from Helper import Level
from typing import Dict
import re
class PublishFromSource(Task):
def __init__(self, name, parent, params, logMethod):
super().__init__(name, parent, params, logMethod, None)
self.paramRules = {
'Pattern': (None, True),
'Keys': ... | [
"re.compile"
] | [((1252, 1271), 're.compile', 're.compile', (['pattern'], {}), '(pattern)\n', (1262, 1271), False, 'import re\n')] |
from flask import Flask
from flask_restful import Api
from resources.books import Books
app = Flask(__name__) # Flask intialization
api = Api(app) # API intialization
api.add_resource(Books, "/books") # api url
if __name__ == "__main__":
app.run(debug=True)
| [
"flask_restful.Api",
"flask.Flask"
] | [((96, 111), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (101, 111), False, 'from flask import Flask\n'), ((141, 149), 'flask_restful.Api', 'Api', (['app'], {}), '(app)\n', (144, 149), False, 'from flask_restful import Api\n')] |
from cuda.upfirdn_2d import *
from cuda.fused_bias_act import fused_bias_act
##################################################################################
# Layers
##################################################################################
class Conv2D(tf.keras.layers.Layer):
def __init__(self, fmaps,... | [
"cuda.fused_bias_act.fused_bias_act"
] | [((7610, 7674), 'cuda.fused_bias_act.fused_bias_act', 'fused_bias_act', (['inputs'], {'b': 'b', 'act': 'self.act', 'alpha': 'None', 'gain': 'None'}), '(inputs, b=b, act=self.act, alpha=None, gain=None)\n', (7624, 7674), False, 'from cuda.fused_bias_act import fused_bias_act\n')] |
import numpy as np
import matplotlib.pyplot as plt
from math import *
def Draw(u,f,n):
x=u
List_X=[u]
List_Y=[0]
for k in range(n):
y=f(x)
List_X.append(x)
List_Y.append(y)
List_Y.append(y)
List_X.append(y)
x=y
plt.plot(List_X,List_Y,"... | [
"matplotlib.pyplot.clf",
"matplotlib.pyplot.plot",
"numpy.linspace",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.show"
] | [((676, 685), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (683, 685), True, 'import matplotlib.pyplot as plt\n'), ((704, 713), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (711, 713), True, 'import matplotlib.pyplot as plt\n'), ((296, 325), 'matplotlib.pyplot.plot', 'plt.plot', (['List_X', 'List_Y', ... |
#!/usr/bin/env python
# Usage:
# python parse_taxonomy_for_clustered_subset.py X Y Z
# where X is the fasta file to read target labels from, Y is the taxonomy mapping file starting with a superset of labels from X, and Z is the output taxonomy mapping file.
from cogent.parse.fasta import MinimalFastaParser
from sys ... | [
"cogent.parse.fasta.MinimalFastaParser"
] | [((475, 507), 'cogent.parse.fasta.MinimalFastaParser', 'MinimalFastaParser', (['target_fasta'], {}), '(target_fasta)\n', (493, 507), False, 'from cogent.parse.fasta import MinimalFastaParser\n')] |
#
# No convection
#
import pybamm
from .base_through_cell_convection import BaseThroughCellModel
class NoConvection(BaseThroughCellModel):
"""A submodel for case where there is no convection.
Parameters
----------
param : parameter class
The parameters to use for this submodel
options : d... | [
"pybamm.FullBroadcast"
] | [((1055, 1121), 'pybamm.FullBroadcast', 'pybamm.FullBroadcast', (['(0)', '"""positive electrode"""', '"""current collector"""'], {}), "(0, 'positive electrode', 'current collector')\n", (1075, 1121), False, 'import pybamm\n'), ((1144, 1210), 'pybamm.FullBroadcast', 'pybamm.FullBroadcast', (['(0)', '"""positive electrod... |
import json
class AstToken:
def __init__(self, lex_token):
self.name = lex_token.type
if lex_token.value != self.name:
self.value = lex_token.value
def __str__(self):
return json.dumps(self, cls=AstTokenEncoder)
class AstTokenList:
def __init__(self, tokens):
s... | [
"json.dumps"
] | [((220, 257), 'json.dumps', 'json.dumps', (['self'], {'cls': 'AstTokenEncoder'}), '(self, cls=AstTokenEncoder)\n', (230, 257), False, 'import json\n'), ((379, 423), 'json.dumps', 'json.dumps', (['self.tokens'], {'cls': 'AstTokenEncoder'}), '(self.tokens, cls=AstTokenEncoder)\n', (389, 423), False, 'import json\n')] |
import unittest
import pandas as pd
from reamber.base import Hold
class TestHold(unittest.TestCase):
""" The purpose of this test is to test the architecture of Base. """
def setUp(self) -> None:
self.hold = Hold(offset=1000, column=1, length=1000)
# @profile
def test_type(self):
s... | [
"unittest.main",
"reamber.base.Hold"
] | [((1401, 1416), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1414, 1416), False, 'import unittest\n'), ((229, 269), 'reamber.base.Hold', 'Hold', ([], {'offset': '(1000)', 'column': '(1)', 'length': '(1000)'}), '(offset=1000, column=1, length=1000)\n', (233, 269), False, 'from reamber.base import Hold\n'), ((423... |
from django.urls import include, path
#
# On Reversing URLs
# =================
#
# Recommended Usage:
# Always use rest_framework.reverse.reverse, do not directly use django.urls.reverse.
# If a request object r is available, use reverse(name, request=r). With the name as defined
# in desecapi.urls.v1 or desecapi.ur... | [
"django.urls.include"
] | [((2912, 2962), 'django.urls.include', 'include', (['"""desecapi.urls.version_2"""'], {'namespace': '"""v2"""'}), "('desecapi.urls.version_2', namespace='v2')\n", (2919, 2962), False, 'from django.urls import include, path\n'), ((3011, 3061), 'django.urls.include', 'include', (['"""desecapi.urls.version_1"""'], {'names... |
"""Implementation of common cast conversion.
Mainly following interfaces are defined.
- to_int_from_float
Convert float value to int.
- to_float_from_int
Convert int value to float.
- to_bool_from_int
Convert int value to bool.
"""
from typing import Any
from typing import Union
from ap... | [
"apysc._validation.number_validation.validate_int_is_zero_or_one",
"apysc.Number",
"apysc.Int"
] | [((2542, 2604), 'apysc._validation.number_validation.validate_int_is_zero_or_one', 'number_validation.validate_int_is_zero_or_one', ([], {'integer': 'integer'}), '(integer=integer)\n', (2587, 2604), False, 'from apysc._validation import number_validation\n'), ((1044, 1064), 'apysc.Int', 'ap.Int', (['int_or_float'], {})... |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | [
"flare_removal.python.u_net.get_model",
"flare_removal.python.vgg.build_can"
] | [((847, 947), 'flare_removal.python.u_net.get_model', 'u_net.get_model', ([], {'input_shape': '(512, 512, 3)', 'scales': '(4)', 'bottleneck_depth': '(1024)', 'bottleneck_layers': '(2)'}), '(input_shape=(512, 512, 3), scales=4, bottleneck_depth=1024,\n bottleneck_layers=2)\n', (862, 947), False, 'from flare_removal.p... |
"""Test MNIST data loader."""
from torch import allclose
from bpexts.utils import set_seeds
from .load_mnist import MNISTDownsampledLoader, MNISTLoader
loaders = [MNISTLoader, MNISTDownsampledLoader]
def test_deterministic_loading():
"""Test deterministc loading of samples."""
for loader in loaders:
... | [
"torch.allclose",
"bpexts.utils.set_seeds"
] | [((323, 335), 'bpexts.utils.set_seeds', 'set_seeds', (['(0)'], {}), '(0)\n', (332, 335), False, 'from bpexts.utils import set_seeds\n'), ((475, 487), 'bpexts.utils.set_seeds', 'set_seeds', (['(0)'], {}), '(0)\n', (484, 487), False, 'from bpexts.utils import set_seeds\n'), ((634, 674), 'torch.allclose', 'allclose', (['t... |
"""
Examples tests using standard documentation.
https://docs.python.org/3/library/unittest.html
"""
import unittest
class TestStringMethods(unittest.TestCase):
def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')
def test_isupper(self):
self.assertTrue('FOO'.isupper())
sel... | [
"unittest.main"
] | [((751, 766), 'unittest.main', 'unittest.main', ([], {}), '()\n', (764, 766), False, 'import unittest\n')] |
# Generated by Django 2.2.1 on 2019-06-01 05:14
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('flatpages', '0001_initial'),
]
operations = [
migrations.CreateModel(
name=... | [
"django.db.models.OneToOneField",
"django.db.models.BooleanField"
] | [((382, 554), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'auto_created': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'parent_link': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'to': '"""flatpages.FlatPage"""'}), "(auto_created=True, on_delete=django.db.models.deletion... |
import errno
import json
import logging
import os
import platform
import uuid
from functools import wraps
from pathlib import Path
from typing import Any, Callable, Dict, Optional, TypeVar
from mixpanel import Consumer, Mixpanel
import datahub as datahub_package
logger = logging.getLogger(__name__)
DATAHUB_FOLDER =... | [
"logging.getLogger",
"datahub.nice_version_name",
"os.makedirs",
"json.dump",
"os.environ.get",
"functools.wraps",
"uuid.uuid4",
"platform.system",
"json.load",
"platform.python_version",
"os.path.expanduser",
"typing.TypeVar"
] | [((275, 302), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (292, 302), False, 'import logging\n'), ((4909, 4921), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (4916, 4921), False, 'from typing import Any, Callable, Dict, Optional, TypeVar\n'), ((326, 358), 'os.path.expandu... |
# filter_plugins/passwdhash.py
#
# Generate password hashes that can be used in /etc/shadow.
#
# Example usage:
#
# Assume you have the following variable defined in Yaml:
#
# users:
# - name: alice
# password: <PASSWORD>
# - name: bob
# password: <PASSWORD>
#
# You can use this filter in your playbook like... | [
"random.choice"
] | [((853, 873), 'random.choice', 'random.choice', (['chars'], {}), '(chars)\n', (866, 873), False, 'import random\n')] |
#!/usr/bin/env python
#-*- coding:utf-8; mode:python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*-
import os.path as path
from bes.fs.dir_util import dir_util
from bes.fs.file_find import file_find
from bes.fs.file_util import file_util
class setup_tools(object):
'Class to deal with setup_tools things... | [
"bes.fs.file_util.file_util.save",
"os.path.exists",
"os.path.join",
"bes.fs.dir_util.dir_util.list",
"os.path.normpath",
"os.path.isfile",
"os.path.isdir",
"bes.fs.file_util.file_util.read"
] | [((946, 1011), 'bes.fs.dir_util.dir_util.list', 'dir_util.list', (['d'], {'patterns': "['*.egg', '*.egg-info']", 'relative': '(True)'}), "(d, patterns=['*.egg', '*.egg-info'], relative=True)\n", (959, 1011), False, 'from bes.fs.dir_util import dir_util\n'), ((1331, 1380), 'os.path.join', 'path.join', (['d', 'clazz.EASY... |
'''
Function:
train the model
Author:
<NAME>
'''
import os
import copy
import torch
import warnings
import argparse
import torch.nn as nn
import torch.distributed as dist
from modules import *
from cfgs import BuildConfig
warnings.filterwarnings('ignore')
'''parse arguments in command line'''
def parseArgs():... | [
"os.path.exists",
"cfgs.BuildConfig",
"argparse.ArgumentParser",
"os.path.join",
"torch.cuda.device_count",
"torch.cuda.is_available",
"copy.deepcopy",
"torch.cuda.set_device",
"warnings.filterwarnings"
] | [((230, 263), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (253, 263), False, 'import warnings\n'), ((334, 482), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""sssegmentation is a general framework for our research on strongly supervised s... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import torch.nn as nn
import torch.nn.functional as F
class DQN(nn.Module):
"""Initialize a deep Q-learning network
Hints:
-----
Original paper for DQN
https://storage.googleapis.com/deepmind-data/assets/papers/DeepMindNature14236Paper.pdf
... | [
"torch.nn.Linear",
"torch.nn.Conv2d"
] | [((729, 770), 'torch.nn.Conv2d', 'nn.Conv2d', (['(4)', '(32)'], {'kernel_size': '(8)', 'stride': '(4)'}), '(4, 32, kernel_size=8, stride=4)\n', (738, 770), True, 'import torch.nn as nn\n'), ((792, 834), 'torch.nn.Conv2d', 'nn.Conv2d', (['(32)', '(64)'], {'kernel_size': '(4)', 'stride': '(2)'}), '(32, 64, kernel_size=4,... |
"""updated table
Revision ID: f203d34254ea
Revises: 10388298852c
Create Date: 2020-04-12 20:25:35.706980
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f203d34254ea'
down_revision = '10388298852c'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
"alembic.op.f",
"alembic.op.drop_column",
"sqlalchemy.String"
] | [((990, 1037), 'alembic.op.drop_column', 'op.drop_column', (['"""npiinterventions"""', '"""subregion"""'], {}), "('npiinterventions', 'subregion')\n", (1004, 1037), False, 'from alembic import op\n'), ((1042, 1099), 'alembic.op.drop_column', 'op.drop_column', (['"""npiinterventions"""', '"""oxford_tracing_code"""'], {}... |
import typing
import numpy as np
from rrtstar.geometry import Point2d, Trajectory
from rrtstar.rrt_star import Vertex
def constant_speed_line_steering_policy(
start: Vertex, dest: Point2d, time: float, velocity: float
) -> typing.Tuple[float, Trajectory]:
unit_vector = dest.to_array() - start.position.t... | [
"rrtstar.geometry.Trajectory",
"numpy.arange",
"numpy.linalg.norm"
] | [((345, 372), 'numpy.linalg.norm', 'np.linalg.norm', (['unit_vector'], {}), '(unit_vector)\n', (359, 372), True, 'import numpy as np\n'), ((522, 571), 'numpy.arange', 'np.arange', ([], {'start': '(0.0)', 'stop': '(time + step)', 'step': 'step'}), '(start=0.0, stop=time + step, step=step)\n', (531, 571), True, 'import n... |
from django import forms
class UploadImageForm(forms.Form):
imageupload = forms.ImageField()
| [
"django.forms.ImageField"
] | [((79, 97), 'django.forms.ImageField', 'forms.ImageField', ([], {}), '()\n', (95, 97), False, 'from django import forms\n')] |
import argparse
import logging
import numpy as np
from PCA.PCAModel import PCAModel
logging.basicConfig(
level=logging.DEBUG,
format='[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s'
)
def main():
logging.info("pca_toy_vector.py main()")
X = np.array([[0.14, -2.3, 1.58, 1], [-1.2,... | [
"logging.basicConfig",
"numpy.array",
"PCA.PCAModel.PCAModel",
"logging.info"
] | [((85, 208), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s"""'}), "(level=logging.DEBUG, format=\n '[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s')\n", (104, 208), False, 'import lo... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2020-01-25 19:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('isisdata', '0086_auto_20200112_2037'),
]
operations = [
migrations.AlterFi... | [
"django.db.models.CharField"
] | [((421, 1216), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'choices': "[(b'SPWT', b'Weldon Thesaurus Terms (2002-present)'), (b'SPWC',\n b'Weldon Classification System (2002-present)'), (b'GUE',\n b'Guerlac Committee Classification System (1953-2001)'), (b'NEU',\n b'Neu'), (b'MW'... |
import graph_tool
def graph_from_pandas_edgelist(df, source='source', target='target', weight='weight', directed=True, remove_empty=True):
network = graph_tool.Graph(directed=directed)
n_vertices = max(df[source].max(), df[target].max()) + 1
vertex_list = network.add_vertex(n_vertices)
if weight i... | [
"graph_tool.Graph"
] | [((154, 189), 'graph_tool.Graph', 'graph_tool.Graph', ([], {'directed': 'directed'}), '(directed=directed)\n', (170, 189), False, 'import graph_tool\n')] |
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from settings import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(... | [
"django.views.generic.TemplateView.as_view",
"django.conf.urls.include",
"django.conf.urls.patterns",
"django.contrib.staticfiles.urls.staticfiles_urlpatterns",
"django.contrib.admin.autodiscover"
] | [((275, 295), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (293, 295), False, 'from django.contrib import admin\n'), ((766, 791), 'django.contrib.staticfiles.urls.staticfiles_urlpatterns', 'staticfiles_urlpatterns', ([], {}), '()\n', (789, 791), False, 'from django.contrib.staticfiles.ur... |
import demo_quipuswap.models as models
from demo_quipuswap.types.quipu_fa12.parameter.transfer import TransferParameter
from demo_quipuswap.types.quipu_fa12.storage import QuipuFa12Storage
from dipdup.context import HandlerContext
from dipdup.models import Transaction
async def on_fa12_transfer(
ctx: HandlerConte... | [
"demo_quipuswap.models.Position.get_or_create"
] | [((690, 755), 'demo_quipuswap.models.Position.get_or_create', 'models.Position.get_or_create', ([], {'trader': 'from_address', 'symbol': 'symbol'}), '(trader=from_address, symbol=symbol)\n', (719, 755), True, 'import demo_quipuswap.models as models\n'), ((930, 993), 'demo_quipuswap.models.Position.get_or_create', 'mode... |
import sys
import yappi
import unittest
class YappiUnitTestCase(unittest.TestCase):
def setUp(self):
# reset everything back to default
yappi.stop()
yappi.clear_stats()
yappi.set_clock_type('cpu') # reset to default clock type
yappi.set_context_id_callback(None)
... | [
"yappi.start",
"yappi.set_context_name_callback",
"yappi.stop",
"sys.stdout.write",
"yappi.get_thread_stats",
"yappi.get_func_stats",
"yappi.set_clock_type",
"yappi.set_context_id_callback",
"yappi.clear_stats"
] | [((1197, 1210), 'yappi.start', 'yappi.start', ([], {}), '()\n', (1208, 1210), False, 'import yappi\n'), ((1243, 1255), 'yappi.stop', 'yappi.stop', ([], {}), '()\n', (1253, 1255), False, 'import yappi\n'), ((1365, 1387), 'yappi.get_func_stats', 'yappi.get_func_stats', ([], {}), '()\n', (1385, 1387), False, 'import yappi... |
from flask import current_app
import json
from sqlalchemy.orm import load_only
import random
from redis.exceptions import RedisError
from sqlalchemy.exc import DatabaseError
from models.user import User
from . import contants
# key value
# user:{user_id}:info
# user:123:info
# user:124:info ... | [
"sqlalchemy.orm.load_only",
"json.loads",
"json.dumps",
"flask.current_app.logger.error"
] | [((2534, 2555), 'json.dumps', 'json.dumps', (['user_dict'], {}), '(user_dict)\n', (2544, 2555), False, 'import json\n'), ((1880, 1907), 'flask.current_app.logger.error', 'current_app.logger.error', (['e'], {}), '(e)\n', (1904, 1907), False, 'from flask import current_app\n'), ((3512, 3539), 'flask.current_app.logger.er... |
from eth_utils import remove_0x_prefix
def hex2a(s):
# astr = ''
chrlist = []
s = remove_0x_prefix(s)
for i in range(0, len(s), 2):
aint = int(s[i:i + 2], 16)
if aint >= 32:
# astr = astr + chr(aint)
chrlist.append(aint)
return ''.join(map(chr, chrlist))
| [
"eth_utils.remove_0x_prefix"
] | [((95, 114), 'eth_utils.remove_0x_prefix', 'remove_0x_prefix', (['s'], {}), '(s)\n', (111, 114), False, 'from eth_utils import remove_0x_prefix\n')] |
# Generated by Django 2.1.2 on 2018-11-30 05:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0011_auto_20181130_1533'),
]
operations = [
migrations.RenameField(
model_name='orderitem',
old_name='price',
... | [
"django.db.migrations.RenameField"
] | [((223, 315), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""orderitem"""', 'old_name': '"""price"""', 'new_name': '"""unit_price"""'}), "(model_name='orderitem', old_name='price', new_name=\n 'unit_price')\n", (245, 315), False, 'from django.db import migrations\n')] |
from random import randint
from nose.tools import *
# from legsewoc import *
# from legsewoc.leguincounter import LeGuinCounter
# from .context import legsewoc
# from legsewoc.leguincounter import LeGuinCounter
from .context import leguincounter
from leguincounter import LeGuinCounter
def test_init():
'''Test C... | [
"random.randint",
"leguincounter.LeGuinCounter"
] | [((640, 659), 'leguincounter.LeGuinCounter', 'LeGuinCounter', (['text'], {}), '(text)\n', (653, 659), False, 'from leguincounter import LeGuinCounter\n'), ((1146, 1165), 'leguincounter.LeGuinCounter', 'LeGuinCounter', (['text'], {}), '(text)\n', (1159, 1165), False, 'from leguincounter import LeGuinCounter\n'), ((1350,... |
# Generated by Django 3.2.8 on 2022-05-02 10:27
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('dorm', '0001_initial'),
]
operations = [
migrations.DeleteModel(
name='OrganizationDormManager',
),
]
| [
"django.db.migrations.DeleteModel"
] | [((213, 267), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""OrganizationDormManager"""'}), "(name='OrganizationDormManager')\n", (235, 267), False, 'from django.db import migrations\n')] |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 2.0.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
# ... | [
"os.path.abspath",
"os.path.join"
] | [((4524, 4563), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""www"""', '"""static"""'], {}), "(BASE_DIR, 'www', 'static')\n", (4536, 4563), False, 'import os\n'), ((4602, 4633), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""media"""'], {}), "(BASE_DIR, 'media')\n", (4614, 4633), False, 'import os\n'), ((433, 45... |
import numpy as np
import os
import pickle
from utils import load_config_file
import sys
if __name__ == '__main__':
config_file_name = sys.argv[1]
config = load_config_file(config_file_name)
# create output folder if it doesn't exist
output_folder = config["Output Folder"]
if not os.... | [
"numpy.mean",
"utils.load_config_file",
"numpy.histogram",
"numpy.abs",
"numpy.unique",
"numpy.digitize",
"numpy.where",
"os.path.join",
"pickle.load",
"os.path.isdir",
"os.mkdir",
"numpy.shape",
"numpy.load"
] | [((175, 209), 'utils.load_config_file', 'load_config_file', (['config_file_name'], {}), '(config_file_name)\n', (191, 209), False, 'from utils import load_config_file\n'), ((491, 526), 'numpy.load', 'np.load', (['input_feature_path_testing'], {}), '(input_feature_path_testing)\n', (498, 526), True, 'import numpy as np\... |
import json
import jwt
from ..base import BaseTestCase
from api.models import Todo, User, db, TodoItem
from api.util import generate_token
from datetime import datetime, timedelta
class TodosTestCase(BaseTestCase):
def setUp(self):
db.drop_all()
db.create_all()
self.user_1 = User(
... | [
"api.models.db.drop_all",
"api.models.db.create_all",
"api.models.Todo",
"api.util.generate_token",
"api.models.TodoItem",
"api.models.User"
] | [((248, 261), 'api.models.db.drop_all', 'db.drop_all', ([], {}), '()\n', (259, 261), False, 'from api.models import Todo, User, db, TodoItem\n'), ((270, 285), 'api.models.db.create_all', 'db.create_all', ([], {}), '()\n', (283, 285), False, 'from api.models import Todo, User, db, TodoItem\n'), ((313, 427), 'api.models.... |
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
from __future__ import absolute_import
from __future__ import division
from __future__ import p... | [
"tensorflow.contrib.training.python.training.hparam.HParams",
"tensorflow.logging.error",
"google.cloud.storage.blob.Blob",
"argparse.ArgumentParser",
"sklearn.model_selection.train_test_split",
"tensorflow.logging.info",
"json.dumps",
"tensorflow.logging.set_verbosity",
"tensorflow.contrib.learn.py... | [((3648, 3688), 'tensorflow.logging.info', 'tf.logging.info', (["('job_dir: %s' % job_dir)"], {}), "('job_dir: %s' % job_dir)\n", (3663, 3688), True, 'import tensorflow as tf\n'), ((3702, 3776), 're.search', 're.search', (['"""gs://(monorail-.+)-mlengine/(component_trainer_\\\\d+)"""', 'job_dir'], {}), "('gs://(monorai... |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
from views import *
from django.contrib import admin
# from asistencias.api import AsistenciaResource
#asistencia_resource = AsistenciaResource()... | [
"django.views.generic.TemplateView.as_view",
"django.conf.urls.include",
"django.conf.urls.static.static"
] | [((1295, 1356), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n', (1301, 1356), False, 'from django.conf.urls.static import static\n'), ((365, 416), 'django.views.generic.TemplateView.as_view', 'Te... |
##
## Name: test_scrubby.py
## Purpose: Unit tests for scrubby.py
##
## Copyright (C) 2009, <NAME>, All Rights Reserved.
##
import scrubby as S
import unittest, functools
# {{ class test_scanner
class test_scanner(unittest.TestCase):
"""Low-level tests for the markup_scanner class. Only tests the internal
... | [
"unittest.main",
"scrubby.markup_parser",
"scrubby.markup_scanner",
"scrubby.html_parser"
] | [((18734, 18749), 'unittest.main', 'unittest.main', ([], {}), '()\n', (18747, 18749), False, 'import unittest, functools\n'), ((1304, 1339), 'scrubby.markup_scanner', 'S.markup_scanner', (['"""unquoted string"""'], {}), "('unquoted string')\n", (1320, 1339), True, 'import scrubby as S\n'), ((1427, 1453), 'scrubby.marku... |
import tekore as tk
from tekore._model.artist import FullArtist
from .Device import Device
from .Spotify_auth import Spotify_Auth
spotify_token, spotify = Spotify_Auth()
class Artist:
@staticmethod
def search(artist_name: str) -> FullArtist:
"""Will search for artist
Args:
artis... | [
"tekore.to_uri"
] | [((1200, 1230), 'tekore.to_uri', 'tk.to_uri', (['"""artist"""', 'artist.id'], {}), "('artist', artist.id)\n", (1209, 1230), True, 'import tekore as tk\n')] |
import tensorflow as tf
class Stats:
def __init__(self, config, run_name, is_eval):
self.is_eval = is_eval
self.reward = 0
self.step_count = 0
self.loss = 0.0
self.loss_count = 0
self.episodes = 0
self.current_score = 0
self.max_score = None
... | [
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.summary.merge",
"tensorflow.summary.scalar",
"tensorflow.summary.FileWriter"
] | [((605, 667), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[]', 'name': '"""score_per_episode"""'}), "(tf.float32, shape=[], name='score_per_episode')\n", (619, 667), True, 'import tensorflow as tf\n'), ((750, 786), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[]'})... |
import ssl
import httpcore
import httpx
import pytest # noqa
from yarl import URL # noqa
from httpx_socks import (
ProxyType,
AsyncProxyTransport,
ProxyError,
ProxyConnectionError,
ProxyTimeoutError,
)
from tests.config import (
TEST_HOST_PEM_FILE, TEST_URL_IPV4, TEST_URL_IPV4_HTTPS, SOCKS5... | [
"ssl.SSLContext",
"pytest.mark.parametrize",
"pytest.raises",
"httpx.AsyncClient",
"pytest.mark.skipif",
"yarl.URL",
"httpx.Timeout"
] | [((1049, 1117), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""url"""', '(TEST_URL_IPV4, TEST_URL_IPV4_HTTPS)'], {}), "('url', (TEST_URL_IPV4, TEST_URL_IPV4_HTTPS))\n", (1072, 1117), False, 'import pytest\n'), ((1119, 1165), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""rdns"""', '(True, Fals... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from mgkegg.html_parser import *
from PIL import ImageColor, ImageDraw
import re
def get_gene(ls:str) -> list:
"""
get gene and color from file
"""
with open(ls) as f:
return [line.strip() for line in f if line !='\n']
def highlight_rect(coord... | [
"PIL.ImageColor.getcolor",
"re.findall",
"PIL.ImageDraw.ImageDraw",
"PIL.ImageDraw.floodfill"
] | [((531, 565), 'PIL.ImageColor.getcolor', 'ImageColor.getcolor', (['color', '"""RGBA"""'], {}), "(color, 'RGBA')\n", (550, 565), False, 'from PIL import ImageColor, ImageDraw\n'), ((1082, 1116), 'PIL.ImageColor.getcolor', 'ImageColor.getcolor', (['color', '"""RGBA"""'], {}), "(color, 'RGBA')\n", (1101, 1116), False, 'fr... |
"""Tasks module, defining relevant classes and functions"""
import sys
from skpar.core.utils import get_logger
LOGGER = get_logger(__name__)
# TODO: get_tasklist below assumes the legacy definition of tasks in userinput:
# '- taskname: [list_of_task_arguments]'.
# It should be possible to provide an alter... | [
"skpar.core.utils.get_logger",
"sys.exit"
] | [((121, 141), 'skpar.core.utils.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (131, 141), False, 'from skpar.core.utils import get_logger\n'), ((674, 685), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (682, 685), False, 'import sys\n'), ((1703, 1714), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', ... |
'''Simple utility to ease plotting of training curves.
'''
import collections
import time
import matplotlib.pyplot as plt
import pandas as pd
import chainer as C
class Log:
'''A simple training log plotting interface.
For example:
log = Log()
log.add('loss', 'train', 2.3)
log.add('lo... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"pandas.DataFrame.from_dict",
"collections.defaultdict",
"matplotlib.pyplot.title",
"time.time"
] | [((583, 594), 'time.time', 'time.time', ([], {}), '()\n', (592, 594), False, 'import time\n'), ((648, 659), 'time.time', 'time.time', ([], {}), '()\n', (657, 659), False, 'import time\n'), ((2666, 2681), 'matplotlib.pyplot.title', 'plt.title', (['kind'], {}), '(kind)\n', (2675, 2681), True, 'import matplotlib.pyplot as... |
from blog import application
from blog.controllers.web_funcs import blog_template
from blog.models.blogging import Blog
from blog.models.feature import Feature
from bottle import request
import logging
log = logging.getLogger('blog')
@application.route('/about', method='GET')
@application.route('/contact', method='G... | [
"logging.getLogger",
"blog.controllers.web_funcs.blog_template",
"blog.models.feature.Feature",
"blog.models.blogging.Blog",
"blog.application.route"
] | [((210, 235), 'logging.getLogger', 'logging.getLogger', (['"""blog"""'], {}), "('blog')\n", (227, 235), False, 'import logging\n'), ((238, 279), 'blog.application.route', 'application.route', (['"""/about"""'], {'method': '"""GET"""'}), "('/about', method='GET')\n", (255, 279), False, 'from blog import application\n'),... |
# Generated by Django 2.2.5 on 2019-09-11 03:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('post', '0003_auto_20190909_2139'),
]
operations = [
migrations.AlterField(
model_name='post',
name='title',
... | [
"django.db.models.CharField"
] | [((330, 374), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(80)', 'unique': '(True)'}), '(max_length=80, unique=True)\n', (346, 374), False, 'from django.db import migrations, models\n')] |
# Copyright (c) 2015 SONATA-NFV, 2017 5GTANGO
# 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 ... | [
"logging.basicConfig",
"logging.getLogger",
"sonmanobase.messaging.ManoBrokerRequestResponseConnection",
"yaml.dump",
"yaml.load",
"time.sleep"
] | [((1538, 1577), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (1557, 1577), False, 'import logging\n'), ((1584, 1621), 'logging.getLogger', 'logging.getLogger', (['"""son-mano-fakeslm"""'], {}), "('son-mano-fakeslm')\n", (1601, 1621), False, 'import logging\n')... |
import bleach
from bleach_allowlist import markdown_tags, markdown_attrs
from markdown import markdown
def bleached_markdown(text, **kwargs):
"""Try to avoid XSS by bleaching markdown output"""
markdown_rendered = markdown(text, **kwargs)
bleached = bleach.clean(markdown_rendered, markdown_tags, markdown_... | [
"bleach.clean",
"markdown.markdown"
] | [((224, 248), 'markdown.markdown', 'markdown', (['text'], {}), '(text, **kwargs)\n', (232, 248), False, 'from markdown import markdown\n'), ((264, 326), 'bleach.clean', 'bleach.clean', (['markdown_rendered', 'markdown_tags', 'markdown_attrs'], {}), '(markdown_rendered, markdown_tags, markdown_attrs)\n', (276, 326), Fal... |
"""Argument parser for training pipelines."""
import dataclasses
import re
from argparse import ArgumentTypeError
from enum import Enum
from functools import partial
from typing import Any, List, NewType, Optional, Type, Union
from transformers import HfArgumentParser
def none_checker_bool(val: Union[bool, str]) -... | [
"argparse.ArgumentTypeError",
"functools.partial",
"dataclasses.fields",
"typing.NewType"
] | [((1271, 1296), 'typing.NewType', 'NewType', (['"""DataClass"""', 'Any'], {}), "('DataClass', Any)\n", (1278, 1296), False, 'from typing import Any, List, NewType, Optional, Type, Union\n'), ((1329, 1358), 'typing.NewType', 'NewType', (['"""DataClassType"""', 'Any'], {}), "('DataClassType', Any)\n", (1336, 1358), False... |
"""
Django settings for vcard project.
Generated by 'django-admin startproject' using Django 2.1.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# B... | [
"os.path.abspath",
"os.path.join"
] | [((3307, 3338), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""media"""'], {}), "(BASE_DIR, 'media')\n", (3319, 3338), False, 'import os\n'), ((3224, 3256), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""static"""'], {}), "(BASE_DIR, 'static')\n", (3236, 3256), False, 'import os\n'), ((432, 457), 'os.path.abspath... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
__author__ = 'shouke'
import os
import re
class OtherTools:
def __init__(self):
pass
# 批量创建目录
def mkdirs_once_many(self, path):
path = os.path.normpath(path) # 去掉路径最右侧的 \\ 、/
path = path.replace('\\', '/') # 将所有的\\转为/,避免出现转义字符串
... | [
"os.path.split",
"os.path.normpath",
"os.path.isfile",
"os.path.isdir",
"os.mkdir"
] | [((212, 234), 'os.path.normpath', 'os.path.normpath', (['path'], {}), '(path)\n', (228, 234), False, 'import os\n'), ((336, 355), 'os.path.split', 'os.path.split', (['path'], {}), '(path)\n', (349, 355), False, 'import os\n'), ((458, 478), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (472, 478), Fals... |
"""
Invoked via ``python -m id3c.cli``.
"""
if __name__ == "__main__":
from id3c.cli import cli
cli(prog_name = "id3c")
| [
"id3c.cli.cli"
] | [((105, 126), 'id3c.cli.cli', 'cli', ([], {'prog_name': '"""id3c"""'}), "(prog_name='id3c')\n", (108, 126), False, 'from id3c.cli import cli\n')] |
import base64
helpstring = "b64 encode|decode <string>"
minlevel = 1
arguments = ["self", "info", "args"]
def main(connection, info, args) :
"""Decodes/encodes using base64"""
if args[1] == "encode" :
connection.msg(info["channel"], "%s: %s" % (info["sender"], base64.b64encode(" ".join(args[2:]))))
... | [
"base64.b64decode"
] | [((416, 441), 'base64.b64decode', 'base64.b64decode', (['args[2]'], {}), '(args[2])\n', (432, 441), False, 'import base64\n')] |
#!/usr/bin/env python
# Copyright (c) 2016 Hewlett Packard Enterprise Development Company, L.P.
#
# 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... | [
"monasca_analytics.banana.typeck.type_util.String",
"json.dumps",
"monasca_analytics.util.validation_utils.NoSpaceCharacter",
"os.path.isdir",
"monasca_analytics.util.validation_utils.ExistingPath",
"tempfile.NamedTemporaryFile",
"time.time",
"os.path.expanduser"
] | [((1247, 1279), 'os.path.expanduser', 'path.expanduser', (["_config['path']"], {}), "(_config['path'])\n", (1262, 1279), True, 'import os.path as path\n'), ((1295, 1312), 'os.path.isdir', 'path.isdir', (['_path'], {}), '(_path)\n', (1305, 1312), True, 'import os.path as path\n'), ((1457, 1486), 'tempfile.NamedTemporary... |
import unittest
import torch
from tqdm import tqdm
from data.utils import get_db_container, get_db_info
from utils import get_dataloader, get_train_val_test_datasets
dataset_names = (
'acquirevaluedshopperschallenge',
'homecreditdefaultrisk',
'kddcup2014',
)
scalar_encoders = (
'ScalarRobustScalerEn... | [
"data.utils.get_db_info",
"utils.get_dataloader",
"utils.get_train_val_test_datasets",
"tqdm.tqdm",
"data.utils.get_db_container",
"torch.where"
] | [((529, 549), 'data.utils.get_db_info', 'get_db_info', (['db_name'], {}), '(db_name)\n', (540, 549), False, 'from data.utils import get_db_container, get_db_info\n'), ((597, 622), 'data.utils.get_db_container', 'get_db_container', (['db_name'], {}), '(db_name)\n', (613, 622), False, 'from data.utils import get_db_conta... |
# coding: utf-8
from multiprocessing import Pool, Manager, cpu_count
import time
import requests
link_list = []
with open('alexa.txt', 'r') as file:
file_list = file.readlines()
for eachone in file_list:
link = eachone.split('\t')[1]
link = link.replace('\n','')
link_list.append(link)
... | [
"multiprocessing.Manager",
"requests.get",
"time.time",
"multiprocessing.cpu_count"
] | [((328, 339), 'time.time', 'time.time', ([], {}), '()\n', (337, 339), False, 'import time\n'), ((716, 725), 'multiprocessing.Manager', 'Manager', ([], {}), '()\n', (723, 725), False, 'from multiprocessing import Pool, Manager, cpu_count\n'), ((1034, 1045), 'time.time', 'time.time', ([], {}), '()\n', (1043, 1045), False... |
#!/usr/bin/env python3
import argparse
import clang.cindex as clang
from clang.cindex import Index
import sys
import re
class Function:
def __init__(self, name, signature, ret, display, args):
self.name = name
self.signature = signature
self.ret = ret
self.display = display
... | [
"clang.cindex.Config.set_library_file",
"re.match",
"argparse.ArgumentParser",
"clang.cindex.Index.create"
] | [((4590, 4615), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (4613, 4615), False, 'import argparse\n'), ((5646, 5690), 'clang.cindex.Config.set_library_file', 'clang.Config.set_library_file', (['args.clanglib'], {}), '(args.clanglib)\n', (5675, 5690), True, 'import clang.cindex as clang\n'), ... |
from typing import NamedTuple, Tuple, Optional
from .data_types import Vec3, Vec4
from .packet_buffer import PacketBuffer
from .packet_component import PacketComponent, PacketComponentArray
from .version import Version
class MarkerSetDescription(PacketComponent, NamedTuple(
"MarkerSetDescriptionFields",... | [
"typing.NamedTuple"
] | [((274, 370), 'typing.NamedTuple', 'NamedTuple', (['"""MarkerSetDescriptionFields"""', "(('name', str), ('marker_names', Tuple[str, ...]))"], {}), "('MarkerSetDescriptionFields', (('name', str), ('marker_names',\n Tuple[str, ...])))\n", (284, 370), False, 'from typing import NamedTuple, Tuple, Optional\n'), ((797, 9... |
import cv2
import numpy as np
import glob
def comparator(result, groundTruth):
"""
Compares the background/foreground of 2 grayscale images as states in
http://jacarini.dinf.usherbrooke.ca/datasetOverview/
but with some simplification: the shadows and unknown are considered as good classification in e... | [
"cv2.createBackgroundSubtractorMOG2",
"numpy.abs",
"cv2.imwrite",
"numpy.bitwise_not",
"numpy.ones",
"cv2.threshold",
"cv2.bgsegm.createBackgroundSubtractorMOG",
"cv2.imshow",
"cv2.morphologyEx",
"numpy.zeros",
"numpy.bitwise_and",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor... | [((477, 517), 'cv2.cvtColor', 'cv2.cvtColor', (['result', 'cv2.COLOR_BGR2GRAY'], {}), '(result, cv2.COLOR_BGR2GRAY)\n', (489, 517), False, 'import cv2\n'), ((536, 581), 'cv2.cvtColor', 'cv2.cvtColor', (['groundTruth', 'cv2.COLOR_BGR2GRAY'], {}), '(groundTruth, cv2.COLOR_BGR2GRAY)\n', (548, 581), False, 'import cv2\n'),... |
"""
Here is the Auth Factory defined, this factory will
generate a knox token.
"""
__all__ = ("AuthFactory",)
from factory import DjangoModelFactory, SubFactory
from rest_multi_factor.utils import get_token_model
from tests.utils import get_token_object, get_token_string
from rest_multi_factor.factories.user import... | [
"factory.SubFactory",
"tests.utils.get_token_object",
"rest_multi_factor.utils.get_token_model",
"tests.utils.get_token_string"
] | [((494, 517), 'factory.SubFactory', 'SubFactory', (['UserFactory'], {}), '(UserFactory)\n', (504, 517), False, 'from factory import DjangoModelFactory, SubFactory\n'), ((464, 481), 'rest_multi_factor.utils.get_token_model', 'get_token_model', ([], {}), '()\n', (479, 481), False, 'from rest_multi_factor.utils import get... |
from flask import Blueprint, render_template, request, flash, redirect, url_for
from .models import User
from werkzeug.security import generate_password_hash, check_password_hash
from . import db
from flask_login import login_user, login_required, logout_user, current_user
auth = Blueprint('auth', __name__)
@... | [
"flask.render_template",
"flask.flash",
"flask_login.login_user",
"flask_login.logout_user",
"flask.url_for",
"flask.request.form.get",
"werkzeug.security.generate_password_hash",
"flask.Blueprint",
"werkzeug.security.check_password_hash"
] | [((288, 315), 'flask.Blueprint', 'Blueprint', (['"""auth"""', '__name__'], {}), "('auth', __name__)\n", (297, 315), False, 'from flask import Blueprint, render_template, request, flash, redirect, url_for\n'), ((1008, 1056), 'flask.render_template', 'render_template', (['"""login.html"""'], {'user': 'current_user'}), "(... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import re
from core import perf_benchmark
from telemetry import benchmark
from telemetry.timeline import tracing_category_filter
from telemetry.web_perf im... | [
"telemetry.timeline.tracing_category_filter.TracingCategoryFilter",
"re.compile",
"telemetry.web_perf.timeline_based_measurement.Options",
"telemetry.benchmark.Enabled"
] | [((1223, 1251), 'telemetry.benchmark.Enabled', 'benchmark.Enabled', (['"""android"""'], {}), "('android')\n", (1240, 1251), False, 'from telemetry import benchmark\n'), ((1932, 1960), 'telemetry.benchmark.Enabled', 'benchmark.Enabled', (['"""android"""'], {}), "('android')\n", (1949, 1960), False, 'from telemetry impor... |
# Generated by Django 3.1.11 on 2021-05-17 03:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('actors', '0002_auto_20210517_0212'),
]
operations = [
migrations.AlterField(
model_name='actor',
name='bio',
... | [
"django.db.models.TextField",
"django.db.models.CharField"
] | [((332, 380), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'verbose_name': '"""Bio"""'}), "(blank=True, verbose_name='Bio')\n", (348, 380), False, 'from django.db import migrations, models\n'), ((505, 606), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_len... |
import torch
import math
import numpy as np
from matplotlib import path
import pdb
class BoxSampler(object):
def __init__(self,
RoI_number=1,
IoU_bin_bases=torch.tensor([0.73,0.12,0.15,0.05,0], dtype=torch.float),
IoU_weights=torch.tensor([0.5,0.6,0.7,0.8,0.9], ... | [
"torch.cuda.LongTensor",
"torch.unique",
"math.ceil",
"torch.multinomial",
"torch.cuda.FloatTensor",
"torch.rand",
"torch.max",
"torch.min",
"torch.ceil",
"torch.tensor",
"torch.cat",
"torch.arange",
"torch.sum",
"torch.cuda.ByteTensor",
"numpy.random.uniform",
"torch.clamp"
] | [((197, 257), 'torch.tensor', 'torch.tensor', (['[0.73, 0.12, 0.15, 0.05, 0]'], {'dtype': 'torch.float'}), '([0.73, 0.12, 0.15, 0.05, 0], dtype=torch.float)\n', (209, 257), False, 'import torch\n'), ((284, 342), 'torch.tensor', 'torch.tensor', (['[0.5, 0.6, 0.7, 0.8, 0.9]'], {'dtype': 'torch.float'}), '([0.5, 0.6, 0.7,... |
from lib import common
from lib.handlers import HandlerParams
HELP_MESSAGE = """
Lunch Bot Help
Available Commands:
`help` Displays all available commands that Lunch Bot understands
`make-plan [restaurant] [time]` Creates a lunch plan for a given place and time. [restaurant] and [time] must not \
contain any space... | [
"lib.common.send_reply"
] | [((1222, 1284), 'lib.common.send_reply', 'common.send_reply', (['params.client', 'params.message', 'HELP_MESSAGE'], {}), '(params.client, params.message, HELP_MESSAGE)\n', (1239, 1284), False, 'from lib import common\n')] |
from flask_sqlalchemy import SQLAlchemy
from flask_security import UserMixin, RoleMixin, SQLAlchemyUserDatastore, Security
from flask_dance.consumer.storage.sqla import OAuthConsumerMixin
db = SQLAlchemy()
roles_users = db.Table(
"roles_users",
db.Column("user_id", db.Integer(), db.ForeignKey("user.id")),
... | [
"flask_sqlalchemy.SQLAlchemy",
"flask_security.SQLAlchemyUserDatastore",
"flask_security.Security"
] | [((195, 207), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (205, 207), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((1213, 1252), 'flask_security.SQLAlchemyUserDatastore', 'SQLAlchemyUserDatastore', (['db', 'User', 'Role'], {}), '(db, User, Role)\n', (1236, 1252), False, 'from flask_security ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 9 17:02:59 2018
@author: bruce
compared with version 1.6.4
the update is from correlation coefficient
"""
import pandas as pd
import numpy as np
from scipy import fftpack
from scipy import signal
import matplotlib.pyplot as plt
from matplotlib.co... | [
"scipy.signal.detrend",
"numpy.array",
"scipy.fftpack.fft",
"numpy.arange",
"pandas.read_pickle",
"numpy.fft.fft",
"numpy.asarray",
"pandas.concat",
"pandas.DataFrame",
"scipy.signal.kaiser",
"numpy.abs",
"scipy.signal.hamming",
"matplotlib.pyplot.title",
"matplotlib.colors.LinearSegmented... | [((10135, 10210), 'pandas.read_pickle', 'pd.read_pickle', (['"""/home/bruce/Dropbox/4.Project/4.Code for Linux/df_EFR.pkl"""'], {}), "('/home/bruce/Dropbox/4.Project/4.Code for Linux/df_EFR.pkl')\n", (10149, 10210), True, 'import pandas as pd\n'), ((10366, 10380), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (... |
"""
MouseRobotEKF 自己实现的一个EKF算法,
此算法中把鼠标作为机器人控制信号,为机器人提供运动需要的加速度和方向向量: M_vector,(加速度就用鼠标的加速度a,方向也是鼠标运动的方向);
同时,鼠标的当前位置和当前速度,也作为机器人的测量传感器使用Z_k(P,V)
Note: 以下: 当前时刻: cur or k-1 下一时刻: next or k
1.状态向量定义:
机器人根据鼠标的运动产生自己的位置和速度两个状态向量state_x(Position(x,y),Velocity(x,y)),即: X(P,V);
估计值向量: X= [ Px
Vx
... | [
"math.pow",
"tinyekf.EKF.__init__",
"numpy.array",
"numpy.eye"
] | [((3162, 3204), 'tinyekf.EKF.__init__', 'EKF.__init__', (['self', 'n', 'm', 'pval', 'qval', 'rval'], {}), '(self, n, m, pval, qval, rval)\n', (3174, 3204), False, 'from tinyekf import EKF\n'), ((3510, 3604), 'numpy.array', 'np.array', (['[(1, self.interval, 0, 0), (0, 1, 0, 0), (0, 0, 1, self.interval), (0, 0, 0, 1)\n ... |
#!/usr/bin/env python
# coding: utf-8
import logging
import sys
import time
import datetime as dt
from selenium.webdriver.common.keys import Keys
from core.types import Tweet
from core.util.selenium import TweetFinder
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
log = logging.getLogger("scraper")
# E... | [
"logging.basicConfig",
"logging.getLogger",
"time.sleep",
"datetime.date.fromtimestamp",
"core.util.selenium.TweetFinder",
"time.time"
] | [((222, 280), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stderr', 'level': 'logging.INFO'}), '(stream=sys.stderr, level=logging.INFO)\n', (241, 280), False, 'import logging\n'), ((287, 315), 'logging.getLogger', 'logging.getLogger', (['"""scraper"""'], {}), "('scraper')\n", (304, 315), False, 'i... |
"""
This file defines the core research contribution
"""
import matplotlib
matplotlib.use('Agg')
import math
import re
import torch
from torch import nn
from models.encoders import psp_encoders
from models.encoders import cond_mappers
from models.stylegan2.model import Generator
from configs.paths_config im... | [
"models.encoders.psp_encoders.GradualStyleEncoder",
"matplotlib.use",
"torch.load",
"models.encoders.psp_encoders.BackboneEncoderUsingLastLayerIntoWPlus",
"os.path.join",
"models.encoders.psp_encoders.TwoChannelCLIPMapper",
"os.path.split",
"math.log",
"torch.cat",
"models.encoders.psp_encoders.St... | [((79, 100), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (93, 100), False, 'import matplotlib\n'), ((992, 1032), 'models.stylegan2.model.Generator', 'Generator', (['self.opts.output_size', '(512)', '(8)'], {}), '(self.opts.output_size, 512, 8)\n', (1001, 1032), False, 'from models.stylegan2.mo... |
import os
from pkg_resources import parse_version
from pip.backwardcompat import urllib
from pip.req import InstallRequirement
from pip.index import PackageFinder
from pip.exceptions import BestVersionAlreadyInstalled, DistributionNotFound
from tests.path import Path
from tests.test_pip import here, path_to_url
from no... | [
"mock.patch",
"os.path.join",
"nose.tools.assert_raises",
"pkg_resources.parse_version",
"pip.req.InstallRequirement.from_line",
"pip.index.PackageFinder"
] | [((2958, 2995), 'mock.patch', 'patch', (['"""pip.pep425tags.get_supported"""'], {}), "('pip.pep425tags.get_supported')\n", (2963, 2995), False, 'from mock import Mock, patch\n'), ((415, 445), 'os.path.join', 'os.path.join', (['here', '"""packages"""'], {}), "(here, 'packages')\n", (427, 445), False, 'import os\n'), ((4... |
"""coBib - the Console Bibliography.
.. include:: ../../README.md
"""
import subprocess
from pathlib import Path
__version__ = "3.5.2"
if (Path(__file__).parent.parent.parent / ".git").exists():
# if installed from source, append HEAD commit SHA to version info as metadata
with subprocess.Popen(["git", "rev... | [
"subprocess.Popen",
"pathlib.Path"
] | [((291, 361), 'subprocess.Popen', 'subprocess.Popen', (["['git', 'rev-parse', 'HEAD']"], {'stdout': 'subprocess.PIPE'}), "(['git', 'rev-parse', 'HEAD'], stdout=subprocess.PIPE)\n", (307, 361), False, 'import subprocess\n'), ((143, 157), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (147, 157), False, 'fro... |
from math import gcd, ceil, sqrt
from numpy import around, int32, zeros
from numpy.random import RandomState
from polymod import Poly
def isprime(n):
"""
>>> isprime(1109)
True
>>> isprime(10**6)
False
"""
# this is slow and basic, but saves the sympy dependency
# alternatively, fro... | [
"math.gcd",
"polymod.Poly.monomial",
"polymod.Poly",
"math.sqrt",
"numpy.zeros",
"numpy.around",
"numpy.random.RandomState"
] | [((1295, 1308), 'numpy.random.RandomState', 'RandomState', ([], {}), '()\n', (1306, 1308), False, 'from numpy.random import RandomState\n'), ((2080, 2115), 'numpy.zeros', 'zeros', (['(modulus.deg + 1)'], {'dtype': 'int32'}), '(modulus.deg + 1, dtype=int32)\n', (2085, 2115), False, 'from numpy import around, int32, zero... |
import os
import sys
# list of density functionals
dft_list = ["wB97X-D", "M06-2X", "MN15", "REVM11","TPSS"]
# optionally, read this in from a text file where the functionals
# are separated by space
#with open("dft_list.txt", "r") as dft_file_hnd:
# dft_list=dft_file_hnd.read().replace("\n","").replace("\r","").... | [
"os.path.isfile",
"os.system",
"sys.exit"
] | [((362, 392), 'os.path.isfile', 'os.path.isfile', (['"""template.inp"""'], {}), "('template.inp')\n", (376, 392), False, 'import os\n'), ((537, 547), 'sys.exit', 'sys.exit', ([], {}), '()\n', (545, 547), False, 'import sys\n'), ((810, 839), 'os.path.isfile', 'os.path.isfile', (['new_file_name'], {}), '(new_file_name)\n... |
# Generated by Django 3.1.1 on 2020-11-28 15:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('visitors', '0017_auto_20201127_0024'),
]
operations = [
migrations.AlterField(
model_name='visitor',
name='date',
... | [
"django.db.models.DateField"
] | [((336, 378), 'django.db.models.DateField', 'models.DateField', ([], {'db_index': '(True)', 'null': '(True)'}), '(db_index=True, null=True)\n', (352, 378), False, 'from django.db import migrations, models\n')] |
from os import path
from tinydb import Query, TinyDB
from nazurin.config import DATA_DIR
class Local(object):
"""Local database driver using TinyDB."""
def collection(self, key):
self.db = TinyDB(path.join(DATA_DIR, key + '.json'))
return self
def document(self, key):
self._key =... | [
"tinydb.Query",
"os.path.join"
] | [((390, 397), 'tinydb.Query', 'Query', ([], {}), '()\n', (395, 397), False, 'from tinydb import Query, TinyDB\n'), ((719, 726), 'tinydb.Query', 'Query', ([], {}), '()\n', (724, 726), False, 'from tinydb import Query, TinyDB\n'), ((838, 845), 'tinydb.Query', 'Query', ([], {}), '()\n', (843, 845), False, 'from tinydb imp... |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import json
import logging
from dataclasses import dataclass
import ijson
from pants.backend.go.module import (
DownloadedExternalModule,
Downl... | [
"logging.getLogger",
"pants.engine.fs.AddPrefix",
"json.loads",
"pants.engine.fs.FileContent",
"pants.backend.go.module.DownloadExternalModuleRequest",
"pants.backend.go.module.FindNearestGoModuleRequest",
"pants.engine.fs.MergeDigests",
"dataclasses.dataclass",
"pants.util.ordered_set.OrderedSet",
... | [((1503, 1530), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1520, 1530), False, 'import logging\n'), ((1767, 1789), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (1776, 1789), False, 'from dataclasses import dataclass\n'), ((7231, 7253), 'datacla... |