code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.optim
import math
from typing import TYPE_CHECKING, Any, Callable, Optional
if TYPE_CHECKING:
fro... | [
"torch.zeros_like",
"torch.tensor",
"torch.clone",
"math.pow"
] | [((3489, 3517), 'math.pow', 'math.pow', (['(k / (k + 1))', '(1 / 2)'], {}), '(k / (k + 1), 1 / 2)\n', (3497, 3517), False, 'import math\n'), ((3527, 3549), 'math.pow', 'math.pow', (['(k + 1)', '(1 / 3)'], {}), '(k + 1, 1 / 3)\n', (3535, 3549), False, 'import math\n'), ((3394, 3429), 'torch.tensor', 'torch.tensor', (['[... |
import os
path = os.getcwd()
from cu__grid_cell.data_gen import data_gen
from cu__grid_cell.preparation import preparation
import numpy as np
from cu__grid_cell.Validation.validation_utils import plot_image, grid_based_eval_with_iou, plot_image3d, nms, concatenate_cells
import matplotlib.pyplot as plt
import cv2
d... | [
"matplotlib.pyplot.show",
"numpy.ones_like",
"os.getcwd",
"cu__grid_cell.Validation.validation_utils.concatenate_cells",
"matplotlib.pyplot.figure",
"cu__grid_cell.data_gen.data_gen",
"numpy.array",
"numpy.exp",
"numpy.int32",
"numpy.matmul",
"cu__grid_cell.Validation.validation_utils.nms",
"c... | [((18, 29), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (27, 29), False, 'import os\n'), ((392, 417), 'cu__grid_cell.preparation.preparation', 'preparation', ([], {'testing': '(True)'}), '(testing=True)\n', (403, 417), False, 'from cu__grid_cell.preparation import preparation\n'), ((450, 551), 'cu__grid_cell.data_gen.d... |
import json
import falcon
from api.resources import BaseResource
from core.pedidos.exceptions import PedidoNotFoundException
from core.pedidos.gateway import PedidoGateway
class PedidosResource(BaseResource):
def on_get(self, req, resp, pedido_id=None):
pedido_gateway = PedidoGateway(self.db.session)
... | [
"core.pedidos.gateway.PedidoGateway",
"json.dumps",
"json.loads"
] | [((287, 317), 'core.pedidos.gateway.PedidoGateway', 'PedidoGateway', (['self.db.session'], {}), '(self.db.session)\n', (300, 317), False, 'from core.pedidos.gateway import PedidoGateway\n'), ((830, 849), 'json.dumps', 'json.dumps', (['content'], {}), '(content)\n', (840, 849), False, 'import json\n'), ((910, 940), 'cor... |
import time
import string
import json
import sys
import paho.mqtt.publish as publish
import paho.mqtt.client as mqtt
from workload_config import * # Read configuration
import utils # Utilities file in this dir (utils.py)
def post_networkdata_single_wiotp(jsonpayload, event_id, heart_beat=False)... | [
"utils.print_",
"sys.exc_info",
"paho.mqtt.publish.single"
] | [((868, 1057), 'paho.mqtt.publish.single', 'publish.single', ([], {'topic': 'mqtt_topic', 'payload': 'jsonpayload', 'qos': 'qos', 'hostname': 'mqtt_broker', 'protocol': 'mqtt.MQTTv311', 'client_id': 'mqtt_client_id', 'port': 'mqtt_port', 'tls': 'mqtt_tls', 'retain': 'retain'}), '(topic=mqtt_topic, payload=jsonpayload, ... |
# Generated by Django 3.1.6 on 2021-09-24 14:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0023_auto_20210924_1400'),
]
operations = [
migrations.RemoveField(
model_name='objectpermission',
name='pe... | [
"django.db.migrations.RemoveField",
"django.db.models.BooleanField"
] | [((233, 311), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""objectpermission"""', 'name': '"""permission_level"""'}), "(model_name='objectpermission', name='permission_level')\n", (255, 311), False, 'from django.db import migrations, models\n'), ((469, 502), 'django.db.models.Boo... |
######################################################################################################################
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... | [
"boto3.Session"
] | [((1702, 1740), 'boto3.Session', 'boto3.Session', ([], {'region_name': 'self.region'}), '(region_name=self.region)\n', (1715, 1740), False, 'import boto3\n'), ((1615, 1630), 'boto3.Session', 'boto3.Session', ([], {}), '()\n', (1628, 1630), False, 'import boto3\n')] |
from __future__ import print_function
import tensorflow
import tensorflow.keras as keras
from tensorflow.keras.datasets import mnist
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Flatten
from tensorflow.keras.layers import Conv2D, MaxPooling2D
from tensorflow.keras.c... | [
"tensorflow.keras.backend.image_data_format",
"tensorflow.keras.optimizers.Adadelta",
"tensorflow.keras.utils.to_categorical",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.MaxPooling2D",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.layers.Dense",
"tensorflow.config.experimental.s... | [((474, 533), 'tensorflow.config.experimental.list_physical_devices', 'tensorflow.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (526, 533), False, 'import tensorflow\n'), ((534, 604), 'tensorflow.config.experimental.set_memory_growth', 'tensorflow.config.experimental.set_memory_growth', ... |
"""Tests for managers of contributions (media files)."""
import os
import glob
from PIL import Image
from StringIO import StringIO
from django.core.files.base import ContentFile
from django.test import TestCase
from django.conf import settings
from nose.tools import raises
from geokey.core.exceptions import FileTy... | [
"PIL.Image.new",
"os.remove",
"geokey.contributions.tests.model_factories.ObservationFactory.create",
"geokey.core.tests.helpers.image_helpers.get_image",
"geokey.users.tests.model_factories.UserFactory.create",
"nose.tools.raises",
"os.path.join",
"StringIO.StringIO",
"geokey.contributions.models.M... | [((1489, 1510), 'nose.tools.raises', 'raises', (['FileTypeError'], {}), '(FileTypeError)\n', (1495, 1510), False, 'from nose.tools import raises\n'), ((940, 963), 'geokey.contributions.models.MediaFile.objects.all', 'MediaFile.objects.all', ([], {}), '()\n', (961, 963), False, 'from geokey.contributions.models import M... |
from Utilities import *
import math
from rlbot.agents.base_agent import BaseAgent, SimpleControllerState
from rlbot.utils.structures.game_data_struct import GameTickPacket
from rlbot.utils.game_state_util import GameState, BallState, CarState, Physics, Vector3, Rotator
import random
"""
Right corner loc: (-2048, -2560... | [
"rlbot.agents.base_agent.SimpleControllerState",
"math.atan2",
"math.sin",
"random.randrange",
"math.cos",
"rlbot.utils.game_state_util.Vector3",
"math.degrees",
"rlbot.utils.game_state_util.GameState"
] | [((1612, 1635), 'rlbot.agents.base_agent.SimpleControllerState', 'SimpleControllerState', ([], {}), '()\n', (1633, 1635), False, 'from rlbot.agents.base_agent import BaseAgent, SimpleControllerState\n'), ((6603, 6626), 'rlbot.agents.base_agent.SimpleControllerState', 'SimpleControllerState', ([], {}), '()\n', (6624, 66... |
import logging
import luigi
import luigi.contrib.s3
from . import hh, index
# Disable all child loggers
for name in ["botocore", "boto3", "elasticsearch"]:
logging.getLogger(name).propagate = False
class MainTask(luigi.Task):
# 113 - Россия, 1 - Москва, 83 - Смоленск
# areas_ids = luigi.ListParameter([... | [
"luigi.ListParameter",
"logging.getLogger"
] | [((342, 368), 'luigi.ListParameter', 'luigi.ListParameter', (['[113]'], {}), '([113])\n', (361, 368), False, 'import luigi\n'), ((163, 186), 'logging.getLogger', 'logging.getLogger', (['name'], {}), '(name)\n', (180, 186), False, 'import logging\n')] |
# Generated by Django 2.1.7 on 2020-08-13 22:00
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('server', '0011_auto_20200721_1516'),
]
operations = [
migrations.AddField(
model_name='namedent... | [
"django.db.models.ForeignKey"
] | [((392, 521), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""ner_history"""', 'to': '"""server.Annotation"""'}), "(null=True, on_delete=django.db.models.deletion.CASCADE,\n related_name='ner_history', to='server.Annota... |
from urllib.parse import urlparse
import warnings
from django.contrib.sitemaps import Sitemap, views
from django.contrib.sites.shortcuts import get_current_site
from django.urls import reverse
from django.core.paginator import EmptyPage, PageNotAnInteger
from django.http import Http404
from django.shortcuts import get... | [
"django.template.response.TemplateResponse",
"django.urls.reverse",
"django.shortcuts.get_object_or_404",
"coda_mdstore.models.Bag.objects.latest",
"django.http.Http404",
"django.contrib.sites.shortcuts.get_current_site",
"warnings.warn",
"urllib.parse.urlparse",
"coda_mdstore.models.Bag.objects.ord... | [((1371, 1396), 'django.contrib.sites.shortcuts.get_current_site', 'get_current_site', (['request'], {}), '(request)\n', (1387, 1396), False, 'from django.contrib.sites.shortcuts import get_current_site\n'), ((2041, 2192), 'django.template.response.TemplateResponse', 'TemplateResponse', (['request', 'template_name', "{... |
# This file is part of the NESi software.
#
# Copyright (c) 2020
# Original Software Design by <NAME> <https://github.com/etingof>.
#
# Software adapted by inexio <https://github.com/inexio>.
# - <NAME> <https://github.com/unkn0wn-user>
# - <NAME> <https://github.com/Connyko65>
# - <NAME> <https://github.com/Dinker1996... | [
"nesi.devices.softbox.base_resources.interface.base.Field",
"nesi.devices.softbox.base_resources.interface.logging.getLogger"
] | [((491, 518), 'nesi.devices.softbox.base_resources.interface.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (508, 518), False, 'from nesi.devices.softbox.base_resources.interface import Interface, InterfaceCollection, logging, base\n'), ((619, 640), 'nesi.devices.softbox.base_resources.int... |
import requests
from bs4 import BeautifulSoup
import html5lib as h5l
import json
import pandas as pd
import os
import time
r = requests.get("https://en.wikipedia.org/wiki/List_of_Indian_Premier_League_venues")
htmlContent = r.content
soup = BeautifulSoup(htmlContent, 'html.parser')
stadium_det = [['Stadium', 'Home T... | [
"bs4.BeautifulSoup",
"pandas.DataFrame",
"requests.get"
] | [((129, 216), 'requests.get', 'requests.get', (['"""https://en.wikipedia.org/wiki/List_of_Indian_Premier_League_venues"""'], {}), "(\n 'https://en.wikipedia.org/wiki/List_of_Indian_Premier_League_venues')\n", (141, 216), False, 'import requests\n'), ((243, 284), 'bs4.BeautifulSoup', 'BeautifulSoup', (['htmlContent',... |
import logging
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream
log = logging.getLogger(__name__)
class DRDK(Plugin):
live_api_url = 'https://www.dr-massive.com/api/page'
url_re = re.compile(r'''
https?://(?:www\.)?dr\... | [
"streamlink.plugin.api.validate.url",
"streamlink.plugin.api.validate.optional",
"streamlink.plugin.api.validate.get",
"streamlink.stream.HLSStream.parse_variant_playlist",
"logging.getLogger",
"re.compile"
] | [((153, 180), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (170, 180), False, 'import logging\n'), ((274, 385), 're.compile', 're.compile', (['"""\n https?://(?:www\\\\.)?dr\\\\.dk/drtv\n (/kanal/[\\\\w-]+)\n """', 're.VERBOSE'], {}), '(\n """\n https?://(?:ww... |
from collections.abc import Iterable
from itertools import repeat
def _ntuple(n):
def parse(x):
if isinstance(x, Iterable):
return x
return tuple(repeat(x, n))
return parse
_single = _ntuple(1)
| [
"itertools.repeat"
] | [((180, 192), 'itertools.repeat', 'repeat', (['x', 'n'], {}), '(x, n)\n', (186, 192), False, 'from itertools import repeat\n')] |
import vial
def init():
vial.register_command('VialEscape', '.plugin.escape')
vial.register_command('VialSearchOutline', '.plugin.search_outline')
vial.register_command('VialChangedProjects', '.plugin.changed_projects')
vial.register_command('VialNew', '.plugin.new', complete='file', nargs=1)
vial... | [
"vial.register_command",
"vial.register_function"
] | [((30, 83), 'vial.register_command', 'vial.register_command', (['"""VialEscape"""', '""".plugin.escape"""'], {}), "('VialEscape', '.plugin.escape')\n", (51, 83), False, 'import vial\n'), ((88, 156), 'vial.register_command', 'vial.register_command', (['"""VialSearchOutline"""', '""".plugin.search_outline"""'], {}), "('V... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018 Tigera, 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 re... | [
"datetime.timedelta",
"datetime.datetime.now"
] | [((651, 672), 'datetime.timedelta', 'datetime.timedelta', (['(0)'], {}), '(0)\n', (669, 672), False, 'import datetime\n'), ((894, 920), 'datetime.datetime.now', 'datetime.datetime.now', (['utc'], {}), '(utc)\n', (915, 920), False, 'import datetime\n')] |
import torch
import argparse
import sys
import os
import torchvision
import torchvision.transforms as transforms
from fedlab.core.client.scale.trainer import SubsetSerialTrainer
from fedlab.core.client.scale.manager import ScaleClientPassiveManager
from fedlab.core.network import DistNetwork
from fedlab.utils.logger... | [
"sys.path.append",
"argparse.ArgumentParser",
"fedlab.core.client.scale.trainer.SubsetSerialTrainer",
"fedlab.core.client.scale.manager.ScaleClientPassiveManager",
"fedlab.utils.functional.load_dict",
"models.cnn.CNN_MNIST",
"fedlab.core.network.DistNetwork",
"torchvision.transforms.ToTensor"
] | [((430, 458), 'sys.path.append', 'sys.path.append', (['"""../../../"""'], {}), "('../../../')\n", (445, 458), False, 'import sys\n'), ((534, 600), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Distbelief training example"""'}), "(description='Distbelief training example')\n", (557, 600)... |
import argparse
import torch
from pathlib import Path
import h5py
import logging
from tqdm import tqdm
import pprint
import numpy as np
from . import matchers
from .utils.base_model import dynamic_load
from .utils.parsers import names_to_pair
'''
A set of standard configurations that can be directly selected from th... | [
"numpy.stack",
"tqdm.tqdm",
"pprint.pformat",
"numpy.count_nonzero",
"argparse.ArgumentParser",
"torch.topk",
"logging.warning",
"logging.info",
"torch.einsum",
"pathlib.Path",
"torch.cuda.is_available",
"torch.no_grad",
"torch.from_numpy"
] | [((1171, 1186), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1184, 1186), False, 'import torch\n'), ((2879, 2894), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2892, 2894), False, 'import torch\n'), ((7473, 7488), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (7486, 7488), False, 'import torch\n')... |
import datetime
import decimal
def test_sanity():
from kvfile import KVFile
kv = KVFile()
data = dict(
s='value',
i=123,
d=datetime.datetime.fromtimestamp(12325),
n=decimal.Decimal('1234.56'),
ss=set(range(10)),
o=dict(d=decimal.Decimal('1234.58'), n=dat... | [
"decimal.Decimal",
"kvfile.KVFile",
"datetime.datetime.fromtimestamp"
] | [((91, 99), 'kvfile.KVFile', 'KVFile', ([], {}), '()\n', (97, 99), False, 'from kvfile import KVFile\n'), ((164, 202), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimestamp', (['(12325)'], {}), '(12325)\n', (195, 202), False, 'import datetime\n'), ((215, 241), 'decimal.Decimal', 'decimal.Decimal', (['"""1... |
from unittest import TestCase
from i18n import translate, LangText
langs = {
"lang1": "asd.text=aaa",
"lang2": "asd.text=bbb"
}
class TestLangText(LangText):
def load(self, langname):
super(TestLangText, self)._loadText(langs[langname])
@translate(TestLangText)
class TestTranslation:
def __... | [
"i18n.translate"
] | [((263, 286), 'i18n.translate', 'translate', (['TestLangText'], {}), '(TestLangText)\n', (272, 286), False, 'from i18n import translate, LangText\n')] |
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distributed in the hope that ... | [
"os.path.isdir",
"os.path.exists"
] | [((1622, 1651), 'os.path.isdir', 'os.path.isdir', (['"""/.SUNWnative"""'], {}), "('/.SUNWnative')\n", (1635, 1651), False, 'import os\n'), ((2729, 2755), 'os.path.exists', 'os.path.exists', (['"""/proc/vz"""'], {}), "('/proc/vz')\n", (2743, 2755), False, 'import os\n')] |
from django import forms
from app.models import Post, Comment, Profile
from django.contrib.auth.models import User
class CommentForm(forms.ModelForm):
class Meta:
model = Comment
fields = ('name','email','comment_body' )
class RegisterForm(forms.ModelForm):
... | [
"django.forms.EmailField",
"django.forms.TextInput",
"django.forms.PasswordInput",
"django.contrib.auth.models.User.objects.filter",
"django.forms.ValidationError",
"django.forms.CharField"
] | [((334, 381), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(100)', 'label': '"""<NAME>"""'}), "(max_length=100, label='<NAME>')\n", (349, 381), False, 'from django import forms\n'), ((399, 451), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(100)', 'label': '"""الاسم الاول"""'})... |
import traceback
from email.parser import Parser
import sentry_sdk
from aiosmtpd.controller import Controller
from aiosmtpd.lmtp import LMTP
from aiosmtpd.smtp import Envelope
from . import make_logger
class CustomLMTP(LMTP):
"""
A relatively simple wrapper around the LMTP/SMTP classes that implements some ... | [
"email.parser.Parser",
"sentry_sdk.capture_exception",
"traceback.print_exc"
] | [((2175, 2183), 'email.parser.Parser', 'Parser', ([], {}), '()\n', (2181, 2183), False, 'from email.parser import Parser\n'), ((3155, 3176), 'traceback.print_exc', 'traceback.print_exc', ([], {}), '()\n', (3174, 3176), False, 'import traceback\n'), ((3261, 3291), 'sentry_sdk.capture_exception', 'sentry_sdk.capture_exce... |
import unittest
from src.dataset.reader.csv_reader import CSVDatasetReader
from src.dataset.reader.dataset_reader_errors import InvalidFileContentError
class CSVReaderTest(unittest.TestCase):
def test_empty_path(self):
try:
reader = CSVDatasetReader()
_ = reader.read('')
... | [
"src.dataset.reader.csv_reader.CSVDatasetReader"
] | [((260, 278), 'src.dataset.reader.csv_reader.CSVDatasetReader', 'CSVDatasetReader', ([], {}), '()\n', (276, 278), False, 'from src.dataset.reader.csv_reader import CSVDatasetReader\n'), ((482, 500), 'src.dataset.reader.csv_reader.CSVDatasetReader', 'CSVDatasetReader', ([], {}), '()\n', (498, 500), False, 'from src.data... |
# -*- coding: utf-8 -*-
# ==============================================================================
# MIT License
#
# Copyright (c) 2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the S... | [
"ecdsa.SigningKey.from_pem",
"ecdsa.SigningKey.generate",
"ecdsa.VerifyingKey.from_string",
"ecdsa.SigningKey.from_string",
"ecdsa.VerifyingKey.from_pem"
] | [((1764, 1853), 'ecdsa.VerifyingKey.from_string', 'ecdsa.VerifyingKey.from_string', (['data'], {'curve': 'ecdsa.SECP256k1', 'hashfunc': 'hashlib.sha256'}), '(data, curve=ecdsa.SECP256k1, hashfunc=\n hashlib.sha256)\n', (1794, 1853), False, 'import ecdsa\n'), ((1881, 1939), 'ecdsa.VerifyingKey.from_pem', 'ecdsa.Verif... |
# -*- coding: utf-8 -*-
"""Preview
Code for 'Inf-Net: Automatic COVID-19 Lung Infection Segmentation from CT Scans'
submit to Transactions on Medical Imaging, 2020.
First Version: Created on 2020-05-13 (@author: <NAME>)
"""
# ---- base lib -----
import os
import argparse
from datetime import datetime
import cv2
impo... | [
"argparse.ArgumentParser",
"random.shuffle",
"scipy.misc.imsave",
"os.path.join",
"Code.utils.utils.AvgMeter",
"Code.model_lung_infection.InfNet_Res2Net.Inf_Net",
"torch.nn.functional.avg_pool2d",
"torch.load",
"os.path.exists",
"torch.nn.functional.binary_cross_entropy_with_logits",
"Code.utils... | [((984, 1045), 'torch.nn.functional.binary_cross_entropy_with_logits', 'F.binary_cross_entropy_with_logits', (['pred', 'mask'], {'reduce': '"""none"""'}), "(pred, mask, reduce='none')\n", (1018, 1045), True, 'import torch.nn.functional as F\n'), ((1120, 1139), 'torch.sigmoid', 'torch.sigmoid', (['pred'], {}), '(pred)\n... |
# Copyright (C) 2020-2021 by <EMAIL>, < https://github.com/DevsExpo >.
#
# This file is part of < https://github.com/DevsExpo/FridayUserBot > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/DevsExpo/blob/master/LICENSE >
#
# All rights reserved.
from pyrogram impor... | [
"innexiaBot.pyrogramee.pluginshelper.get_text",
"pyrogram.filters.command"
] | [((610, 627), 'innexiaBot.pyrogramee.pluginshelper.get_text', 'get_text', (['message'], {}), '(message)\n', (618, 627), False, 'from innexiaBot.pyrogramee.pluginshelper import admins_only, get_text\n'), ((448, 473), 'pyrogram.filters.command', 'filters.command', (['"""tagall"""'], {}), "('tagall')\n", (463, 473), False... |
from modules.trainer.configs import TrainingConfigs
from modules.trainer.train_model import train_model
from tsne import tsne_visualizer
import matplotlib.pyplot as plt
from sys import argv
def create_training_cfg() -> TrainingConfigs:
conf = TrainingConfigs()
# conf.data_sets = ['20ng', 'R8', 'R52', 'ohsume... | [
"modules.trainer.configs.TrainingConfigs",
"tsne.tsne_visualizer",
"modules.trainer.train_model.train_model",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.savefig"
] | [((250, 267), 'modules.trainer.configs.TrainingConfigs', 'TrainingConfigs', ([], {}), '()\n', (265, 267), False, 'from modules.trainer.configs import TrainingConfigs\n'), ((1094, 1156), 'modules.trainer.train_model.train_model', 'train_model', ([], {'ds_name': 'ds', 'is_featureless': '(True)', 'cfg': 'training_cfg'}), ... |
import sys, json, traceback, datetime, glob, xlrd
from xlrd import open_workbook, cellname, xldate_as_tuple, error_text_from_code
def dump_record(record_type, values):
print(json.dumps([record_type, values]));
def parse_cell_value(sheet, cell):
if cell.ctype == xlrd.XL_CELL_DATE:
year, month, day, hour, minut... | [
"optparse.OptionParser",
"xlrd.open_workbook",
"json.dumps",
"xlrd.cellname",
"traceback.format_exc",
"xlrd.xldate_as_tuple",
"sys.exit"
] | [((1223, 1251), 'optparse.OptionParser', 'optparse.OptionParser', (['usage'], {}), '(usage)\n', (1244, 1251), False, 'import optparse\n'), ((3478, 3488), 'sys.exit', 'sys.exit', ([], {}), '()\n', (3486, 3488), False, 'import sys, json, traceback, datetime, glob, xlrd\n'), ((177, 210), 'json.dumps', 'json.dumps', (['[re... |
"""
Add user profile columns
Revision ID: 6f86796f64e0
Revises: <KEY>
Create Date: 2016-07-06 11:28:50.075057
"""
from __future__ import unicode_literals
from alembic import op
import sqlalchemy as sa
revision = '6f86796f64e0'
down_revision = '<KEY>'
def upgrade():
op.add_column('user', sa.Column('display_na... | [
"alembic.op.drop_column",
"sqlalchemy.UnicodeText"
] | [((630, 668), 'alembic.op.drop_column', 'op.drop_column', (['"""user"""', '"""display_name"""'], {}), "('user', 'display_name')\n", (644, 668), False, 'from alembic import op\n'), ((673, 710), 'alembic.op.drop_column', 'op.drop_column', (['"""user"""', '"""description"""'], {}), "('user', 'description')\n", (687, 710),... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2016 Red Hat, Inc.
#
# Authors:
# <NAME> <<EMAIL>>
#
# 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 2 of the License, or
# (at your... | [
"firewall.core.rich.Rich_Rule",
"firewall.errors.FirewallError",
"dbus.SystemBus",
"traceback.format_exc",
"dbus.Interface",
"dbus.mainloop.glib.DBusGMainLoop",
"gi.repository.GLib.timeout_add_seconds",
"firewall.dbus_utils.dbus_to_python"
] | [((13557, 13646), 'dbus.Interface', 'dbus.Interface', (['self.dbus_obj'], {'dbus_interface': 'config.dbus.DBUS_INTERFACE_CONFIG_ZONE'}), '(self.dbus_obj, dbus_interface=config.dbus.\n DBUS_INTERFACE_CONFIG_ZONE)\n', (13571, 13646), False, 'import dbus\n'), ((13696, 13775), 'dbus.Interface', 'dbus.Interface', (['self... |
import LMRt
import os
import numpy as np
import pandas as pd
import xarray as xr
# preprocessing
print("\n======== Preprocessing ========\n")
config = 'configs.yml'
recon_iterations = 1
figure = 'graph'
job = LMRt.ReconJob()
job.load_configs(config, verbose=True)
job.load_proxydb(verbose=True)
job.filter_proxydb(ve... | [
"scipy.io.loadmat",
"LMRt.ReconJob",
"numpy.zeros",
"numpy.mean",
"numpy.arange",
"LMRt.ReconRes",
"os.path.join"
] | [((213, 228), 'LMRt.ReconJob', 'LMRt.ReconJob', ([], {}), '()\n', (226, 228), False, 'import LMRt\n'), ((494, 545), 'os.path.join', 'os.path.join', (['job_dirpath', '"""seasonalized_prior.pkl"""'], {}), "(job_dirpath, 'seasonalized_prior.pkl')\n", (506, 545), False, 'import os\n'), ((570, 619), 'os.path.join', 'os.path... |
"""
Units models
"""
import logging
from datetime import date
import pint.systems
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext as _
from geocurrency.converters.models import BaseConverter, ConverterResult, \
... | [
"logging.error",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"logging.warning",
"django.db.models.SlugField",
"geocurrency.converters.models.ConverterResultDetail",
"geocurrency.converters.models.ConverterResult",
"django.utils.translation.ugettext"
] | [((26040, 26111), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'related_name': '"""units"""', 'on_delete': 'models.PROTECT'}), "(User, related_name='units', on_delete=models.PROTECT)\n", (26057, 26111), False, 'from django.db import models\n'), ((26147, 26279), 'django.db.models.CharField', 'models.C... |
"""Test environment wrapper."""
import gym
class AutoStopEnv(gym.Wrapper):
"""Environment wrapper that stops episode at step max_episode_length."""
def __init__(self, env=None, env_name='', max_episode_length=100):
"""Create an AutoStepEnv.
Args:
env (gym.Env): Environment to be... | [
"gym.make"
] | [((514, 532), 'gym.make', 'gym.make', (['env_name'], {}), '(env_name)\n', (522, 532), False, 'import gym\n')] |
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
from string import digits
import csv
# Create a SentimentIntensityAnalyzer object
file1 = open("DATASET\\LibriSpeech\\dev-clean\\84\\121123\\84-121123.trans.txt", 'r')
Lines = file1.readlines()
with open('vader_84_121123.csv', 'w', newline='') as ... | [
"vaderSentiment.vaderSentiment.SentimentIntensityAnalyzer",
"csv.writer"
] | [((339, 355), 'csv.writer', 'csv.writer', (['file'], {}), '(file)\n', (349, 355), False, 'import csv\n'), ((537, 565), 'vaderSentiment.vaderSentiment.SentimentIntensityAnalyzer', 'SentimentIntensityAnalyzer', ([], {}), '()\n', (563, 565), False, 'from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer\n')] |
from pathlib import Path
from fhir.resources.valueset import ValueSet as _ValueSet
from oops_fhir.utils import ValueSet
from oops_fhir.r4.code_system.list_mode import ListMode as ListMode_
__all__ = ["ListMode"]
_resource = _ValueSet.parse_file(Path(__file__).with_suffix(".json"))
class ListMode(ListMode_):
... | [
"pathlib.Path"
] | [((252, 266), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (256, 266), False, 'from pathlib import Path\n')] |
from django.core.management.base import BaseCommand
from wq.db.patterns.identify.models import Authority
class Command(BaseCommand):
def handle(self, *args, **options):
Authority.objects.get_or_create(
name="This Site",
)
Authority.objects.get_or_create(
name="Wikip... | [
"wq.db.patterns.identify.models.Authority.objects.get_or_create"
] | [((183, 232), 'wq.db.patterns.identify.models.Authority.objects.get_or_create', 'Authority.objects.get_or_create', ([], {'name': '"""This Site"""'}), "(name='This Site')\n", (214, 232), False, 'from wq.db.patterns.identify.models import Authority\n'), ((264, 396), 'wq.db.patterns.identify.models.Authority.objects.get_o... |
import math
class Solution:
def checkPerfectNumber(self, num: int) -> bool:
res = 0
high = int(math.sqrt(num))
for i in range(high, 0,-1):
if num%i==0:
res+=i
res+= num//i if i != 1 else 0
res = res - high if high*high == num else res
... | [
"math.sqrt"
] | [((115, 129), 'math.sqrt', 'math.sqrt', (['num'], {}), '(num)\n', (124, 129), False, 'import math\n')] |
#
# Copyright 2004,2005 <NAME> <<EMAIL>>
#
# This file forms part of Infotrope Polymer
#
# Infotrope Polymer 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 2 of the License, or
# (at your optio... | [
"wx.ListCtrl",
"wx.SystemSettings.GetFont",
"time.time",
"wx.StaticText",
"socket.gethostname",
"wx.ListItem",
"wx.GetApp"
] | [((3817, 3855), 'wx.ListCtrl', 'wx.ListCtrl', (['p', '(-1)'], {'style': 'wx.LC_REPORT'}), '(p, -1, style=wx.LC_REPORT)\n', (3828, 3855), False, 'import wx\n'), ((5095, 5119), 'wx.StaticText', 'wx.StaticText', (['p', '(-1)', '""""""'], {}), "(p, -1, '')\n", (5108, 5119), False, 'import wx\n'), ((4042, 4055), 'wx.ListIte... |
from random import random
class Treap:
def __init__(self, key, value = 0):
self.key = key
self.value = value
self.priority = random()
self.size = 1
self.height = 1
self.lazy = 0
self.max_value = value
self.min_value = value
self.left = None
self.right = None
... | [
"random.random"
] | [((146, 154), 'random.random', 'random', ([], {}), '()\n', (152, 154), False, 'from random import random\n')] |
from threading import Thread
import socket
import time
import json
offline = False
class Client(Thread):
address = ('localhost', 8957)
buffer_size = 8000
delimiter = b'\r\n'
def __init__(self):
super().__init__()
self.sock = None
self.make_socket()
self.handlers = ... | [
"json.dumps",
"json.loads",
"socket.create_connection",
"time.sleep"
] | [((706, 719), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (716, 719), False, 'import time\n'), ((1921, 1940), 'json.loads', 'json.loads', (['message'], {}), '(message)\n', (1931, 1940), False, 'import json\n'), ((471, 509), 'socket.create_connection', 'socket.create_connection', (['self.address'], {}), '(self.a... |
import string
import pprint
import types
import sys
import os
# strangely enough, the following code is necessary to find modules in the parent-directory
# (despite what is said in http://www.python.org/doc/current/tut/node8.html)
# it adds the parent directory to the sys.path variable that determines w... | [
"shared.fileIndexer.fileIndexer",
"shared.XMLConfig.getVariables",
"string.atoi",
"string.lower",
"os.popen3",
"os.path.dirname",
"shared.XMLConfig.parse",
"pprint.pprint",
"shared.XMLConfig.getEntries"
] | [((2448, 2489), 'shared.XMLConfig.getVariables', 'XMLConfig.getVariables', (['scriptConfigEntry'], {}), '(scriptConfigEntry)\n', (2470, 2489), False, 'from shared import XMLConfig\n'), ((5045, 5084), 'shared.XMLConfig.getEntries', 'XMLConfig.getEntries', (['"""dynamic"""', 'config'], {}), "('dynamic', config)\n", (5065... |
import json
import numpy as np
import cv2
from numpy.core.records import array
import cv2.aruco as aruco
import socket
from urllib.request import urlopen
from get_img import get_img as gi
ADDRESS = ('', 10000)
central = None
conn_pool = []
central = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
central.setsockopt... | [
"cv2.GaussianBlur",
"cv2.aruco.drawDetectedMarkers",
"numpy.arctan2",
"socket.socket",
"cv2.aruco.detectMarkers",
"numpy.linalg.norm",
"cv2.imshow",
"json.loads",
"cv2.cvtColor",
"cv2.aruco.drawAxis",
"numpy.arccos",
"cv2.destroyAllWindows",
"cv2.aruco.estimatePoseSingleMarkers",
"cv2.wait... | [((252, 301), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (265, 301), False, 'import socket\n'), ((570, 594), 'numpy.array', 'np.array', (['[35, 110, 106]'], {}), '([35, 110, 106])\n', (578, 594), True, 'import numpy as np\n'), ((609, 633),... |
import numpy as np
import sys
sys.path.append("./original_data");
from dataset.mnist import load_mnist
from PIL import Image
import pickle
#This line loads training images, training labels (in or not in one-hot representation), testing images and testing labels (in or not in one-hot representation).
(x_train, t_tra... | [
"sys.path.append",
"dataset.mnist.load_mnist"
] | [((31, 65), 'sys.path.append', 'sys.path.append', (['"""./original_data"""'], {}), "('./original_data')\n", (46, 65), False, 'import sys\n'), ((344, 385), 'dataset.mnist.load_mnist', 'load_mnist', ([], {'flatten': '(True)', 'normalize': '(False)'}), '(flatten=True, normalize=False)\n', (354, 385), False, 'from dataset.... |
import base64
from ..Helpers import get_xml_as_string
from ..Object import Data
class Document(object):
def __init__(self, client):
self.client = client
def add(self, file_path, folder_id, author_first_name, author_last_name, title):
"""
Submit a new document to your iThenticate acco... | [
"base64.b64encode"
] | [((924, 951), 'base64.b64encode', 'base64.b64encode', (['file_path'], {}), '(file_path)\n', (940, 951), False, 'import base64\n')] |
import csv
import json
import os
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
"""
pre-requisite:
sql:
drop table hijri_calendar_data_file CASCADE;
drop table hijri_calendar CASCADE;
drop table holiday CASCADE;
or
tru... | [
"os.path.abspath",
"csv.reader",
"json.loads",
"os.path.exists",
"json.dumps",
"django.core.management.base.CommandError",
"os.path.join"
] | [((1397, 1430), 'os.path.join', 'os.path.join', (['BASE_DIR', 'file_path'], {}), '(BASE_DIR, file_path)\n', (1409, 1430), False, 'import os\n'), ((3378, 3396), 'json.loads', 'json.loads', (['result'], {}), '(result)\n', (3388, 3396), False, 'import json\n'), ((3417, 3442), 'json.dumps', 'json.dumps', (['res'], {'indent... |
import sys
import shutil
import os
import time
from image_quality.handlers.model_builder import Nima
from image_quality.evaluater.predict import fetch_model,score_media
fetch_model() # ensure model weights are local in image quality path
image_quality_path = '/tmp/image_quality/'
image_ranking_model_name ... | [
"image_quality.evaluater.predict.fetch_model",
"image_quality.handlers.model_builder.Nima",
"image_quality.evaluater.predict.score_media",
"time.time",
"os.path.join"
] | [((170, 183), 'image_quality.evaluater.predict.fetch_model', 'fetch_model', ([], {}), '()\n', (181, 183), False, 'from image_quality.evaluater.predict import fetch_model, score_media\n'), ((366, 460), 'os.path.join', 'os.path.join', (['image_quality_path', '"""models/MobileNet/weights_mobilenet_technical_0.11.hdf5"""']... |
import torch
from torch.nn import Module
from geomloss import SamplesLoss
class SinkhornLoss(Module):
def __init__(self, blur=0.3, scaling=.8):
super(SinkhornLoss, self).__init__()
self.loss = SamplesLoss("sinkhorn", blur=blur, scaling=scaling)
def forward(self, *args):
x... | [
"geomloss.SamplesLoss",
"torch.flatten"
] | [((220, 271), 'geomloss.SamplesLoss', 'SamplesLoss', (['"""sinkhorn"""'], {'blur': 'blur', 'scaling': 'scaling'}), "('sinkhorn', blur=blur, scaling=scaling)\n", (231, 271), False, 'from geomloss import SamplesLoss\n'), ((345, 385), 'torch.flatten', 'torch.flatten', (['x'], {'start_dim': '(2)', 'end_dim': '(3)'}), '(x, ... |
import requests
example = {
"userid": 1,
"timestamp": "2020-04-04T12:17:00",
"feels_sick": False,
"location_trace": [
{
"start_time": "2020-04-03T00:00:00",
"end_time": "2020-04-03T04:00:00",
"geographic_location": {
"lat": 37.8123177,
... | [
"requests.post"
] | [((625, 681), 'requests.post', 'requests.post', (['"""http://localhost:5000/add"""'], {'json': 'example'}), "('http://localhost:5000/add', json=example)\n", (638, 681), False, 'import requests\n')] |
import hassapi as hass
import datetime
import re
"""
Class Notification_Manager handles sending text to notfyng service
"""
__NOTIFY__ = "notify/"
SUB_NOTIFICHE = [(" +", " "), ("\s\s+", "\n")]
class Notification_Manager(hass.Hass):
def initialize(self):
self.text_last_message = self.args["tex... | [
"datetime.datetime.now"
] | [((1141, 1164), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1162, 1164), False, 'import datetime\n'), ((3345, 3368), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (3366, 3368), False, 'import datetime\n')] |
#!/usr/bin/env python3
"""
Testing the routing graph generator
"""
import pytrellis
import sys
pytrellis.load_database("../../database")
chip = pytrellis.Chip("LFE5U-45F")
rg = chip.get_routing_graph()
tile = rg.tiles[pytrellis.Location(9, 71)]
for wire in tile.wires:
print("Wire {}:".format(rg.to_str(wire.key()))... | [
"pytrellis.load_database",
"pytrellis.Chip",
"pytrellis.Location"
] | [((96, 137), 'pytrellis.load_database', 'pytrellis.load_database', (['"""../../database"""'], {}), "('../../database')\n", (119, 137), False, 'import pytrellis\n'), ((145, 172), 'pytrellis.Chip', 'pytrellis.Chip', (['"""LFE5U-45F"""'], {}), "('LFE5U-45F')\n", (159, 172), False, 'import pytrellis\n'), ((219, 244), 'pytr... |
import numpy as np
from .VariableUnitTest import VariableUnitTest
from gwlfe.Input.WaterBudget import Percolation
class TestPercolation(VariableUnitTest):
def test_Percolation_ground_truth(self):
z = self.z
np.testing.assert_array_almost_equal(
np.load(self.basepath + "/Percolation.n... | [
"gwlfe.Input.WaterBudget.Percolation.Percolation_f",
"numpy.load",
"gwlfe.Input.WaterBudget.Percolation.Percolation"
] | [((281, 324), 'numpy.load', 'np.load', (["(self.basepath + '/Percolation.npy')"], {}), "(self.basepath + '/Percolation.npy')\n", (288, 324), True, 'import numpy as np\n'), ((338, 579), 'gwlfe.Input.WaterBudget.Percolation.Percolation', 'Percolation.Percolation', (['z.NYrs', 'z.DaysMonth', 'z.Temp', 'z.InitSnow_0', 'z.P... |
"""add user client type
Revision ID: cbbf822c6b4f
Revises: <KEY>
Create Date: 2021-06-21 18:23:43.202954
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'cbbf822c6b4f'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
def upgrade():
# ### com... | [
"alembic.op.drop_column",
"sqlalchemy.Integer"
] | [((579, 616), 'alembic.op.drop_column', 'op.drop_column', (['"""user"""', '"""client_type"""'], {}), "('user', 'client_type')\n", (593, 616), False, 'from alembic import op\n'), ((424, 436), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (434, 436), True, 'import sqlalchemy as sa\n')] |
import graphene
from app.schemas.console import ConsoleOutput
from .mutations import CreateConsole, DeleteConsole, UpdateConsole
from .resolvers import resolve_console
class ConsoleQuery(graphene.ObjectType):
"""Queries to get all console information."""
# consoles = graphene.List(graphene.relay.Node.Field... | [
"graphene.List"
] | [((417, 445), 'graphene.List', 'graphene.List', (['ConsoleOutput'], {}), '(ConsoleOutput)\n', (430, 445), False, 'import graphene\n')] |
from random import choice
class RandomList(list):
def get_random_element(self):
element = choice(self)
self.remove(element)
return element
# previous course and doesn't work
# def get_random_element(self):
# element_index = randint(0, len(self) - 1)
# element = se... | [
"unittest.main",
"random.choice",
"unittest.mock.patch"
] | [((833, 848), 'unittest.main', 'unittest.main', ([], {}), '()\n', (846, 848), False, 'import unittest\n'), ((105, 117), 'random.choice', 'choice', (['self'], {}), '(self)\n', (111, 117), False, 'from random import choice\n'), ((595, 637), 'unittest.mock.patch', 'mock.patch', (['"""random.choice"""', 'mocked_choice'], {... |
"""
Solution-based probabilistic linear solvers.
Implementations of solution-based linear solvers which perform inference on the solution
of a linear system given linear observations.
"""
import warnings
import numpy as np
from probnum.linalg.linearsolvers.matrixbased import ProbabilisticLinearSolver
class Solutio... | [
"warnings.warn",
"numpy.linalg.norm"
] | [((2132, 2224), 'warnings.warn', 'warnings.warn', (['"""Iteration terminated. Solver reached the maximum number of iterations."""'], {}), "(\n 'Iteration terminated. Solver reached the maximum number of iterations.')\n", (2145, 2224), False, 'import warnings\n'), ((2339, 2360), 'numpy.linalg.norm', 'np.linalg.norm',... |
#!/usr/bin/env python
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (t... | [
"io.BytesIO",
"pytest.raises"
] | [((1709, 1770), 'pytest.raises', 'pytest.raises', (['d1_common.types.exceptions.IdentifierNotUnique'], {}), '(d1_common.types.exceptions.IdentifierNotUnique)\n', (1722, 1770), False, 'import pytest\n'), ((2173, 2234), 'pytest.raises', 'pytest.raises', (['d1_common.types.exceptions.IdentifierNotUnique'], {}), '(d1_commo... |
import yaml
from yaml import Loader
from depth2mesh import data
from depth2mesh import metaavatar
method_dict = {
'metaavatar': metaavatar,
}
# General config
def load_config(path, default_path=None):
''' Loads config file.
Args:
path (str): path to config file
default_path (bool): wheth... | [
"yaml.load",
"depth2mesh.data.CAPECorrDataset"
] | [((446, 466), 'yaml.load', 'yaml.load', (['f', 'Loader'], {}), '(f, Loader)\n', (455, 466), False, 'import yaml\n'), ((4371, 4825), 'depth2mesh.data.CAPECorrDataset', 'data.CAPECorrDataset', (['dataset_folder'], {'subjects': 'split', 'mode': 'mode', 'use_aug': 'use_aug', 'input_pointcloud_n': 'input_pointcloud_n', 'sin... |
import torch
from weakvtg.loss import loss_orthogonal
def test_loss_orthogonal():
X = torch.tensor([1, -1, 1, -1, 0, 0, .236, -.751], dtype=torch.float),
y = torch.tensor([1, -1, -1, 1, -1, 1, -1, 1], dtype=torch.float)
assert torch.equal(
loss_orthogonal(X, y),
-1 * torch.tenso... | [
"weakvtg.loss.loss_orthogonal",
"torch.tensor"
] | [((171, 232), 'torch.tensor', 'torch.tensor', (['[1, -1, -1, 1, -1, 1, -1, 1]'], {'dtype': 'torch.float'}), '([1, -1, -1, 1, -1, 1, -1, 1], dtype=torch.float)\n', (183, 232), False, 'import torch\n'), ((93, 161), 'torch.tensor', 'torch.tensor', (['[1, -1, 1, -1, 0, 0, 0.236, -0.751]'], {'dtype': 'torch.float'}), '([1, ... |
"""
Django settings for collaborative project.
Generated by 'django-admin startproject' using Django 2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os... | [
"os.path.abspath",
"os.path.join",
"os.getenv",
"dj_database_url.config"
] | [((505, 540), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""templates"""'], {}), "(BASE_DIR, 'templates')\n", (517, 540), False, 'import os\n'), ((555, 591), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""www/assets"""'], {}), "(BASE_DIR, 'www/assets')\n", (567, 591), False, 'import os\n'), ((656, 687), 'os.path... |
import numpy as np
#from ..utils import *
from ..metrics import Metrics
from .map_data import StdMapData
class StdMapMetrics():
"""
Class used for calculating pattern attributes and difficulty.
.. warning::
Undocumented functions in this class are not supported and are experimental.
"""
... | [
"numpy.arctan2",
"numpy.logical_and",
"numpy.asarray",
"numpy.sin",
"numpy.diff",
"numpy.cos"
] | [((944, 954), 'numpy.diff', 'np.diff', (['t'], {}), '(t)\n', (951, 954), True, 'import numpy as np\n'), ((4638, 4648), 'numpy.diff', 'np.diff', (['x'], {}), '(x)\n', (4645, 4648), True, 'import numpy as np\n'), ((4662, 4672), 'numpy.diff', 'np.diff', (['y'], {}), '(y)\n', (4669, 4672), True, 'import numpy as np\n'), ((... |
import datetime
import re
from unittest import TestCase
from module import storage_util
from module.oss_util import read_file_in_oss, copy_file, delete_file
from module.pyplot_util import generate_pie_chart
class TestOSSUtil(TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
def ... | [
"module.storage_util.read_json_from_file_locally",
"module.oss_util.delete_file",
"module.oss_util.read_file_in_oss",
"datetime.date.today",
"re.sub",
"module.oss_util.copy_file"
] | [((370, 425), 'module.oss_util.read_file_in_oss', 'read_file_in_oss', (['"""test_read_file_in_oss_remotely.json"""'], {}), "('test_read_file_in_oss_remotely.json')\n", (386, 425), False, 'from module.oss_util import read_file_in_oss, copy_file, delete_file\n'), ((453, 483), 're.sub', 're.sub', (['"""\\\\s+"""', '""""""... |
import os
class BaseConfig:
"""Base configuration"""
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = "<KEY>"
TOKEN_EXPIRATION_DAYS = 30
TOKEN_EXPIRATION_SECONDS = 0
class DevelopmentConfig(BaseConfig):
"""Development configuration"""
SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE... | [
"os.environ.get"
] | [((296, 326), 'os.environ.get', 'os.environ.get', (['"""DATABASE_URL"""'], {}), "('DATABASE_URL')\n", (310, 326), False, 'import os\n')] |
#%%
import cvxpy as cp
import numpy as np
import matplotlib.pyplot as plt
def loss_fn(X, Y, beta):
return cp.norm2(cp.matmul(X, beta) - Y)**2
def regularizer(beta):
return cp.norm1(beta)
def objective_fn(X, Y, beta, lambd):
return loss_fn(X, Y, beta) + lambd * regularizer(beta)
def mse(X, Y, beta):
... | [
"matplotlib.pyplot.xscale",
"matplotlib.pyplot.title",
"numpy.random.seed",
"cvxpy.Parameter",
"matplotlib.pyplot.plot",
"numpy.random.randn",
"matplotlib.pyplot.show",
"numpy.logspace",
"matplotlib.pyplot.legend",
"cvxpy.matmul",
"cvxpy.norm1",
"numpy.random.normal",
"cvxpy.Variable",
"ma... | [((936, 950), 'cvxpy.Variable', 'cp.Variable', (['n'], {}), '(n)\n', (947, 950), True, 'import cvxpy as cp\n'), ((959, 984), 'cvxpy.Parameter', 'cp.Parameter', ([], {'nonneg': '(True)'}), '(nonneg=True)\n', (971, 984), True, 'import cvxpy as cp\n'), ((1080, 1102), 'numpy.logspace', 'np.logspace', (['(-2)', '(3)', '(50)... |
import numpy as np
def stringify_vec(vec):
s = ""
for x in vec: s += str(x) + " "
return s
def distance(p1, p2):
pv1 = np.asarray(p1)
pv2 = np.asarray(p2)
return np.linalg.norm(pv1 - pv2)
def multireplace(arr, x, sub_arr):
new_arr = []
for entry in arr:
if (entry == x).all():
... | [
"numpy.asarray",
"numpy.cross",
"numpy.sin",
"numpy.linalg.norm",
"numpy.cos",
"numpy.dot"
] | [((137, 151), 'numpy.asarray', 'np.asarray', (['p1'], {}), '(p1)\n', (147, 151), True, 'import numpy as np\n'), ((162, 176), 'numpy.asarray', 'np.asarray', (['p2'], {}), '(p2)\n', (172, 176), True, 'import numpy as np\n'), ((188, 213), 'numpy.linalg.norm', 'np.linalg.norm', (['(pv1 - pv2)'], {}), '(pv1 - pv2)\n', (202,... |
import aws_cdk.aws_lambda as _lambda
from aws_cdk import core
from aws_cdk.aws_apigatewayv2 import (
HttpApi,
HttpMethod,
)
from aws_cdk.aws_apigatewayv2_integrations import (
LambdaProxyIntegration,
)
from aws_cdk.aws_iam import PolicyStatement, Effect
class CdkStack(core.Stack):
def __init__(self, s... | [
"aws_cdk.core.CfnOutput",
"aws_cdk.core.Duration.seconds",
"aws_cdk.aws_iam.PolicyStatement",
"aws_cdk.aws_lambda.Code.from_asset",
"aws_cdk.aws_apigatewayv2_integrations.LambdaProxyIntegration",
"aws_cdk.aws_apigatewayv2.HttpApi"
] | [((1388, 1414), 'aws_cdk.aws_apigatewayv2.HttpApi', 'HttpApi', (['self', 'f"""{id}-api"""'], {}), "(self, f'{id}-api')\n", (1395, 1414), False, 'from aws_cdk.aws_apigatewayv2 import HttpApi, HttpMethod\n'), ((1593, 1650), 'aws_cdk.core.CfnOutput', 'core.CfnOutput', (['self', 'f"""{id}-url"""'], {'value': 'api.api_endpo... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
colNames = ['x', 'y', 'z', 'particle.type', 'BPM no']
particleTypeNames = {
-1: 'other',
0: 'e-',
1: 'e+',
... | [
"matplotlib.backends.backend_pdf.PdfPages",
"numpy.ma.masked_where",
"pandas.read_csv",
"numpy.histogram2d",
"matplotlib.pyplot.Circle",
"matplotlib.pyplot.subplots"
] | [((345, 443), 'pandas.read_csv', 'pd.read_csv', (['"""../build-10/out_nt_bpmScreenHits.csv"""'], {'header': 'None', 'names': 'colNames', 'comment': '"""#"""'}), "('../build-10/out_nt_bpmScreenHits.csv', header=None, names=\n colNames, comment='#')\n", (356, 443), True, 'import pandas as pd\n'), ((573, 658), 'numpy.h... |
from datetime import datetime
import cacahuate.inputs
from cacahuate.jsontypes import MultiFormDict, Map
DATE_FIELDS = [
'started_at',
'finished_at',
]
def make_actor_map(execution_data):
actor_map = {}
for fg in execution_data['values']:
ref = fg['ref']
form_groups = []
fo... | [
"cacahuate.jsontypes.MultiFormDict",
"cacahuate.jsontypes.Map"
] | [((1733, 1759), 'cacahuate.jsontypes.MultiFormDict', 'MultiFormDict', (['form_groups'], {}), '(form_groups)\n', (1746, 1759), False, 'from cacahuate.jsontypes import MultiFormDict, Map\n'), ((2708, 2733), 'cacahuate.jsontypes.Map', 'Map', (['[]'], {'key': '"""identifier"""'}), "([], key='identifier')\n", (2711, 2733), ... |
#setup.py - Free Rider HD Installation script
#by maxmillion18
#http://www.github.com/maxmillion18
#http://www.freeriderhd.com/u/MaxwellNurzia
from setuptools import setup, find_packages
versionFile = "VERSION"
setup(name="frhdtools",
version=open(versionFile).read(),
description="Library to work with Free Ri... | [
"setuptools.find_packages"
] | [((879, 912), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['images']"}), "(exclude=['images'])\n", (892, 912), False, 'from setuptools import setup, find_packages\n')] |
# 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"
] | [((1797, 1825), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""roleId"""'}), "(name='roleId')\n", (1810, 1825), False, 'import pulumi\n'), ((2098, 2128), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""domainId"""'}), "(name='domainId')\n", (2111, 2128), False, 'import pulumi\n'), ((2445, 2474), 'pulumi.getter... |
from src import app, api
from flask_restful import Resource
from src.data import Data
from src.models import Pair, Interval
data = Data()
class HelloWorld(Resource):
def get(self):
return {'hello': 'world'}
class Test(Resource):
def get(self):
return {'results':data.test()}
class History(Res... | [
"src.models.Interval",
"src.api.add_resource",
"src.data.Data",
"src.models.Pair"
] | [((132, 138), 'src.data.Data', 'Data', ([], {}), '()\n', (136, 138), False, 'from src.data import Data\n'), ((799, 832), 'src.api.add_resource', 'api.add_resource', (['HelloWorld', '"""/"""'], {}), "(HelloWorld, '/')\n", (815, 832), False, 'from src import app, api\n'), ((833, 864), 'src.api.add_resource', 'api.add_res... |
"""
LSH for euclidean distance.
"""
from pyspark import SparkContext, RDD
from datming.utils import join_multiple_keys
import numpy as np
__all__ = [
"EuclideanDistance"
]
class EuclideanDistanceLSH(object):
"""
Find item pairs between which Euclidean Distance is closed enough.
"""
def __init__... | [
"numpy.random.seed",
"numpy.random.randn",
"pyspark.SparkContext.getOrCreate",
"datming.utils.join_multiple_keys",
"numpy.random.randint",
"numpy.linalg.norm",
"numpy.dot"
] | [((4908, 4941), 'numpy.linalg.norm', 'np.linalg.norm', (['(vector1 - vector2)'], {}), '(vector1 - vector2)\n', (4922, 4941), True, 'import numpy as np\n'), ((5059, 5085), 'pyspark.SparkContext.getOrCreate', 'SparkContext.getOrCreate', ([], {}), '()\n', (5083, 5085), False, 'from pyspark import SparkContext, RDD\n'), ((... |
from django.contrib import admin
from .models import Sheet, Cell
@admin.register(Sheet)
class SheetAdmin(admin.ModelAdmin):
list_display = ('name', 'key', 'owner')
readonly_fields = ('key', )
search_fields = ('name', )
@admin.register(Cell)
class CellAdmin(admin.ModelAdmin):
pass
| [
"django.contrib.admin.register"
] | [((69, 90), 'django.contrib.admin.register', 'admin.register', (['Sheet'], {}), '(Sheet)\n', (83, 90), False, 'from django.contrib import admin\n'), ((228, 248), 'django.contrib.admin.register', 'admin.register', (['Cell'], {}), '(Cell)\n', (242, 248), False, 'from django.contrib import admin\n')] |
from unittest import TestCase
from mapping import Mapping
from mapping import Value
class MappingTestCase(TestCase):
def setUp(self):
self.mapping = Mapping(Value.zero, Value.one, Value.two, Value.three)
def test_distinct_values_correct(self):
try:
Mapping(Value.zero, Value.one, Value.two, Value.three)
... | [
"mapping.Mapping",
"mapping.Value.get_instance"
] | [((157, 211), 'mapping.Mapping', 'Mapping', (['Value.zero', 'Value.one', 'Value.two', 'Value.three'], {}), '(Value.zero, Value.one, Value.two, Value.three)\n', (164, 211), False, 'from mapping import Mapping\n'), ((264, 318), 'mapping.Mapping', 'Mapping', (['Value.zero', 'Value.one', 'Value.two', 'Value.three'], {}), '... |
# =============================================================================
#
# Explicit Finite Difference Method Code
# Solves the 2D Temperature Convection-Diffusion Equation
# Assumes Tubular Plug-Flow-Reactor in Laminar Regime
# Assumes hagen poiseuille velocity profile
# Heat Source-Sink Included Uses ... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.xlim",
"numpy.meshgrid",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"numpy.zeros",
"numpy.ones",
"matplotlib.pyplot.colorbar",
"numpy.max",
"numpy.array",
"matplotlib.pyplot.contourf",
"numpy.linspace",
"m... | [((2506, 2528), 'numpy.linspace', 'np.linspace', (['(0)', 'xl', 'nx'], {}), '(0, xl, nx)\n', (2517, 2528), True, 'import numpy as np\n'), ((2535, 2557), 'numpy.linspace', 'np.linspace', (['(0)', 'yl', 'ny'], {}), '(0, yl, ny)\n', (2546, 2557), True, 'import numpy as np\n'), ((2567, 2584), 'numpy.meshgrid', 'np.meshgrid... |
"""
Priors for GPCSD parameters.
"""
import autograd.numpy as np
from scipy.stats import invgamma, halfnorm
class GPCSDPrior:
def __init__(self):
pass
class GPCSDInvGammaPrior(GPCSDPrior):
def __init__(self, alpha=1, beta=1):
GPCSDPrior.__init__(self)
self.alpha = alpha
... | [
"autograd.numpy.log",
"scipy.stats.invgamma.rvs",
"autograd.numpy.square",
"scipy.stats.halfnorm.rvs"
] | [((787, 828), 'scipy.stats.invgamma.rvs', 'invgamma.rvs', (['self.alpha'], {'scale': 'self.beta'}), '(self.alpha, scale=self.beta)\n', (799, 828), False, 'from scipy.stats import invgamma, halfnorm\n'), ((1225, 1252), 'scipy.stats.halfnorm.rvs', 'halfnorm.rvs', ([], {'scale': 'self.sd'}), '(scale=self.sd)\n', (1237, 12... |
from django.db import models
from .managers import GeneralManager
class Rain(models.Model):
amount = models.IntegerField()
date = models.DateField(auto_now=False)
objects = models.Manager()
my_query = GeneralManager()
class Meta:
ordering = ['date']
def __str__(self):
... | [
"django.db.models.DateField",
"django.db.models.IntegerField",
"django.db.models.Manager"
] | [((112, 133), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (131, 133), False, 'from django.db import models\n'), ((146, 178), 'django.db.models.DateField', 'models.DateField', ([], {'auto_now': '(False)'}), '(auto_now=False)\n', (162, 178), False, 'from django.db import models\n'), ((194, 2... |
"""CNN Module."""
import warnings
import akro
import numpy as np
import torch
from torch import nn
from garage import InOutSpec
from garage.torch import (expand_var, NonLinearity, output_height_2d,
output_width_2d)
# pytorch v1.6 issue, see https://github.com/pytorch/pytorch/issues/42305
#... | [
"torch.nn.Sequential",
"garage.torch.NonLinearity",
"garage.torch.output_width_2d",
"torch.nn.Conv2d",
"akro.Box",
"torch.nn.LayerNorm",
"torch.div",
"torch.nn.Linear",
"torch.nn.MaxPool2d",
"warnings.warn",
"garage.torch.output_height_2d"
] | [((4863, 4878), 'torch.nn.Sequential', 'nn.Sequential', ([], {}), '()\n', (4876, 4878), False, 'from torch import nn\n'), ((10467, 10611), 'warnings.warn', 'warnings.warn', (['f"""CNNModule input has {in_channels} channels, but 1 or 3 channels are typical. Consider changing the CNN image_format."""'], {}), "(\n f'CN... |
"""
.. module:: function
:synopsis: Nuts that perform functions on single stream elements.
"""
from __future__ import print_function
from __future__ import absolute_import
import time
import threading
from nutsflow.common import (shapestr, as_tuple, is_iterable, istensor,
print_type, c... | [
"nutsflow.common.print_type",
"nutsflow.common.is_iterable",
"nutsflow.common.shapestr",
"time.time",
"threading.Lock",
"time.sleep",
"nutsflow.common.console",
"nutsflow.common.as_tuple",
"nutsflow.common.istensor"
] | [((5898, 5918), 'time.sleep', 'time.sleep', (['duration'], {}), '(duration)\n', (5908, 5918), False, 'import time\n'), ((4569, 4585), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (4583, 4585), False, 'import threading\n'), ((8604, 8615), 'time.time', 'time.time', ([], {}), '()\n', (8613, 8615), False, 'import ... |
from peek_platform import PeekPlatformConfig
from peek_platform.sw_install.PeekSwInstallManagerABC import PeekSwInstallManagerABC
__author__ = 'synerty'
class PeekSwInstallManager(PeekSwInstallManagerABC):
def _stopCode(self):
PeekPlatformConfig.pluginLoader.stopOptionalPlugins()
PeekPlatformCon... | [
"peek_platform.PeekPlatformConfig.pluginLoader.startOptionalPlugins",
"peek_platform.PeekPlatformConfig.pluginLoader.unloadOptionalPlugins",
"peek_platform.PeekPlatformConfig.pluginLoader.stopOptionalPlugins",
"peek_platform.PeekPlatformConfig.pluginLoader.unloadCorePlugins",
"peek_platform.PeekPlatformConf... | [((243, 296), 'peek_platform.PeekPlatformConfig.pluginLoader.stopOptionalPlugins', 'PeekPlatformConfig.pluginLoader.stopOptionalPlugins', ([], {}), '()\n', (294, 296), False, 'from peek_platform import PeekPlatformConfig\n'), ((305, 354), 'peek_platform.PeekPlatformConfig.pluginLoader.stopCorePlugins', 'PeekPlatformCon... |
import unittest
from ncaabb import team
class TestTeam(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.team_one = team.Team(["Team One", "Region", 1, True, 30, 30])
def test_calculate_rating(self):
self.assertNotEqual(self.team_one, self.team_one.calculate_rating()... | [
"unittest.main",
"ncaabb.team.Team"
] | [((711, 726), 'unittest.main', 'unittest.main', ([], {}), '()\n', (724, 726), False, 'import unittest\n'), ((153, 203), 'ncaabb.team.Team', 'team.Team', (["['Team One', 'Region', 1, True, 30, 30]"], {}), "(['Team One', 'Region', 1, True, 30, 30])\n", (162, 203), False, 'from ncaabb import team\n'), ((372, 418), 'ncaabb... |
# -*- coding: utf-8 -*-
# Copyright: (c) 2019. <NAME> <<EMAIL>>
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
netbox.py
A lookup function designed to return data from the Netbox application
"""
from __future__ import absolute_import, division, print_function
from... | [
"ansible.utils.display.Display",
"ansible.errors.AnsibleError",
"ansible.parsing.splitter.parse_kv",
"pynetbox.api"
] | [((7878, 7982), 'pynetbox.api', 'pynetbox.api', (['netbox_api_endpoint'], {'token': 'netbox_api_token', 'private_key_file': 'netbox_private_key_file'}), '(netbox_api_endpoint, token=netbox_api_token, private_key_file=\n netbox_private_key_file)\n', (7890, 7982), False, 'import pynetbox\n'), ((8093, 8188), 'ansible.e... |
from django.conf import settings
from haystack.backends import SQ
from haystack.generic_views import SearchView
from haystack.inputs import AutoQuery
from haystack.query import SearchQuerySet
# convert the subfacet settings to Facet objects
from facets import Facet
SEARCH_SUBFACETS = getattr(settings, "SEARCH_SUBFAC... | [
"haystack.query.SearchQuerySet",
"haystack.inputs.AutoQuery",
"facets.Facet"
] | [((879, 949), 'facets.Facet', 'Facet', ([], {'field_name': '"""search_types"""', 'is_top_level': '(True)', 'select_many': '(False)'}), "(field_name='search_types', is_top_level=True, select_many=False)\n", (884, 949), False, 'from facets import Facet\n'), ((392, 403), 'facets.Facet', 'Facet', ([], {}), '(**kw)\n', (397... |
import os
from stray.scene import Scene
from stray.renderer import Renderer
import numpy as np
import pycocotools.mask as mask_util
import pickle
def write_segmentation_masks(scene_path):
scene = Scene(scene_path)
renderer = Renderer(scene)
segmentation_parent_path = os.path.join(scene_path, "segmentation... | [
"pickle.dump",
"os.makedirs",
"numpy.asarray",
"stray.renderer.Renderer",
"stray.scene.Scene",
"os.path.join"
] | [((202, 219), 'stray.scene.Scene', 'Scene', (['scene_path'], {}), '(scene_path)\n', (207, 219), False, 'from stray.scene import Scene\n'), ((235, 250), 'stray.renderer.Renderer', 'Renderer', (['scene'], {}), '(scene)\n', (243, 250), False, 'from stray.renderer import Renderer\n'), ((282, 322), 'os.path.join', 'os.path.... |
# Generated by Django 3.2.9 on 2022-02-03 13:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0012_auto_20220203_1617'),
]
operations = [
migrations.AlterField(
model_name='fundraiser',
name='end_date',
... | [
"django.db.models.DateTimeField"
] | [((338, 369), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'null': '(True)'}), '(null=True)\n', (358, 369), False, 'from django.db import migrations, models\n'), ((499, 549), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)', 'null': '(True)'}), '(auto_now_add=T... |
from setuptools import setup
from Cython.Build import cythonize
from distutils.extension import Extension
from distutils.command.build_ext import build_ext
import numpy
import mpi4py
import os
class build_ext_subclass(build_ext):
user_options = build_ext.user_options + \
[
('mpicc', None, ... | [
"Cython.Build.cythonize",
"distutils.command.build_ext.build_ext.finalize_options",
"mpi4py.get_config",
"os.environ.get",
"distutils.command.build_ext.build_ext.initialize_options",
"distutils.command.build_ext.build_ext.build_extensions",
"numpy.get_include",
"re.search"
] | [((1444, 1506), 're.search', 're.search', (['"""^__version__ = [\'\\\\"]([^\'\\\\"]*)[\'\\\\"]"""', 's', 're.M'], {}), '(\'^__version__ = [\\\'\\\\"]([^\\\'\\\\"]*)[\\\'\\\\"]\', s, re.M)\n', (1453, 1506), False, 'import re\n'), ((516, 549), 'os.environ.get', 'os.environ.get', (['"""MPICC"""', 'compiler'], {}), "('MPIC... |
import os, sys
ticksleep = 0.1
project_path = os.path.realpath(os.path.join(os.path.dirname(__file__), "../.."))
| [
"os.path.dirname"
] | [((77, 102), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (92, 102), False, 'import os, sys\n')] |
import os
from random import randint
for name in os.listdir('pendrive'):
newname='{}.mp3'.format(randint(0,1000000))
os.rename("pendrive/"+name,"pendrive/"+newname)
| [
"os.rename",
"random.randint",
"os.listdir"
] | [((50, 72), 'os.listdir', 'os.listdir', (['"""pendrive"""'], {}), "('pendrive')\n", (60, 72), False, 'import os\n'), ((120, 172), 'os.rename', 'os.rename', (["('pendrive/' + name)", "('pendrive/' + newname)"], {}), "('pendrive/' + name, 'pendrive/' + newname)\n", (129, 172), False, 'import os\n'), ((99, 118), 'random.r... |
# -*- coding: UTF-8 -*-
# 自定义py导入开始
# from getList import getList
import zbrank
# 导入拓展包开始
import json
import time
# 导入拓展包结束
# 自定义py导入结束
now = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
class status_start:
def __init__(self):
# 主url
self.main_url = "http://www.zbrank.com/ra... | [
"zbrank.zbrankSave",
"time.time"
] | [((198, 209), 'time.time', 'time.time', ([], {}), '()\n', (207, 209), False, 'import time\n'), ((509, 528), 'zbrank.zbrankSave', 'zbrank.zbrankSave', ([], {}), '()\n', (526, 528), False, 'import zbrank\n')] |
"""Tests for graphmode_tensornetwork."""
import numpy as np
import tensorflow as tf
from tensornetwork import (contract, connect, flatten_edges_between,
contract_between, Node)
import pytest
class GraphmodeTensorNetworkTest(tf.test.TestCase):
def test_basic_graphmode(self):
# pylint:... | [
"tensorflow.test.main",
"tensorflow.ones",
"tensornetwork.Node",
"tensorflow.convert_to_tensor",
"tensornetwork.contract",
"tensorflow.compat.v1.train.GradientDescentOptimizer",
"tensornetwork.contract_between",
"numpy.ones",
"tensorflow.compat.v1.Session",
"tensornetwork.connect",
"tensorflow.m... | [((1743, 1820), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""Test fails due to probable bug in tensorflow 2.0.0"""'}), "(reason='Test fails due to probable bug in tensorflow 2.0.0')\n", (1759, 1820), False, 'import pytest\n'), ((3750, 3764), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (3762... |
import os
import sys
import glob
import numpy as np
import tensorflow as tf
import scipy
import scipy.io
import keras
from keras.models import Model, Sequential
from keras.layers import *
from keras.optimizers import Adam
from keras import regularizers
from keras import backend as K
from keras.utils import to_categori... | [
"numpy.fromfile",
"keras.models.Model",
"keras.backend.set_image_data_format"
] | [((4799, 4840), 'keras.backend.set_image_data_format', 'K.set_image_data_format', (['"""channels_first"""'], {}), "('channels_first')\n", (4822, 4840), True, 'from keras import backend as K\n'), ((3827, 3846), 'keras.models.Model', 'Model', (['img_input', 'x'], {}), '(img_input, x)\n', (3832, 3846), False, 'from keras.... |
from resource import *
import psutil
from collections import defaultdict
# FILE_IN_PATH = 'K3241.K03200DV.D00422.L00001'
FILE_IN_PATH = '/Users/cadu/Downloads/datasets/dadosabertos_CNPjs/K3241.K03200DV.D00422.L00001'
FILE_OUT_PATH = 'output.txt'
# head
# posicao de inicio da linha e TAMANHO de registros
# ini = acc(... | [
"psutil.virtual_memory",
"psutil.cpu_percent",
"time.time"
] | [((2448, 2459), 'time.time', 'time.time', ([], {}), '()\n', (2457, 2459), False, 'import time\n'), ((2659, 2679), 'psutil.cpu_percent', 'psutil.cpu_percent', ([], {}), '()\n', (2677, 2679), False, 'import psutil\n'), ((2556, 2567), 'time.time', 'time.time', ([], {}), '()\n', (2565, 2567), False, 'import time\n'), ((271... |
#!/usr/bin/python3
from apiclient.http import MediaFileUpload
from apiclient.errors import HttpError
from apiclient.discovery import build
import time
import sys
import random
import os
import httplib2
import json
import boto3
import requests
try:
import httplib
except ImportError: # python3 compatibility
f... | [
"oauth2client.file.Storage",
"httplib2.Http",
"os.makedirs",
"http.client.flow_from_clientsecrets",
"os.path.exists",
"time.sleep",
"random.random",
"apiclient.http.MediaFileUpload",
"requests.get",
"os.path.split"
] | [((4566, 4643), 'oauth2client.file.Storage', 'file.Storage', (["(self.SECRETS_DIRECTORY + 'connect_youtube_uploader-oauth2.json')"], {}), "(self.SECRETS_DIRECTORY + 'connect_youtube_uploader-oauth2.json')\n", (4578, 4643), False, 'from oauth2client import file\n'), ((5747, 5783), 'requests.get', 'requests.get', (['vide... |
#
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Azure Client Configuration."""
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.costmanagement import CostManagementClient
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.storage import St... | [
"azure.mgmt.resource.ResourceManagementClient",
"azure.mgmt.storage.StorageManagementClient",
"azure.storage.blob.BlobServiceClient.from_connection_string",
"azure.mgmt.costmanagement.CostManagementClient"
] | [((1945, 2005), 'azure.mgmt.costmanagement.CostManagementClient', 'CostManagementClient', (['self.credentials', 'self.subscription_id'], {}), '(self.credentials, self.subscription_id)\n', (1965, 2005), False, 'from azure.mgmt.costmanagement import CostManagementClient\n'), ((2107, 2171), 'azure.mgmt.resource.ResourceMa... |
import pytest
from year_2020.day23.crab_cups import get_crab_cups
TEST_INPUT = "389125467"
@pytest.mark.parametrize("num_moves, expected", [(10, "92658374"), (100, "67384529")])
def test_get_crap_cups(num_moves, expected):
assert get_crab_cups(TEST_INPUT, num_moves=num_moves) == expected
@pytest.mark.slow
def... | [
"pytest.mark.parametrize",
"year_2020.day23.crab_cups.get_crab_cups"
] | [((96, 185), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""num_moves, expected"""', "[(10, '92658374'), (100, '67384529')]"], {}), "('num_moves, expected', [(10, '92658374'), (100,\n '67384529')])\n", (119, 185), False, 'import pytest\n'), ((238, 284), 'year_2020.day23.crab_cups.get_crab_cups', 'get_cr... |
from allauth.account.adapter import DefaultAccountAdapter
from django.conf import settings
import urlparse
class OsfMeetingsAdapter(DefaultAccountAdapter):
def get_login_redirect_url(self, request):
try:
refererUrl = request.environ['HTTP_REFERER']
nextUrl = urlparse.parse_qs(
... | [
"urlparse.urlparse"
] | [((333, 362), 'urlparse.urlparse', 'urlparse.urlparse', (['refererUrl'], {}), '(refererUrl)\n', (350, 362), False, 'import urlparse\n')] |
"""
This script is written and tested in Blender 2.83.1 & BlenderGIS 1.0
"""
import bpy, bmesh, json, os, re
from pathlib import Path
def load_data(data_file):
with open(data_file) as f:
data = json.load(f)
f.close()
return data
def clean_mesh(obj_name):
# Clean up the mesh by delete some... | [
"bpy.ops.importgis.shapefile",
"pathlib.Path",
"bpy.data.materials.new",
"bpy.ops.mesh.primitive_plane_add",
"os.path.join",
"bpy.ops.mesh.delete",
"bpy.data.fonts.load",
"bpy.ops.object.shape_key_add",
"bpy.data.curves.new",
"bpy.ops.object.delete",
"re.match",
"bmesh.from_edit_mesh",
"bpy.... | [((340, 390), 'bpy.ops.object.mode_set', 'bpy.ops.object.mode_set', ([], {'mode': '"""EDIT"""', 'toggle': '(False)'}), "(mode='EDIT', toggle=False)\n", (363, 390), False, 'import bpy, bmesh, json, os, re\n'), ((534, 558), 'bmesh.from_edit_mesh', 'bmesh.from_edit_mesh', (['me'], {}), '(me)\n', (554, 558), False, 'import... |
# encoding utf-8
import pandas as pd
import numpy as np
import statsmodels.api as sm
from statsmodels.tools import eval_measures
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
class Preprocessing:
def __init__(self, data_raw):
self.data_clean = data_r... | [
"sklearn.preprocessing.StandardScaler",
"numpy.log",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"statsmodels.api.add_constant"
] | [((2743, 2793), 'pandas.read_csv', 'pd.read_csv', (['"""./../../data/house_prices/train.csv"""'], {}), "('./../../data/house_prices/train.csv')\n", (2754, 2793), True, 'import pandas as pd\n'), ((2112, 2199), 'sklearn.model_selection.train_test_split', 'train_test_split', (['self.X', 'self.y'], {'train_size': 'TRAIN_SI... |