code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
Generic Caracara API module.
This module contains the the FalconApiModule class, which represents a generic
Caracara API module. All modules, including Hosts, Prevention Policies, etc.
derive from this abstract base class.
"""
import logging
from abc import ABC, abstractmethod
from falconpy import OAuth2
class... | [
"logging.getLogger"
] | [((936, 965), 'logging.getLogger', 'logging.getLogger', (['class_name'], {}), '(class_name)\n', (953, 965), False, 'import logging\n')] |
import os
import socket
import ssl
from OpenSSL import crypto, SSL
import random
def getSSLContext(app=None,config_folder="/tmp/config", cert_file="app.crt", key_file="app.key"):
""" Create SSL Cert in config folder if it does not exists """
if not os.path.exists(config_folder):
os.makedirs(config_fold... | [
"ssl.SSLContext",
"os.makedirs",
"OpenSSL.crypto.X509",
"random.randint",
"os.path.exists",
"socket.gethostname",
"OpenSSL.crypto.PKey",
"OpenSSL.crypto.dump_privatekey",
"os.path.join",
"OpenSSL.crypto.dump_certificate"
] | [((340, 378), 'os.path.join', 'os.path.join', (['config_folder', 'cert_file'], {}), '(config_folder, cert_file)\n', (352, 378), False, 'import os\n'), ((394, 431), 'os.path.join', 'os.path.join', (['config_folder', 'key_file'], {}), '(config_folder, key_file)\n', (406, 431), False, 'import os\n'), ((258, 287), 'os.path... |
import os
import uuid
import inflection
from django.db import models
from django.urls import reverse
from django.template.defaultfilters import slugify
from django.utils.translation import gettext_lazy as _
from django.conf import settings
from .abstracts import ArvestustRecord, ArvestustFile
from .validators.file impo... | [
"django.urls.reverse",
"django.db.models.Index",
"os.path.splitext",
"django.utils.translation.gettext_lazy"
] | [((432, 458), 'os.path.splitext', 'os.path.splitext', (['filename'], {}), '(filename)\n', (448, 458), False, 'import os\n'), ((1014, 1065), 'django.urls.reverse', 'reverse', (['"""image-detail"""'], {'kwargs': "{'slug': self.slug}"}), "('image-detail', kwargs={'slug': self.slug})\n", (1021, 1065), False, 'from django.u... |
from flask import Flask
from flask_jwt import JWT, jwt_required, current_identity
from werkzeug.security import safe_str_cmp
class User(object):
def __init__(self, id, username, password):
self.id = id
self.username = username
self.password = password
def __str__(self):
return... | [
"flask.Flask",
"flask_jwt.jwt_required",
"flask_jwt.JWT"
] | [((823, 838), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (828, 838), False, 'from flask import Flask\n'), ((905, 937), 'flask_jwt.JWT', 'JWT', (['app', 'authenticate', 'identity'], {}), '(app, authenticate, identity)\n', (908, 937), False, 'from flask_jwt import JWT, jwt_required, current_identity\n'),... |
from mongoengine import signals
from mass_flask_core.models import AnalysisSystem, Report
from .dispatch_request import update_dispatch_request_for_new_sample, create_requests_for_new_analysis_system
from .copy_report_tags import copy_tags_from_report_to_sample
def connect_signals():
signals.post_save.connect(upd... | [
"mongoengine.signals.post_save.connect"
] | [((291, 356), 'mongoengine.signals.post_save.connect', 'signals.post_save.connect', (['update_dispatch_request_for_new_sample'], {}), '(update_dispatch_request_for_new_sample)\n', (316, 356), False, 'from mongoengine import signals\n'), ((361, 455), 'mongoengine.signals.post_save.connect', 'signals.post_save.connect', ... |
from datetime import datetime, timedelta
from nose.tools import eq_
from kitsune.products.tests import ProductFactory, TopicFactory
from kitsune.search.tests.test_es import ElasticTestCase
from kitsune.wiki.tests import (
DocumentFactory, RevisionFactory, HelpfulVoteFactory, RedirectRevisionFactory)
from kitsune.... | [
"kitsune.wiki.tests.RedirectRevisionFactory",
"kitsune.wiki.tests.HelpfulVoteFactory",
"kitsune.products.tests.TopicFactory",
"kitsune.wiki.models.RevisionMetricsMappingType.search",
"kitsune.wiki.models.DocumentMappingType.search",
"datetime.datetime.now",
"kitsune.wiki.models.DocumentMappingType.extra... | [((579, 596), 'kitsune.wiki.tests.DocumentFactory', 'DocumentFactory', ([], {}), '()\n', (594, 596), False, 'from kitsune.wiki.tests import DocumentFactory, RevisionFactory, HelpfulVoteFactory, RedirectRevisionFactory\n'), ((605, 652), 'kitsune.wiki.tests.RevisionFactory', 'RevisionFactory', ([], {'document': 'doc', 'i... |
"""
stateinterpreter
Interpretation of metastable states from MD simulations
"""
import sys
from setuptools import setup, find_packages, Extension
import versioneer
import numpy
os_name = sys.platform
compile_args = ["-O3", "-ffast-math", "-march=native", "-fopenmp" ]
libraries = ["m"]
link_args = ['-fopenmp']
if os_... | [
"versioneer.get_version",
"Cython.Build.cythonize",
"versioneer.get_cmdclass",
"numpy.get_include",
"setuptools.find_packages"
] | [((1487, 1509), 'Cython.Build.cythonize', 'cythonize', (['ext_modules'], {}), '(ext_modules)\n', (1496, 1509), False, 'from Cython.Build import cythonize\n'), ((1809, 1833), 'versioneer.get_version', 'versioneer.get_version', ([], {}), '()\n', (1831, 1833), False, 'import versioneer\n'), ((1848, 1873), 'versioneer.get_... |
import os
from django.urls import reverse
from zentral.contrib.munki.forms import EnrollmentForm
from zentral.utils.osx_package import EnrollmentPackageBuilder
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
class MunkiZentralEnrollPkgBuilder(EnrollmentPackageBuilder):
name = "Zentral Munki Enrollment"
... | [
"django.urls.reverse",
"os.path.abspath",
"os.path.join"
] | [((188, 213), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (203, 213), False, 'import os\n'), ((466, 502), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""build.tmpl"""'], {}), "(BASE_DIR, 'build.tmpl')\n", (478, 502), False, 'import os\n'), ((985, 1008), 'django.urls.reverse', 'reverse',... |
# Here we provide the key functions for tile-coding. To avoid huge dimensionality expansion, we have tiled
# per feature variable, but using feature-column cross functionality a pair of feature-variables
# also can be tiled, and also higher orders.
from typing import List
import numpy as np
import tensorflow as tf
fr... | [
"tensorflow.python.ops.math_ops.bucketize",
"tensorflow.reshape",
"tensorflow.concat",
"tensorflow.cast",
"numpy.array"
] | [((652, 672), 'numpy.array', 'np.array', (['boundaries'], {}), '(boundaries)\n', (660, 672), True, 'import numpy as np\n'), ((1062, 1093), 'tensorflow.cast', 'tf.cast', (['input_data', 'tf.float64'], {}), '(input_data, tf.float64)\n', (1069, 1093), True, 'import tensorflow as tf\n'), ((1452, 1480), 'tensorflow.concat',... |
from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(
name='EOSim',
version='0.1',
description='Earth Observation Simulation',
author='BAERI',
author_email='<EMAIL>',
packages=['eosim'],
scripts=[
],
# Cartopy installation may n... | [
"setuptools.setup"
] | [((102, 345), 'setuptools.setup', 'setup', ([], {'name': '"""EOSim"""', 'version': '"""0.1"""', 'description': '"""Earth Observation Simulation"""', 'author': '"""BAERI"""', 'author_email': '"""<EMAIL>"""', 'packages': "['eosim']", 'scripts': '[]', 'install_requires': "['numpy', 'pandas', 'scipy', 'lowtran', 'astropy',... |
# Copyright (c) 2019 Red Hat, 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 to in writ... | [
"os.environ.copy",
"oslo_concurrency.processutils.execute",
"logging.getLogger"
] | [((696, 723), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (713, 723), False, 'import logging\n'), ((1995, 2031), 'oslo_concurrency.processutils.execute', 'processutils.execute', (['*cmd'], {}), '(*cmd, **kwargs)\n', (2015, 2031), False, 'from oslo_concurrency import processutils\n'), (... |
from collections import deque
from random import *
class Maze():
def __init__(self, player, canvas, y, x):
self.player = player
self.canvas = canvas
self.size = {"x": 2 * x - 1,
"y": 2 * y - 1}
# 0 = air, 1 = wall, 2 = player. 3 = target
def generate(self):
... | [
"collections.deque"
] | [((957, 964), 'collections.deque', 'deque', ([], {}), '()\n', (962, 964), False, 'from collections import deque\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | [
"django.db.models.TextField",
"django.db.migrations.swappable_dependency",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField"
] | [((210, 267), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (241, 267), False, 'from django.db import models, migrations\n'), ((2008, 2069), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'to': '""... |
# -*- coding: utf-8 -*-"""
"""
Setup file for pymusepipe.
Use setup.cfg to configure your project.
"""
# Licensed under a MIT style license - see LICENSE.txt
from __future__ import absolute_import, division, print_function
from setuptools import setup, find_packages
version = {}
with open("src/pymusepipe/vers... | [
"setuptools.find_packages"
] | [((974, 1014), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "('tests', 'docs')"}), "(exclude=('tests', 'docs'))\n", (987, 1014), False, 'from setuptools import setup, find_packages\n')] |
import tensorflow as tf
import numpy as np
import src.utils as utils
"""
Implementation of InfoVAE
https://arxiv.org/abs/1706.02262
"""
def reparameterise(x, n, stddev):
"""
Model each output as bing guassian distributed.
Use the reparameterisation trick so we can sample while remaining
differentiable... | [
"tensorflow.reshape",
"tensorflow.zeros_like",
"tensorflow.keras.Sequential",
"numpy.round",
"numpy.pad",
"tensorflow.cast",
"tensorflow.keras.layers.Activation",
"tensorflow.exp",
"numpy.reshape",
"tensorflow.gradients",
"tensorflow.name_scope",
"tensorflow.norm",
"tensorflow.layers.flatten... | [((1473, 1495), 'tensorflow.norm', 'tf.norm', (['(x - y)'], {'axis': '(1)'}), '(x - y, axis=1)\n', (1480, 1495), True, 'import tensorflow as tf\n'), ((1630, 1650), 'tensorflow.layers.flatten', 'tf.layers.flatten', (['z'], {}), '(z)\n', (1647, 1650), True, 'import tensorflow as tf\n'), ((6352, 6379), 'tensorflow.enable_... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: tetration_application
short description: Enables creation, modification, deletion and query of an application
version_added: '2.9'
description:
-... | [
"ansible.module_utils.basic.AnsibleModule",
"ansible.module_utils.tetration.TetrationApiModule"
] | [((6042, 6190), 'ansible.module_utils.basic.AnsibleModule', 'AnsibleModule', ([], {'argument_spec': 'module_args', 'mutually_exclusive': "[['app_scope_name', 'app_scope_id']]", 'required_one_of': "[['app_name', 'app_id']]"}), "(argument_spec=module_args, mutually_exclusive=[[\n 'app_scope_name', 'app_scope_id']], re... |
import unittest
from unittest import mock
import uuid
import asyncio
from rafter.server import RaftServer
from rafter.models import LogEntry
from rafter.exceptions import NotLeaderException
from .mocks import Log, Storage, Service
class RaftServerTest(unittest.TestCase):
def setUp(self):
self.loop = asy... | [
"unittest.mock.patch",
"unittest.mock.Mock",
"asyncio.get_event_loop"
] | [((317, 341), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (339, 341), False, 'import asyncio\n'), ((568, 579), 'unittest.mock.Mock', 'mock.Mock', ([], {}), '()\n', (577, 579), False, 'from unittest import mock\n'), ((787, 798), 'unittest.mock.Mock', 'mock.Mock', ([], {}), '()\n', (796, 798), F... |
from collections import Counter
from time import time
from typing import List, Optional, Tuple
from ..framework.load_file import load_file
from ..library.base import list_to_number
Sudoku = List[List[int]]
spec = '{:6.6f}'
class SetNoZero(set):
def add(self, x) -> None:
if x != 0:
super().ad... | [
"collections.Counter",
"time.time"
] | [((5396, 5402), 'time.time', 'time', ([], {}), '()\n', (5400, 5402), False, 'from time import time\n'), ((2906, 2915), 'collections.Counter', 'Counter', ([], {}), '()\n', (2913, 2915), False, 'from collections import Counter\n'), ((3329, 3338), 'collections.Counter', 'Counter', ([], {}), '()\n', (3336, 3338), False, 'f... |
from unittest import mock
import pytest
from karp5.server import searching
def test_autocompletequery(app):
mode = "foo"
q = "any"
boost = {"term": {"field": {"boost": "500", "value": q}}}
result = searching.autocompletequery(mode, boost, q)
expected = {"bool": {"should": [boost, {"match_phras... | [
"karp5.server.searching.get_pre_post",
"karp5.server.searching.autocompletequery",
"unittest.mock.Mock",
"karp5.server.searching.export",
"karp5.server.searching.autocomplete",
"unittest.mock.patch",
"pytest.raises",
"karp5.server.searching.get_context",
"pytest.mark.parametrize"
] | [((373, 433), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""user_is_authorized"""', '[False, True]'], {}), "('user_is_authorized', [False, True])\n", (396, 433), False, 'import pytest\n'), ((2080, 2123), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""lexicon"""', "['foo']"], {}), "('lexicon',... |
#!/usr/bin/env python3
import argparse
def parse_args():
p = argparse.ArgumentParser()
p.add_argument('path', type=str)
p.add_argument('-m', '--minpow', type=int, default=3)
p.add_argument('-M', '--maxpow', type=int, default=7)
p.add_argument('-s', '--step', type=int, default=2)
p.add_argument... | [
"speedfuncs3d.speed_funcs",
"common3d.time_marcher",
"h5py.File",
"argparse.ArgumentParser",
"common3d.get_marcher_name",
"numpy.logspace",
"sys.path.insert",
"speedfuncs3d.get_soln_func",
"itertools.product",
"numpy.round",
"common3d.compute_soln",
"speedfuncs3d.get_speed_func_name",
"speed... | [((67, 92), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (90, 92), False, 'import argparse\n'), ((694, 735), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../build/Release"""'], {}), "(0, '../../build/Release')\n", (709, 735), False, 'import sys\n'), ((1395, 1461), 'numpy.logspace', '... |
import threading as th
import queue as q
import yaml
STOP_STAT = "STOP"
class StatsFileHandler:
class StatsWriter(th.Thread):
def __init__(self, queue, file_path):
self.running = True
self.queue = queue
self.file_path = file_path
self.f_pointer_map = {}
... | [
"yaml.dump",
"queue.Queue"
] | [((951, 960), 'queue.Queue', 'q.Queue', ([], {}), '()\n', (958, 960), True, 'import queue as q\n'), ((683, 714), 'yaml.dump', 'yaml.dump', ([], {'data': 'value', 'stream': 'f'}), '(data=value, stream=f)\n', (692, 714), False, 'import yaml\n')] |
import time
import logging
import yaml
from kubernetes import client
from kubernetes.client.rest import ApiException
LOGGER = logging.getLogger()
def set_global_namespace_value(namespace_name):
"""
Make namespace as global to be used in later functions
Args:
param1: namespace_name - ... | [
"kubernetes.client.V1ServiceAccount",
"kubernetes.client.V1ClusterRole",
"kubernetes.client.V1Namespace",
"kubernetes.client.V1beta1JSONSchemaProps",
"kubernetes.client.V1ObjectMeta",
"logging.getLogger",
"kubernetes.client.V1LabelSelector",
"kubernetes.client.V1EmptyDirVolumeSource",
"kubernetes.cl... | [((131, 150), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (148, 150), False, 'import logging\n'), ((748, 766), 'kubernetes.client.CoreV1Api', 'client.CoreV1Api', ([], {}), '()\n', (764, 766), False, 'from kubernetes import client\n'), ((793, 884), 'kubernetes.client.V1ObjectMeta', 'client.V1ObjectMeta',... |
# coding: utf-8
from datetime import date, datetime
from typing import List, Dict, Type
from openapi_server.models.base_model_ import Model
from openapi_server import util
class Block(Model):
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Do not edit the class... | [
"openapi_server.util.deserialize_model"
] | [((1388, 1421), 'openapi_server.util.deserialize_model', 'util.deserialize_model', (['dikt', 'cls'], {}), '(dikt, cls)\n', (1410, 1421), False, 'from openapi_server import util\n')] |
import torch
from models.experimental import attempt_load
from utils.datasets import LoadImages
from utils.general import check_img_size, non_max_suppression, scale_coords, set_logging
from utils.torch_utils import select_device, time_synchronized
import multiprocessing as mp
# 目标检测
def detect_center(frame_cap,conditi... | [
"utils.torch_utils.time_synchronized",
"torch.tensor",
"utils.general.set_logging",
"utils.general.non_max_suppression",
"models.experimental.attempt_load",
"utils.datasets.LoadImages",
"torch.zeros",
"utils.torch_utils.select_device",
"utils.general.check_img_size",
"utils.general.scale_coords",
... | [((431, 444), 'utils.general.set_logging', 'set_logging', ([], {}), '()\n', (442, 444), False, 'from utils.general import check_img_size, non_max_suppression, scale_coords, set_logging\n'), ((458, 475), 'utils.torch_utils.select_device', 'select_device', (['""""""'], {}), "('')\n", (471, 475), False, 'from utils.torch_... |
"""Test Suites: 370 passed, 370 total
Tests: 4 skipped, 1050 passed, 1054 total
Tests: 28 passed, 28 total
Snapshots: 830 passed, 830 total
Time: 67.988s
Ran all test suites.
Done in 99.84s."""
"""Test Suites: 187 passed, 187 total
Tests: 1 skipped, 579 passed, 580 total
Snapshots: 429 pas... | [
"log_retriever.joblog",
"re.findall"
] | [((1108, 1148), 're.findall', 're.findall', (['TEST_REGEX_FORMAT_2_P_T', 'log'], {}), '(TEST_REGEX_FORMAT_2_P_T, log)\n', (1118, 1148), False, 'import re\n'), ((1478, 1511), 're.findall', 're.findall', (['TEST_REGEX_P_T_2', 'log'], {}), '(TEST_REGEX_P_T_2, log)\n', (1488, 1511), False, 'import re\n'), ((1765, 1798), 'r... |
# Generated by Django 2.2.7 on 2019-11-17 17:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Pedido', '0039_auto_20191117_1417'),
]
operations = [
migrations.AlterField(
model_name='pedido',
name='valor_total'... | [
"django.db.models.DecimalField"
] | [((340, 435), 'django.db.models.DecimalField', 'models.DecimalField', ([], {'decimal_places': '(2)', 'max_digits': '(7)', 'null': '(True)', 'verbose_name': '"""Valor Total"""'}), "(decimal_places=2, max_digits=7, null=True, verbose_name\n ='Valor Total')\n", (359, 435), False, 'from django.db import migrations, mode... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [
"pulumi.get",
"pulumi.getter",
"pulumi.ResourceOptions",
"pulumi.set",
"pulumi.log.warn",
"warnings.warn"
] | [((15269, 15305), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""scalingGroupId"""'}), "(name='scalingGroupId')\n", (15282, 15305), False, 'import pulumi\n'), ((16035, 16076), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""creditSpecification"""'}), "(name='creditSpecification')\n", (16048, 16076), False, 'im... |
# -*- coding: utf-8 -*-
import json
from itertools import izip
from django.test.client import Client
from networkapi.test.test_case import NetworkApiTestCase
from networkapi.util.geral import prepare_url
fixtures_base_path = 'networkapi/api_network/fixtures/integration/%s'
class NetworksIntegrationV6TestCase(Netwo... | [
"django.test.client.Client",
"networkapi.util.geral.prepare_url",
"itertools.izip",
"json.dumps"
] | [((1904, 1912), 'django.test.client.Client', 'Client', ([], {}), '()\n', (1910, 1912), False, 'from django.test.client import Client\n'), ((14418, 14451), 'itertools.izip', 'izip', (['networks', 'expected_networks'], {}), '(networks, expected_networks)\n', (14422, 14451), False, 'from itertools import izip\n'), ((4352,... |
import re
import string
import unicodedata
from unstdlib.six import text_type, PY3, string_types, binary_type, u
from unstdlib.six.moves import xrange
if PY3:
text_type_magicmethod = "__str__"
else:
text_type_magicmethod = "__unicode__"
from .random_ import random
__all__ = [
'random_string',
'numb... | [
"unstdlib.six.moves.xrange",
"unstdlib.six.binary_type",
"unstdlib.six.text_type",
"doctest.testmod",
"re.compile"
] | [((9514, 9542), 're.compile', 're.compile', (['"""[\\\\d\\\\.\\\\-eE]+"""'], {}), "('[\\\\d\\\\.\\\\-eE]+')\n", (9524, 9542), False, 'import re\n'), ((10478, 10496), 're.compile', 're.compile', (['"""\\\\W+"""'], {}), "('\\\\W+')\n", (10488, 10496), False, 'import re\n'), ((5771, 5787), 'unstdlib.six.binary_type', 'bin... |
import pytest
import snappi
def test_snappi_lists(api):
"""Validate SnappiList object indexing and unpacking
"""
config = api.config()
flows = config.flows.flow(name='1')
assert(flows.__class__ == snappi.FlowIter)
flow = flows[0]
flow.tx_rx.port.tx_name = 'p1'
assert(flow.__class__ ==... | [
"pytest.main"
] | [((1897, 1933), 'pytest.main', 'pytest.main', (["['-vv', '-s', __file__]"], {}), "(['-vv', '-s', __file__])\n", (1908, 1933), False, 'import pytest\n')] |
import sys
def dprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def read():
c = sys.stdin.read(1)
#dprint(f"Read byte '{c[0]}'")
return c
def clean_read():
while True:
v = read()
#dprint(f"clean_read: '{v[0]}'")
if v == '\n': continue
if v == ' ': ... | [
"sys.stdin.read",
"sys.exit"
] | [((106, 123), 'sys.stdin.read', 'sys.stdin.read', (['(1)'], {}), '(1)\n', (120, 123), False, 'import sys\n'), ((4725, 4736), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (4733, 4736), False, 'import sys\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pyFuckery - memory.py
Created on 2/12/17.
Memory object implementation. Provides memory bounds checking, as well as value enforcement.
"""
# Stdlib
import argparse
import hashlib
import json
import logging
import sys
# Third Party Code
import msgpack
# Custom Code
f... | [
"fuckery.exc.StorageError",
"argparse.ArgumentParser",
"logging.basicConfig",
"fuckery.exc.AddressError",
"logging.getLogger",
"logging.disable",
"msgpack.dumps",
"sys.exit"
] | [((544, 571), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (561, 571), False, 'import logging\n'), ((2907, 2918), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (2915, 2918), False, 'import sys\n'), ((3015, 3078), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description... |
"""Admin for the ``test_app`` app."""
from django.contrib import admin
from .models import DummyProfileModel
admin.site.register(DummyProfileModel)
| [
"django.contrib.admin.site.register"
] | [((112, 150), 'django.contrib.admin.site.register', 'admin.site.register', (['DummyProfileModel'], {}), '(DummyProfileModel)\n', (131, 150), False, 'from django.contrib import admin\n')] |
import datetime
import logging
import h5py
from .file_analyzer import FileAnalyzer
from .flux_calibration_data_analyzer import FluxCalibrationDataAnalyzer
module_logger = logging.getLogger(__name__)
class FluxCalibrationFileAnalyzer(FileAnalyzer):
def __init__(self, file_path):
super(FluxCalibrationA... | [
"datetime.datetime.strptime",
"h5py.File",
"logging.getLogger"
] | [((175, 202), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (192, 202), False, 'import logging\n'), ((568, 629), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['self.timestamp', '"""%Y-%j-%Hh%Mm%Ss"""'], {}), "(self.timestamp, '%Y-%j-%Hh%Mm%Ss')\n", (594, 629), False, 'imp... |
import pandas as pd
import json
file = '~/stations.xlsx'
sheet_name = 'Data'
scenarios = ['A', 'B', 'C', 'D', 'E']
flat_rate = 0.3
battery_rate = 0.7
length_time_interval = 120
stations = {}
def read_excel():
df_stations = pd.read_excel(file, sheet_name)
for index, row in df_stations.iterrows():
int... | [
"pandas.read_excel",
"json.dump"
] | [((231, 262), 'pandas.read_excel', 'pd.read_excel', (['file', 'sheet_name'], {}), '(file, sheet_name)\n', (244, 262), True, 'import pandas as pd\n'), ((1480, 1507), 'json.dump', 'json.dump', (['json_element', 'fp'], {}), '(json_element, fp)\n', (1489, 1507), False, 'import json\n')] |
from utils import Semaphore, Thread, Buffer, execution_manager
import random
import time
class WaitForEvent:
def __init__(self, data):
self.data = data
def process(self):
print("Finished consuming event {}".format(self.data))
mutex = Semaphore(1)
items = Semaphore(0)
buffer = Buffer()
def ... | [
"utils.Buffer",
"random.random",
"utils.Thread",
"utils.Semaphore"
] | [((262, 274), 'utils.Semaphore', 'Semaphore', (['(1)'], {}), '(1)\n', (271, 274), False, 'from utils import Semaphore, Thread, Buffer, execution_manager\n'), ((283, 295), 'utils.Semaphore', 'Semaphore', (['(0)'], {}), '(0)\n', (292, 295), False, 'from utils import Semaphore, Thread, Buffer, execution_manager\n'), ((305... |
from ctypes import Structure, Union, c_char_p, c_double, c_int, c_byte, \
c_long, POINTER
c_byte_p = POINTER(c_byte)
class MBusString(Structure):
_fields_ = [
('value', c_byte_p),
('size', c_int),
]
class MBusValue(Union):
_fields_ = [
('real_val... | [
"ctypes.POINTER"
] | [((110, 125), 'ctypes.POINTER', 'POINTER', (['c_byte'], {}), '(c_byte)\n', (117, 125), False, 'from ctypes import Structure, Union, c_char_p, c_double, c_int, c_byte, c_long, POINTER\n')] |
from rest_framework import routers
from . import ecommerce_viewsets
router = routers.DefaultRouter()
router.register(
r"ecommerce/purchase", ecommerce_viewsets.PurchasesViewSet, basename="api-purchases"
)
urlpatterns = router.urls
| [
"rest_framework.routers.DefaultRouter"
] | [((79, 102), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (100, 102), False, 'from rest_framework import routers\n')] |
# Copyright (c) 2018 Georgia Tech Research Corporation
# Distributed under the terms of the BSD-3-Clause License
""" Completion implementations
"""
# pylint: disable=W0613,C0330,R0913,W0703,R0914
import re
from typing import List, Tuple
from IPython.core.completerlib import get_root_modules
from robot.libraries imp... | [
"IPython.core.completerlib.get_root_modules",
"re.split",
"re.match",
"re.findall",
"robot.parsing.robotreader.RobotReader.split_row"
] | [((7940, 8010), 're.match', 're.match', (['"""^(given|when|then|and|but)?\\\\b *(.*)"""', 'kw_token'], {'flags': 're.I'}), "('^(given|when|then|and|but)?\\\\b *(.*)', kw_token, flags=re.I)\n", (7948, 8010), False, 'import re\n'), ((9384, 9462), 're.split', 're.split', (['"""^(\\\\| )?(\\\\*+ *[^*]+? *\\\\*+)"""', 'code... |
""" irc x
"""
import automol.reac
import autofile
import elstruct
from mechlib.reaction import grid as rxngrid
from mechlib.amech_io import printer as ioprinter
from mechroutines.es import runner as es_runner
from mechroutines.es.runner import qchem_params
# Intrinsic Reaction Coordinates
def execute_irc(zma, ts_inf... | [
"mechroutines.es.runner.read_job",
"mechroutines.es.runner.run_job",
"mechroutines.es.runner.qchem_params",
"mechlib.amech_io.printer.info_message",
"autofile.fs.single_point",
"mechlib.reaction.grid.grid_maximum_zmatrices",
"elstruct.reader.irc_points",
"elstruct.reader.irc_path",
"sys.exit"
] | [((3157, 3203), 'mechroutines.es.runner.read_job', 'es_runner.read_job', ([], {'job': 'irc_job', 'run_fs': 'run_fs'}), '(job=irc_job, run_fs=run_fs)\n', (3175, 3203), True, 'from mechroutines.es import runner as es_runner\n'), ((7051, 7061), 'sys.exit', 'sys.exit', ([], {}), '()\n', (7059, 7061), False, 'import sys\n')... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 19 18:03:59 2016
@author: jones_000
"""
import copy as cp
import numpy as np
import math
import Solver
import Physics
import Body
import vector
import matplotlib.pyplot as plt
class Simulation(object):
'''Parent Simulation class
Attributes
----------
... | [
"matplotlib.pyplot.title",
"Solver.RK2",
"copy.deepcopy",
"math.sqrt",
"matplotlib.pyplot.plot",
"math.floor",
"Physics.NBody",
"matplotlib.pyplot.figure",
"Body.GravBody",
"numpy.array",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.ylabel",
"vector.Vector",
"numpy.arccos",
"numpy.sqrt... | [((4569, 4654), 'math.sqrt', 'math.sqrt', (['(self.G * M2 ** 3.0 / (a1 * (M1 + M2) ** 2.0) * ((1.0 + e) / (1.0 - e)))'], {}), '(self.G * M2 ** 3.0 / (a1 * (M1 + M2) ** 2.0) * ((1.0 + e) / (1.0 -\n e)))\n', (4578, 4654), False, 'import math\n'), ((4671, 4699), 'vector.Vector', 'vector.Vector', (['r1p', '(0.0)', '(0.0... |
""" core run function
"""
from autorun import from_input_string
def direct(input_writer, script_str, run_dir, prog,
geo, charge, mult, method, basis, **kwargs):
""" Generates an input file for an electronic structure job and
runs it directly.
:param input_writer: elstruct writer modul... | [
"autorun.from_input_string"
] | [((1280, 1329), 'autorun.from_input_string', 'from_input_string', (['script_str', 'run_dir', 'input_str'], {}), '(script_str, run_dir, input_str)\n', (1297, 1329), False, 'from autorun import from_input_string\n')] |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
import torch
import torch.nn as nn
import torch.utils.data as data
import torch.backends.cudnn as cudnn
import torchvision.transforms as transforms
import os
import time
import argparse
import numpy as np
from PIL import Ima... | [
"utils.augmentations.to_chw_bgr",
"argparse.ArgumentParser",
"torch.set_default_tensor_type",
"torch.cat",
"cv2.rectangle",
"os.path.join",
"torch.load",
"os.path.exists",
"torch.Tensor",
"cv2.resize",
"importlib.import_module",
"os.path.basename",
"torch.cuda.is_available",
"os.listdir",
... | [((543, 601), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""face detection demo"""'}), "(description='face detection demo')\n", (566, 601), False, 'import argparse\n'), ((1751, 1776), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1774, 1776), False, 'import to... |
import os
import numpy as np
import tensorflow as tf
from keras import backend as K
from keras.models import Sequential
from keras.layers import Conv2D, Dense, Activation, Flatten, Lambda, Dropout
from keras.models import Sequential
from keras.optimizers import Adam
from utils import load_multi_dataset, mkdir_p, HDF5_P... | [
"sklearn.model_selection.train_test_split",
"keras.layers.Dropout",
"keras.backend.set_session",
"tensorflow.Session",
"keras.layers.Flatten",
"keras.optimizers.Adam",
"time.time",
"datetime.datetime.now",
"tensorflow.ConfigProto",
"utils.mkdir_p",
"keras.layers.Lambda",
"keras.layers.Conv2D",... | [((442, 458), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (456, 458), True, 'import tensorflow as tf\n'), ((505, 530), 'tensorflow.Session', 'tf.Session', ([], {'config': 'config'}), '(config=config)\n', (515, 530), True, 'import tensorflow as tf\n'), ((531, 550), 'keras.backend.set_session', 'K.set_s... |
import os
from flask import Flask, request, jsonify, Response
from flask_pymongo import PyMongo
from bson.objectid import ObjectId
from prometheus_flask_exporter import PrometheusMetrics
app = Flask(__name__)
app.config["MONGO_URI"] = "mongodb://mongo:27017/dev"
mongo = PyMongo(app)
db = mongo.db
hostname = os.uname(... | [
"bson.objectid.ObjectId",
"flask.Flask",
"os.uname",
"flask.jsonify",
"flask_pymongo.PyMongo",
"prometheus_flask_exporter.PrometheusMetrics",
"flask.request.get_json"
] | [((194, 209), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (199, 209), False, 'from flask import Flask, request, jsonify, Response\n'), ((272, 284), 'flask_pymongo.PyMongo', 'PyMongo', (['app'], {}), '(app)\n', (279, 284), False, 'from flask_pymongo import PyMongo\n'), ((326, 348), 'prometheus_flask_expo... |
from core.advbase import *
from slot.a import *
from slot.d import *
def module():
return Yurius
class Yurius(Adv):
a3 = ('prep', 100)
conf = {}
conf['slots.a'] = Primal_Crisis()+Candy_Couriers()
conf['slots.d'] = Gaibhne_and_Creidhne()
conf['acl'] = """
if self.afflics.frostbite.get()... | [
"core.simulate.test_with_argv"
] | [((2511, 2542), 'core.simulate.test_with_argv', 'test_with_argv', (['None', '*sys.argv'], {}), '(None, *sys.argv)\n', (2525, 2542), False, 'from core.simulate import test_with_argv\n')] |
from numpy.testing import assert_allclose
from ctapipe.calib.camera import (
CameraCalibrator,
HESSIOR1Calibrator,
NullR1Calibrator
)
from ctapipe.image.extractor import LocalPeakWindowSum
from ctapipe.io import SimTelEventSource
from ctapipe.utils import get_dataset_path
from traitlets.config.configurable... | [
"ctapipe.calib.camera.CameraCalibrator",
"ctapipe.utils.get_dataset_path",
"traitlets.config.configurable.Config",
"ctapipe.io.SimTelEventSource"
] | [((440, 489), 'ctapipe.calib.camera.CameraCalibrator', 'CameraCalibrator', ([], {'r1_product': '"""HESSIOR1Calibrator"""'}), "(r1_product='HESSIOR1Calibrator')\n", (456, 489), False, 'from ctapipe.calib.camera import CameraCalibrator, HESSIOR1Calibrator, NullR1Calibrator\n'), ((648, 697), 'ctapipe.calib.camera.CameraCa... |
# Generated by Django 1.9.1 on 2016-02-20 21:11
from django.db import migrations
def is_course_archived(course):
assert (course._participant_count is None) == (course._voter_count is None)
return course._participant_count is not None
def is_semester_archived(semester):
if semester.course_set.count() ==... | [
"django.db.migrations.RunPython"
] | [((956, 1033), 'django.db.migrations.RunPython', 'migrations.RunPython', (['set_is_archived'], {'reverse_code': 'migrations.RunPython.noop'}), '(set_is_archived, reverse_code=migrations.RunPython.noop)\n', (976, 1033), False, 'from django.db import migrations\n')] |
from tkinter import Tk, Label
root = Tk()
a = Label(root, text='Live de Python', font=('Arial', 30))
a.pack()
root.mainloop()
| [
"tkinter.Label",
"tkinter.Tk"
] | [((39, 43), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (41, 43), False, 'from tkinter import Tk, Label\n'), ((49, 103), 'tkinter.Label', 'Label', (['root'], {'text': '"""Live de Python"""', 'font': "('Arial', 30)"}), "(root, text='Live de Python', font=('Arial', 30))\n", (54, 103), False, 'from tkinter import Tk, Label\n')] |
from fastapi import FastAPI
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from fastapi.middleware.cors import CORSMiddleware
from pydantic import BaseSettings
#root
app = FastAPI()
class Settings(BaseSettings):
env: str = 'production'
SECRET_KEY = "09d25e094faa6... | [
"sqlalchemy.create_engine",
"sqlalchemy.ext.declarative.declarative_base",
"fastapi.FastAPI"
] | [((220, 229), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (227, 229), False, 'from fastapi import FastAPI\n'), ((532, 559), 'sqlalchemy.create_engine', 'create_engine', (['DATABASE_URI'], {}), '(DATABASE_URI)\n', (545, 559), False, 'from sqlalchemy import create_engine\n'), ((567, 585), 'sqlalchemy.ext.declarative.... |
import os
import random
import time
from multiprocessing import Pool
def run_task(name):
print('Task {task_name} (pid={pid}) is Running...'.format(task_name=name, pid=os.getpid()))
time.sleep(random.randm() * 3)
print('Task {task_name} end.'.format(task_name=name))
if __name__ == '__main__':
print(... | [
"os.getpid",
"random.randm",
"multiprocessing.Pool"
] | [((377, 394), 'multiprocessing.Pool', 'Pool', ([], {'processes': '(3)'}), '(processes=3)\n', (381, 394), False, 'from multiprocessing import Pool\n'), ((202, 216), 'random.randm', 'random.randm', ([], {}), '()\n', (214, 216), False, 'import random\n'), ((173, 184), 'os.getpid', 'os.getpid', ([], {}), '()\n', (182, 184)... |
import os
from conans import ConanFile, tools
from conans.errors import ConanInvalidConfiguration
class StructoptConan(ConanFile):
name = "structopt"
homepage = "https://github.com/p-ranav/structopt"
url = "https://github.com/conan-io/conan-center-index"
description = "Parse command line arguments by d... | [
"conans.tools.get",
"conans.tools.check_min_cppstd",
"os.path.join",
"conans.tools.Version"
] | [((979, 1024), 'conans.tools.Version', 'tools.Version', (['self.settings.compiler.version'], {}), '(self.settings.compiler.version)\n', (992, 1024), False, 'from conans import ConanFile, tools\n'), ((1977, 2030), 'conans.tools.get', 'tools.get', ([], {}), "(**self.conan_data['sources'][self.version])\n", (1986, 2030), ... |
"""This module contains `docker container rm` class"""
from docker.errors import APIError
from tsaotun.lib.Docker.Container.command import Command
from tsaotun.cli import Tsaotun
class Rm(Command):
"""This class implements `docker container rm` command"""
name = "container rm"
require = []
def __in... | [
"tsaotun.lib.Docker.Container.command.Command.__init__",
"tsaotun.cli.Tsaotun"
] | [((340, 362), 'tsaotun.lib.Docker.Container.command.Command.__init__', 'Command.__init__', (['self'], {}), '(self)\n', (356, 362), False, 'from tsaotun.lib.Docker.Container.command import Command\n'), ((659, 668), 'tsaotun.cli.Tsaotun', 'Tsaotun', ([], {}), '()\n', (666, 668), False, 'from tsaotun.cli import Tsaotun\n'... |
import os
import torch
import torch.nn as nn
import torch.optim as optim
from torch.nn.utils import clip_grad_norm
import misc.utils as utils
class Optim(object):
def __init__(self, opt):
self.last_ppl = None
self.init_i2t(opt)
self.init_nmt(opt)
self._step = 0
self.opt = o... | [
"torch.optim.Adagrad",
"torch.optim.Adam",
"torch.nn.utils.clip_grad_norm",
"torch.optim.RMSprop",
"os.path.join",
"torch.optim.SGD"
] | [((2428, 2500), 'torch.optim.RMSprop', 'optim.RMSprop', (['parameters', 'lr', 'alpha', 'epsilon'], {'weight_decay': 'weight_decay'}), '(parameters, lr, alpha, epsilon, weight_decay=weight_decay)\n', (2441, 2500), True, 'import torch.optim as optim\n'), ((2559, 2615), 'torch.optim.Adagrad', 'optim.Adagrad', (['parameter... |
'''
Haystack does not yet support range facets on Solr. This module
provides subclasses of SolrSearchQuery and SolrSearchBackend to
patch in range facet functionalty.
'''
from haystack import connections
from haystack.backends.solr_backend import SolrSearchQuery, SolrSearchBackend, \
SolrEngine
from unidecode imp... | [
"unidecode.unidecode"
] | [((5382, 5400), 'unidecode.unidecode', 'unidecode', (['elem[0]'], {}), '(elem[0])\n', (5391, 5400), False, 'from unidecode import unidecode\n')] |
from glob import glob
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import argparse
"""
This is a reproduction of Fernando's 2011 normalized commit rate plot. This
shows roughly the bus factor
"""
parser = argparse.ArgumentParser()
parser.add_argument("--outname", "-o")
args = parse... | [
"argparse.ArgumentParser",
"pandas.read_csv",
"os.path.dirname",
"numpy.arange",
"glob.glob",
"matplotlib.pyplot.subplots",
"numpy.unique"
] | [((243, 268), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (266, 268), False, 'import argparse\n'), ((372, 407), 'glob.glob', 'glob', (['"""data/raw_data/*/commits.tsv"""'], {}), "('data/raw_data/*/commits.tsv')\n", (376, 407), False, 'from glob import glob\n'), ((436, 450), 'matplotlib.pyplo... |
# -*- coding: utf-8 -*-
import os
import sys
from xml.dom import minidom
from os.path import abspath, dirname, normcase, normpath, splitdrive
# http://code.activestate.com/recipes/302594/
def commonpath(a, b):
"""Returns the longest common to 'paths' path.
Unlike the strange os.path.commonprefix:
- this... | [
"os.path.splitdrive",
"os.path.dirname",
"xml.dom.minidom.parse",
"os.sep.join",
"os.path.normpath",
"os.path.join",
"os.path.normcase"
] | [((1382, 1403), 'os.path.splitdrive', 'splitdrive', (['base_path'], {}), '(base_path)\n', (1392, 1403), False, 'from os.path import abspath, dirname, normcase, normpath, splitdrive\n'), ((1664, 1698), 'os.sep.join', 'os.sep.join', (['([os.pardir] * dirs_up)'], {}), '([os.pardir] * dirs_up)\n', (1675, 1698), False, 'imp... |
import os
from pathlib import Path
from dotenv import load_dotenv
load_dotenv()
API_TOKEN = os.getenv("TELEGRAM_API_TOKEN")
SECRET_KEY = os.getenv("SECRET_KEY")
ACCESS_KEY = os.getenv("ACCESS_KEY")
OBJECT_STORAGE_IP = os.getenv("IN_DOCKER", "127.0.0.1")
OBJECT_STORAGE_PORT = os.getenv("OBJECT_STORAGE_PORT", "9000"... | [
"dotenv.load_dotenv",
"pathlib.Path",
"os.getenv"
] | [((68, 81), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (79, 81), False, 'from dotenv import load_dotenv\n'), ((95, 126), 'os.getenv', 'os.getenv', (['"""TELEGRAM_API_TOKEN"""'], {}), "('TELEGRAM_API_TOKEN')\n", (104, 126), False, 'import os\n'), ((141, 164), 'os.getenv', 'os.getenv', (['"""SECRET_KEY"""'], ... |
import pytest
from chirc import replies
import chirc.tests.fixtures as fixtures
class TestWHOIS(object):
@pytest.mark.category("WHOIS")
def test_whois1(self, irc_session):
"""
Test doing a WHOIS on a user (user2) that is not in any channels.
"""
client1 = irc... | [
"pytest.fail",
"pytest.mark.category"
] | [((113, 142), 'pytest.mark.category', 'pytest.mark.category', (['"""WHOIS"""'], {}), "('WHOIS')\n", (133, 142), False, 'import pytest\n'), ((1002, 1031), 'pytest.mark.category', 'pytest.mark.category', (['"""WHOIS"""'], {}), "('WHOIS')\n", (1022, 1031), False, 'import pytest\n'), ((1613, 1642), 'pytest.mark.category', ... |
import numpy
import pytest
from grunnur import dtypes
from grunnur.modules import render_with_modules
def test_normalize_type():
dtype = dtypes.normalize_type(numpy.int32)
assert dtype == numpy.int32
assert type(dtype) == numpy.dtype
def test_ctype_builtin():
assert dtypes.ctype(numpy.int32) == 'in... | [
"numpy.uint64",
"grunnur.dtypes.is_double",
"numpy.empty",
"grunnur.dtypes.is_complex",
"grunnur.dtypes.detect_type",
"grunnur.dtypes._align",
"grunnur.dtypes._find_minimum_alignment",
"numpy.arange",
"grunnur.dtypes.align",
"numpy.float64",
"numpy.complex64",
"numpy.int8",
"grunnur.dtypes.c... | [((144, 178), 'grunnur.dtypes.normalize_type', 'dtypes.normalize_type', (['numpy.int32'], {}), '(numpy.int32)\n', (165, 178), False, 'from grunnur import dtypes\n'), ((359, 393), 'grunnur.dtypes.is_complex', 'dtypes.is_complex', (['numpy.complex64'], {}), '(numpy.complex64)\n', (376, 393), False, 'from grunnur import d... |
import torch
import torch.nn as nn
from .convolution import Conv2d
class SelfAttention2d(nn.Module):
def __init__(self, in_channels, k=8, bias=False, eq_lr=False, spectral_normalization=False):
super().__init__()
self.wf = Conv2d(in_channels, in_channels // k, kernel_size=1, stride=1, padding=0,... | [
"torch.zeros",
"torch.bmm",
"torch.softmax"
] | [((1236, 1255), 'torch.softmax', 'torch.softmax', (['s', '(2)'], {}), '(s, 2)\n', (1249, 1255), False, 'import torch\n'), ((916, 930), 'torch.zeros', 'torch.zeros', (['(1)'], {}), '(1)\n', (927, 930), False, 'import torch\n'), ((1269, 1287), 'torch.bmm', 'torch.bmm', (['h', 'beta'], {}), '(h, beta)\n', (1278, 1287), Fa... |
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2015, ARM Limited and contributors.
#
# 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
#
# ... | [
"android.Screen.set_orientation",
"android.Screen.set_brightness",
"subprocess.Popen",
"android.System.monkey",
"android.System.home",
"logging.getLogger",
"time.sleep",
"android.System.gfxinfo_get",
"android.Screen.unlock",
"android.System.set_airplane_mode",
"os.path.join",
"android.System.g... | [((3084, 3112), 'logging.getLogger', 'logging.getLogger', (['"""UiBench"""'], {}), "('UiBench')\n", (3101, 3112), False, 'import logging\n'), ((4082, 4109), 'android.Screen.unlock', 'Screen.unlock', (['self._target'], {}), '(self._target)\n', (4095, 4109), False, 'from android import Screen, System, Workload\n'), ((415... |
from setuptools import setup,find_packages
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(
name='python installer',
version='0.0.1',
license='MIT',
author='<NAME>',
author_email='<EMAIL>',
description='A package installer for python',
... | [
"setuptools.find_packages"
] | [((425, 440), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (438, 440), False, 'from setuptools import setup, find_packages\n')] |
import os
import subprocess
import sys
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(6,GPIO.IN)
while True:
val = GPIO.input(6)
print(val)
if val==1:
break;
time.sleep(0.2)
print(' finished ' )
| [
"RPi.GPIO.setup",
"RPi.GPIO.setmode",
"RPi.GPIO.input",
"time.sleep"
] | [((76, 98), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (88, 98), True, 'import RPi.GPIO as GPIO\n'), ((99, 121), 'RPi.GPIO.setup', 'GPIO.setup', (['(6)', 'GPIO.IN'], {}), '(6, GPIO.IN)\n', (109, 121), True, 'import RPi.GPIO as GPIO\n'), ((144, 157), 'RPi.GPIO.input', 'GPIO.input', (['(6)'],... |
import os
from datetime import timedelta
from pathlib import Path
from dotenv import load_dotenv
BASE_DIR = Path(__file__).resolve().parent.parent
load_dotenv(dotenv_path=BASE_DIR / '.env')
SECRET_KEY = os.getenv('SECRET_KEY')
DEBUG = True if os.getenv('DEBUG') in ['true', 'True', True] else False
INSTALLED_APPS ... | [
"dotenv.load_dotenv",
"pathlib.Path",
"datetime.timedelta",
"os.path.join",
"os.getenv"
] | [((150, 192), 'dotenv.load_dotenv', 'load_dotenv', ([], {'dotenv_path': "(BASE_DIR / '.env')"}), "(dotenv_path=BASE_DIR / '.env')\n", (161, 192), False, 'from dotenv import load_dotenv\n'), ((207, 230), 'os.getenv', 'os.getenv', (['"""SECRET_KEY"""'], {}), "('SECRET_KEY')\n", (216, 230), False, 'import os\n'), ((3544, ... |
# AUTOGENERATED! DO NOT EDIT! File to edit: dev/52_USB_camera.ipynb (unless otherwise specified).
__all__ = ['Camera']
# Cell
from FLIRCam.core import *
# Cell
# Standard imports:
from pathlib import Path
import logging
from logging.handlers import RotatingFileHandler
from time import sleep, time as timestamp
from ... | [
"PySpin.System.GetInstance",
"logging.StreamHandler",
"numpy.flipud",
"logging.Formatter",
"datetime.datetime.utcnow",
"pathlib.Path",
"numpy.fliplr",
"threading.Event",
"numpy.rot90",
"weakref.ref",
"logging.handlers.RotatingFileHandler",
"logging.getLogger"
] | [((3110, 3138), 'logging.getLogger', 'logging.getLogger', (['f"""{name}"""'], {}), "(f'{name}')\n", (3127, 3138), False, 'import logging\n'), ((5060, 5067), 'threading.Event', 'Event', ([], {}), '()\n', (5065, 5067), False, 'from threading import Thread, Event\n'), ((11271, 11281), 'pathlib.Path', 'Path', (['path'], {}... |
# :copyright: Copyright (c) 2018-2020. OS4D Ltd - All Rights Reserved
# :license: Commercial
# Unauthorized copying of this file, via any medium is strictly prohibited
# Written by <NAME> <<EMAIL>>, October 2020
from birder.core.redis import client
channel = client.pubsub()
channel.subscribe('system')
send = lamb... | [
"birder.core.redis.client.publish",
"birder.core.redis.client.pubsub"
] | [((264, 279), 'birder.core.redis.client.pubsub', 'client.pubsub', ([], {}), '()\n', (277, 279), False, 'from birder.core.redis import client\n'), ((329, 359), 'birder.core.redis.client.publish', 'client.publish', (['"""system"""', 'data'], {}), "('system', data)\n", (343, 359), False, 'from birder.core.redis import cli... |
from django.contrib import admin
from .models import FAQModel, AssistanceModel, FeedbackModel
admin.site.register(FAQModel)
admin.site.register(AssistanceModel)
admin.site.register(FeedbackModel)
| [
"django.contrib.admin.site.register"
] | [((96, 125), 'django.contrib.admin.site.register', 'admin.site.register', (['FAQModel'], {}), '(FAQModel)\n', (115, 125), False, 'from django.contrib import admin\n'), ((126, 162), 'django.contrib.admin.site.register', 'admin.site.register', (['AssistanceModel'], {}), '(AssistanceModel)\n', (145, 162), False, 'from dja... |
# -*- coding: utf-8 -*-
"""
rstblog.modules
~~~~~~~~~~~~~~~
The module interface.
:copyright: (c) 2010 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
def add_module_path(folder):
"""Adds a new search path to the list of search paths."""
... | [
"os.path.abspath"
] | [((351, 374), 'os.path.abspath', 'os.path.abspath', (['folder'], {}), '(folder)\n', (366, 374), False, 'import os\n')] |
import os
import sys
import cv2
import numpy as np
import pandas as pd
import os
import matplotlib.image as mpimg
def file_to_fragment(path, return_path):
path = path
file_path = []
file_class = []
for subdirectory in os.walk(path):
for file in subdirectory[2]:
file_path.append(os.path.join(subdirectory[0],... | [
"pandas.DataFrame",
"os.mkdir",
"os.stat",
"os.path.isdir",
"cv2.cvtColor",
"os.walk",
"os.path.join"
] | [((225, 238), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (232, 238), False, 'import os\n'), ((375, 429), 'pandas.DataFrame', 'pd.DataFrame', (["{'class': file_class, 'path': file_path}"], {}), "({'class': file_class, 'path': file_path})\n", (387, 429), True, 'import pandas as pd\n'), ((1337, 1350), 'os.walk', 'o... |
import random
import threading
class RR() :
def __init__(self,v):
self.v = v
def kapoy (self):
print('Russian Roulette is starting!!')
if self.v == 0 :
def random1():
print('Randomizing your punishment...')
timer = threading.Timer(1.0, random1)
timer.start()
def random2():
pr... | [
"threading.Timer",
"random.choice"
] | [((245, 274), 'threading.Timer', 'threading.Timer', (['(1.0)', 'random1'], {}), '(1.0, random1)\n', (260, 274), False, 'import threading\n'), ((371, 400), 'threading.Timer', 'threading.Timer', (['(2.0)', 'random2'], {}), '(2.0, random2)\n', (386, 400), False, 'import threading\n'), ((497, 526), 'threading.Timer', 'thre... |
import sys
sys.path.append('./lib')
from eloqua_request import EloquaRequest
request = EloquaRequest('site', 'user', 'password')
response = request.get('/assets/emails?search=Demand*&page=1&count=50&depth=minimal', None)
| [
"sys.path.append",
"eloqua_request.EloquaRequest"
] | [((11, 35), 'sys.path.append', 'sys.path.append', (['"""./lib"""'], {}), "('./lib')\n", (26, 35), False, 'import sys\n'), ((88, 129), 'eloqua_request.EloquaRequest', 'EloquaRequest', (['"""site"""', '"""user"""', '"""password"""'], {}), "('site', 'user', 'password')\n", (101, 129), False, 'from eloqua_request import El... |
import datetime
import pytest
import pytz
from applications.models import (
Application,
ApplicationEvent,
ApplicationEventSchedule,
ApplicationRound,
)
@pytest.fixture
def default_application_round() -> ApplicationRound:
return ApplicationRound.objects.create(
application_period_begin=d... | [
"datetime.date",
"datetime.datetime",
"applications.models.Application.objects.create",
"datetime.timedelta",
"applications.models.ApplicationEventSchedule.objects.create"
] | [((999, 1076), 'applications.models.Application.objects.create', 'Application.objects.create', ([], {'application_round_id': 'default_application_round.id'}), '(application_round_id=default_application_round.id)\n', (1025, 1076), False, 'from applications.models import Application, ApplicationEvent, ApplicationEventSch... |
from ipykernel.kernelbase import Kernel
import tempfile
import os
from .realtime_subprocess import RealTimeSubprocess
from .fprogram import FortranGatherer
class FortranKernel(Kernel):
implementation = 'jfk-fling'
implementation_version = '0.1'
language = 'Fortran'
language_version = 'F2008'
lang... | [
"os.environ.get",
"tempfile.NamedTemporaryFile",
"os.remove"
] | [((1134, 1195), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'delete': '(False)', 'mode': '"""w"""'}), "(delete=False, mode='w', **kwargs)\n", (1161, 1195), False, 'import tempfile\n'), ((1893, 1925), 'os.environ.get', 'os.environ.get', (['"""FC"""', '"""gfortran"""'], {}), "('FC', 'gfortran')\n"... |
import json
from monster import Monster
from rune import Rune, Grind, Gem
from constant_maps import *
class Summoner:
def __init__(self,filename):
self.data_file = filename
print(f'Loading data from {filename}')
with open(filename) as fin:
data = json.load(fin)
... | [
"rune.Grind",
"json.load",
"rune.Rune",
"monster.Monster",
"rune.Gem"
] | [((298, 312), 'json.load', 'json.load', (['fin'], {}), '(fin)\n', (307, 312), False, 'import json\n'), ((733, 745), 'monster.Monster', 'Monster', (['mon'], {}), '(mon)\n', (740, 745), False, 'from monster import Monster\n'), ((1219, 1229), 'rune.Rune', 'Rune', (['rune'], {}), '(rune)\n', (1223, 1229), False, 'from rune... |
from devito.core.cpu import CPU64Operator, CPU64OpenMPOperator
from devito.exceptions import InvalidOperator
from devito.passes.clusters import (Blocking, Lift, cire, cse, eliminate_arrays,
extract_increments, factorize, fuse, optimize_pows)
from devito.tools import timed_pass
__all... | [
"devito.passes.clusters.cire",
"devito.passes.clusters.extract_increments",
"devito.passes.clusters.fuse",
"devito.passes.clusters.eliminate_arrays",
"devito.passes.clusters.factorize",
"devito.exceptions.InvalidOperator",
"devito.passes.clusters.Blocking",
"devito.passes.clusters.Lift",
"devito.pas... | [((1040, 1080), 'devito.tools.timed_pass', 'timed_pass', ([], {'name': '"""specializing.Clusters"""'}), "(name='specializing.Clusters')\n", (1050, 1080), False, 'from devito.tools import timed_pass\n'), ((1345, 1374), 'devito.passes.clusters.fuse', 'fuse', (['clusters'], {'toposort': '(True)'}), '(clusters, toposort=Tr... |
# coding: utf-8
"""
Yapily API
To access endpoints that require authentication, use your application key and secret created in the Dashboard (https://dashboard.yapily.com) # noqa: E501
The version of the OpenAPI document: 1.157.0
Generated by: https://openapi-generator.tech
"""
import pprint
impor... | [
"yapily.configuration.Configuration",
"six.iteritems"
] | [((7061, 7094), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (7074, 7094), False, 'import six\n'), ((1813, 1828), 'yapily.configuration.Configuration', 'Configuration', ([], {}), '()\n', (1826, 1828), False, 'from yapily.configuration import Configuration\n')] |
import os
class Tools(object):
def getRootPath(self):
'''
获取上级目录的路径
:return:
'''
rootpath = os.path.dirname(os.path.abspath(__file__))
while rootpath:
if os.path.exists(os.path.join(rootpath, 'readme.md')):
break
rootpath = ro... | [
"os.path.abspath",
"os.path.join"
] | [((466, 509), 'os.path.join', 'os.path.join', (['rootpath', '"""apks"""', '"""cnode.apk"""'], {}), "(rootpath, 'apks', 'cnode.apk')\n", (478, 509), False, 'import os\n'), ((154, 179), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (169, 179), False, 'import os\n'), ((235, 270), 'os.path.join'... |
# Copyright 2019 <NAME>, Inc. and the University of Edinburgh. 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
#
# Unle... | [
"commentjson.loads",
"os.path.basename"
] | [((944, 970), 'os.path.basename', 'os.path.basename', (['filepath'], {}), '(filepath)\n', (960, 970), False, 'import os\n'), ((1349, 1375), 'os.path.basename', 'os.path.basename', (['filepath'], {}), '(filepath)\n', (1365, 1375), False, 'import os\n'), ((2288, 2315), 'commentjson.loads', 'commentjson.loads', (['json_st... |
from tensorflow.keras import backend as K
from tensorflow.keras.metrics import SpecificityAtSensitivity
from tensorflow.keras.metrics import Precision
from tensorflow.keras.metrics import Recall, FalsePositives, FalseNegatives, TruePositives, TrueNegatives
def recall(y_true, y_pred):
m = Recall()
m.upda... | [
"tensorflow.keras.metrics.TrueNegatives",
"tensorflow.keras.metrics.FalsePositives",
"tensorflow.keras.metrics.Recall",
"tensorflow.keras.backend.epsilon",
"tensorflow.keras.metrics.SpecificityAtSensitivity",
"tensorflow.keras.metrics.Precision"
] | [((300, 308), 'tensorflow.keras.metrics.Recall', 'Recall', ([], {}), '()\n', (306, 308), False, 'from tensorflow.keras.metrics import Recall, FalsePositives, FalseNegatives, TruePositives, TrueNegatives\n'), ((452, 463), 'tensorflow.keras.metrics.Precision', 'Precision', ([], {}), '()\n', (461, 463), False, 'from tenso... |
import sys
from pathlib import Path
from argparse import ArgumentParser
import h5py
import pandas as pd
import numpy as np
from tqdm import tqdm
from export import export_read_file
def get_args():
parser = ArgumentParser(description="Parse sequencing_summary.txt files and .paf files to find split reads "
... | [
"pandas.DataFrame",
"export.export_read_file",
"tqdm.tqdm",
"h5py.File",
"argparse.ArgumentParser",
"pandas.read_csv",
"numpy.floor",
"pandas.concat",
"sys.exit"
] | [((214, 369), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Parse sequencing_summary.txt files and .paf files to find split reads in an Oxford Nanopore Dataset"""', 'add_help': '(False)'}), "(description=\n 'Parse sequencing_summary.txt files and .paf files to find split reads in an Oxford Na... |
import tkinter as tk
from tkinter import ttk
import pandas as pd
import numpy as np
class ProcessFrame(tk.Frame):
def __init__(self, parent: tk.Tk) -> None:
super().__init__(parent)
self.data = None
# init widgets
frame_delete_nan = tk.LabelFrame(self, text='Delete empty values')
... | [
"tkinter.ttk.Combobox",
"tkinter.Label",
"tkinter.Entry",
"tkinter.LabelFrame"
] | [((271, 318), 'tkinter.LabelFrame', 'tk.LabelFrame', (['self'], {'text': '"""Delete empty values"""'}), "(self, text='Delete empty values')\n", (284, 318), True, 'import tkinter as tk\n'), ((406, 451), 'tkinter.LabelFrame', 'tk.LabelFrame', (['self'], {'text': '"""Fill empty values"""'}), "(self, text='Fill empty value... |
from adjutant.actions.v1.serializers import BaseUserIdSerializer
from rest_framework import serializers
class EditMFASerializer(BaseUserIdSerializer):
delete = serializers.BooleanField(default=False)
| [
"rest_framework.serializers.BooleanField"
] | [((166, 205), 'rest_framework.serializers.BooleanField', 'serializers.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (190, 205), False, 'from rest_framework import serializers\n')] |
# matrices.py - boolean matrices as row bitsets and column bitsets
"""Boolean matrices as collections of row and column vectors."""
import bitsets
from ._compat import zip
__all__ = ['Relation']
Vector = bitsets.bases.MemberBits
"""Single row or column of a boolean matrix as bit vector."""
class Vectors(bitsets... | [
"bitsets.meta.bitset",
"bitsets.bitset"
] | [((3213, 3277), 'bitsets.meta.bitset', 'bitsets.meta.bitset', (['xname', 'xmembers', 'xid', 'Vector', 'None', 'Vectors'], {}), '(xname, xmembers, xid, Vector, None, Vectors)\n', (3232, 3277), False, 'import bitsets\n'), ((3308, 3372), 'bitsets.meta.bitset', 'bitsets.meta.bitset', (['yname', 'ymembers', 'yid', 'Vector',... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
'''
Author: <NAME> (<EMAIL>)
Created Date: 2019-09-19 5:35:12
-----
Last Modified: 2019-10-07 8:27:16
Modified By: <NAME> (<EMAIL>)
-----
THIS PROGRAM IS FREE SOFTWARE, IS LICENSED UNDER MIT.
A short and simple permissive license with conditions
only requiring preservation... | [
"tempfile.mkdtemp",
"pytest.fixture",
"os.chdir",
"smtplib.SMTP"
] | [((570, 600), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (584, 600), False, 'import pytest\n'), ((682, 713), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""package"""'}), "(scope='package')\n", (696, 713), False, 'import pytest\n'), ((803, 819), 'pytest.fixture', ... |
from typing import List, Dict
from identifyneeds.entities import Condition
class MemRepo():
def __init__(self, condition_dicts):
self.conditions = {}
self.put(condition_dicts)
def get(self, filters: Dict = None):
condition_objects = [Condition.from_dict(i) for i in self.conditions.v... | [
"identifyneeds.entities.Condition.from_dict"
] | [((271, 293), 'identifyneeds.entities.Condition.from_dict', 'Condition.from_dict', (['i'], {}), '(i)\n', (290, 293), False, 'from identifyneeds.entities import Condition\n')] |
import requests
import tkinter as tk
from tkinter import filedialog, Text
import main as main
from sortedcontainers import SortedSet
# This file runs the main program
def raise_frame(frame):
frame.tkraise()
root=tk.Tk()
root.title("Better Bolus V2.0")
# root.iconbitmap("../favicon.ico")
f1 = tk.Frame(root)
f2 ... | [
"tkinter.StringVar",
"main.show_adjusted_graph",
"main.bolusStack",
"main.unadjusted_graph",
"main.initial_bg",
"tkinter.Button",
"tkinter.Entry",
"main.show_unadjusted_graph",
"tkinter.OptionMenu",
"main.build_resistance_profile",
"sortedcontainers.SortedSet",
"main.applyInitialBolus",
"tki... | [((219, 226), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (224, 226), True, 'import tkinter as tk\n'), ((302, 316), 'tkinter.Frame', 'tk.Frame', (['root'], {}), '(root)\n', (310, 316), True, 'import tkinter as tk\n'), ((322, 336), 'tkinter.Frame', 'tk.Frame', (['root'], {}), '(root)\n', (330, 336), True, 'import tkinter a... |
from autumn.projects.covid_19.vaccine_optimisation.vaccine_opti import (
get_decision_vars_names,
initialise_opti_object,
)
import numpy as np
import yaml
COUNTRY = "malaysia" # should use "malaysia" or "philippines"
def run_sample_code():
# Initialisation of the optimisation object. This needs to be r... | [
"numpy.random.uniform",
"yaml.load",
"autumn.projects.covid_19.vaccine_optimisation.vaccine_opti.initialise_opti_object",
"autumn.projects.covid_19.vaccine_optimisation.vaccine_opti.get_decision_vars_names",
"yaml.dump"
] | [((365, 396), 'autumn.projects.covid_19.vaccine_optimisation.vaccine_opti.initialise_opti_object', 'initialise_opti_object', (['COUNTRY'], {}), '(COUNTRY)\n', (387, 396), False, 'from autumn.projects.covid_19.vaccine_optimisation.vaccine_opti import get_decision_vars_names, initialise_opti_object\n'), ((2009, 2040), 'a... |
from rest_framework.response import Response
from rest_framework_simplejwt.views import TokenObtainPairView
from rest_framework.viewsets import ModelViewSet
from rest_framework.permissions import AllowAny
from rest_framework import status
from rest_framework_simplejwt.tokens import RefreshToken
from rest_framework_simp... | [
"rest_framework_simplejwt.tokens.RefreshToken.for_user",
"rest_framework_simplejwt.exceptions.InvalidToken",
"rest_framework.response.Response"
] | [((872, 934), 'rest_framework.response.Response', 'Response', (['serializer.validated_data'], {'status': 'status.HTTP_200_OK'}), '(serializer.validated_data, status=status.HTTP_200_OK)\n', (880, 934), False, 'from rest_framework.response import Response\n'), ((1322, 1349), 'rest_framework_simplejwt.tokens.RefreshToken.... |
#! python
import logging
import os.path
import sys
import traceback
import toil.config
import toil.parm
import toil.parm.parse
import toil.framework
import toil.util.decorator
from toil.batch.base import BaseBatch
logging.basicConfig(format='%(asctime)s %(levelname)s: %(name)s %(message)s', level=logging.E... | [
"logging.getLogger",
"traceback.print_exc",
"logging.basicConfig"
] | [((227, 330), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s %(levelname)s: %(name)s %(message)s"""', 'level': 'logging.ERROR'}), "(format=\n '%(asctime)s %(levelname)s: %(name)s %(message)s', level=logging.ERROR)\n", (246, 330), False, 'import logging\n'), ((336, 363), 'logging.getLog... |
"""Info needed by the plugins."""
from dataclasses import dataclass, field
from typing import Set
from identify import identify
from nitpick.constants import DOT
from nitpick.exceptions import Deprecation
from nitpick.project import Project
@dataclass
class FileInfo:
"""File information needed by the plugin."""... | [
"dataclasses.field",
"nitpick.exceptions.Deprecation.pre_commit_without_dash",
"identify.identify.tags_from_filename"
] | [((388, 414), 'dataclasses.field', 'field', ([], {'default_factory': 'set'}), '(default_factory=set)\n', (393, 414), False, 'from dataclasses import dataclass, field\n'), ((570, 621), 'nitpick.exceptions.Deprecation.pre_commit_without_dash', 'Deprecation.pre_commit_without_dash', (['path_from_root'], {}), '(path_from_r... |
# 1. kubectl create -k "github.com/kubernetes-sigs/aws-fsx-csi-driver/deploy/kubernetes/overlays/stable/?ref=master"
# 2. python get_security_group.py
# 3. kubectl apply -f specs/eks/fsx.yml
import os
import sys
import tempfile
import time
from typing import List
import boto3
from kube2.types import Volume
from kub... | [
"kube2.aws_utils.get_security_group_id",
"kube2.utils.load_template",
"kube2.utils.sh_capture",
"tempfile.TemporaryDirectory",
"boto3.client",
"kube2.aws_utils.get_cluster_vpc_id",
"kube2.utils.make_table",
"time.sleep",
"kube2.utils.sh",
"kube2.utils.check_name",
"kube2.aws_utils.get_subnet_id"... | [((621, 744), 'kube2.utils.sh', 'sh', (['f"""kubectl create -k "github.com/kubernetes-sigs/aws-fsx-csi-driver/deploy/kubernetes/overlays/stable/?ref=master\\""""'], {}), '(f\'kubectl create -k "github.com/kubernetes-sigs/aws-fsx-csi-driver/deploy/kubernetes/overlays/stable/?ref=master"\'\n )\n', (623, 744), False, '... |
import numpy as np
import os
from astropy.time import Time
from pandas import DataFrame
from orbitize.kepler import calc_orbit
from orbitize import read_input, system, sampler
def test_secondary_rv_lnlike_calc():
"""
Generates fake secondary RV data and asserts that
the log(likelihood) of the true paramet... | [
"pandas.DataFrame",
"orbitize.kepler.calc_orbit",
"orbitize.read_input.read_file",
"os.system",
"orbitize.system.System",
"numpy.array",
"orbitize.sampler.MCMC",
"numpy.all",
"numpy.sqrt"
] | [((628, 679), 'numpy.array', 'np.array', (['[a, e, i, omega, Omega, tau, plx, m1, m0]'], {}), '([a, e, i, omega, Omega, tau, plx, m1, m0])\n', (636, 679), True, 'import numpy as np\n'), ((778, 856), 'orbitize.kepler.calc_orbit', 'calc_orbit', (['epochs', 'a', 'e', 'i', 'omega', 'Omega', 'tau', 'plx', '(m0 + m1)'], {'ma... |
import math
import pygame
import sys
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((600,500))
pygame.display.set_caption("The Pie Game - Press 1,2,3,4")
myfont = pygame.font.Font(None, 60)
color = 200, 80, 60
width = 4
x = 300
y = 250
radius = 200
position = x-radius, y-radius, radius*2, ... | [
"pygame.draw.arc",
"pygame.draw.line",
"pygame.event.get",
"pygame.display.set_mode",
"math.radians",
"pygame.init",
"pygame.display.update",
"pygame.font.Font",
"pygame.display.set_caption",
"sys.exit"
] | [((66, 79), 'pygame.init', 'pygame.init', ([], {}), '()\n', (77, 79), False, 'import pygame\n'), ((89, 124), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(600, 500)'], {}), '((600, 500))\n', (112, 124), False, 'import pygame\n'), ((124, 182), 'pygame.display.set_caption', 'pygame.display.set_caption', (['""... |
# Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
"torch.manual_seed",
"pytest.raises",
"torchmetrics.classification.checks._input_format_classification",
"torchmetrics.HammingDistance",
"pytest.mark.parametrize",
"torchmetrics.functional.hamming_distance",
"sklearn.metrics.hamming_loss"
] | [((1635, 1656), 'torch.manual_seed', 'torch.manual_seed', (['(42)'], {}), '(42)\n', (1652, 1656), False, 'import torch\n'), ((2027, 2562), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""preds, target"""', '[(_input_binary_prob.preds, _input_binary_prob.target), (_input_binary.\n preds, _input_binary.tar... |
import tensorflow as tf
import numpy as np
def get_infos2Laplace_1D(input_dim=1, out_dim=1, intervalL=0.0, intervalR=1.0, equa_name=None):
# -uxx = f
if equa_name == 'PDE1':
# u=sin(pi*x), f=-pi*pi*sin(pi*x)
fside = lambda x: -(np.pi)*(np.pi)*tf.sin(np.pi*x)
utrue = lambda x: ... | [
"tensorflow.sin",
"numpy.square",
"tensorflow.pow",
"tensorflow.ones_like",
"tensorflow.exp",
"tensorflow.square"
] | [((320, 337), 'tensorflow.sin', 'tf.sin', (['(np.pi * x)'], {}), '(np.pi * x)\n', (326, 337), True, 'import tensorflow as tf\n'), ((363, 388), 'tensorflow.sin', 'tf.sin', (['(np.pi * intervalL)'], {}), '(np.pi * intervalL)\n', (369, 388), True, 'import tensorflow as tf\n'), ((415, 440), 'tensorflow.sin', 'tf.sin', (['(... |
import modelexp
from modelexp.experiments import Generic
from modelexp.models.Generic import Parabola
import numpy as np
import random
app = modelexp.App()
app.setExperiment(Generic)
modelRef = app.setModel(Parabola)
modelRef.defineDomain(np.linspace(-3, 3, 100))
modelRef.setParam('a', 1.3)
modelRef.setParam('x0', 0... | [
"modelexp.App",
"random.gauss",
"numpy.array",
"numpy.linspace"
] | [((142, 156), 'modelexp.App', 'modelexp.App', ([], {}), '()\n', (154, 156), False, 'import modelexp\n'), ((536, 558), 'numpy.array', 'np.array', (['randomized_y'], {}), '(randomized_y)\n', (544, 558), True, 'import numpy as np\n'), ((242, 265), 'numpy.linspace', 'np.linspace', (['(-3)', '(3)', '(100)'], {}), '(-3, 3, 1... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-09 08:19
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... | [
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateField"
] | [((403, 496), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (419, 496), False, 'from django.db import migrations, models\... |
from paleo.profilers.flops_profiler import FlopsProfiler as PaleoFlopsProfiler
from paleo.profilers.base import ProfilerOptions
class FlopsProfiler:
@staticmethod
def profile(layer_spec, device, backward=False, batch_size=None, comm_penalization=1, comp_penalization=1):
layer = layer_spec.operation
... | [
"paleo.profilers.flops_profiler.FlopsProfiler",
"paleo.profilers.base.ProfilerOptions"
] | [((480, 497), 'paleo.profilers.base.ProfilerOptions', 'ProfilerOptions', ([], {}), '()\n', (495, 497), False, 'from paleo.profilers.base import ProfilerOptions\n'), ((846, 890), 'paleo.profilers.flops_profiler.FlopsProfiler', 'PaleoFlopsProfiler', (['profiler_options', 'device'], {}), '(profiler_options, device)\n', (8... |
import keras.layers
import numpy as np
import random
import string
import tensorflow as tf
from .common import random_string
def convert_gemm(params, w_name, scope_name, inputs, layers, weights, names):
"""
Convert Linear.
Args:
params: dictionary with layer parameters
w_name: name prefix... | [
"random.random"
] | [((743, 758), 'random.random', 'random.random', ([], {}), '()\n', (756, 758), False, 'import random\n'), ((1983, 1998), 'random.random', 'random.random', ([], {}), '()\n', (1996, 1998), False, 'import random\n')] |