code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# 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... | [
"functools.partial",
"tensorflow.python.keras.backend.get_graph",
"tensorflow.keras.utils.register_keras_serializable",
"tensorflow.reduce_sum",
"tensorflow.keras.initializers.constant",
"tensorflow.add_n",
"tensorflow.keras.layers.BatchNormalization",
"itertools.count",
"logging.info",
"xl_tensor... | [((1299, 1357), 'tensorflow.keras.utils.register_keras_serializable', 'tf.keras.utils.register_keras_serializable', ([], {'package': '"""Text"""'}), "(package='Text')\n", (1341, 1357), True, 'import tensorflow as tf\n'), ((2210, 2231), 'tensorflow.reduce_sum', 'tf.reduce_sum', (['self.w'], {}), '(self.w)\n', (2223, 223... |
import os
import secrets
def create_env_file():
prompt = "> "
print("POSTGRES_USER= ?")
POSTGRES_USER = input(prompt)
print("POSTGRES_PW= ?")
POSTGRES_PW = input(prompt)
print("DATABASE= ?")
DATABASE = input(prompt)
print("REDIS_PW= ?")
REDIS_PW = input(prompt)
SECRET_KEY... | [
"secrets.token_hex",
"os.path.join"
] | [((323, 344), 'secrets.token_hex', 'secrets.token_hex', (['(32)'], {}), '(32)\n', (340, 344), False, 'import secrets\n'), ((362, 383), 'secrets.token_hex', 'secrets.token_hex', (['(32)'], {}), '(32)\n', (379, 383), False, 'import secrets\n'), ((819, 851), 'os.path.join', 'os.path.join', (['"""../../.."""', '""".env"""'... |
from unittest import TestCase
from copy import copy
from pyprocessing.math import PVector
class PyProcessingMathTest(TestCase):
def setUp(self):
pass
def test_pvector_instanciation(self):
'''
Test instanciating a vector
'''
vector = PVector(0, 0, 0)
self.asser... | [
"pyprocessing.math.PVector.add",
"pyprocessing.math.PVector",
"pyprocessing.math.PVector.sub",
"copy.copy"
] | [((285, 301), 'pyprocessing.math.PVector', 'PVector', (['(0)', '(0)', '(0)'], {}), '(0, 0, 0)\n', (292, 301), False, 'from pyprocessing.math import PVector\n'), ((475, 491), 'pyprocessing.math.PVector', 'PVector', (['(0)', '(1)', '(0)'], {}), '(0, 1, 0)\n', (482, 491), False, 'from pyprocessing.math import PVector\n'),... |
import mysql.connector
import pandas as pd
from sqlalchemy import create_engine
hostname="localhost"
dbname="DWM"
uname="root"
pwd="<PASSWORD>"
engine = create_engine("mysql+pymysql://{user}:{pw}@{host}/{db}".format(host=hostname, db=dbname, user=uname, pw=pwd))
dataset = pd.read_csv('Student_details.csv')
dataset | [
"pandas.read_csv"
] | [((273, 307), 'pandas.read_csv', 'pd.read_csv', (['"""Student_details.csv"""'], {}), "('Student_details.csv')\n", (284, 307), True, 'import pandas as pd\n')] |
from pipeline_monitor import prometheus_monitor as monitor
_labels= {'a_label_key':'a_label_value'}
@monitor(labels=_labels, name="test_monitor")
def test_log_inputs_and_outputs(arg1: int, arg2: int):
return arg1 + arg2
test_log_inputs_and_outputs(4, 5)
| [
"pipeline_monitor.prometheus_monitor"
] | [((103, 147), 'pipeline_monitor.prometheus_monitor', 'monitor', ([], {'labels': '_labels', 'name': '"""test_monitor"""'}), "(labels=_labels, name='test_monitor')\n", (110, 147), True, 'from pipeline_monitor import prometheus_monitor as monitor\n')] |
from django import forms
class AnswerQuestion(forms.Form):
answer = forms.IntegerField()
| [
"django.forms.IntegerField"
] | [((73, 93), 'django.forms.IntegerField', 'forms.IntegerField', ([], {}), '()\n', (91, 93), False, 'from django import forms\n')] |
import networkx as nx
from scipy.io import loadmat
x = loadmat(dataset)
dataset='blogcatalog.mat'
x = loadmat(dataset)
x = x['network']
G = nx.from_scipy_sparse_matrix(x)
del x
f=open("BC_DW.edgelist",'wb')
nx.write_edgelist(G, f)
| [
"networkx.from_scipy_sparse_matrix",
"networkx.write_edgelist",
"scipy.io.loadmat"
] | [((55, 71), 'scipy.io.loadmat', 'loadmat', (['dataset'], {}), '(dataset)\n', (62, 71), False, 'from scipy.io import loadmat\n'), ((102, 118), 'scipy.io.loadmat', 'loadmat', (['dataset'], {}), '(dataset)\n', (109, 118), False, 'from scipy.io import loadmat\n'), ((140, 170), 'networkx.from_scipy_sparse_matrix', 'nx.from_... |
from pyinstrument import Profiler
from functools import wraps
def profile(func):
@wraps(func)
def wrapper(*args, **kwargs):
profiler = Profiler()
profiler.start()
results = func(*args, **kwargs)
profiler.stop()
profiler.output_text()
return results
return wrapper
| [
"pyinstrument.Profiler",
"functools.wraps"
] | [((86, 97), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (91, 97), False, 'from functools import wraps\n'), ((145, 155), 'pyinstrument.Profiler', 'Profiler', ([], {}), '()\n', (153, 155), False, 'from pyinstrument import Profiler\n')] |
"""A lab app that runs a sub process for a demo or a test."""
import sys
from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin
from tornado.ioloop import IOLoop
from .handlers import LabConfig, add_handlers
from .process import Process
class ProcessApp(ExtensionAppJinjaMixin, LabConf... | [
"tornado.ioloop.IOLoop.current",
"sys.exit"
] | [((793, 809), 'tornado.ioloop.IOLoop.current', 'IOLoop.current', ([], {}), '()\n', (807, 809), False, 'from tornado.ioloop import IOLoop\n'), ((1105, 1121), 'tornado.ioloop.IOLoop.current', 'IOLoop.current', ([], {}), '()\n', (1119, 1121), False, 'from tornado.ioloop import IOLoop\n'), ((1372, 1383), 'sys.exit', 'sys.e... |
from random import random
import sys
def pie(times=100):
incircle = 0
for _ in range(times):
x = random()
y = random()
if x * x + y * y < 1:
incircle += 1
return incircle / times * 4
if __name__ == "__main__":
with open(sys.argv[1], "r") as f:
times = f.re... | [
"random.random"
] | [((115, 123), 'random.random', 'random', ([], {}), '()\n', (121, 123), False, 'from random import random\n'), ((136, 144), 'random.random', 'random', ([], {}), '()\n', (142, 144), False, 'from random import random\n')] |
import numpy as np
from autotabular.pipeline.components.base import AutotabularClassificationAlgorithm
from autotabular.pipeline.constants import DENSE, PREDICTIONS, UNSIGNED_DATA
from ConfigSpace.configuration_space import ConfigurationSpace
class GaussianNB(AutotabularClassificationAlgorithm):
def __init__(sel... | [
"ConfigSpace.configuration_space.ConfigurationSpace"
] | [((1843, 1863), 'ConfigSpace.configuration_space.ConfigurationSpace', 'ConfigurationSpace', ([], {}), '()\n', (1861, 1863), False, 'from ConfigSpace.configuration_space import ConfigurationSpace\n')] |
# SPDX-License-Identifier: BSD-3-Clause
"""Test result storage and processing functionality."""
from pytest import fixture, raises
from softfab.resultlib import ResultStorage
@fixture
def resultStorage(tmp_path):
return ResultStorage(tmp_path)
# Test data that can be used by various test cases:
TASK_NAME = 't... | [
"softfab.resultlib.ResultStorage",
"pytest.raises"
] | [((229, 252), 'softfab.resultlib.ResultStorage', 'ResultStorage', (['tmp_path'], {}), '(tmp_path)\n', (242, 252), False, 'from softfab.resultlib import ResultStorage\n'), ((1311, 1327), 'pytest.raises', 'raises', (['KeyError'], {}), '(KeyError)\n', (1317, 1327), False, 'from pytest import fixture, raises\n')] |
# coding: utf-8
import os
def fileinode(filename):
return os.stat(filename).st_ino
if __name__ == '__main__':
print(fileinode("test.txt"))
| [
"os.stat"
] | [((64, 81), 'os.stat', 'os.stat', (['filename'], {}), '(filename)\n', (71, 81), False, 'import os\n')] |
from django.test import TestCase
from channels.models import Channel
from talks.models import Talk
# Create your tests here.
class TalkModelTests(TestCase):
def setUp(self):
chanel_1 = Channel.objects.create(code='1', title='channel title 1')
Talk.objects.create(code='1', title='talk title 1', ... | [
"talks.models.Talk.objects.create",
"talks.models.Talk.objects.get",
"channels.models.Channel.objects.create"
] | [((202, 259), 'channels.models.Channel.objects.create', 'Channel.objects.create', ([], {'code': '"""1"""', 'title': '"""channel title 1"""'}), "(code='1', title='channel title 1')\n", (224, 259), False, 'from channels.models import Channel\n'), ((268, 337), 'talks.models.Talk.objects.create', 'Talk.objects.create', ([]... |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... | [
"json.dump",
"json.load",
"logging.basicConfig",
"pathlib.Path",
"logging.getLogger"
] | [((575, 602), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (592, 602), False, 'import logging\n'), ((1300, 1336), 'pathlib.Path', 'Path', (['"""package_service_mapping.json"""'], {}), "('package_service_mapping.json')\n", (1304, 1336), False, 'from pathlib import Path\n'), ((1835, 1856)... |
import types
from collections import OrderedDict
import apiclient
import pandas as pd
from datasheets import exceptions, helpers
class Tab(object):
def __init__(self, tabname, workbook, drive_svc, sheets_svc):
"""Create a datasheets.Tab instance of an existing Google Sheets tab.
This class in n... | [
"pandas.DataFrame",
"datasheets.helpers._convert_nan_and_datelike_values",
"datasheets.helpers._make_list_of_lists",
"datasheets.helpers._find_max_nonempty_row",
"datasheets.helpers.convert_cell_index_to_label",
"datasheets.helpers._resize_row"
] | [((10510, 10550), 'datasheets.helpers._make_list_of_lists', 'helpers._make_list_of_lists', (['data', 'index'], {}), '(data, index)\n', (10537, 10550), False, 'from datasheets import exceptions, helpers\n'), ((10568, 10616), 'datasheets.helpers._convert_nan_and_datelike_values', 'helpers._convert_nan_and_datelike_values... |
#pylint: disable=logging-fstring-interpolation
#Standart library imports
import subprocess
import os
import re
import platform
from typing import Tuple,Any
from pathlib import Path
import shutil
# Third party imports
from bs4 import BeautifulSoup
import wget
# Selenium imports
from selenium import webdriver
from sele... | [
"selenium.webdriver.Opera",
"subprocess.Popen",
"selenium_driver_updater.util.logger.logger.error",
"os.uname",
"os.system",
"platform.system",
"wget.download",
"pathlib.Path",
"re.findall",
"shutil.move",
"bs4.BeautifulSoup",
"shutil.rmtree",
"selenium_driver_updater.util.logger.logger.info... | [((4454, 4493), 'bs4.BeautifulSoup', 'BeautifulSoup', (['json_data', '"""html.parser"""'], {}), "(json_data, 'html.parser')\n", (4467, 4493), False, 'from bs4 import BeautifulSoup\n'), ((4517, 4534), 'platform.system', 'platform.system', ([], {}), '()\n', (4532, 4534), False, 'import platform\n'), ((5185, 5250), 'selen... |
import urllib.request
import yaml
import os
import json
import time
import logging
import requests
logger = logging.getLogger('IR')
_FETCH_CONFIG_RETRIES = 5
# Defines a process-wide instance of the config.
# Alternative is passing the configuration through the entire stack, which is feasible,
# but we consider that ... | [
"os.getcwd",
"json.dumps",
"time.time",
"os.environ.get",
"yaml.safe_load",
"requests.get",
"logging.getLogger"
] | [((109, 132), 'logging.getLogger', 'logging.getLogger', (['"""IR"""'], {}), "('IR')\n", (126, 132), False, 'import logging\n'), ((2529, 2582), 'os.environ.get', 'os.environ.get', (['"""ELASTICSEARCH_HOST"""', '"""elasticsearch"""'], {}), "('ELASTICSEARCH_HOST', 'elasticsearch')\n", (2543, 2582), False, 'import os\n'), ... |
#
# File:
# streamline1.py
#
# Synopsis:
# Draws streamlines on a map over water only.
#
# Category:
# Streamlines on a map.
#
# Author:
# <NAME>
#
# Date of original publication:
# December, 2004
#
# Description:
# This example draws streamlines over water on a map using a
# Cylindrical Eq... | [
"Ngl.open_wks",
"Ngl.end",
"Ngl.frame",
"Ngl.streamline_map",
"Ngl.polyline",
"Ngl.pynglpath",
"Ngl.add_cyclic",
"Ngl.Resources",
"Ngl.text_ndc"
] | [((1137, 1174), 'Ngl.open_wks', 'Ngl.open_wks', (['wks_type', '"""streamline1"""'], {}), "(wks_type, 'streamline1')\n", (1149, 1174), False, 'import Ngl\n'), ((1384, 1399), 'Ngl.Resources', 'Ngl.Resources', ([], {}), '()\n', (1397, 1399), False, 'import Ngl\n'), ((1985, 2051), 'Ngl.streamline_map', 'Ngl.streamline_map'... |
from setuptools import find_packages, setup
setup(
name='grpcping',
version='0.1.0',
packages=find_packages(),
include_package_data=True,
url='https://github.com/hashimom/grpcping',
entry_points={
"console_scripts": [
"grpcping = grpcping.ping:main",
]
},
lic... | [
"setuptools.find_packages"
] | [((107, 122), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (120, 122), False, 'from setuptools import find_packages, setup\n')] |
from django.core.serializers import serialize
from django.core.serializers.json import DjangoJSONEncoder
from django.db.models.query import QuerySet
from django.utils.safestring import mark_safe
from django.template import Library
import json
register = Library()
@register.filter
def jsonify(object):
return json... | [
"django.template.Library",
"json.dumps"
] | [((255, 264), 'django.template.Library', 'Library', ([], {}), '()\n', (262, 264), False, 'from django.template import Library\n'), ((316, 357), 'json.dumps', 'json.dumps', (['object'], {'cls': 'DjangoJSONEncoder'}), '(object, cls=DjangoJSONEncoder)\n', (326, 357), False, 'import json\n')] |
# Implementation from https://github.com/nmhkahn/CARN-pytorch
# Fast, Accurate, and Lightweight Super-Resolution with Cascading Residual Network
# https://arxiv.org/abs/1803.08664
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.hub import load_state_dict_from_url
__all__ = [ ... | [
"torch.hub.load_state_dict_from_url",
"torch.nn.ReLU",
"torch.eye",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.cat",
"torch.Tensor",
"torch.cuda.is_available",
"torch.nn.functional.relu",
"torch.device",
"math.log",
"torch.nn.PixelShuffle"
] | [((789, 813), 'torch.nn.Conv2d', 'nn.Conv2d', (['(3)', '(3)', '(1)', '(1)', '(0)'], {}), '(3, 3, 1, 1, 0)\n', (798, 813), True, 'import torch.nn as nn\n'), ((914, 937), 'torch.Tensor', 'torch.Tensor', (['[r, g, b]'], {}), '([r, g, b])\n', (926, 937), False, 'import torch\n'), ((1964, 1979), 'torch.nn.functional.relu', ... |
# Author: <NAME>
# Date: 05 April 2020
# Project: Challenger
import os, json, sys, subprocess
rmf = ['bin', 'etc', 'include', 'lib', 'lib64', 'pyvenv.cfg', 'share']
msk = ['challenger', 'package', 'elementtree', 'ffprobe']
def packages_from_project(path):
try:
cmd = 'pipreqs --force --no-pin --print... | [
"os.remove",
"os.getcwd",
"os.path.isdir",
"os.path.exists",
"os.system",
"datetime.datetime.now",
"os.listdir"
] | [((1227, 1247), 'os.path.exists', 'os.path.exists', (['file'], {}), '(file)\n', (1241, 1247), False, 'import os, json, sys, subprocess\n'), ((1376, 1396), 'os.path.exists', 'os.path.exists', (['file'], {}), '(file)\n', (1390, 1396), False, 'import os, json, sys, subprocess\n'), ((1937, 1957), 'os.path.exists', 'os.path... |
import collections
import math
import numpy as np
import mlpy
class TermFrequencyAnalyzer(object):
def __init__(self, *documents):
self.idf = self.compute_idf(*documents)
def compute_idf(self, *documents):
# document frequency
df = collections.defaultdict(int)
for tokens in d... | [
"collections.defaultdict",
"numpy.zeros",
"mlpy.lcs_std"
] | [((268, 296), 'collections.defaultdict', 'collections.defaultdict', (['int'], {}), '(int)\n', (291, 296), False, 'import collections\n'), ((1437, 1455), 'mlpy.lcs_std', 'mlpy.lcs_std', (['a', 'b'], {}), '(a, b)\n', (1449, 1455), False, 'import mlpy\n'), ((1660, 1680), 'numpy.zeros', 'np.zeros', (['(2, N + 1)'], {}), '(... |
"""Custom Forms"""
from django import forms
from django.db.models import (
CharField)
class CustomForm(forms.ModelForm):
"""Sample Custom form"""
sample_id = CharField("Sample Id:", max_length=200, editable=False)
| [
"django.db.models.CharField"
] | [((173, 228), 'django.db.models.CharField', 'CharField', (['"""Sample Id:"""'], {'max_length': '(200)', 'editable': '(False)'}), "('Sample Id:', max_length=200, editable=False)\n", (182, 228), False, 'from django.db.models import CharField\n')] |
from field_types import field_type, field_regex_pattern
class Phone(field_type.FieldType):
name = "PHONE_NUMBER"
context = ["phone", "number", "telephone", "cell", "mobile", "call"]
patterns = []
# Strong pattern: e.g., (425) 882 8080, 425 882-8080, 425.882.8080
pattern = field_regex_pattern.Rege... | [
"field_types.field_regex_pattern.RegexFieldPattern"
] | [((296, 335), 'field_types.field_regex_pattern.RegexFieldPattern', 'field_regex_pattern.RegexFieldPattern', ([], {}), '()\n', (333, 335), False, 'from field_types import field_type, field_regex_pattern\n'), ((583, 622), 'field_types.field_regex_pattern.RegexFieldPattern', 'field_regex_pattern.RegexFieldPattern', ([], {... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-03-27 05:53
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depende... | [
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.IntegerField"
] | [((292, 349), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (323, 349), False, 'from django.db import migrations, models\n'), ((1792, 1835), 'django.db.models.CharField', 'models.CharField', ([], {'default': '""""""', ... |
from tox._cmdline import main
main()
| [
"tox._cmdline.main"
] | [((31, 37), 'tox._cmdline.main', 'main', ([], {}), '()\n', (35, 37), False, 'from tox._cmdline import main\n')] |
"""
digitalarchive.models
The module provides documented models and an ORM for interacting with the DA API.
"""
from __future__ import annotations
# Standard Library
import dataclasses
import json
import logging
import copy
from datetime import datetime, date
from typing import List, Any, Optional, Union, Dict, Class... | [
"logging.error",
"logging.warning",
"copy.copy",
"datetime.date",
"digitalarchive.matching.ResourceMatcher",
"datetime.date.today",
"datetime.date.fromisoformat",
"pydantic.validator",
"digitalarchive.api.get",
"digitalarchive.exceptions.APIServerError",
"digitalarchive.api.get_date_range",
"d... | [((10121, 10140), 'pydantic.validator', 'validator', (['"""parent"""'], {}), "('parent')\n", (10130, 10140), False, 'from pydantic import validator\n'), ((19770, 19809), 'pydantic.validator', 'validator', (['"""date_range_start"""'], {'pre': '(True)'}), "('date_range_start', pre=True)\n", (19779, 19809), False, 'from p... |
from pyramid import interfaces
from zope import interface
from h.auth.policy._identity_base import IdentityBasedPolicy
from h.security import Identity
@interface.implementer(interfaces.IAuthenticationPolicy)
class TokenAuthenticationPolicy(IdentityBasedPolicy):
"""
A bearer token authentication policy.
... | [
"zope.interface.implementer",
"h.security.Identity"
] | [((155, 210), 'zope.interface.implementer', 'interface.implementer', (['interfaces.IAuthenticationPolicy'], {}), '(interfaces.IAuthenticationPolicy)\n', (176, 210), False, 'from zope import interface\n'), ((1273, 1292), 'h.security.Identity', 'Identity', ([], {'user': 'user'}), '(user=user)\n', (1281, 1292), False, 'fr... |
import os, glob, sys
from turbo_seti.find_event.plot_dat import plot_dat
from turbo_seti import find_event as find
import numpy as np
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--dir', default=os.getcwd())
parser.add_argument('--minHit', type=float, default=None... | [
"os.mkdir",
"turbo_seti.find_event.read_dat",
"argparse.ArgumentParser",
"os.getcwd",
"os.path.exists",
"glob.glob",
"numpy.round",
"turbo_seti.find_event.plot_dat.plot_dat"
] | [((180, 205), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (203, 205), False, 'import argparse\n'), ((453, 478), 'glob.glob', 'glob.glob', (["(path + '*.dat')"], {}), "(path + '*.dat')\n", (462, 478), False, 'import os, glob, sys\n'), ((1166, 1186), 'numpy.round', 'np.round', (['min_hit', '(2... |
"""
=====
sender.py
=====
Import data from server.
============================
"""
from flask import Flask, jsonify
from flask import make_response
from config import sender_links
app = Flask(__name__)
@app.errorhandler(404)
def not_found(error):
return make_response(jsonify({'error': 'Not found'}), 404)
... | [
"flask.jsonify",
"flask.Flask"
] | [((192, 207), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (197, 207), False, 'from flask import Flask, jsonify\n'), ((545, 571), 'flask.jsonify', 'jsonify', (["{'task': task[0]}"], {}), "({'task': task[0]})\n", (552, 571), False, 'from flask import Flask, jsonify\n'), ((280, 311), 'flask.jsonify', 'json... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `marble` package."""
import unittest
import marble
import numpy as np
import sympl as sp
test_era5_filename = '/home/twine/data/era5/era5-interp-2016.nc'
def get_test_state(pc_value=0.):
n_features = marble.components.marble.name_feature_counts
st... | [
"unittest.main",
"marble.DiagnosticPrincipalComponentsToHeight",
"numpy.allclose",
"sympl.timedelta",
"numpy.ones",
"marble.InputPrincipalComponentsToHeight",
"marble.InputHeightToPrincipalComponents"
] | [((3497, 3512), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3510, 3512), False, 'import unittest\n'), ((344, 359), 'sympl.timedelta', 'sp.timedelta', (['(0)'], {}), '(0)\n', (356, 359), True, 'import sympl as sp\n'), ((2010, 2051), 'marble.InputPrincipalComponentsToHeight', 'marble.InputPrincipalComponentsToHe... |
### Figure 5 C and E - Obenhaus et al.
# Figure S6 A, C, E and F - Obenhaus et al.
#
# NN distance analysis
# Pairwise distance analysis
#
import sys, os
import os.path
import numpy as np
import pandas as pd
import datajoint as dj
import cmasher as cmr
from tabulate import tabulate
import itertools
# Make plot... | [
"pandas.DataFrame",
"helpers_topography.notebooks.pairw_distances.plot_pairw_nn_summary",
"numpy.std",
"helpers_topography.notebooks.pairw_distances.norm_pairw_nn_df",
"os.path.dirname",
"dj_plotter.helpers.plotting_helpers.make_linear_colormap",
"numpy.nanmean",
"seaborn.set",
"general.print_wilcox... | [((352, 374), 'seaborn.set', 'sns.set', ([], {'style': '"""white"""'}), "(style='white')\n", (359, 374), True, 'import seaborn as sns\n'), ((2598, 2676), 'dj_plotter.helpers.plotting_helpers.make_linear_colormap', 'make_linear_colormap', (['pairw_df.animal_name'], {'categorical': '(True)', 'cmap': '"""cmr.guppy"""'}), ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
simulations for sensitivity to results
Author: <NAME>
Date: May, 2020
"""
import csv
import time as mytime
############################################ENVIRONMENT###################################################################################
exec(open('./enviro... | [
"csv.reader",
"csv.writer",
"time.time"
] | [((581, 594), 'time.time', 'mytime.time', ([], {}), '()\n', (592, 594), True, 'import time as mytime\n'), ((2050, 2063), 'time.time', 'mytime.time', ([], {}), '()\n', (2061, 2063), True, 'import time as mytime\n'), ((1142, 1161), 'csv.writer', 'csv.writer', (['outfile'], {}), '(outfile)\n', (1152, 1161), False, 'import... |
from swampdragon.serializers.model_serializer import ModelSerializer
from swampdragon.testing.dragon_testcase import DragonTestCase
from .models import TextModel, SDModel
from datetime import datetime
from django.db import models
# to make sure none of the ModelSerializer variables are clobbering the data
MODEL_KEYWO... | [
"django.db.models.DateTimeField",
"django.db.models.TextField",
"datetime.datetime.now"
] | [((529, 547), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (545, 547), False, 'from django.db import models\n'), ((1030, 1052), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {}), '()\n', (1050, 1052), False, 'from django.db import models\n'), ((2080, 2094), 'datetime.datetime.now... |
import base64
import json
import os
import zlib
from urllib.request import urlretrieve
import boto3
import mrcnn.model as modellib
import numpy as np
import pandas as pd
import skimage.io
from mrcnn import utils
from mrcnn.config import Config
from superai.meta_ai import BaseModel
s3 = boto3.client("s3")
_MODEL_PAT... | [
"os.listdir",
"mrcnn.utils.download_trained_weights",
"json.loads",
"boto3.client",
"os.getcwd",
"os.path.exists",
"pandas.read_json",
"zlib.compress",
"urllib.request.urlretrieve",
"numpy.where",
"base64.b64encode",
"os.path.join",
"numpy.delete"
] | [((290, 308), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (302, 308), False, 'import boto3\n'), ((324, 381), 'os.path.join', 'os.path.join', (['"""sagify_base/local_test/test_dir/"""', '"""model"""'], {}), "('sagify_base/local_test/test_dir/', 'model')\n", (336, 381), False, 'import os\n'), ((3886, ... |
"""
Storage layer for perses automated molecular design.
TODO
----
* Add write_sampler_state(modname, sampler_state, iteration)
* Generalize write_quantity to handle units
* Add data access routines for reading to isolate low-level storage layer
"""
__author__ = '<NAME>'
############################################... | [
"netCDF4.Dataset",
"logging.getLogger",
"pickle.dumps"
] | [((827, 854), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (844, 854), False, 'import logging\n'), ((1505, 1546), 'netCDF4.Dataset', 'netcdf.Dataset', (['self._filename'], {'mode': 'mode'}), '(self._filename, mode=mode)\n', (1519, 1546), True, 'import netCDF4 as netcdf\n'), ((6839, 6856... |
from datetime import datetime
from app import db
class DOCUMENT(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True)
description = db.Column(db.String(300), nullable=False, default='Missing Description')
isActive = db.Column(db.Boolean, nullable=False, default=... | [
"app.db.String",
"app.db.Column"
] | [((99, 154), 'app.db.Column', 'db.Column', (['db.Integer'], {'nullable': '(False)', 'primary_key': '(True)'}), '(db.Integer, nullable=False, primary_key=True)\n', (108, 154), False, 'from app import db\n'), ((274, 325), 'app.db.Column', 'db.Column', (['db.Boolean'], {'nullable': '(False)', 'default': '(True)'}), '(db.B... |
#################################################################
# 指定されたフォルダ配下のExcelを開いていき、画像が指定位置に貼付けされていないファイルを出力or調整します。
#
# 実行には、以下のライブラリが必要です.
# - win32com
# - $ python -m pip install pywin32
#
# [参考にした情報]
# - https://www.sejuku.net/blog/23647
##############################################################... | [
"pathlib.Path",
"argparse.ArgumentParser"
] | [((533, 557), 'pathlib.Path', 'pathlib.Path', (['target_dir'], {}), '(target_dir)\n', (545, 557), False, 'import pathlib\n'), ((1768, 1971), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'usage': '"""python main.py -d /path/to/excel/dir -p base-left-position(e.g. 100.0) [-r]"""', 'description': '"""指定されたフ... |
import torch
from mmdet.core import bbox2result, bbox2roi, build_assigner, build_sampler
from ..builder import HEADS, build_head, build_roi_extractor
from .base_roi_head import BaseRoIHead
from .test_mixins import BBoxTestMixin, MaskTestMixin
from mmdet.core import multiclass_nms,bbox_select_per_class
from mmdet.core.... | [
"torch.ones",
"mmdet.core.bbox_mapping",
"mmdet.core.bbox2roi",
"torch.unsqueeze",
"mmdet.core.build_assigner",
"torch.cat",
"torch.zeros",
"mmdet.core.build_sampler",
"mmdet.core.bbox_select_per_class",
"torch.onnx.is_in_onnx_export",
"mmdet.core.merge_aug_bboxes",
"mmdet.core.bbox2result",
... | [((4587, 4602), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (4600, 4602), False, 'import torch\n'), ((3363, 3384), 'mmdet.core.bbox2roi', 'bbox2roi', (['[proposals]'], {}), '([proposals])\n', (3371, 3384), False, 'from mmdet.core import bbox2roi, bbox_mapping, merge_aug_bboxes, merge_aug_masks, multiclass_nms\n... |
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import i2c, sensor
from esphome.const import CONF_HUMIDITY, CONF_ID, CONF_TEMPERATURE, \
UNIT_CELSIUS, ICON_THERMOMETER, ICON_WATER_PERCENT, UNIT_PERCENT
DEPENDENCIES = ['i2c']
am2320_ns = cg.esphome_ns.namespace('am2320')... | [
"esphome.config_validation.declare_id",
"esphome.components.sensor.sensor_schema",
"esphome.components.i2c.register_i2c_device",
"esphome.config_validation.GenerateID",
"esphome.components.i2c.i2c_device_schema",
"esphome.config_validation.polling_component_schema",
"esphome.codegen.new_Pvariable",
"e... | [((287, 320), 'esphome.codegen.esphome_ns.namespace', 'cg.esphome_ns.namespace', (['"""am2320"""'], {}), "('am2320')\n", (310, 320), True, 'import esphome.codegen as cg\n'), ((729, 754), 'esphome.components.i2c.i2c_device_schema', 'i2c.i2c_device_schema', (['(92)'], {}), '(92)\n', (750, 754), False, 'from esphome.compo... |
import ast
import os
import dj_database_url
PROJECT_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), os.pardir))
SECRET_KEY = os.environ.get("SECRET_KEY", "UNKNOWN")
DEBUG = ast.literal_eval(os.environ.get('DEBUG', 'False'))
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True... | [
"os.environ.get",
"os.path.dirname",
"os.path.join"
] | [((143, 182), 'os.environ.get', 'os.environ.get', (['"""SECRET_KEY"""', '"""UNKNOWN"""'], {}), "('SECRET_KEY', 'UNKNOWN')\n", (157, 182), False, 'import os\n'), ((1799, 1842), 'os.environ.get', 'os.environ.get', (['"""TERRAFORM_ELASTICACHE_URL"""'], {}), "('TERRAFORM_ELASTICACHE_URL')\n", (1813, 1842), False, 'import o... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
from accounts.models import Player
class PlayerInline(admin.StackedInline):
model = Player
class UserAdmin(BaseUserAdmin):
inlines = (PlayerInline,)
admin.site.unr... | [
"django.contrib.admin.site.register",
"django.contrib.admin.site.unregister"
] | [((306, 333), 'django.contrib.admin.site.unregister', 'admin.site.unregister', (['User'], {}), '(User)\n', (327, 333), False, 'from django.contrib import admin\n'), ((334, 370), 'django.contrib.admin.site.register', 'admin.site.register', (['User', 'UserAdmin'], {}), '(User, UserAdmin)\n', (353, 370), False, 'from djan... |
"""
Connect to a BL-NET via it's web interface and read and write data
TODO: as component
"""
import logging
import voluptuous as vol
from homeassistant.helpers.discovery import load_platform
from homeassistant.const import (
CONF_RESOURCE, CONF_PASSWORD, CONF_SCAN_INTERVAL, TEMP_CELSIUS,
)
from homeassistant.hel... | [
"voluptuous.Optional",
"voluptuous.Required",
"pyblnet.BLNET",
"homeassistant.helpers.discovery.load_platform",
"datetime.timedelta",
"datetime.datetime.now",
"logging.getLogger"
] | [((530, 557), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (547, 557), False, 'import logging\n'), ((2205, 2311), 'pyblnet.BLNET', 'BLNET', (['resource'], {'password': 'password', 'web_port': 'web_port', 'ta_port': 'ta_port', 'use_web': 'use_web', 'use_ta': 'use_ta'}), '(resource, passw... |
from FEV_KEGG.Graph import SubstanceGraphs
from FEV_KEGG.Graph.Elements import ReactionID, EcNumber
from FEV_KEGG.Graph.SubstanceGraphs import SubstanceEcGraph, SubstanceReactionGraph
from FEV_KEGG.KEGG.File import cache
from FEV_KEGG.KEGG.Organism import Organism
from FEV_KEGG.settings import verbosity as init_verbosi... | [
"FEV_KEGG.KEGG.File.cache",
"FEV_KEGG.Graph.SubstanceGraphs.Conversion.KeggPathwaySet2SubstanceReactionGraph",
"FEV_KEGG.Graph.Elements.ReactionID",
"FEV_KEGG.Graph.SubstanceGraphs.SubstanceEcGraph",
"FEV_KEGG.KEGG.Organism.Organism"
] | [((805, 872), 'FEV_KEGG.KEGG.File.cache', 'cache', ([], {'folder_path': '"""NUKA/graph"""', 'file_name': '"""SubstanceReactionGraph"""'}), "(folder_path='NUKA/graph', file_name='SubstanceReactionGraph')\n", (810, 872), False, 'from FEV_KEGG.KEGG.File import cache\n'), ((2203, 2264), 'FEV_KEGG.KEGG.File.cache', 'cache',... |
#! /usr/bin/env python
# Licensed to Big Data Genomics (BDG) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The BDG licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you... | [
"hashlib.md5",
"os.path.join",
"os.path.splitext",
"re.sub",
"subprocess.check_call"
] | [((1073, 1111), 're.sub', 're.sub', (['"""/|\\\\\\\\|;|:|\\\\?|="""', '"""_"""', 'dirty'], {}), "('/|\\\\\\\\|;|:|\\\\?|=', '_', dirty)\n", (1079, 1111), False, 'import re\n'), ((1975, 2005), 'os.path.join', 'pjoin', (['staging_path', 'dest_name'], {}), '(staging_path, dest_name)\n', (1980, 2005), True, 'from os.path i... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | [
"attr.s",
"attr.asdict",
"attr.validators.instance_of",
"logging.getLogger"
] | [((1054, 1081), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1071, 1081), False, 'import logging\n'), ((1634, 1654), 'attr.s', 'attr.s', ([], {'kw_only': '(True)'}), '(kw_only=True)\n', (1640, 1654), False, 'import attr\n'), ((5293, 5314), 'attr.asdict', 'attr.asdict', (['perm_ctx'], {... |
import tkinter as tk
from tkinter import filedialog
from tkinter import *
from PIL import ImageTk, Image
import numpy as np
import cv2
#load the trained model to classify sign
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.models i... | [
"PIL.ImageTk.PhotoImage",
"tensorflow.keras.models.load_model",
"tensorflow.keras.applications.inception_v3.preprocess_input",
"numpy.argmax",
"tensorflow.keras.applications.inception_v3.InceptionV3",
"tensorflow.keras.preprocessing.image.img_to_array",
"numpy.expand_dims",
"tkinter.filedialog.askopen... | [((533, 606), 'tensorflow.keras.applications.inception_v3.InceptionV3', 'InceptionV3', ([], {'weights': '"""inception_v3_weights_tf_dim_ordering_tf_kernels.h5"""'}), "(weights='inception_v3_weights_tf_dim_ordering_tf_kernels.h5')\n", (544, 606), False, 'from tensorflow.keras.applications.inception_v3 import InceptionV3... |
import abc
import operator
from fuzzysets import utils
class Domain(abc.ABC):
"""
An abstract class for domain of a fuzzy set.
"""
@abc.abstractmethod
def __iter__(self):
"""
:returns: a generator which yields the elements of the domain.
The order of the elements is the sa... | [
"fuzzysets.utils.is_membership_degree_v",
"fuzzysets.utils.to_float_if_int",
"fuzzysets.utils.validate_alpha"
] | [((3385, 3413), 'fuzzysets.utils.to_float_if_int', 'utils.to_float_if_int', (['alpha'], {}), '(alpha)\n', (3406, 3413), False, 'from fuzzysets import utils\n'), ((3422, 3449), 'fuzzysets.utils.validate_alpha', 'utils.validate_alpha', (['alpha'], {}), '(alpha)\n', (3442, 3449), False, 'from fuzzysets import utils\n'), (... |
#!/usr/bin/env python3
#
# MIT License
#
# Copyright (c) 2020-2022 EntySec
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to... | [
"ldaptor.protocols.pureldap.LDAPSearchResultEntry",
"ldaptor.protocols.pureldap.LDAPSearchResultDone",
"pex.string.String",
"ldaptor.protocols.ldap.ldapserver.LDAPServer.__init__"
] | [((1828, 1836), 'pex.string.String', 'String', ([], {}), '()\n', (1834, 1836), False, 'from pex.string import String\n'), ((1941, 1966), 'ldaptor.protocols.ldap.ldapserver.LDAPServer.__init__', 'LDAPServer.__init__', (['self'], {}), '(self)\n', (1960, 1966), False, 'from ldaptor.protocols.ldap.ldapserver import LDAPSer... |
from cli.src.providers.aws.InfrastructureBuilder import InfrastructureBuilder
from cli.src.helpers.objdict_helpers import dict_to_objdict
def test_get_resource_group_should_set_proper_values_to_model():
cluster_model = get_cluster_model(cluster_name='TestCluster', address_pool='10.20.0.0/22')
builder = Infrast... | [
"cli.src.helpers.objdict_helpers.dict_to_objdict",
"cli.src.providers.aws.InfrastructureBuilder.InfrastructureBuilder"
] | [((313, 351), 'cli.src.providers.aws.InfrastructureBuilder.InfrastructureBuilder', 'InfrastructureBuilder', (['[cluster_model]'], {}), '([cluster_model])\n', (334, 351), False, 'from cli.src.providers.aws.InfrastructureBuilder import InfrastructureBuilder\n'), ((694, 732), 'cli.src.providers.aws.InfrastructureBuilder.I... |
import random,math
def distribution(decay,buckets):
"Return random numbers, sum noamrlzes 0..1"
tmp=[random.random()]
for _ in range(buckets-1):
old=tmp[-1];
tmp += [old*decay]
s=sum(tmp)
return sorted([x/s for x in tmp])
def run(n=1000,decay=0.99,dimensions=10, buckets = 10):
ds=[distribution... | [
"random.random",
"random.choice"
] | [((106, 121), 'random.random', 'random.random', ([], {}), '()\n', (119, 121), False, 'import random, math\n'), ((427, 443), 'random.choice', 'random.choice', (['d'], {}), '(d)\n', (440, 443), False, 'import random, math\n')] |
from ngubot.utils.base import BaseGame
import pyautogui as pag
import time
game = BaseGame()
def clean(game):
itemsToMerge = [
"Head",
"Chest",
"Legs",
"Boots",
"Weapon",
"Accessory1",
"0_0",
"0_1",
"0_2",
"0_3",
"0_4",
... | [
"pyautogui.press",
"ngubot.utils.base.BaseGame",
"time.sleep"
] | [((83, 93), 'ngubot.utils.base.BaseGame', 'BaseGame', ([], {}), '()\n', (91, 93), False, 'from ngubot.utils.base import BaseGame\n'), ((1189, 1204), 'time.sleep', 'time.sleep', (['(300)'], {}), '(300)\n', (1199, 1204), False, 'import time\n'), ((1337, 1352), 'time.sleep', 'time.sleep', (['(300)'], {}), '(300)\n', (1347... |
#!/usr/bin/env python
import print_environment
import sys
print_environment.execute()
sys.exit(1)
| [
"sys.exit",
"print_environment.execute"
] | [((60, 87), 'print_environment.execute', 'print_environment.execute', ([], {}), '()\n', (85, 87), False, 'import print_environment\n'), ((88, 99), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (96, 99), False, 'import sys\n')] |
# Copyright (c) 2016-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | [
"caffe2.python.layers.layers.get_layer_class"
] | [((1438, 1471), 'caffe2.python.layers.layers.get_layer_class', 'get_layer_class', (['prediction_layer'], {}), '(prediction_layer)\n', (1453, 1471), False, 'from caffe2.python.layers.layers import ModelLayer, get_layer_class\n')] |
from datetime import timedelta
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.crypto import get_random_string
from invitations.adapters import get_invitations_adapt... | [
"django.db.models.FileField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.utils.timezone.now",
"django.db.models.EmailField",
"django.urls.reverse",
"datetime.timedelta",
"invitations.adapters.get_invitations_adapter",
"django.db.models.DateTimeField",
"django.utils.crypto... | [((474, 559), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Classes'], {'on_delete': 'models.CASCADE', 'related_name': '"""assignments"""'}), "(Classes, on_delete=models.CASCADE, related_name='assignments'\n )\n", (491, 559), False, 'from django.db import models\n'), ((581, 630), 'django.db.models.TextField... |
# this is the mysql service used to communicate with the backend
import mysql.connector
from datetime import datetime
from flask import jsonify
import json
# connector method for the spothole db
def connect():
return mysql.connector.connect(
host="localhost",
user="",
passwd="",
database=""... | [
"datetime.datetime.utcnow",
"flask.jsonify"
] | [((1552, 1568), 'flask.jsonify', 'jsonify', (['payload'], {}), '(payload)\n', (1559, 1568), False, 'from flask import jsonify\n'), ((759, 776), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (774, 776), False, 'from datetime import datetime\n')] |
from basic_tests import BasicTest
from models.model_operations import scenario_operations
from models.model_operations import topic_operations
from models.model_operations import user_operations
from models.model_operations import vision_operations
from models.model import db
import unittest
class VisionTest(BasicTes... | [
"unittest.main",
"models.model_operations.vision_operations.get_visions_by_scenario",
"models.model_operations.vision_operations.remove_vision",
"models.model_operations.scenario_operations.create_scenario",
"models.model.db.create_all",
"models.model_operations.vision_operations.create_vision",
"models... | [((10663, 10678), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10676, 10678), False, 'import unittest\n'), ((386, 401), 'models.model.db.create_all', 'db.create_all', ([], {}), '()\n', (399, 401), False, 'from models.model import db\n'), ((424, 469), 'models.model_operations.topic_operations.create_topic', 'top... |
# import the necessary packages
from imutils import paths
import argparse
import cv2
import os
def variance_of_laplacian(image):
# compute the Laplacian of the image and then return the focus
# measure -- the variance of the Laplacian
return cv2.Laplacian(image, cv2.CV_64F).var()
# construct the argument parse and... | [
"imutils.paths.list_images",
"os.remove",
"argparse.ArgumentParser",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imread",
"cv2.Laplacian"
] | [((346, 371), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (369, 371), False, 'import argparse\n'), ((795, 828), 'imutils.paths.list_images', 'paths.list_images', (["args['images']"], {}), "(args['images'])\n", (812, 828), False, 'from imutils import paths\n'), ((983, 1004), 'cv2.imread', 'cv... |
import pandas as pd
import argparse
import os
import mdtraj
import numpy as np
parser = argparse.ArgumentParser(description='Script to generate trajectories containing only top scoring frames as scored by RWPlus. These top scoring trajectories can then be averaged with Gromacs to produce an averaged structure.')
pars... | [
"pandas.DataFrame",
"argparse.ArgumentParser",
"numpy.array",
"numpy.arange",
"os.path.join",
"os.listdir"
] | [((90, 325), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Script to generate trajectories containing only top scoring frames as scored by RWPlus. These top scoring trajectories can then be averaged with Gromacs to produce an averaged structure."""'}), "(description=\n 'Script to gen... |
import asyncio
import time
from async_reduce import async_reduceable
@async_reduceable()
async def fetch(url):
print('- fetch page: ', url)
await asyncio.sleep(1)
return time.time()
async def amain():
coros = [
fetch('/page') for _ in range(10)
]
print('-- Simultaneous run')
do... | [
"async_reduce.async_reduceable",
"asyncio.wait",
"asyncio.sleep",
"time.time"
] | [((73, 91), 'async_reduce.async_reduceable', 'async_reduceable', ([], {}), '()\n', (89, 91), False, 'from async_reduce import async_reduceable\n'), ((185, 196), 'time.time', 'time.time', ([], {}), '()\n', (194, 196), False, 'import time\n'), ((157, 173), 'asyncio.sleep', 'asyncio.sleep', (['(1)'], {}), '(1)\n', (170, 1... |
"""Helpers to generate ulids."""
from random import getrandbits
import time
def ulid_hex() -> str:
"""Generate a ULID in lowercase hex that will work for a UUID.
This ulid should not be used for cryptographically secure
operations.
This string can be converted with https://github.com/ahawker/ulid
... | [
"time.time",
"random.getrandbits"
] | [((410, 425), 'random.getrandbits', 'getrandbits', (['(80)'], {}), '(80)\n', (421, 425), False, 'from random import getrandbits\n'), ((386, 397), 'time.time', 'time.time', ([], {}), '()\n', (395, 397), False, 'import time\n'), ((971, 986), 'random.getrandbits', 'getrandbits', (['(80)'], {}), '(80)\n', (982, 986), False... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import matplotlib.pyplot as plt
import os
import plot_tools
import settings
from pythonapi import anno_tools
def plt_print_text(*a... | [
"json.load",
"os.makedirs",
"json.loads",
"os.path.isdir",
"pythonapi.anno_tools.each_char",
"matplotlib.pyplot.style.context",
"plot_tools.print_text"
] | [((382, 421), 'matplotlib.pyplot.style.context', 'plt.style.context', (["{'pdf.fonttype': 42}"], {}), "({'pdf.fonttype': 42})\n", (399, 421), True, 'import matplotlib.pyplot as plt\n'), ((446, 474), 'plot_tools.print_text', 'plot_tools.print_text', (['*args'], {}), '(*args)\n', (467, 474), False, 'import plot_tools\n')... |
import django
from django.http import HttpResponse
import random
def rand_string(min, max):
"""Returns a randomly-generated string, of a random length.
Args:
min (int): Minimum string length to return, inclusive
max (int): Maximum string length to return, inclusive
"""
int_gen = ra... | [
"django.http.HttpResponse"
] | [((762, 781), 'django.http.HttpResponse', 'HttpResponse', (['_body'], {}), '(_body)\n', (774, 781), False, 'from django.http import HttpResponse\n')] |
'''Recommendations Module'''
from time import time
from urllib.parse import quote, urlencode
import requests as r
from constructor_io.helpers.exception import ConstructorException
from constructor_io.helpers.utils import (clean_params, create_auth_header,
create_request_head... | [
"constructor_io.helpers.utils.clean_params",
"urllib.parse.urlencode",
"constructor_io.helpers.utils.throw_http_exception_from_response",
"time.time",
"urllib.parse.quote",
"constructor_io.helpers.utils.create_auth_header",
"constructor_io.helpers.utils.create_shared_query_params",
"constructor_io.hel... | [((620, 684), 'constructor_io.helpers.utils.create_shared_query_params', 'create_shared_query_params', (['options', 'parameters', 'user_parameters'], {}), '(options, parameters, user_parameters)\n', (646, 684), False, 'from constructor_io.helpers.utils import clean_params, create_auth_header, create_request_headers, cr... |
import json
from builtins import NotImplemented
from pprint import pprint
import aiohttp
import asyncio
import async_timeout
from aiohttp.client import _RequestContextManager
from logging import getLogger
from exceptions.SmhiExceptions import SmhiConnectionException
BASE_URL = 'https://opendata-download-metfcst.smhi... | [
"asyncio.get_event_loop",
"builtins.NotImplemented",
"aiohttp.ClientSession",
"async_timeout.timeout",
"pprint.pprint",
"exceptions.SmhiExceptions.SmhiConnectionException",
"logging.getLogger"
] | [((402, 413), 'logging.getLogger', 'getLogger', ([], {}), '()\n', (411, 413), False, 'from logging import getLogger\n'), ((1305, 1329), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (1327, 1329), False, 'import asyncio\n'), ((1279, 1295), 'builtins.NotImplemented', 'NotImplemented', ([], {}), '(... |
import unittest
from pieces.bishop import Bishop
from board import Board
class TestSum(unittest.TestCase):
def test_no_movement(self):
board = Board()
bishop1 = Bishop("W", 7, 0, board)
bishop2 = Bishop("W", 6, 1, board)
board.add_piece(bishop1, 7, 0)
board.add_piece(bish... | [
"unittest.main",
"pieces.bishop.Bishop",
"board.Board"
] | [((1676, 1691), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1689, 1691), False, 'import unittest\n'), ((157, 164), 'board.Board', 'Board', ([], {}), '()\n', (162, 164), False, 'from board import Board\n'), ((184, 208), 'pieces.bishop.Bishop', 'Bishop', (['"""W"""', '(7)', '(0)', 'board'], {}), "('W', 7, 0, boa... |
#!/usr/local/bin/python3.4
# encoding: utf-8
'''
pyverse.bin.build -- builds DB objects into your database.
pyverse.bin.build Use this command to build the various code generate objects in your DB, like Stored Procedures, Functions, Views and Triggers
@author: <NAME>
@copyright: 2014 open source. All rights re... | [
"app.parser.add_argument",
"os.path.realpath",
"traceback.print_exc"
] | [((639, 873), 'app.parser.add_argument', 'parser.add_argument', (['"""-s"""', '"""--stored_proc"""'], {'dest': '"""stored_proc"""', 'action': '"""store"""', 'nargs': '"""?"""', 'default': '(False)', 'const': '"""All"""', 'help': '"""build all stored procedures, or the folder/*.sql specified. Root folder is the database... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-09-06 21:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('calls', '0006_auto_20180906_0430'),
]
operations = [
migrations.AlterField... | [
"django.db.models.IntegerField"
] | [((406, 576), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'choices': "[(1, 'New'), (10, 'Approved'), (20, 'In Progress'), (30, 'Paused'), (40,\n 'Complete'), (50, 'Declined'), (60, 'Suspended')]", 'default': '(1)'}), "(choices=[(1, 'New'), (10, 'Approved'), (20,\n 'In Progress'), (30, 'Paused'),... |
# vim: filetype=python ts=2 sw=2 sts=2 et :
# (c) 2021, <NAME> (<EMAIL>) unlicense.org
"""Standard library functions."""
import re
import sys
import copy
class obj:
"Simple base class with pretty print"
def __init__(i, **d): i.__dict__.update(d)
def __repr__(i) : return i.__class__.__name__+"{" + ', '.join(
... | [
"copy.deepcopy",
"re.sub"
] | [((907, 945), 're.sub', 're.sub', (['"""([\\\\n\\\\t\\\\r ]|#.*)"""', '""""""', 'line'], {}), "('([\\\\n\\\\t\\\\r ]|#.*)', '', line)\n", (913, 945), False, 'import re\n'), ((427, 452), 'copy.deepcopy', 'copy.deepcopy', (['i.__dict__'], {}), '(i.__dict__)\n', (440, 452), False, 'import copy\n')] |
import unittest
import torch.utils.data
from nuplan.planning.scenario_builder.nuplan_db.test.nuplan_scenario_test_utils import get_test_nuplan_scenario
from nuplan.planning.simulation.trajectory.trajectory_sampling import TrajectorySampling
from nuplan.planning.training.data_loader.scenario_dataset import ScenarioDat... | [
"unittest.main",
"nuplan.planning.training.preprocessing.feature_collate.FeatureCollate",
"nuplan.planning.training.preprocessing.feature_builders.raster_feature_builder.RasterFeatureBuilder",
"nuplan.planning.training.preprocessing.feature_builders.vector_map_feature_builder.VectorMapFeatureBuilder",
"nupl... | [((3312, 3327), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3325, 3327), False, 'import unittest\n'), ((2144, 2170), 'nuplan.planning.scenario_builder.nuplan_db.test.nuplan_scenario_test_utils.get_test_nuplan_scenario', 'get_test_nuplan_scenario', ([], {}), '()\n', (2168, 2170), False, 'from nuplan.planning.sc... |
import unittest
from knapsack_with_repetition import knapsack_with_repetition
from knapsack_no_repetition import knapsack_no_repetition
class Test_Case_Knapsack(unittest.TestCase):
def test_knapsack_with_repetition(self):
self.assertEqual(knapsack_with_repetition([6, 3, 4, 2], [30,14,16,9], 10), 48)
de... | [
"unittest.main",
"knapsack_with_repetition.knapsack_with_repetition",
"knapsack_no_repetition.knapsack_no_repetition"
] | [((474, 489), 'unittest.main', 'unittest.main', ([], {}), '()\n', (487, 489), False, 'import unittest\n'), ((252, 311), 'knapsack_with_repetition.knapsack_with_repetition', 'knapsack_with_repetition', (['[6, 3, 4, 2]', '[30, 14, 16, 9]', '(10)'], {}), '([6, 3, 4, 2], [30, 14, 16, 9], 10)\n', (276, 311), False, 'from kn... |
import re
ASCII_IS_DEFAULT_ENCODING = False
cookie_re = re.compile(r"^[ \t\f]*#.*coding[:=][ \t]*[-\w.]+")
BOM_UTF8 = '\xef\xbb\xbf'
def _prepare_source(fn):
"""Read the source code for re-writing."""
try:
stat = fn.stat()
source = fn.read("rb")
except EnvironmentError:
return Non... | [
"re.compile"
] | [((58, 111), 're.compile', 're.compile', (['"""^[ \\\\t\\\\f]*#.*coding[:=][ \\\\t]*[-\\\\w.]+"""'], {}), "('^[ \\\\t\\\\f]*#.*coding[:=][ \\\\t]*[-\\\\w.]+')\n", (68, 111), False, 'import re\n')] |
# -*- coding: utf-8 -*-
import sys
sys.path.append('src')
import unittest
from src.get_posters import (download_poster, get_title_display,
get_yearly_url_imgs)
from src.utils import create_folder
class UtilsGetPosters(unittest.TestCase):
def setUp(self):
self.year = 1913
... | [
"sys.path.append",
"src.get_posters.get_title_display",
"src.get_posters.download_poster",
"src.get_posters.get_yearly_url_imgs"
] | [((37, 59), 'sys.path.append', 'sys.path.append', (['"""src"""'], {}), "('src')\n", (52, 59), False, 'import sys\n'), ((473, 498), 'src.get_posters.get_yearly_url_imgs', 'get_yearly_url_imgs', (['(1913)'], {}), '(1913)\n', (492, 498), False, 'from src.get_posters import download_poster, get_title_display, get_yearly_ur... |
"""
{This script reads in the raw chain and plots times series for all parameters
in order to identify the burn-in}
"""
# Libs
from cosmo_utils.utils import work_paths as cwpaths
import matplotlib.pyplot as plt
from matplotlib import rc
import matplotlib
import pandas as pd
import numpy as np
import math
import os
_... | [
"matplotlib.pyplot.title",
"matplotlib.rc",
"numpy.abs",
"matplotlib.pyplot.clf",
"pandas.read_csv",
"numpy.isnan",
"numpy.histogram",
"numpy.mean",
"numpy.exp",
"cosmo_utils.utils.work_paths.cookiecutter_paths",
"numpy.round",
"numpy.unique",
"pandas.DataFrame",
"pandas.read_hdf",
"nump... | [((344, 420), 'matplotlib.rc', 'rc', (['"""font"""'], {'size': '(20)'}), "('font', **{'family': 'sans-serif', 'sans-serif': ['Helvetica']}, size=20)\n", (346, 420), False, 'from matplotlib import rc\n'), ((416, 439), 'matplotlib.rc', 'rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (418, 439), F... |
from flask import Blueprint
from flask_restful import Api
from .user import *
from .auth import *
from .zone import *
from .type import *
from .ttl import *
from .record import *
from .ttldata import *
from .content import *
from .content_serial import *
from .dns.create import *
from .command_rest import *
from .admin... | [
"flask_restful.Api",
"flask.Blueprint"
] | [((503, 548), 'flask.Blueprint', 'Blueprint', (['"""api"""', '__name__'], {'url_prefix': '"""/api"""'}), "('api', __name__, url_prefix='/api')\n", (512, 548), False, 'from flask import Blueprint\n'), ((556, 574), 'flask_restful.Api', 'Api', (['api_blueprint'], {}), '(api_blueprint)\n', (559, 574), False, 'from flask_re... |
#!/bin/env python3
import os, sys, argparse
import requests, yaml
default_temp_file = '/tmp/twitch_online.token'
default_auth_file = os.path.join(os.environ['XDG_CONFIG_HOME'], 'twitch_online.creds')
parser = argparse.ArgumentParser(description="CLI Utility to check if a twitch channel is streaming", \
epilo... | [
"os.chmod",
"argparse.ArgumentParser",
"os.path.isfile",
"yaml.safe_load",
"requests.get",
"requests.post",
"sys.stderr.write",
"os.path.join",
"sys.exit"
] | [((135, 201), 'os.path.join', 'os.path.join', (["os.environ['XDG_CONFIG_HOME']", '"""twitch_online.creds"""'], {}), "(os.environ['XDG_CONFIG_HOME'], 'twitch_online.creds')\n", (147, 201), False, 'import os, sys, argparse\n'), ((212, 426), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""CL... |
#coding:utf-8
"""
@auther tk0103
@date 2018-07-04
"""
import os, time, sys, copy
import numpy as np
import chainer
import chainer.links as L
import chainer.functions as F
from chainer.dataset import concat_examples
class Unet3DEvaluator(chainer.training.extensions.Evaluator):
def __init__(self, iterator, unet, nu... | [
"chainer.functions.flatten",
"chainer.functions.sum",
"copy.copy",
"chainer.reporter.report_scope",
"chainer.functions.log",
"chainer.no_backprop_mode",
"chainer.using_config",
"chainer.reporter.DictSummary"
] | [((1105, 1154), 'chainer.functions.flatten', 'F.flatten', (['predict[:, 1:self._max_label, :, :, :]'], {}), '(predict[:, 1:self._max_label, :, :, :])\n', (1114, 1154), True, 'import chainer.functions as F\n'), ((1270, 1299), 'chainer.functions.sum', 'F.sum', (['(predict * ground_truth)'], {}), '(predict * ground_truth)... |
# Generated by Django 2.1.2 on 2018-11-04 06:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0035_userwithprofile_followedcategories'),
]
operations = [
migrations.AddField(
model_name='story',
name='im... | [
"django.db.models.FileField",
"django.db.models.ManyToManyField"
] | [((344, 451), 'django.db.models.FileField', 'models.FileField', ([], {'blank': '(True)', 'default': '"""pic_folder/None/no-img.jpg"""', 'null': '(True)', 'upload_to': '"""pic_folder/"""'}), "(blank=True, default='pic_folder/None/no-img.jpg', null=\n True, upload_to='pic_folder/')\n", (360, 451), False, 'from django.... |
import numpy as np
import matplotlib.pyplot as plt
def plot_tsp(parameters, rank):
rank = np.concatenate([rank, rank[0:1]], axis=0)
plt.figure()
plt.plot(parameters[:, 0], parameters[:, 1], 'ro', color='red')
plt.plot(parameters[:, 0][rank], parameters[:, 1][rank], 'r-', color='blue')
plt.show()
| [
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.concatenate"
] | [((96, 137), 'numpy.concatenate', 'np.concatenate', (['[rank, rank[0:1]]'], {'axis': '(0)'}), '([rank, rank[0:1]], axis=0)\n', (110, 137), True, 'import numpy as np\n'), ((143, 155), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (153, 155), True, 'import matplotlib.pyplot as plt\n'), ((160, 223), 'matplot... |
"""
Make a pie charts of varying size - see
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.pie for the docstring.
This example shows a basic pie charts with labels optional features,
like autolabeling the percentage, offsetting a slice with "explode"
and adding a shadow, in different sizes.
"""
import ma... | [
"matplotlib.pyplot.pie",
"matplotlib.pyplot.subplot",
"matplotlib.gridspec.GridSpec",
"matplotlib.pyplot.show"
] | [((533, 547), 'matplotlib.gridspec.GridSpec', 'GridSpec', (['(2)', '(2)'], {}), '(2, 2)\n', (541, 547), False, 'from matplotlib.gridspec import GridSpec\n'), ((549, 586), 'matplotlib.pyplot.subplot', 'plt.subplot', (['the_grid[0, 0]'], {'aspect': '(1)'}), '(the_grid[0, 0], aspect=1)\n', (560, 586), True, 'import matplo... |
"""build_test_dataset.py -- The functions to build simulated data sets.
"""
import pickle
import numpy as np
from scipy import stats
# import matplotlib.pyplot as plt
# import corner
DATA_NAME = 'simple' # default
DATA_NAME = '3_gaus'
MB_HOST = 'indirect' # default
MB_HOST = 'step' # todo implement this
M... | [
"numpy.random.dirichlet",
"numpy.random.triangular",
"numpy.random.seed",
"numpy.abs",
"numpy.random.randn",
"numpy.random.exponential",
"numpy.expand_dims",
"numpy.ones",
"numpy.append",
"numpy.diag",
"numpy.concatenate"
] | [((340, 364), 'numpy.random.seed', 'np.random.seed', (['(13048293)'], {}), '(13048293)\n', (354, 364), True, 'import numpy as np\n'), ((644, 682), 'numpy.concatenate', 'np.concatenate', (['(mass_young, mass_old)'], {}), '((mass_young, mass_old))\n', (658, 682), True, 'import numpy as np\n'), ((1011, 1040), 'numpy.appen... |
"""Static database tables."""
import pandas as pd
FERC_ACCOUNTS: pd.DataFrame = pd.DataFrame(
columns=['row_number', 'ferc_account_id', 'ferc_account_description'],
data=[
# 1. Intangible Plant
(2, '301', 'Intangible: Organization'),
(3, '302', 'Intangible: Franchises and consents'),
... | [
"pandas.DataFrame"
] | [((81, 6600), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['row_number', 'ferc_account_id', 'ferc_account_description']", 'data': '[(2, \'301\', \'Intangible: Organization\'), (3, \'302\',\n \'Intangible: Franchises and consents\'), (4, \'303\',\n \'Intangible: Miscellaneous intangible plant\'), (5,\n ... |
import asyncio
from aiohttp import web
async def handle(request):
index = open("index.html", 'rb')
content = index.read()
return web.Response(body=content, content_type='text/html')
async def wshandler(request):
app = request.app
ws = web.WebSocketResponse()
await ws.prepare(request)
if ... | [
"aiohttp.web.Response",
"aiohttp.web.WebSocketResponse",
"asyncio.sleep",
"aiohttp.web.run_app",
"aiohttp.web.Application"
] | [((1343, 1360), 'aiohttp.web.Application', 'web.Application', ([], {}), '()\n', (1358, 1360), False, 'from aiohttp import web\n'), ((1500, 1516), 'aiohttp.web.run_app', 'web.run_app', (['app'], {}), '(app)\n', (1511, 1516), False, 'from aiohttp import web\n'), ((142, 194), 'aiohttp.web.Response', 'web.Response', ([], {... |
import os
from mkconfig.conf.utils import Utils
from mkconfig.env import setup_logging_with_details, Configurations
import logging
from cement.utils import test
setup_logging_with_details()
logger = logging.getLogger(__name__)
from mkconfig.core.cli import MkConfigApp
class TestMkConfigApp(test.CementTestCase):
... | [
"os.path.join",
"os.unlink",
"mkconfig.env.setup_logging_with_details",
"os.path.isfile",
"mkconfig.env.Configurations.getTmpTemplateDir",
"mkconfig.env.Configurations.getTmpTemplateFile",
"mkconfig.env.Configurations.getProjectRootDir",
"os.listdir",
"logging.getLogger"
] | [((162, 190), 'mkconfig.env.setup_logging_with_details', 'setup_logging_with_details', ([], {}), '()\n', (188, 190), False, 'from mkconfig.env import setup_logging_with_details, Configurations\n'), ((200, 227), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (217, 227), False, 'import logg... |
"""
This module communicate with the Open Targets REST API with a simple client, and requires not knowledge of the API.
"""
import logging
from opentargets.conn import Connection, IterableResult
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class OpenTargetsClient(object):
'''
main cl... | [
"opentargets.conn.Connection",
"logging.getLogger",
"opentargets.conn.IterableResult"
] | [((208, 235), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (225, 235), False, 'import logging\n'), ((962, 982), 'opentargets.conn.Connection', 'Connection', ([], {}), '(**kwargs)\n', (972, 982), False, 'from opentargets.conn import Connection, IterableResult\n'), ((1237, 1262), 'opentar... |
"""
Defines the model to hold application events
"""
from django.conf import settings
from django.db import models
from django.forms.models import model_to_dict
from ..constants import EventKind, EventModel, EventCommonCodes, CODES_PER_MODEL
from .user import get_sentinel_user
class Event(models.Model):
"""... | [
"django.db.models.TextField",
"django.forms.models.model_to_dict",
"django.db.models.IntegerField",
"django.db.models.SET",
"django.db.models.DateTimeField"
] | [((443, 465), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {}), '()\n', (463, 465), False, 'from django.db import models\n'), ((477, 515), 'django.db.models.IntegerField', 'models.IntegerField', (['EventKind.choices'], {}), '(EventKind.choices)\n', (496, 515), False, 'from django.db import models\n'),... |
#!/usr/bin/env python
from pysphere import VIServer
server = VIServer()
server.connect("my.esx.host.example.org", "username", "secret")
vm = server.get_vm_by_path("[datastore] path/to/file.vmx")
vm.wait_for_tools()
vm.login_in_guest("Administrator", "secret")
vm.get_screenshot("vm_screenshot.png", overwrite=True)
se... | [
"pysphere.VIServer"
] | [((62, 72), 'pysphere.VIServer', 'VIServer', ([], {}), '()\n', (70, 72), False, 'from pysphere import VIServer\n')] |
import os
import shutil
from ._mworks import ReservedEventCode, _MWKFile, _MWKStream
class IndexingException(IOError):
pass
class MWKFile(_MWKFile):
def __init__(self, file_name):
super(MWKFile, self).__init__(file_name)
self._codec = None
self._reverse_codec = None
def close... | [
"os.remove",
"os.pathsep.join",
"os.path.basename",
"os.path.isdir",
"os.rename",
"os.path.exists",
"os.path.isfile",
"shutil.rmtree",
"os.path.split",
"os.path.join"
] | [((608, 633), 'os.path.exists', 'os.path.exists', (['self.file'], {}), '(self.file)\n', (622, 633), False, 'import os\n'), ((2478, 2502), 'os.path.isdir', 'os.path.isdir', (['self.file'], {}), '(self.file)\n', (2491, 2502), False, 'import os\n'), ((3861, 3888), 'os.path.basename', 'os.path.basename', (['self.file'], {}... |
# Importing modules
from decimal import Decimal
from PyInquirer import prompt
from termcolor import colored
from .get import get
# The function to mint tokens
def mint(currency_module) -> None:
mint_data = prompt([
{
'type': 'input',
'name': 'amount',
'message': 'Enter... | [
"termcolor.colored",
"PyInquirer.prompt",
"decimal.Decimal"
] | [((213, 454), 'PyInquirer.prompt', 'prompt', (["[{'type': 'input', 'name': 'amount', 'message':\n 'Enter the amount of tokens to mint', 'default': '1'}, {'type':\n 'confirm', 'name': 'confirmation', 'message':\n 'Do you want to mint the selected tokens?', 'default': False}]"], {}), "([{'type': 'input', 'name'... |
import re
import wordMaps
class WordSplitter:
def __init__(self):
self.word_mapper = wordMaps.WordMaps()
self.word_breaker = re.compile(r"([^\W\d]*)", re.MULTILINE)
self.sentence_breaker = re.compile(r"((?!=|\!|\.|\?).)+.\b", re.MULTILINE)
self.swaps = {}
self.contexts =... | [
"wordMaps.WordMaps",
"re.compile"
] | [((100, 119), 'wordMaps.WordMaps', 'wordMaps.WordMaps', ([], {}), '()\n', (117, 119), False, 'import wordMaps\n'), ((149, 189), 're.compile', 're.compile', (['"""([^\\\\W\\\\d]*)"""', 're.MULTILINE'], {}), "('([^\\\\W\\\\d]*)', re.MULTILINE)\n", (159, 189), False, 'import re\n'), ((221, 274), 're.compile', 're.compile'... |
#! /usr/bin/env python3
import prime
from memo import memoize
description = '''
Next
Product-sum numbers
Problem 88
A natural number, N, that can be written as the sum and product of a given set of at least two natural numbers, {a1, a2, ... , ak} is called a product-sum number: N = a1 + a2 + ... + ak = a1 × a2 × ... ... | [
"prime.isPrime",
"prime.primes"
] | [((1107, 1121), 'prime.primes', 'prime.primes', ([], {}), '()\n', (1119, 1121), False, 'import prime\n'), ((1451, 1467), 'prime.isPrime', 'prime.isPrime', (['n'], {}), '(n)\n', (1464, 1467), False, 'import prime\n')] |
import warnings
import numpy as np
from magicgui.widgets import Table
from napari_plugin_engine import napari_hook_implementation
from napari.types import ImageData, LabelsData, LayerDataTuple
from napari import Viewer
from pandas import DataFrame
from qtpy.QtCore import QTimer
from qtpy.QtWidgets import QTableWidget,... | [
"napari_skimage_regionprops.add_table",
"pyclesperanto_prototype.statistics_of_background_and_labelled_pixels",
"warnings.warn",
"pyclesperanto_prototype.statistics_of_labelled_pixels",
"napari_tools_menu.register_function"
] | [((489, 576), 'napari_tools_menu.register_function', 'register_function', ([], {'menu': '"""Measurement > Statistics of labeled pixels (clEsperanto)"""'}), "(menu=\n 'Measurement > Statistics of labeled pixels (clEsperanto)')\n", (506, 576), False, 'from napari_tools_menu import register_function\n'), ((1407, 1445),... |
"""Run model ensemble
The canonical form of `job run` is:
job run [OPTIONS] -- EXECUTABLE [OPTIONS]
where `EXECUTABLE` is your model executable or a command, followed by its
arguments. Note the `--` that separates `job run` arguments `OPTIONS` from the
executable. When there is no ambiguity in the command-line ... | [
"argparse.ArgumentParser",
"numpy.empty",
"runner.param.MultiParam",
"runner.xrun.XParams.read",
"runner.job.config.program",
"runner.job.config.ParserIO",
"numpy.arange",
"runner.job.model.interface.get",
"os.path.join",
"runner.xrun.XRun"
] | [((2929, 2968), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'add_help': '(False)'}), '(add_help=False)\n', (2952, 2968), False, 'import argparse\n'), ((4063, 4102), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'add_help': '(False)'}), '(add_help=False)\n', (4086, 4102), False, 'import arg... |
from datetime import date
now = date.today()
print(now)
print(now.strftime("%m-%d-%y. %d %b %Y is a %A on the %d day of %B"))
past = date(2003, 12, 2)
print(past)
print(past.strftime("%m-%d-%y. %d %b %Y is a %A on the %d day of %B"))
birthday = date(1964, 7, 31)
age = now - birthday
print(age.days)
| [
"datetime.date",
"datetime.date.today"
] | [((33, 45), 'datetime.date.today', 'date.today', ([], {}), '()\n', (43, 45), False, 'from datetime import date\n'), ((135, 152), 'datetime.date', 'date', (['(2003)', '(12)', '(2)'], {}), '(2003, 12, 2)\n', (139, 152), False, 'from datetime import date\n'), ((248, 265), 'datetime.date', 'date', (['(1964)', '(7)', '(31)'... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2021 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Tests for the CLI."""
from faker import Faker
from invenio_communities.fixtures.... | [
"faker.Faker",
"invenio_communities.fixtures.demo.create_fake_community"
] | [((603, 610), 'faker.Faker', 'Faker', ([], {}), '()\n', (608, 610), False, 'from faker import Faker\n'), ((637, 665), 'invenio_communities.fixtures.demo.create_fake_community', 'create_fake_community', (['faker'], {}), '(faker)\n', (658, 665), False, 'from invenio_communities.fixtures.demo import create_fake_community\... |
from dakota_class import DakotaClass
from exceptions import *
import unittest
import xarray as xr
import numpy as np
import os
class TestDakotaClass(unittest.TestCase):
# Try and create an instance of the dakota class
def test_create_dakota_template(self):
my_dakota = DakotaClass()
s... | [
"os.remove",
"xarray.Dataset",
"os.path.isfile",
"xarray.DataArray",
"dakota_class.DakotaClass"
] | [((288, 301), 'dakota_class.DakotaClass', 'DakotaClass', ([], {}), '()\n', (299, 301), False, 'from dakota_class import DakotaClass\n'), ((610, 633), 'xarray.Dataset', 'xr.Dataset', ([], {'attrs': 'attrs'}), '(attrs=attrs)\n', (620, 633), True, 'import xarray as xr\n'), ((663, 676), 'dakota_class.DakotaClass', 'DakotaC... |
# coding: utf-8
# # Download Mmtf Files Demo
#
# Example of downloading a list of PDB entries from [RCSB]("http://mmtf.rcsb.org")
#
# ## Imports
# In[9]:
from pyspark import SparkConf, SparkContext
from mmtfPyspark.io import mmtfReader
from mmtfPyspark.structureViewer import view_structure
# ## Configure Spark... | [
"pyspark.SparkContext",
"mmtfPyspark.io.mmtfReader.download_mmtf_files",
"mmtfPyspark.structureViewer.view_structure",
"pyspark.SparkConf"
] | [((435, 458), 'pyspark.SparkContext', 'SparkContext', ([], {'conf': 'conf'}), '(conf=conf)\n', (447, 458), False, 'from pyspark import SparkConf, SparkContext\n'), ((582, 624), 'mmtfPyspark.io.mmtfReader.download_mmtf_files', 'mmtfReader.download_mmtf_files', (['pdbIds', 'sc'], {}), '(pdbIds, sc)\n', (612, 624), False,... |
from typing import List
from parse import parse_explain
from db import explain, rows_count
from parse import Analyzer
from serializer import Serializer
class Task(Serializer):
''' defines query as a task
'''
def __init__(self, parent_title, title, query, *args, **kwargs):
self.query = query
... | [
"db.rows_count",
"db.explain"
] | [((891, 922), 'db.rows_count', 'rows_count', (['session', 'self.table'], {}), '(session, self.table)\n', (901, 922), False, 'from db import explain, rows_count\n'), ((966, 994), 'db.explain', 'explain', (['session', 'self.query'], {}), '(session, self.query)\n', (973, 994), False, 'from db import explain, rows_count\n'... |