code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Generated by Django 3.0.5 on 2020-04-20 00:08
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='EntityType',
fields=[
... | [
"django.db.models.DateField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.FileField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((339, 432), '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", (355, 432), False, 'from django.db import migrations, models\... |
from setuptools import setup, find_packages
dependencies = []
try:
import json
except ImportError:
dependencies.append('simplejson')
setup(
name="Djangy",
version="0.14",
packages = find_packages(),
author="<NAME>",
author_email="<EMAIL>",
description="Djangy.com client application",
... | [
"setuptools.find_packages"
] | [((204, 219), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (217, 219), False, 'from setuptools import setup, find_packages\n')] |
"""
Book: Building RESTful Python Web Services
Chapter 3: Improving and adding authentication to an API with Django
Author: <NAME> - Twitter.com/gastonhillar
Publisher: Packt Publishing Ltd. - http://www.packtpub.com
"""
from django.contrib.auth.models import User
user = User.objects.create_user('kevin', '<EMAIL>', '<P... | [
"django.contrib.auth.models.User.objects.create_user"
] | [((272, 330), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', (['"""kevin"""', '"""<EMAIL>"""', '"""<PASSWORD>"""'], {}), "('kevin', '<EMAIL>', '<PASSWORD>')\n", (296, 330), False, 'from django.contrib.auth.models import User\n')] |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2021-2022 <NAME>
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... | [
"logging.getLogger",
"eth_account.Account.encrypt",
"web3.Web3.isAddress",
"aea.helpers.http_requests.get",
"eth_account.Account.recoverHash",
"eth_utils.currency.to_wei",
"aea.crypto.helpers.DecryptError",
"eth_account.messages._hash_eip191_message",
"eth_account.messages.encode_defunct",
"thread... | [((2386, 2413), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2403, 2413), False, 'import logging\n'), ((3222, 3240), 'eth_utils.currency.to_wei', 'to_wei', (['(20)', '"""gwei"""'], {}), "(20, 'gwei')\n", (3228, 3240), False, 'from eth_utils.currency import from_wei, to_wei\n'), ((3270,... |
#!/usr/bin/env python
#
# -*- coding: utf-8 -*-
"""
__author__ = 'CodeFace'
"""
import json
from PyQt5.QtCore import QRegExp
from PyQt5.QtWidgets import (QVBoxLayout, QLabel, QPushButton, QDialog, QGridLayout, QComboBox, QLineEdit,
QWidget, QHBoxLayout)
from PyQt5.QtGui import QRegExpValida... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtGui.QIntValidator",
"json.loads",
"PyQt5.QtWidgets.QComboBox",
"electrum.bitcoin.b58_address_to_hash160",
"json.dumps",
"PyQt5.QtWidgets.QVBoxLayout.__init__",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QDialog.__init__",
"electrum.bitcoin.is_hash160",
"e... | [((681, 701), 'electrum.logging.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (691, 701), False, 'from electrum.logging import get_logger\n'), ((783, 812), 'PyQt5.QtGui.QIntValidator', 'QIntValidator', (['(0)', '(10 ** 9 - 1)'], {}), '(0, 10 ** 9 - 1)\n', (796, 812), False, 'from PyQt5.QtGui import QRe... |
"""Serve static files used by HACS."""
# pylint: disable=broad-except
import logging
import os
from aiohttp import web
from aiohttp.web import HTTPNotFound
from ...blueprints import HacsViewBase
_LOGGER = logging.getLogger('custom_components.hacs.frontend')
class HacsStaticView(HacsViewBase):
"""Serve static fil... | [
"logging.getLogger",
"os.path.exists",
"aiohttp.web.FileResponse"
] | [((206, 258), 'logging.getLogger', 'logging.getLogger', (['"""custom_components.hacs.frontend"""'], {}), "('custom_components.hacs.frontend')\n", (223, 258), False, 'import logging\n'), ((731, 756), 'os.path.exists', 'os.path.exists', (['servefile'], {}), '(servefile)\n', (745, 756), False, 'import os\n'), ((777, 804),... |
# -*- coding: utf-8 -*-
"""
Unit tests for analytics logic in framework/analytics/__init__.py
"""
import re
import unittest
import mock
import pytest
from django.utils import timezone
from nose.tools import * # flake8: noqa (PEP8 asserts)
from flask import Flask
from datetime import datetime
from addons.osfstorage... | [
"datetime.datetime",
"osf_tests.factories.ProjectFactory",
"mock.patch",
"osf_tests.factories.UserFactory",
"framework.analytics.get_total_activity_count",
"osf.models.PageCounter.get_all_downloads_on_date",
"re.match",
"osf.models.PageCounter.update_counter",
"django.utils.timezone.now",
"osf.mod... | [((1462, 1478), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1476, 1478), False, 'import pytest\n'), ((1518, 1534), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1532, 1534), False, 'import pytest\n'), ((1596, 1612), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1610, 1612), False, 'import p... |
# Simple GPS datalogging demonstration for use with a computer like Linux/desktop.
# This actually doesn't even use the GPS library and instead just reads raw
# NMEA sentences from the GPS unit and dumps them to a file.
import serial # pyserial is required
# Path to the file to log GPS data. By default this w... | [
"serial.Serial"
] | [((1025, 1081), 'serial.Serial', 'serial.Serial', (['"""/dev/ttyUSB0"""'], {'baudrate': '(9600)', 'timeout': '(30)'}), "('/dev/ttyUSB0', baudrate=9600, timeout=30)\n", (1038, 1081), False, 'import serial\n')] |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 28 14:33:17 2018
@author: lzw
check the box
"""
import cv2
import numpy as np
fo = open("list.txt")
lines = fo.readlines()
for line in lines:
line = line.split()
img_path = line[0]
bbox = [float(i) for i in line[1:]]
boxes = np.arra... | [
"cv2.rectangle",
"cv2.imshow",
"numpy.array",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.imread"
] | [((371, 391), 'cv2.imread', 'cv2.imread', (['img_path'], {}), '(img_path)\n', (381, 391), False, 'import cv2\n'), ((497, 520), 'cv2.imshow', 'cv2.imshow', (['"""test"""', 'img'], {}), "('test', img)\n", (507, 520), False, 'import cv2\n'), ((422, 492), 'cv2.rectangle', 'cv2.rectangle', (['img', '(box[0], box[1])', '(box... |
# Lint as: python3
# Copyright 2018 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 ... | [
"re.sub",
"sys.exit"
] | [((2138, 2168), 're.sub', 're.sub', (['"""[,.\\\\?!]+ """', '""" """', 'txt'], {}), "('[,.\\\\?!]+ ', ' ', txt)\n", (2144, 2168), False, 'import re\n'), ((2213, 2243), 're.sub', 're.sub', (['"""[,.\\\\?!]+$"""', '""" """', 'txt'], {}), "('[,.\\\\?!]+$', ' ', txt)\n", (2219, 2243), False, 'import re\n'), ((2289, 2319), ... |
from django.db.models import SET_NULL, ForeignKey, Model
from django.db.models.fields import CharField
class Flavor(Model):
name = CharField(max_length=255)
label = CharField(max_length=255)
parent = ForeignKey("self", blank=True, null=True, on_delete=SET_NULL)
def __str__(self):
return self.... | [
"django.db.models.fields.CharField",
"django.db.models.ForeignKey"
] | [((137, 162), 'django.db.models.fields.CharField', 'CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (146, 162), False, 'from django.db.models.fields import CharField\n'), ((175, 200), 'django.db.models.fields.CharField', 'CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (184, 200), Fals... |
from django.urls import include
from django.urls import path
from secure_app.views import (
SecureUserCreateView,
SecureFileUploadView,
SecureFileView,
secure_doc_download
)
urlpatterns = [
path('create-user/', SecureUserCreateView.as_view(), name='secure_user_creation'),
path('upload/', Secur... | [
"secure_app.views.SecureFileUploadView.as_view",
"django.urls.include",
"secure_app.views.SecureFileView.as_view",
"django.urls.path",
"secure_app.views.SecureUserCreateView.as_view"
] | [((455, 528), 'django.urls.path', 'path', (['"""download/<ref>/"""', 'secure_doc_download'], {'name': '"""secure_file_download"""'}), "('download/<ref>/', secure_doc_download, name='secure_file_download')\n", (459, 528), False, 'from django.urls import path\n'), ((233, 263), 'secure_app.views.SecureUserCreateView.as_vi... |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"ml_metadata.proto.metadata_store_pb2.Artifact",
"ml_metadata.metadata_store.metadata_store.MetadataStore",
"ml_metadata.proto.metadata_store_pb2.ArtifactType",
"absl.testing.absltest.main",
"ml_metadata.proto.metadata_store_pb2.Execution",
"ml_metadata.proto.metadata_store_pb2.Event",
"ml_metadata.prot... | [((981, 1018), 'ml_metadata.proto.metadata_store_pb2.ConnectionConfig', 'metadata_store_pb2.ConnectionConfig', ([], {}), '()\n', (1016, 1018), False, 'from ml_metadata.proto import metadata_store_pb2\n'), ((1069, 1116), 'ml_metadata.metadata_store.metadata_store.MetadataStore', 'metadata_store.MetadataStore', (['connec... |
import json, re, copy, os, random, pickle
from multiprocessing import Pool
from nlplingo.oregon.event_models.uoregon.tools.global_constants import *
from nlplingo.oregon.event_models.uoregon.models.pipeline._01.local_constants import ARGUMENT_TAG_MAP
import torch
import torch.nn as nn
from nlplingo.oregon.event_models.... | [
"torch.LongTensor",
"torch.softmax",
"torch.sum",
"copy.deepcopy",
"os.path.exists",
"os.listdir",
"os.path.isdir",
"re.finditer",
"os.mkdir",
"torch.argmax",
"random.shuffle",
"re.match",
"pickle.load",
"os.path.isfile",
"re.sub",
"re.findall",
"pickle.dump",
"os.path.join",
"ra... | [((1506, 1530), 'os.path.isfile', 'os.path.isfile', (['dir_path'], {}), '(dir_path)\n', (1520, 1530), False, 'import json, re, copy, os, random, pickle\n'), ((2427, 2463), 're.match', 're.match', (['"""^fold\\\\d{,2}$"""', 'data_name'], {}), "('^fold\\\\d{,2}$', data_name)\n", (2435, 2463), False, 'import json, re, cop... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: caffe2/proto/caffe2_legacy.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf i... | [
"google.protobuf.descriptor.EnumValueDescriptor",
"google.protobuf.symbol_database.Default",
"google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper"
] | [((554, 580), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (578, 580), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((1733, 1782), 'google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper', 'enum_type_wrapper.EnumTypeWrapper', (['_LEGACYPADDI... |
#!/usr/bin/python3
import pico as ps
import argparse
import ctypes
import time
from utils import *
import logging
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('channel', type=str, help='Channel <A,B,C,D>')
parser.add_argument('nbSamples', type=int, help='Number of sampl... | [
"logging.getLogger",
"ctypes.c_int16",
"argparse.ArgumentParser",
"pico.pico_close",
"pico.pico_init",
"pico.pico_block",
"time.time"
] | [((155, 180), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (178, 180), False, 'import argparse\n'), ((1225, 1254), 'logging.getLogger', 'logging.getLogger', (['"""anon-sca"""'], {}), "('anon-sca')\n", (1242, 1254), False, 'import logging\n'), ((1286, 1302), 'ctypes.c_int16', 'ctypes.c_int16',... |
#!/usr/bin/env python
# Copyright 2017 Google Inc. 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... | [
"google.oauth2.service_account.Credentials.from_service_account_file",
"argparse.ArgumentParser",
"os.environ.get",
"google.cloud.pubsub.PublisherClient",
"io.open",
"googleapiclient.discovery.build",
"sys.exit",
"time.time"
] | [((1272, 1296), 'google.cloud.pubsub.PublisherClient', 'pubsub.PublisherClient', ([], {}), '()\n', (1294, 1296), False, 'from google.cloud import pubsub\n'), ((2049, 2124), 'google.oauth2.service_account.Credentials.from_service_account_file', 'service_account.Credentials.from_service_account_file', (['service_account_... |
import hashlib
import logging
import urllib.parse
import uuid
from django.conf import settings
from django.contrib.auth import authenticate, login
from django.forms import ValidationError
from django.forms.utils import ErrorList
from django.http import (
HttpResponseForbidden,
HttpResponseRedirect,
)
from djan... | [
"logging.getLogger",
"django.contrib.auth.authenticate",
"django.shortcuts.render",
"django.http.HttpResponseRedirect",
"django.utils.translation.gettext",
"django.contrib.auth.login",
"django.http.HttpResponseForbidden",
"django.forms.ValidationError",
"uuid.uuid4",
"django.urls.reverse",
"djan... | [((890, 917), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (907, 917), False, 'import logging\n'), ((5319, 5358), 'django.shortcuts.render', 'render', (['request', 'self.template', 'context'], {}), '(request, self.template, context)\n', (5325, 5358), False, 'from django.shortcuts import... |
# © 2019 University of Illinois Board of Trustees. All rights reserved
"""
Prepare a VCF file from a set of features in the current directory
"""
import glob
import pickle
from vcfFromContigs import createVcfRecord
from PySamFastaWrapper import PySamFastaWrapper as ReferenceCache
from multiprocessing import Pool
impor... | [
"os.path.exists",
"sys.exit",
"os.makedirs",
"argparse.ArgumentParser",
"os.path.join",
"numpy.argmax",
"os.path.split",
"PySamFastaWrapper.PySamFastaWrapper",
"multiprocessing.Pool",
"subprocess.call",
"shutil.rmtree",
"math.log10",
"vcfFromContigs.createVcfRecord",
"glob.glob",
"os.rem... | [((455, 493), 'glob.glob', 'glob.glob', (["('%s/shard[0-9]*.txt' % path)"], {}), "('%s/shard[0-9]*.txt' % path)\n", (464, 493), False, 'import glob\n'), ((3458, 3486), 'PySamFastaWrapper.PySamFastaWrapper', 'ReferenceCache', ([], {'database': 'ref'}), '(database=ref)\n', (3472, 3486), True, 'from PySamFastaWrapper impo... |
import torch.nn as nn
import torch
from collections import OrderedDict
class SEGDetecor(nn.Module):
def __init__(self,
in_channels=[64, 128, 256, 512],
inner_channels=256, k=10,
bias=False, adaptive=False, smooth=False, serial=False,
*args, **kwar... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Sigmoid",
"torch.nn.Sequential",
"torch.nn.init.kaiming_normal_",
"torch.nn.Conv2d",
"torch.nn.Upsample",
"torch.nn.ConvTranspose2d",
"torch.cat"
] | [((406, 449), 'torch.nn.Upsample', 'nn.Upsample', ([], {'scale_factor': '(2)', 'mode': '"""nearest"""'}), "(scale_factor=2, mode='nearest')\n", (417, 449), True, 'import torch.nn as nn\n'), ((493, 536), 'torch.nn.Upsample', 'nn.Upsample', ([], {'scale_factor': '(2)', 'mode': '"""nearest"""'}), "(scale_factor=2, mode='n... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import json
import base64
args = sys.argv
if len(args) <= 1:
result = u"No result"
else:
result = base64.b64encode(args[1])
output = {"items": [
{
"title": result,
"arg": result,
"valid": True
}
]}
sys.stdout.write(json.dumps... | [
"base64.b64encode",
"json.dumps"
] | [((159, 184), 'base64.b64encode', 'base64.b64encode', (['args[1]'], {}), '(args[1])\n', (175, 184), False, 'import base64\n'), ((310, 350), 'json.dumps', 'json.dumps', (['output', 'sys.stdout'], {'indent': '(4)'}), '(output, sys.stdout, indent=4)\n', (320, 350), False, 'import json\n')] |
# Copyright 2020 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, s... | [
"monai.handlers.ROCAUC",
"torch.distributed.destroy_process_group",
"numpy.testing.assert_allclose",
"torch.distributed.get_rank",
"torch.distributed.init_process_group",
"torch.device"
] | [((694, 755), 'torch.distributed.init_process_group', 'dist.init_process_group', ([], {'backend': '"""nccl"""', 'init_method': '"""env://"""'}), "(backend='nccl', init_method='env://')\n", (717, 755), True, 'import torch.distributed as dist\n'), ((817, 855), 'monai.handlers.ROCAUC', 'ROCAUC', ([], {'to_onehot_y': '(Tru... |
from __future__ import absolute_import, division, print_function
from numbers import Number
import torch
from torch.distributions import constraints
from torch.distributions.utils import broadcast_all, lazy_property, logits_to_probs, probs_to_logits
from pyro.distributions.torch_distribution import TorchDistribution... | [
"torch.distributions.utils.logits_to_probs",
"torch.distributions.utils.broadcast_all",
"torch.lgamma",
"torch.distributions.utils.probs_to_logits",
"torch.distributions.constraints.integer_interval",
"torch.no_grad",
"torch.Size",
"torch.arange"
] | [((2482, 2531), 'torch.distributions.constraints.integer_interval', 'constraints.integer_interval', (['(0)', 'self.total_count'], {}), '(0, self.total_count)\n', (2510, 2531), False, 'from torch.distributions import constraints\n'), ((2772, 2815), 'torch.distributions.utils.probs_to_logits', 'probs_to_logits', (['self.... |
from unittest import TestCase
from Rammbock.templates.primitives import UInt, PDU
from Rammbock.binary_tools import to_bin
from .tools import *
class TestListTemplate(TestCase):
def test_create_list(self):
list = get_list_of_three()
self.assertEqual(list.name, 'topthree')
self.assertEqual... | [
"Rammbock.templates.primitives.UInt",
"Rammbock.binary_tools.to_bin"
] | [((1349, 1365), 'Rammbock.templates.primitives.UInt', 'UInt', (['(4)', 'None', '(3)'], {}), '(4, None, 3)\n', (1353, 1365), False, 'from Rammbock.templates.primitives import UInt, PDU\n'), ((1397, 1426), 'Rammbock.binary_tools.to_bin', 'to_bin', (["('0x' + '00000003' * 5)"], {}), "('0x' + '00000003' * 5)\n", (1403, 142... |
from decimal import Decimal
from typing import Union
class Point:
def __init__(self, x: Union[Decimal, float, str], y: Union[Decimal, float, str]):
self.x = x if isinstance(x, Decimal) else Decimal(x)
self.y = y if isinstance(y, Decimal) else Decimal(y)
def __str__(self):
return f'POI... | [
"decimal.Decimal"
] | [((204, 214), 'decimal.Decimal', 'Decimal', (['x'], {}), '(x)\n', (211, 214), False, 'from decimal import Decimal\n'), ((265, 275), 'decimal.Decimal', 'Decimal', (['y'], {}), '(y)\n', (272, 275), False, 'from decimal import Decimal\n'), ((646, 663), 'decimal.Decimal', 'Decimal', (['parts[0]'], {}), '(parts[0])\n', (653... |
import serial
from time import sleep
from functools import reduce
class Strip:
def __init__(self, device, num_leds, code):
self.num_leds = num_leds
self.leds = [bytearray([0, 0, 0])] * num_leds
self.code = bytearray(code.encode())
self.ser = serial.Serial(device, 500000)
s... | [
"functools.reduce",
"serial.Serial",
"time.sleep"
] | [((280, 309), 'serial.Serial', 'serial.Serial', (['device', '(500000)'], {}), '(device, 500000)\n', (293, 309), False, 'import serial\n'), ((319, 329), 'time.sleep', 'sleep', (['(0.5)'], {}), '(0.5)\n', (324, 329), False, 'from time import sleep\n'), ((624, 661), 'functools.reduce', 'reduce', (['(lambda x, y: x + y)', ... |
import playfab.PlayFabErrors as PlayFabErrors
import sys
import traceback
ProductionEnvironmentURL = ".playfabapi.com"
"""
The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this
"""
VerticalName = None
"""
You must set this value for PlayFabSdk to wo... | [
"playfab.PlayFabErrors.PlayFabException",
"sys.exc_info",
"traceback.print_exc"
] | [((2392, 2413), 'traceback.print_exc', 'traceback.print_exc', ([], {}), '()\n', (2411, 2413), False, 'import traceback\n'), ((1594, 1695), 'playfab.PlayFabErrors.PlayFabException', 'PlayFabErrors.PlayFabException', (['"""You must set PlayFabSettings.TitleId before making an API call"""'], {}), "(\n 'You must set Pla... |
# Generated by Django 2.0.5 on 2018-06-01 15:35
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='apply',
... | [
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((3404, 3491), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""backend.users"""'}), "(on_delete=django.db.models.deletion.CASCADE, to=\n 'backend.users')\n", (3421, 3491), False, 'from django.db import migrations, models\n'), ((3608, 3701), 'djan... |
import pathlib
import sys
import numpy as np
import bentoml
from bentoml.adapters import DataframeInput
from bentoml.fastai import FastaiModelArtifact
@bentoml.env(infer_pip_packages=True)
@bentoml.artifacts([FastaiModelArtifact("model")])
class FastaiClassifier(bentoml.BentoService):
@bentoml.api(input=Datafra... | [
"bentoml.adapters.DataframeInput",
"bentoml.env",
"pathlib.Path",
"bentoml.fastai.FastaiModelArtifact"
] | [((156, 192), 'bentoml.env', 'bentoml.env', ([], {'infer_pip_packages': '(True)'}), '(infer_pip_packages=True)\n', (167, 192), False, 'import bentoml\n'), ((213, 241), 'bentoml.fastai.FastaiModelArtifact', 'FastaiModelArtifact', (['"""model"""'], {}), "('model')\n", (232, 241), False, 'from bentoml.fastai import Fastai... |
# Copyright 2021, Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | [
"google.cloud.dialogflowcx_v3.types.agent.DeleteAgentRequest",
"os.getenv",
"page_management.create_page",
"page_management.delete_page",
"asyncio.new_event_loop",
"page_management.list_page",
"uuid.uuid4",
"pytest.fail",
"pytest.PARENT.split",
"google.cloud.dialogflowcx_v3.services.agents.client.... | [((884, 917), 'os.getenv', 'os.getenv', (['"""GOOGLE_CLOUD_PROJECT"""'], {}), "('GOOGLE_CLOUD_PROJECT')\n", (893, 917), False, 'import os\n'), ((1261, 1305), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'autouse': '(True)'}), "(scope='module', autouse=True)\n", (1275, 1305), False, 'import pytest\... |
import csv
import os
import os.path
import shutil
import util
def get_version():
with open("version") as verfile:
return verfile.read().strip()
class Plant:
def __init__(self, dic):
self.id = util.str_to_int_or_zero(dic["id"])
self.name = dic["name"]
self.descr1 = dic["descr_... | [
"csv.DictWriter",
"csv.DictReader",
"os.makedirs",
"shutil.move",
"util.parse_bool",
"os.path.isfile",
"os.mkdir",
"shutil.copy",
"util.str_to_int_or_zero",
"csv.reader"
] | [((1249, 1286), 'os.makedirs', 'os.makedirs', (['"""plants/"""'], {'exist_ok': '(True)'}), "('plants/', exist_ok=True)\n", (1260, 1286), False, 'import os\n'), ((1291, 1336), 'os.makedirs', 'os.makedirs', (['"""plants/archive/"""'], {'exist_ok': '(True)'}), "('plants/archive/', exist_ok=True)\n", (1302, 1336), False, '... |
"""List VLANs."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer import utils
COLUMNS = ['id',
'number',
'name',
'firewall',
'datacenter',
'ha... | [
"SoftLayer.CLI.formatting.Table",
"click.Choice",
"SoftLayer.CLI.formatting.blank",
"SoftLayer.NetworkManager",
"click.option",
"click.command",
"SoftLayer.utils.lookup"
] | [((387, 402), 'click.command', 'click.command', ([], {}), '()\n', (400, 402), False, 'import click\n'), ((512, 610), 'click.option', 'click.option', (['"""--datacenter"""', '"""-d"""'], {'help': '"""Filter by datacenter shortname (sng01, dal05, ...)"""'}), "('--datacenter', '-d', help=\n 'Filter by datacenter shortn... |
# Copyright 2020 The TensorFlow Quantum 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 req... | [
"nbconvert.preprocessors.execute.executenb",
"nbformat.read",
"absl.testing.parameterized.parameters",
"tensorflow.test.main",
"re.sub",
"glob.glob"
] | [((991, 1034), 'glob.glob', 'glob.glob', (['"""quantum/docs/tutorials/*.ipynb"""'], {}), "('quantum/docs/tutorials/*.ipynb')\n", (1000, 1034), False, 'import glob\n'), ((1110, 1145), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (['NOTEBOOKS'], {}), '(NOTEBOOKS)\n', (1134, 1145), False, 'from abs... |
import hashlib
import logging
from pathlib import Path
from urllib import request
import numpy as np
import pytest
from jfibsem_dat.read import HEADER_LENGTH, parse_metadata
logger = logging.getLogger(__name__)
TEST_DIR = Path(__file__).resolve().parent
FIXTURE_DIR = TEST_DIR / "fixtures"
BLOCKSIZE = 2**20
EXAMPLE... | [
"logging.getLogger",
"numpy.product",
"pytest.skip",
"hashlib.md5",
"numpy.random.default_rng",
"pathlib.Path",
"jfibsem_dat.read.parse_metadata",
"numpy.iinfo",
"pytest.fixture",
"numpy.dtype",
"urllib.request.urlopen",
"numpy.random.RandomState"
] | [((186, 213), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (203, 213), False, 'import logging\n'), ((2562, 2593), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (2576, 2593), False, 'import pytest\n'), ((2711, 2742), 'pytest.fixture', 'pytes... |
import json
import boto3
from urllib import parse
s3 = boto3.client('s3')
def get_target_key(source_key):
### defining file key (prefix + filename)
city, year, month, day, query = ['']*5
for s in source_key.split('/'):
city = s if 'city' in s else city
year = s if 'year' in s else ye... | [
"boto3.client",
"urllib.parse.unquote_plus"
] | [((57, 75), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (69, 75), False, 'import boto3\n'), ((1025, 1087), 'urllib.parse.unquote_plus', 'parse.unquote_plus', (["event['Records'][0]['s3']['object']['key']"], {}), "(event['Records'][0]['s3']['object']['key'])\n", (1043, 1087), False, 'from urllib impo... |
import json
import os
import boto3
from botocore.exceptions import ClientError
session = boto3.Session()
dynamodb = session.resource('dynamodb')
table = dynamodb.Table(os.environ['STAY_TABLE_NAME'])
class StayReservationException(Exception):
pass
class StayFullyBookedException(StayReservationException):
p... | [
"boto3.Session",
"json.dumps"
] | [((91, 106), 'boto3.Session', 'boto3.Session', ([], {}), '()\n', (104, 106), False, 'import boto3\n'), ((1640, 1655), 'json.dumps', 'json.dumps', (['ret'], {}), '(ret)\n', (1650, 1655), False, 'import json\n')] |
import logging
from typing import List
from omegaconf import DictConfig
from nuplan.planning.script.builders.metric_builder import build_metrics_engines
from nuplan.planning.simulation.callback.metric_callback import MetricCallback
from nuplan.planning.simulation.runner.metric_runner import MetricRunner
from nuplan.p... | [
"logging.getLogger",
"nuplan.planning.simulation.callback.metric_callback.MetricCallback",
"nuplan.planning.simulation.runner.metric_runner.MetricRunner",
"nuplan.planning.script.builders.metric_builder.build_metrics_engines"
] | [((385, 412), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (402, 412), False, 'import logging\n'), ((1120, 1171), 'nuplan.planning.script.builders.metric_builder.build_metrics_engines', 'build_metrics_engines', ([], {'cfg': 'cfg', 'scenarios': 'scenarios'}), '(cfg=cfg, scenarios=scenari... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
# Copyright (C) 2017 <NAME>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
import time
from testrunner import run
US_PE... | [
"time.time",
"testrunner.run",
"sys.exit"
] | [((456, 467), 'time.time', 'time.time', ([], {}), '()\n', (465, 467), False, 'import time\n'), ((1309, 1322), 'testrunner.run', 'run', (['testfunc'], {}), '(testfunc)\n', (1312, 1322), False, 'from testrunner import run\n'), ((1255, 1266), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1263, 1266), False, 'import sys... |
"""Tests for functions from pandas._libs.tslibs"""
from datetime import date, datetime
import pytest
from pandas._libs import tslibs
from pandas._libs.tslibs.timestamps import Timestamp
@pytest.mark.parametrize(
"value,expected",
[
(date(2012, 9, 7), datetime(2012, 9, 7)),
(da... | [
"pandas._libs.tslibs.normalize_date",
"datetime.datetime",
"datetime.date",
"pandas._libs.tslibs.timestamps.Timestamp"
] | [((506, 534), 'pandas._libs.tslibs.normalize_date', 'tslibs.normalize_date', (['value'], {}), '(value)\n', (527, 534), False, 'from pandas._libs import tslibs\n'), ((1023, 1048), 'pandas._libs.tslibs.normalize_date', 'tslibs.normalize_date', (['dt'], {}), '(dt)\n', (1044, 1048), False, 'from pandas._libs import tslibs\... |
import os
import logging
def create_folder(fd):
if not os.path.exists(fd):
os.makedirs(fd)
def create_logging(log_dir, filemode):
create_folder(log_dir)
i1 = 0
while os.path.isfile(os.path.join(log_dir, '{:04d}.log'.format(i1))):
i1 += 1
log_path = os.path.join(... | [
"logging.basicConfig",
"os.path.exists",
"logging.getLogger",
"logging.StreamHandler",
"os.makedirs",
"logging.Formatter"
] | [((358, 556), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s"""', 'datefmt': '"""%a, %d %b %Y %H:%M:%S"""', 'filename': 'log_path', 'filemode': 'filemode'}), "(level=logging.DEBUG, format=\n '%(asctime)s ... |
# Copyright 2017, Google LLC 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 applicable law or a... | [
"six.moves.range",
"google.cloud.pubsub_v1.futures.Future",
"mock.Mock",
"google.cloud.pubsub_v1.types.FlowControl",
"threading.Lock",
"time.sleep",
"pytest.fail",
"datetime.datetime.now",
"google.cloud.pubsub_v1.SubscriberClient",
"google.cloud.pubsub_v1.PublisherClient",
"test_utils.system.uni... | [((976, 1007), 'pytest.fixture', 'pytest.fixture', ([], {'scope': 'u"""module"""'}), "(scope=u'module')\n", (990, 1007), False, 'import pytest\n'), ((1099, 1130), 'pytest.fixture', 'pytest.fixture', ([], {'scope': 'u"""module"""'}), "(scope=u'module')\n", (1113, 1130), False, 'import pytest\n'), ((1189, 1220), 'pytest.... |
# See LICENSE for licensing information
import ipaddress
import logging
import math
import os
import cPickle as pickle
import string
import sys
import yaml
from time import time
from copy import deepcopy
from base64 import b64decode
from twisted.internet import task, reactor, ssl
from twisted.internet.protocol impor... | [
"privcount.tagged_event.is_ip_address_valid",
"logging.debug",
"privcount.counter.get_valid_counters",
"yaml.load",
"privcount.log.format_last_event_time_since",
"privcount.counter.SecureCounters",
"privcount.crypto.load_public_key_string",
"math.log",
"privcount.connection.get_a_control_password",
... | [((2158, 2205), 'privcount.node.PrivCountClient.__init__', 'PrivCountClient.__init__', (['self', 'config_filepath'], {}), '(self, config_filepath)\n', (2182, 2205), False, 'from privcount.node import PrivCountClient, EXPECTED_EVENT_INTERVAL_MAX, EXPECTED_CONTROL_ESTABLISH_MAX\n'), ((2458, 2487), 'privcount.protocol.Pri... |
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
from dotenv import load_dotenv
load_dotenv()
lz_uri = 'spotify:artist:36QJpDe2go2KgaRleHCDTp'
client_credentials_manager = SpotifyClientCredentials(client_id='CLIENT_ID',
client_secret='CLIENT_SECRET')
spotify =... | [
"spotipy.Spotify",
"spotipy.oauth2.SpotifyClientCredentials",
"dotenv.load_dotenv"
] | [((99, 112), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (110, 112), False, 'from dotenv import load_dotenv\n'), ((193, 271), 'spotipy.oauth2.SpotifyClientCredentials', 'SpotifyClientCredentials', ([], {'client_id': '"""CLIENT_ID"""', 'client_secret': '"""CLIENT_SECRET"""'}), "(client_id='CLIENT_ID', client_... |
"""Utilities to help job and tool code setup jobs."""
import json
import os
from typing import (
Any,
cast,
Dict,
List,
Optional,
Tuple,
Union,
)
from galaxy.files import (
ConfiguredFileSources,
DictFileSourcesUserContext,
ProvidesUserFileSourcesUserContext,
)
from galaxy.job_e... | [
"os.path.exists",
"galaxy.job_execution.datasets.DatasetPath",
"galaxy.job_execution.datasets.get_path_rewriter",
"os.path.join",
"galaxy.util.safe_makedirs",
"galaxy.files.DictFileSourcesUserContext",
"os.path.basename",
"galaxy.files.ConfiguredFileSources.from_dict",
"json.load",
"typing.cast"
] | [((10159, 10192), 'os.path.join', 'os.path.join', (['work_dir', '"""configs"""'], {}), "(work_dir, 'configs')\n", (10171, 10192), False, 'import os\n'), ((4989, 5044), 'galaxy.files.ConfiguredFileSources.from_dict', 'ConfiguredFileSources.from_dict', (['self.file_sources_dict'], {}), '(self.file_sources_dict)\n', (5020... |
# -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
""" Provides utility functions to build a FogLAMP Support bundle.
"""
import datetime
import platform
import os
from os.path import basename
import glob
import sys
import shutil
import json
import tarfile
import fnmatch
impor... | [
"os.path.exists",
"os.listdir",
"tarfile.open",
"os.makedirs",
"subprocess.Popen",
"platform.platform",
"foglamp.common.logger.setup",
"json.dump",
"os.path.join",
"os.path.isfile",
"datetime.datetime.now",
"shutil.disk_usage",
"foglamp.services.core.api.service.get_service_records",
"fnma... | [((679, 701), 'foglamp.common.logger.setup', 'logger.setup', (['__name__'], {}), '(__name__)\n', (691, 701), False, 'from foglamp.common import logger\n'), ((847, 866), 'platform.platform', 'platform.platform', ([], {}), '()\n', (864, 866), False, 'import platform\n'), ((884, 903), 'platform.platform', 'platform.platfo... |
import os
import numpy as np
from zero2ml.utils.data_transformations import train_test_split
from zero2ml.supervised_learning.knn import KNNClassifier
def main():
# Construct path to dataset
root_directory_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
data_path = os.path.join(root_d... | [
"zero2ml.utils.data_transformations.train_test_split",
"os.path.join",
"zero2ml.supervised_learning.knn.KNNClassifier",
"os.path.dirname",
"numpy.genfromtxt"
] | [((301, 377), 'os.path.join', 'os.path.join', (['root_directory_path', '"""tests"""', '"""test_data"""', '"""breast_cancer.csv"""'], {}), "(root_directory_path, 'tests', 'test_data', 'breast_cancer.csv')\n", (313, 377), False, 'import os\n'), ((409, 463), 'numpy.genfromtxt', 'np.genfromtxt', (['data_path'], {'delimiter... |
# coding=utf-8
# Copyright 2019 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"tensorflow.random.uniform",
"preprocessors.sequence_preprocessor.random_square_crop",
"preprocessors.sequence_preprocessor.convert_image_sequence_dtype",
"preprocessors.sequence_preprocessor.resize_sequence",
"random.shuffle",
"preprocessors.sequence_preprocessor.adjust_sequence_brightness",
"preproces... | [((5140, 5195), 'tensorflow.random.uniform', 'tf.random.uniform', (['[]', '(-max_delta)', 'max_delta'], {'seed': 'seed'}), '([], -max_delta, max_delta, seed=seed)\n', (5157, 5195), True, 'import tensorflow as tf\n'), ((5382, 5428), 'tensorflow.random.uniform', 'tf.random.uniform', (['[]', 'lower', 'upper'], {'seed': 's... |
""" Sunrise and Sunset Estimation Module
This module contains functions for estimating sunrise and sunset times from an
unlabel PV power dataset.
"""
import numpy as np
from solardatatools.signal_decompositions import tl1_l2d2p365
def rise_set_rough(bool_msk):
nvals = bool_msk.shape[0]
num_meas_per_hour = n... | [
"numpy.ones_like",
"numpy.flip",
"numpy.argmax",
"numpy.isnan",
"numpy.arange"
] | [((348, 389), 'numpy.arange', 'np.arange', (['(0)', '(24)', '(1.0 / num_meas_per_hour)'], {}), '(0, 24, 1.0 / num_meas_per_hour)\n', (357, 389), True, 'import numpy as np\n'), ((409, 436), 'numpy.argmax', 'np.argmax', (['bool_msk'], {'axis': '(0)'}), '(bool_msk, axis=0)\n', (418, 436), True, 'import numpy as np\n'), ((... |
"""w created serializers.py at 2021/9/3 下午12:12"""
from rest_framework import serializers
from drf_spectacular.utils import extend_schema_field, OpenApiTypes
from tag.models import Tag
from utils.drf_utils.base_model_serializer import BaseHyperlinkedModelSerializer, BaseModelSerializer
from .models import Article
cla... | [
"rest_framework.serializers.SerializerMethodField",
"drf_spectacular.utils.extend_schema_field",
"tag.models.Tag.objects.create",
"rest_framework.serializers.CharField",
"tag.models.Tag.objects.all",
"tag.models.Tag.objects.filter"
] | [((403, 466), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'source': '"""author.username"""', 'help_text': '"""作者"""'}), "(source='author.username', help_text='作者')\n", (424, 466), False, 'from rest_framework import serializers\n'), ((487, 566), 'rest_framework.serializers.CharField', 'seriali... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import datetime
import logging
import hashlib
import hmac
import json
from django.template import Library
from django.conf import settings
register = Library()
log = logging.getLogger(__name__)
INTERCOM_APPID =... | [
"logging.getLogger",
"json.dumps",
"django.template.Library",
"datetime.datetime.utcnow"
] | [((259, 268), 'django.template.Library', 'Library', ([], {}), '()\n', (266, 268), False, 'from django.template import Library\n'), ((275, 302), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (292, 302), False, 'import logging\n'), ((1342, 1368), 'datetime.datetime.utcnow', 'datetime.datet... |
import numpy as np
def most_common(lst):
return max(set(lst), key=lst.count)
def get_preds(y_pred):
y_pred = np.array(y_pred).T.tolist()
y_pred = [most_common(y) for y in y_pred]
return y_pred
def get_score(score, thr, pred):
if pred == 0:
return 1-score/thr
return (score-thr)/(1-thr)
def get_... | [
"numpy.mean",
"numpy.array"
] | [((696, 706), 'numpy.mean', 'np.mean', (['y'], {}), '(y)\n', (703, 706), True, 'import numpy as np\n'), ((120, 136), 'numpy.array', 'np.array', (['y_pred'], {}), '(y_pred)\n', (128, 136), True, 'import numpy as np\n'), ((653, 671), 'numpy.array', 'np.array', (['y_scores'], {}), '(y_scores)\n', (661, 671), True, 'import... |
from ctypes import cdll
sum_lib = cdll.LoadLibrary('./libsum_of_squares.so')
def sum_of_squares_ctypes(N):
return sum_lib.sum_of_squares(N)
| [
"ctypes.cdll.LoadLibrary"
] | [((36, 78), 'ctypes.cdll.LoadLibrary', 'cdll.LoadLibrary', (['"""./libsum_of_squares.so"""'], {}), "('./libsum_of_squares.so')\n", (52, 78), False, 'from ctypes import cdll\n')] |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
from collections import OrderedDict
from torch.autograd import Variable
from options.test_options import TestOptions
from models.models import create_model
from models.mapping_model import Pix2PixHDModel_Mapping
import util.util as util... | [
"torchvision.transforms.CenterCrop",
"os.path.exists",
"os.listdir",
"os.makedirs",
"torchvision.transforms.Scale",
"os.path.join",
"torch.zeros_like",
"numpy.array",
"options.test_options.TestOptions",
"torchvision.transforms.Normalize",
"torchvision.transforms.ToTensor",
"torchvision.utils.s... | [((2567, 2591), 'models.mapping_model.Pix2PixHDModel_Mapping', 'Pix2PixHDModel_Mapping', ([], {}), '()\n', (2589, 2591), False, 'from models.mapping_model import Pix2PixHDModel_Mapping\n'), ((3050, 3076), 'os.listdir', 'os.listdir', (['opt.test_input'], {}), '(opt.test_input)\n', (3060, 3076), False, 'import os\n'), ((... |
from TestHelperSuperClass import testHelperSuperClass
import dockerRegistryPythonClient
import base64
import json
from SampleData import getSampleMetadata
class test_apiDelete(testHelperSuperClass):
def test_simple(self):
baseUrl = "MOCK"
client = dockerRegistryPythonClient.RegistryClient(baseURL=baseUrl)
... | [
"dockerRegistryPythonClient.RegistryClient",
"json.dumps",
"SampleData.getSampleMetadata"
] | [((259, 317), 'dockerRegistryPythonClient.RegistryClient', 'dockerRegistryPythonClient.RegistryClient', ([], {'baseURL': 'baseUrl'}), '(baseURL=baseUrl)\n', (300, 317), False, 'import dockerRegistryPythonClient\n'), ((901, 975), 'SampleData.getSampleMetadata', 'getSampleMetadata', ([], {'catalogName': 'catalogName', 't... |
#!/usr/bin/python
"""
This module provides high-level wrapper functions for bluepy bluetooth handling of DashAgents.
It exposes several functions that can be used to find nearby devices, pair with them and communicate the status and data of DashAgents to the shelve database.
It also exposes several mock versions of th... | [
"pprint.pprint",
"random.randint",
"time.sleep"
] | [((3099, 3114), 'time.sleep', 'sleep', (['duration'], {}), '(duration)\n', (3104, 3114), False, 'from time import sleep\n'), ((4895, 4910), 'random.randint', 'randint', (['(0)', '(127)'], {}), '(0, 127)\n', (4902, 4910), False, 'from random import randint\n'), ((4916, 4931), 'random.randint', 'randint', (['(0)', '(127)... |
#!/usr/bin/env python3
import logging
import os
import sys
from processor import PureAdaptor
logger = logging.getLogger(__name__)
log_formatter = logging.Formatter('%(asctime)s %(name)s:'
' [%(levelname)s] %(message)s')
std_out_handler = logging.StreamHandler(sys.stdout)
std_out_han... | [
"logging.getLogger",
"logging.StreamHandler",
"logging.Formatter",
"os.environ.get",
"logging.exception",
"sys.exit",
"processor.PureAdaptor"
] | [((104, 131), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (121, 131), False, 'import logging\n'), ((148, 218), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s %(name)s: [%(levelname)s] %(message)s"""'], {}), "('%(asctime)s %(name)s: [%(levelname)s] %(message)s')\n", (165, 2... |
import pytest
import concepts
def test_empty_objects():
with pytest.raises(ValueError, match=r'empty objects'):
concepts.Context((), ('spam',), [(False,)])
def test_empty_properies():
with pytest.raises(ValueError, match=r'empty properties'):
concepts.Context(('spam',), (), [(False,)])
de... | [
"concepts.Context",
"pytest.raises"
] | [((1567, 1663), 'concepts.Context', 'concepts.Context', (["('spam', 'eggs')", "('camelot', 'launcelot')", '[(True, False), (False, True)]'], {}), "(('spam', 'eggs'), ('camelot', 'launcelot'), [(True, False),\n (False, True)])\n", (1583, 1663), False, 'import concepts\n'), ((1897, 1965), 'concepts.Context', 'concepts... |
"""Django admin site settings for core models."""
from django.contrib import admin
from pykeg.core import models
from pykeg.core.util import CtoF
class UserAdmin(admin.ModelAdmin):
list_display = (
"username",
"email",
"date_joined",
"last_login",
"is_active",
"is_... | [
"django.contrib.admin.site.register",
"pykeg.core.util.CtoF"
] | [((420, 463), 'django.contrib.admin.site.register', 'admin.site.register', (['models.User', 'UserAdmin'], {}), '(models.User, UserAdmin)\n', (439, 463), False, 'from django.contrib import admin\n'), ((538, 593), 'django.contrib.admin.site.register', 'admin.site.register', (['models.KegbotSite', 'KegbotSiteAdmin'], {}),... |
import sys, os
import math
import numpy as np
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../')
from algorithms import gradient_descent
EPSILON = 1e-3
def test_gradient_with_x2_and_zero():
assert abs(gradient_descent.gradient(lambda x: x**2, 0.0)) <= EPSILON
... | [
"sys.path.insert",
"algorithms.gradient_descent.gradient_descent_for_function",
"math.cos",
"algorithms.gradient_descent.gradient",
"os.path.abspath",
"math.sin"
] | [((104, 139), 'sys.path.insert', 'sys.path.insert', (['(0)', "(myPath + '/../')"], {}), "(0, myPath + '/../')\n", (119, 139), False, 'import sys, os\n'), ((76, 101), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (91, 101), False, 'import sys, os\n'), ((903, 976), 'algorithms.gradient_descent... |
import unittest
from bmaclient.client import MonitoringAPI
from bmaclient.bind import APIClientError, MonitoringAPIMethod
class BindMethodTest(unittest.TestCase):
def setUp(self):
self.api = MonitoringAPI()
def test_bind(self):
method = self.api.fetch_doas(_return_as_instance=True)
s... | [
"unittest.main",
"bmaclient.client.MonitoringAPI"
] | [((1762, 1777), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1775, 1777), False, 'import unittest\n'), ((206, 221), 'bmaclient.client.MonitoringAPI', 'MonitoringAPI', ([], {}), '()\n', (219, 221), False, 'from bmaclient.client import MonitoringAPI\n')] |
# 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... | [
"keras.losses.binary_crossentropy",
"keras.testing_infra.test_utils.should_run_eagerly",
"keras.testing_infra.test_utils.get_model_from_layers",
"numpy.array",
"keras.layers.Dense",
"keras.Sequential",
"tensorflow.compat.v2.executing_eagerly",
"keras.Model",
"keras.testing_infra.test_combinations.ru... | [((1281, 1320), 'keras.optimizers.optimizer_v2.gradient_descent.SGD', 'optimizer_v2.gradient_descent.SGD', (['(0.05)'], {}), '(0.05)\n', (1314, 1320), False, 'from keras.optimizers import optimizer_v2\n'), ((2708, 2781), 'keras.testing_infra.test_combinations.run_with_all_model_types', 'test_combinations.run_with_all_m... |
#!/usr/bin/env python3
import matplotlib
import matplotlib.pyplot as plt
from collections import defaultdict
import numpy as np
lengths = defaultdict(list)
lib_count = defaultdict(int)
lib="good"
lengths[lib].append(20)
lengths[lib].append(30)
lengths[lib].append(100)
lengths[lib].append(330)
lengths[lib].append(10... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.close",
"numpy.array",
"collections.defaultdict",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xscale",
"matplotlib.pyplot.show"
] | [((141, 158), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (152, 158), False, 'from collections import defaultdict\n'), ((171, 187), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (182, 187), False, 'from collections import defaultdict\n'), ((1254, 1271), 'matplotlib.pyplot... |
# OneShot Save Utility
# https://github.com/hunternet93/oneshot-save-utility
# ===========
# UI Settings
# ===========
bgcolor = '#13041B'
textcolor = '#FFFFAA'
highlightcolor = '#888844'
font = ('vgasys', 14)
# ===============
# Initial imports
# ===============
from rubymarshal.reader import load as rb_load
from... | [
"tkinter.messagebox.showwarning",
"os.path.exists",
"tkinter.messagebox.showerror",
"os.listdir",
"rubymarshal.reader.load",
"rubymarshal.writer.write",
"os.makedirs",
"tkinter.messagebox.askyesno",
"os.path.expandvars",
"psutil.pids",
"psutil.Process",
"os.path.join",
"platform.system",
"... | [((1148, 1187), 'os.path.join', 'os.path.join', (['dirpath', '"""p-settings.dat"""'], {}), "(dirpath, 'p-settings.dat')\n", (1160, 1187), False, 'import os\n'), ((1447, 1500), 'os.path.join', 'os.path.join', (['dirpath', '"""OneShot Save Utility Archive"""'], {}), "(dirpath, 'OneShot Save Utility Archive')\n", (1459, 1... |
# Copyright 2022 The AI Flow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | [
"ai_flow.context.workflow_config_loader.current_workflow_config"
] | [((1348, 1373), 'ai_flow.context.workflow_config_loader.current_workflow_config', 'current_workflow_config', ([], {}), '()\n', (1371, 1373), False, 'from ai_flow.context.workflow_config_loader import current_workflow_config\n')] |
from django.contrib import admin
from .models import Usuario
@admin.register(Usuario)
class UsuarioAdmin(admin.ModelAdmin):
list_display = ('nome','email','senha')
search_fields = ('nome', 'email')
readonly_fields = ('senha',)
| [
"django.contrib.admin.register"
] | [((63, 86), 'django.contrib.admin.register', 'admin.register', (['Usuario'], {}), '(Usuario)\n', (77, 86), False, 'from django.contrib import admin\n')] |
# Copyright 2018 getcarrier.io
#
# 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 t... | [
"docker.from_env",
"uuid.uuid4"
] | [((827, 844), 'docker.from_env', 'docker.from_env', ([], {}), '()\n', (842, 844), False, 'import docker\n'), ((2543, 2560), 'docker.from_env', 'docker.from_env', ([], {}), '()\n', (2558, 2560), False, 'import docker\n'), ((1595, 1602), 'uuid.uuid4', 'uuid4', ([], {}), '()\n', (1600, 1602), False, 'from uuid import uuid... |
# Copyright 2021 Internet Corporation for Assigned Names and Numbers.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# Developed by Sinodun IT (sinodun.com)
#
# Ag... | [
"grafanacommon.BarChartTrace",
"grafanacommon.BarChartAxis"
] | [((4003, 4118), 'grafanacommon.BarChartTrace', 'GCommon.BarChartTrace', ([], {'name': '"""UDP Query"""', 'color': '"""#1F60C4"""', 'x': '"""UDPQueryLen"""', 'y': '"""UDPQueryCnt"""', 'text': '"""UDPQueryCnt"""'}), "(name='UDP Query', color='#1F60C4', x='UDPQueryLen', y\n ='UDPQueryCnt', text='UDPQueryCnt')\n", (4024... |
from builtins import range
from PhysicsTools.Heppy.analyzers.core.TreeAnalyzerNumpy import TreeAnalyzerNumpy
from PhysicsTools.Heppy.analyzers.core.AutoHandle import AutoHandle
#from ROOT import TriggerBitChecker
from PhysicsTools.Heppy.analyzers.core.autovars import *
from PhysicsTools.Heppy.analyzers.objects.autophob... | [
"six.itervalues",
"builtins.range",
"six.iteritems",
"PhysicsTools.Heppy.analyzers.core.AutoHandle.AutoHandle"
] | [((1648, 1704), 'PhysicsTools.Heppy.analyzers.core.AutoHandle.AutoHandle', 'AutoHandle', (["('generator', '', '')", '"""GenEventInfoProduct"""'], {}), "(('generator', '', ''), 'GenEventInfoProduct')\n", (1658, 1704), False, 'from PhysicsTools.Heppy.analyzers.core.AutoHandle import AutoHandle\n'), ((1724, 1755), 'six.it... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from covsirphy.ode.mbase import ModelBase
class SIRF(ModelBase):
"""
SIR-F model.
Args:
population (int): total population
theta (float)
kappa (float)
rho (float)
sigma (float)
"""
# Model na... | [
"numpy.array",
"covsirphy.ode.mbase.ModelBase.N.lower"
] | [((820, 842), 'numpy.array', 'np.array', (['[0, 1, 1, 1]'], {}), '([0, 1, 1, 1])\n', (828, 842), True, 'import numpy as np\n'), ((1041, 1060), 'covsirphy.ode.mbase.ModelBase.N.lower', 'ModelBase.N.lower', ([], {}), '()\n', (1058, 1060), False, 'from covsirphy.ode.mbase import ModelBase\n'), ((2229, 2263), 'numpy.array'... |
# -*- coding: utf-8 -*-
"""
Author : LF - SM -TD
Date : 01/02/2020
"""
# Library Python Basics
import os
import matplotlib.pyplot as plt
#Library Chaos Libraries
import nolds.examples
import nolds
import PyGnuplot as gp
def test_nolds_package_service_accuracy():
print("You are testing the 'nolds' package...")
... | [
"nolds.examples.plot_lyap",
"matplotlib.pyplot.plot",
"PyGnuplot.c",
"os.popen",
"os.system",
"matplotlib.pyplot.show"
] | [((324, 356), 'nolds.examples.plot_lyap', 'nolds.examples.plot_lyap', (['"""tent"""'], {}), "('tent')\n", (348, 356), False, 'import nolds\n'), ((361, 397), 'nolds.examples.plot_lyap', 'nolds.examples.plot_lyap', (['"""logistic"""'], {}), "('logistic')\n", (385, 397), False, 'import nolds\n'), ((582, 619), 'PyGnuplot.c... |
import numpy as np
import sys
import logging
import pickle
import matplotlib.pyplot as plt
from pathlib import Path
from scipy.optimize import minimize_scalar
from itertools import product
import ray
import pandas as pd
import click
from neslab.find import distributions as dists
from neslab.find import Model
logger ... | [
"logging.getLogger",
"neslab.find.Model",
"logging.StreamHandler",
"ray.init",
"ray.get",
"click.option",
"neslab.find.distributions.Geometric.get_scale_range",
"click.Path",
"scipy.optimize.minimize_scalar",
"pandas.DataFrame",
"click.command",
"numpy.arange"
] | [((322, 348), 'logging.getLogger', 'logging.getLogger', (['"""model"""'], {}), "('model')\n", (339, 348), False, 'import logging\n'), ((861, 876), 'click.command', 'click.command', ([], {}), '()\n', (874, 876), False, 'import click\n'), ((878, 948), 'click.option', 'click.option', (['"""--redis-password"""', '"""-p"""'... |
# -*- coding: utf-8 -*-
"""
Base class for backend clients.
Created on 2018-04-23 by hbldh <<EMAIL>>
"""
import abc
import asyncio
import uuid
from typing import Callable, Any, Union
from bleak.backends.service import BleakGATTServiceCollection
from bleak.backends.characteristic import BleakGATTCharacteristic
from b... | [
"bleak.backends.service.BleakGATTServiceCollection"
] | [((1353, 1381), 'bleak.backends.service.BleakGATTServiceCollection', 'BleakGATTServiceCollection', ([], {}), '()\n', (1379, 1381), False, 'from bleak.backends.service import BleakGATTServiceCollection\n')] |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [
"oci.util.formatted_flat_dict",
"oci.util.value_allowed_none_or_none_sentinel"
] | [((16457, 16482), 'oci.util.formatted_flat_dict', 'formatted_flat_dict', (['self'], {}), '(self)\n', (16476, 16482), False, 'from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel\n'), ((14558, 14626), 'oci.util.value_allowed_none_or_none_sentinel', 'value_allowed_none_or_none_sent... |
# Copyright 2016 Google Inc. 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 applicable law or agree... | [
"tensorflow.add",
"tensorflow.nn.l2_loss",
"tensorflow.name_scope",
"tensorflow.nn.softmax_cross_entropy_with_logits",
"tensorflow.convert_to_tensor",
"tensorflow.reduce_mean",
"tensorflow.cast",
"tensorflow.add_to_collection",
"tensorflow.abs"
] | [((3865, 3905), 'tensorflow.name_scope', 'tf.name_scope', (['scope', '"""L1Loss"""', '[tensor]'], {}), "(scope, 'L1Loss', [tensor])\n", (3878, 3905), True, 'import tensorflow as tf\n'), ((3920, 3999), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['weight'], {'dtype': 'tensor.dtype.base_dtype', 'name': '"""l... |
from IMLearn.utils import split_train_test
from IMLearn.learners.regressors import LinearRegression
from typing import NoReturn
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import plotly.express as px
import plotly.io as pio
pio.templates.default = "simple_white"
def load_data(filename: ... | [
"pandas.read_csv",
"IMLearn.learners.regressors.LinearRegression",
"numpy.array",
"IMLearn.utils.split_train_test",
"plotly.graph_objects.Scatter",
"plotly.graph_objects.Figure",
"numpy.random.seed",
"numpy.std",
"numpy.cov"
] | [((3265, 3282), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (3279, 3282), True, 'import numpy as np\n'), ((3573, 3591), 'IMLearn.learners.regressors.LinearRegression', 'LinearRegression', ([], {}), '()\n', (3589, 3591), False, 'from IMLearn.learners.regressors import LinearRegression\n'), ((3747, 379... |
"""SCons.Tool.qt5
Tool-specific initialization for Qt5.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001-7,2010,2011,2012 The SCons Foundation
#
# Permission is hereby granted, free of... | [
"re.search",
"re.compile"
] | [((2999, 3044), 're.compile', 're.compile', (['"""<file[^>]*>([^<]*)</file>"""', 're.M'], {}), "('<file[^>]*>([^<]*)</file>', re.M)\n", (3009, 3044), False, 'import re\n'), ((8425, 8467), 're.search', 're.search', (['inc_moc_cpp', 'cpp_contents', 're.M'], {}), '(inc_moc_cpp, cpp_contents, re.M)\n', (8434, 8467), False,... |
from nltk.corpus import stopwords
from tensorflow.keras.preprocessing.text import Tokenizer
import gensim
import pandas as pd
from preprocess import process_text_data
from utils import load_epub
from word2vec import Word2Vec
def remove_stopword(book):
corpus = list()
stopword = stopwords.words('english')
... | [
"nltk.corpus.stopwords.words",
"word2vec.Word2Vec",
"pandas.DataFrame",
"gensim.models.KeyedVectors.load_word2vec_format",
"utils.load_epub",
"tensorflow.keras.preprocessing.text.Tokenizer",
"preprocess.process_text_data"
] | [((290, 316), 'nltk.corpus.stopwords.words', 'stopwords.words', (['"""english"""'], {}), "('english')\n", (305, 316), False, 'from nltk.corpus import stopwords\n'), ((747, 758), 'tensorflow.keras.preprocessing.text.Tokenizer', 'Tokenizer', ([], {}), '()\n', (756, 758), False, 'from tensorflow.keras.preprocessing.text i... |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from openapi_server.models.base_model_ import Model
from openapi_server import util
class DiskSpaceMonitorDescriptorDiskSpace(Model):
"""NOTE: This class is auto ... | [
"openapi_server.util.deserialize_model"
] | [((1888, 1921), 'openapi_server.util.deserialize_model', 'util.deserialize_model', (['dikt', 'cls'], {}), '(dikt, cls)\n', (1910, 1921), False, 'from openapi_server import util\n')] |
# -*- 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... | [
"pipeline.eri.imp.context.ContextMixin",
"json.dumps",
"bamboo_engine.eri.ContextValue",
"bamboo_engine.utils.string.unique_id"
] | [((1154, 1168), 'pipeline.eri.imp.context.ContextMixin', 'ContextMixin', ([], {}), '()\n', (1166, 1168), False, 'from pipeline.eri.imp.context import ContextMixin\n'), ((1196, 1210), 'bamboo_engine.utils.string.unique_id', 'unique_id', (['"""p"""'], {}), "('p')\n", (1205, 1210), False, 'from bamboo_engine.utils.string ... |
import sonnet as snt
import tensorflow as tf
from luminoth.utils.bbox_transform_tf import decode, clip_boxes, change_order
class SSDProposal(snt.AbstractModule):
"""Transforms anchors and SSD predictions into object proposals.
Using the fixed anchors and the SSD predictions for both classification
and r... | [
"tensorflow.unstack",
"tensorflow.shape",
"tensorflow.boolean_mask",
"tensorflow.nn.top_k",
"tensorflow.summary.scalar",
"tensorflow.concat",
"luminoth.utils.bbox_transform_tf.decode",
"tensorflow.gather",
"luminoth.utils.bbox_transform_tf.clip_boxes",
"tensorflow.image.non_max_suppression",
"te... | [((6813, 6846), 'tensorflow.concat', 'tf.concat', (['selected_boxes'], {'axis': '(0)'}), '(selected_boxes, axis=0)\n', (6822, 6846), True, 'import tensorflow as tf\n'), ((6912, 6938), 'luminoth.utils.bbox_transform_tf.change_order', 'change_order', (['proposals_tf'], {}), '(proposals_tf)\n', (6924, 6938), False, 'from ... |
import unittest
from movie_classifier.constants.paths import TRAIN_PATH
from movie_classifier.core.utils.logger import setup_logger_config
from movie_classifier.scripts.pipeline.dataset_generation import generate_training_dataset
setup_logger_config()
class DatasetPipelineTest(unittest.TestCase):
def test_datas... | [
"unittest.main",
"movie_classifier.scripts.pipeline.dataset_generation.generate_training_dataset",
"movie_classifier.core.utils.logger.setup_logger_config"
] | [((232, 253), 'movie_classifier.core.utils.logger.setup_logger_config', 'setup_logger_config', ([], {}), '()\n', (251, 253), False, 'from movie_classifier.core.utils.logger import setup_logger_config\n'), ((726, 741), 'unittest.main', 'unittest.main', ([], {}), '()\n', (739, 741), False, 'import unittest\n'), ((580, 61... |
# -*- coding: utf-8 -*-
"""
Exodus Add-on
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This progra... | [
"resources.lib.modules.dom_parser.parse_dom",
"urlparse.urljoin",
"urlparse.parse_qs",
"resources.lib.modules.client.request",
"re.compile",
"resources.lib.modules.source_utils.is_host_valid",
"urllib.urlencode",
"resources.lib.modules.source_utils.strip_domain",
"re.sub"
] | [((1258, 1284), 're.sub', 're.sub', (['"""[^0-9]"""', '""""""', 'imdb'], {}), "('[^0-9]', '', imdb)\n", (1264, 1284), False, 'import re\n'), ((1552, 1578), 're.sub', 're.sub', (['"""[^0-9]"""', '""""""', 'imdb'], {}), "('[^0-9]', '', imdb)\n", (1558, 1578), False, 'import re\n'), ((1889, 1911), 'urlparse.parse_qs', 'ur... |
#!/usr/bin/env python
# Lint as: python3
"""Output plugins used by flows and hunts for results exports."""
import abc
import threading
from grr_response_core.lib import rdfvalue
from grr_response_core.lib.rdfvalues import protodict as rdf_protodict
from grr_response_core.lib.rdfvalues import structs as rdf_structs
fr... | [
"grr_response_core.lib.rdfvalues.protodict.AttributedDict",
"threading.RLock"
] | [((1701, 1731), 'grr_response_core.lib.rdfvalues.protodict.AttributedDict', 'rdf_protodict.AttributedDict', ([], {}), '()\n', (1729, 1731), True, 'from grr_response_core.lib.rdfvalues import protodict as rdf_protodict\n'), ((2456, 2473), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (2471, 2473), False, 'impo... |
import matplotlib.pyplot as plt
import numpy as np
y = np.array([3, 22, 50, 351, 159,40 ])
sports = ['Biathlon', 'Bobsleigh', 'Curling','Ice hockey','Skating','Skiing']
plt.pie(y, labels = sports)
plt.xlabel("Canada")
plt.title("Which Sport had Most Medal", pad="20")
plt.show()
| [
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.pie",
"numpy.array",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((56, 91), 'numpy.array', 'np.array', (['[3, 22, 50, 351, 159, 40]'], {}), '([3, 22, 50, 351, 159, 40])\n', (64, 91), True, 'import numpy as np\n'), ((171, 196), 'matplotlib.pyplot.pie', 'plt.pie', (['y'], {'labels': 'sports'}), '(y, labels=sports)\n', (178, 196), True, 'import matplotlib.pyplot as plt\n'), ((199, 219... |
#!/usr/bin/env python
import vtk
def main():
graph = vtk.vtkMutableDirectedGraph()
v1 = graph.AddVertex()
v2 = graph.AddChild(v1)
graph.AddChild(v1)
graph.AddChild(v2)
# equivalent to:
# V1 = g.AddVertex()
# V2 = g.AddVertex()
# V3 = g.AddVertex()
# V4 = g.AddVertex()
#... | [
"vtk.vtkTree",
"vtk.vtkGraphLayoutView",
"vtk.vtkMutableDirectedGraph"
] | [((60, 89), 'vtk.vtkMutableDirectedGraph', 'vtk.vtkMutableDirectedGraph', ([], {}), '()\n', (87, 89), False, 'import vtk\n'), ((408, 421), 'vtk.vtkTree', 'vtk.vtkTree', ([], {}), '()\n', (419, 421), False, 'import vtk\n'), ((575, 599), 'vtk.vtkGraphLayoutView', 'vtk.vtkGraphLayoutView', ([], {}), '()\n', (597, 599), Fa... |
import tensorflow as tf
import sys
from models.model import TFModel
class TFLinearModel(TFModel):
def __init__(self, num_features, alpha=0.001, regularization=0.0):
# Inherit all self attributes
TFModel.__init__(self, num_features, alpha=alpha)
self.inputs['d'] = tf.placeholder(tf.float32, [None, 1])
... | [
"models.model.TFModel.__init__",
"tensorflow.placeholder",
"tensorflow.multiply",
"tensorflow.nn.l2_loss",
"tensorflow.maximum",
"tensorflow.reduce_mean",
"tensorflow.square"
] | [((209, 258), 'models.model.TFModel.__init__', 'TFModel.__init__', (['self', 'num_features'], {'alpha': 'alpha'}), '(self, num_features, alpha=alpha)\n', (225, 258), False, 'from models.model import TFModel\n'), ((282, 319), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, 1]'], {}), '(tf.float32, [N... |
import shlex
import aiohttp
import uvloop
import asyncio
import discord
import logging
import argparse
import commands
import datetime
from cmd_manager import dispatcher
from config import config, help_text
from cmd_manager.bot_args import parser, HelpException, UnkownCommandException
from handle_messages import privat... | [
"shlex.split",
"discord.Colour.green",
"uvloop.install",
"asyncio.set_event_loop",
"datetime.datetime.today",
"discord.Client",
"logging.info",
"config.config.MAIN.get",
"handle_messages.delete_user_message",
"commands.load_commands",
"commands.vote_command.remove_vote",
"asyncio.sleep",
"co... | [((621, 637), 'uvloop.install', 'uvloop.install', ([], {}), '()\n', (635, 637), False, 'import uvloop\n'), ((645, 668), 'uvloop.new_event_loop', 'uvloop.new_event_loop', ([], {}), '()\n', (666, 668), False, 'import uvloop\n'), ((669, 697), 'asyncio.set_event_loop', 'asyncio.set_event_loop', (['loop'], {}), '(loop)\n', ... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
"torch.distributions.Normal",
"torchdyn.models.LSDEFunc",
"torch.exp",
"math.log",
"torchsde.sdeint",
"torch.tensor",
"torch.distributions.kl_divergence",
"torch.zeros",
"torch.randn"
] | [((2830, 2880), 'torchdyn.models.LSDEFunc', 'LSDEFunc', ([], {'f': 'post_drift', 'g': 'diffusion', 'h': 'prior_drift'}), '(f=post_drift, g=diffusion, h=prior_drift)\n', (2838, 2880), False, 'from torchdyn.models import LSDEFunc\n'), ((3020, 3058), 'math.log', 'math.log', (['(sigma ** 2.0 / (2.0 * theta))'], {}), '(sigm... |
#!/usr/bin/env python
import sys
import os
import argparse
from lib.prioritize import gene_prioritization
from lib.output import write_list as write_list_tsv
from lib.json_format import write_list as write_list_json
from lib.weight_assignment import assign
from lib.calculation import calc, calc_simple
from lib.filter... | [
"argparse.ArgumentParser",
"lib.prioritize.gene_prioritization",
"lib.calculation.calc",
"os.path.isdir",
"os.mkdir",
"sys.exit",
"lib.calculation.calc_simple",
"lib.weight_assignment.assign"
] | [((491, 704), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Phen2Gene: Phenotype driven gene prioritization tool.\n Phen2Gene take input data (HPO, Human Phenotype Ontology), and output a prioritized suspected gene list."""'}), '(description=\n """Phen2Gene: Phenotype driven gene pr... |
import os
is_pyd = os.environ.get('PYD')
is_pynih = os.environ.get('PYNIH')
def test_array():
import pytest
from pyd import Foo, get, set, test
f = Foo(2)
# the bug only exists for pyd, not pynih
if is_pyd:
# FIXME - see #54
with pytest.raises(AttributeError):
assert ... | [
"pyd.Bizzy4",
"pyd.Bizzy2",
"pyd.def_a",
"pyd.Bizzy2.c",
"pyd.Base",
"pyd.Foo",
"pyd.Bizzy2.b",
"pyd.get",
"datetime.datetime",
"pyd.test",
"pyd.testdll_baz",
"pyd.testdll_throws",
"pyd.Bizzy3",
"pyd.testdll_bar",
"pyd.Bizzy.b",
"pyd.Bizzy2.d",
"pyd.call_poly",
"pyd.Bizzy5",
"pyd... | [((20, 41), 'os.environ.get', 'os.environ.get', (['"""PYD"""'], {}), "('PYD')\n", (34, 41), False, 'import os\n'), ((53, 76), 'os.environ.get', 'os.environ.get', (['"""PYNIH"""'], {}), "('PYNIH')\n", (67, 76), False, 'import os\n'), ((164, 170), 'pyd.Foo', 'Foo', (['(2)'], {}), '(2)\n', (167, 170), False, 'from pyd imp... |
# coding=utf-8
import struct
from collections import namedtuple
from base64 import b64decode
from Crypto.Hash import SHA256
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from Crypto.Util import asn1
__author__ = '<NAME> <<EMAIL>>'
ProofKeyDiscoveryData = namedtuple('ProofKeyDiscoveryData'... | [
"collections.namedtuple",
"base64.b64decode",
"struct.pack",
"Crypto.Signature.PKCS1_v1_5.new",
"Crypto.Util.asn1.DerSequence",
"Crypto.Hash.SHA256.new",
"Crypto.PublicKey.RSA.importKey"
] | [((286, 400), 'collections.namedtuple', 'namedtuple', (['"""ProofKeyDiscoveryData"""', "('value', 'modulus', 'exponent', 'oldvalue', 'oldmodulus', 'oldexponent')"], {}), "('ProofKeyDiscoveryData', ('value', 'modulus', 'exponent',\n 'oldvalue', 'oldmodulus', 'oldexponent'))\n", (296, 400), False, 'from collections im... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import geopandas as gpd
import json
import copy
cInfoFile = open("../src/static/resource/countries.json", 'r')
cInfo = json.load(cInfoFile)
cInfoFile.close()
cInfoIso2List = [i['countryInfo']['iso2'] for i in cInfo]
# cInfoIso2List.sort()
cShp = gpd.read_file("../src/st... | [
"json.load",
"geopandas.read_file",
"copy.deepcopy"
] | [((168, 188), 'json.load', 'json.load', (['cInfoFile'], {}), '(cInfoFile)\n', (177, 188), False, 'import json\n'), ((296, 370), 'geopandas.read_file', 'gpd.read_file', (['"""../src/static/resource/World_Countries__Generalized_.json"""'], {}), "('../src/static/resource/World_Countries__Generalized_.json')\n", (309, 370)... |
#coding:utf-8
#
# id: bugs.core_1402
# title: CREATE VIEW without column list when UNION is used
# decription:
# tracker_id: CORE-1402
# min_versions: ['2.5.0']
# versions: 2.5.0
# qmid: None
import pytest
from firebird.qa import db_factory, isql_act, Action
# version: 2.5.0
# resour... | [
"pytest.mark.version",
"firebird.qa.db_factory",
"firebird.qa.isql_act"
] | [((402, 463), 'firebird.qa.db_factory', 'db_factory', ([], {'page_size': '(4096)', 'sql_dialect': '(3)', 'init': 'init_script_1'}), '(page_size=4096, sql_dialect=3, init=init_script_1)\n', (412, 463), False, 'from firebird.qa import db_factory, isql_act, Action\n'), ((1788, 1850), 'firebird.qa.isql_act', 'isql_act', ([... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import io
import logging
import contextlib
import os
import datetime
import json
import numpy as np
import cv2
import math
import torch
from PIL import Image
from fvcore.common.timer import Timer
from detectron2.structures import BoxMode, Polygon... | [
"numpy.reshape",
"numpy.asarray",
"os.path.join",
"fvcore.common.file_io.PathManager.get_local_path",
"torch.sin",
"os.path.split",
"torch.tensor",
"torch.cos",
"json.load",
"io.StringIO",
"json.dump"
] | [((5757, 5795), 'os.path.join', 'os.path.join', (['data_path', '"""labels.json"""'], {}), "(data_path, 'labels.json')\n", (5769, 5795), False, 'import os\n'), ((5812, 5849), 'fvcore.common.file_io.PathManager.get_local_path', 'PathManager.get_local_path', (['json_file'], {}), '(json_file)\n', (5838, 5849), False, 'from... |
import os
import glob
import json
import time
import pickle
import shutil
import random
import warnings
import pandas as pd
import numpy as np
import matplotlib.pylab as plt
from multiprocessing import Process, cpu_count, Array
from omsdetector.mof import Helper
from omsdetector.mof import MofStructure
from omsdetecto... | [
"omsdetector.mof.Helper.get_checksum",
"multiprocessing.Process",
"multiprocessing.cpu_count",
"time.sleep",
"omsdetector.mof.Helper.copy_folder",
"matplotlib.pylab.show",
"sys.exit",
"numpy.histogram",
"matplotlib.pylab.figure",
"numpy.where",
"pandas.DataFrame.from_dict",
"glob.glob",
"oms... | [((2481, 2522), 'omsdetector.mof.Helper.make_folder', 'Helper.make_folder', (['self._analysis_folder'], {}), '(self._analysis_folder)\n', (2499, 2522), False, 'from omsdetector.mof import Helper\n'), ((2893, 2916), 'omsdetector.mof.Helper.make_folder', 'Helper.make_folder', (['orf'], {}), '(orf)\n', (2911, 2916), False... |
"""
Module varn calculates local densities of the 2D system and plots histogram
of these local densities.
Files are saved according to the active_particles.naming.varN standard.
Environment modes
-----------------
COMPUTE : bool
Compute local densities.
DEFAULT: False
CHECK : bool
Evaluate difference between the p... | [
"numpy.log10",
"numpy.sqrt",
"numpy.array",
"numpy.mean",
"numpy.max",
"numpy.linspace",
"mpl_toolkits.axes_grid1.make_axes_locatable",
"numpy.abs",
"matplotlib.rcParams.update",
"matplotlib.use",
"pickle.load",
"numpy.argmax",
"active_particles.init.get_env",
"active_particles.maths.Histo... | [((3929, 3973), 'active_particles.init.get_env', 'get_env', (['"""SHOW"""'], {'default': '(False)', 'vartype': 'bool'}), "('SHOW', default=False, vartype=bool)\n", (3936, 3973), False, 'from active_particles.init import get_env, slurm_output\n'), ((3977, 3991), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')... |
"""
Utility used by the Network class to actually train.
Based on:
https://github.com/fchollet/keras/blob/master/examples/mnist_mlp.py
"""
# import os
# os.environ["CUDA_VISIBLE_DEVICES"]="-1"
import gc
from keras import backend as k
from keras.datasets import mnist, cifar10
from keras.models import Sequential
... | [
"keras.datasets.cifar10.load_data",
"keras.datasets.mnist.load_data",
"tensorflow.Session",
"keras.models.Sequential",
"keras.utils.np_utils.to_categorical",
"keras.backend.clear_session",
"keras.callbacks.EarlyStopping",
"gc.collect",
"keras.layers.Dense",
"tensorflow.ConfigProto",
"keras.layer... | [((578, 594), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (592, 594), True, 'import tensorflow as tf\n'), ((876, 901), 'keras.callbacks.EarlyStopping', 'EarlyStopping', ([], {'patience': '(5)'}), '(patience=5)\n', (889, 901), False, 'from keras.callbacks import EarlyStopping\n'), ((770, 795), 'tensorf... |
# Copyright 2021 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | [
"complatecpp.QuickJsRendererBuilder"
] | [((733, 757), 'complatecpp.QuickJsRendererBuilder', 'QuickJsRendererBuilder', ([], {}), '()\n', (755, 757), False, 'from complatecpp import QuickJsRendererBuilder\n'), ((1105, 1129), 'complatecpp.QuickJsRendererBuilder', 'QuickJsRendererBuilder', ([], {}), '()\n', (1127, 1129), False, 'from complatecpp import QuickJsRe... |
import asyncio
# import numpy as np
# import importlib
# import pkgutil
import logging
import aiohttp
import voluptuous as vol
# from ledfx.events import Event
from ledfx.integrations import Integration
from ledfx.utils import async_fire_and_forget, resolve_destination
# import time
# import os
# import re
_LOGGER... | [
"logging.getLogger",
"ledfx.utils.resolve_destination",
"voluptuous.Required",
"voluptuous.Coerce",
"asyncio.sleep",
"voluptuous.Range"
] | [((323, 350), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (340, 350), False, 'import logging\n'), ((8073, 8120), 'ledfx.utils.resolve_destination', 'resolve_destination', (["self._config['ip_address']"], {}), "(self._config['ip_address'])\n", (8092, 8120), False, 'from ledfx.utils impo... |
# Copyright (c) 2021 PaddlePaddle 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 appli... | [
"numpy.load",
"numpy.ones",
"numpy.linalg.lstsq"
] | [((703, 749), 'numpy.load', 'np.load', (['"""Data/uv-data/canonical_vertices.npy"""'], {}), "('Data/uv-data/canonical_vertices.npy')\n", (710, 749), True, 'import numpy as np\n'), ((792, 823), 'numpy.ones', 'np.ones', (['[vertices.shape[0], 1]'], {}), '([vertices.shape[0], 1])\n', (799, 823), True, 'import numpy as np\... |