text stringlengths 2 999k |
|---|
# proxy module
from pyface.timer.api import *
|
# Copyright (c) 2018 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 app... |
from distutils.version import LooseVersion
from functools import reduce
from itertools import permutations
from typing import Dict
from typing import Optional
from typing import Tuple
import torch
from torch_complex.tensor import ComplexTensor
from typeguard import check_argument_types
from espnet2.enh.informed_encod... |
# -------------------------------------------------------------------------------
# Copyright IBM Corp. 2016
#
# 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/licens... |
dict = dict()
lista = list()
dict['nome'] = str(input('Nome: '))
dict['media'] = int(input(f'Media de {dict["nome"]}: '))
lista.append(dict.copy())
print('-='*30)
print(f' - nome é igual á {dict["nome"]}')
print(f' - media é igual á {dict["media"]}')
if dict['media'] < 5:
print(' - e a situação é igual a rep... |
from __future__ import annotations
from prettyqt import widgets
from prettyqt.qt import QtCore, QtHelp
QtHelp.QHelpContentWidget.__bases__ = (widgets.TreeView,)
class HelpContentWidget(QtHelp.QHelpContentWidget):
def index_of(self, url: QtCore.QUrl | str) -> QtCore.QModelIndex | None:
if isinstance(url... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-07-12 06:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Publis... |
import csv
from csv import writer
import os
import time
import base64
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf... |
#!/usr/bin/python3
f = open("day3-input.txt", "r")
finput = f.read().split("\n")
finput.pop()
trees_hit = 0
y_cord = 0
x_cord = 0
def get_line(finput, y_cord, x_cord):
... |
"""
Ej. 29
Autor: Zahir Gudiño
Email: zahir.gudino@gmail.com
Descripcion:
Consumir SWAPI, The Star Wars API (http://swapi.co), escribir y mostar en pantalla respuesta JSON.
NOTA:
Note el uso de pkg requests (https://pypi.python.org/pypi/requests), por ende debe instalar pkg previo a ejecucion.
Una... |
import sys
sys.ps1
'>>>'
sys.ps2
'... '
sys.ps1 = 'C> '
print('Yuck!')
|
"""
Provides a function to report all internal modules for using freezing tools
pytest
"""
def pytest_namespace():
return {'freeze_includes': freeze_includes}
def freeze_includes():
"""
Returns a list of module names used by py.test that should be
included by cx_freeze.
"""
import py
impo... |
"""initial Migration
Revision ID: 62433e400e69
Revises:
Create Date: 2021-06-22 03:10:54.264719
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '62433e400e69'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto ... |
n1 = float(input("Digite o valor da primeira nota: "))
n2 = float(input("Digite o valor da segunda nota: "))
print("Sua primeira nota foi {}, e sua segunda nota foi {}.\n"
"O total é {}, e sua média é {:.1f}.".format(n1, n2, (n1+n2), ((n1+n2)/2)))
|
from __future__ import absolute_import
from sfepy.base.testing import TestCommon
from sfepy.homogenization.engine import HomogenizationEngine as he
from sfepy.homogenization.engine import HomogenizationWorkerMulti as hwm
import six
import numpy as nm
class Test(TestCommon):
@staticmethod
def from_conf(conf, o... |
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... |
import matplotlib; matplotlib.use("Agg")
from imageai.Detection import ObjectDetection
import os, glob
def runner():
execution_path = os.getcwd()
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath(os.path.join(execution_path , "resnet50_coco_best_v2.0.1.h5"))
de... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# mypy: ignore-errors
"""
Development scripts.
You need ``invoke`` installed to run them.
"""
import os
import re
import sys
import invoke
ROOT = os.path.dirname(os.path.abspath(__file__))
PACKAGE = "src/py_gql"
DEFAULT_TARGETS = (
"%s tests examples" % PACKAGE
... |
# udp_echo
#
# An example of a simple UDP echo server.
import curio
from curio import socket
async def main(addr):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(addr)
while True:
data, addr = await sock.recvfrom(10000)
print('Received from', addr, data)
await s... |
#/usr/bin/env python
"""Unit tests for condor_ce_router_defaults"""
import imp
import os
import re
import unittest
EXTATTR_FILE_PATH = 'extattr_table.txt'
UID_FILE_PATH = 'uid_table.txt'
DEFAULTS_PATH = os.path.join('..', 'src', 'condor_ce_router_defaults')
defaults = imp.load_source('condor_ce_router_defaults', DEF... |
# This script is to add "hasPart" metadata to all collection resources (github issue #1403)
# how to run:
# docker exec -i hydroshare python manage.py shell \
# < "hs_collection_resource/patches/add_hasPart_term_django_shell.py"
# Note: use "-i" instead of "-it" in above command as
# the latter may cause error "cannot ... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def convertBST(self, root):
"""
:type root: TreeNode
:rtype: TreeNode
"""
def traverse(node):
... |
#!/usr/bin/python
# mostly a proxy object to abstract how some of this works
import json
from slackclient._server import Server
class SlackClient(object):
def __init__(self, token):
self.token = token
self.server = Server(self.token, False)
def rtm_connect(self):
try:
sel... |
#!/usr/bin/env python2
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import logging
... |
# Copyright (c) 2014 The Bitcoin Core developers
# Copyright (c) 2014-2015 The Dash developers
# Copyright (c) 2015-2017 The PIVX developers
# Copyright (c) 2017-2018 The DesignCoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2018 Palo Alto Networks, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... |
# -*- coding: utf-8 -*-
import csv
import datetime
import string
import sys
import xml.etree.ElementTree as ET
import requests
#from reports_27_functions import transfertoDictionary, transfertoFacultyDictionary, removePunctuationField, readTextFile, queryBuilder, callQuery, cleanTitleField, cleanDateField, isTheCont... |
"""
A Sphinx theme for Open edX documentation.
"""
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import os
import six
from six.moves.urllib.parse import quote # pylint: disable=wrong-import-order
# When you change this, also update the CHANGELOG.rst file, thanks.
__versio... |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# 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 the... |
# Generated by Django 3.1.1 on 2021-01-27 19:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('news', '0026_article_draft'),
]
operations = [
migrations.AddField(
model_name='event',
name='draft',
fi... |
# Add all your SQLAlchemy models here.
# This allows us to import just this file when
# we need to preload the models and ensure they
# are all loaded.
# noinspection PyUnresolvedReferences
import pypi_org.data.audit
# noinspection PyUnresolvedReferences
import pypi_org.data.downloads
# noinspection PyUnresolvedRefere... |
from django.core.paginator import Paginator
from django.http import HttpRequest
from django.template.loader import get_template
def test_pagination_snippet():
pagination_tpl = get_template("archive/snippets/pagination.html")
# initiate paginator with simple array, one item per page for testing
# 5 pages ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Civic Knowledge. This file is licensed under the terms of the
# MIT License, included in this distribution as LICENSE.txt
"""
"""
from . import RowpackReader, RowpackWriter
from tableintuit import Stats, RowIntuiter, TypeIntuiter
def run_stats(path, update=True):
fr... |
from django import template
from django.contrib.auth.models import Group
from datetime import datetime, timedelta
import re
import pytz
register = template.Library()
@register.filter(name='has_group')
def has_group(user, group_name):
group = Group.objects.get(name=group_name)
return True if group in user.g... |
from dynamic_stack_decider.abstract_stack_element import AbstractStackElement
class AbstractDecisionElement(AbstractStackElement):
"""
The logic is encapsulated in two types of elements.
The decision elements define the logical path similar to a behavior tree.
Corresponding decisions can be as complex... |
from ..Broadcast import Broadcast
from ...request import Request
from ...controllers import Controller
class BroadcastingController(Controller):
def authorize(self, request: Request, broadcast: Broadcast):
return broadcast.driver("pusher").authorize(
request.input("channel_name"), request.inpu... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Date : 2016-07-04 17:39
# @Author : Bluethon (j5088794@gmail.com)
# @Link : http://github.com/bluethon
from flask import Blueprint
api = Blueprint('api', __name__)
# noinspection PyUnresolvedReferences
from . import authentication, posts, users, comments, ... |
# emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the duecredit package for the
# copyright and license terms.
#
# ## ### ... |
from MySQLdb import connect
print('Conectando ...')
conn = connect(user='root', passwd='alura',
host='127.0.0.1', port=3306)
# deleta a base jogoteca antiga
try:
conn.cursor().execute("DROP DATABASE `jogoteca`;")
except BaseException:
print('Não existe db jogoteca, continuando a execuacao...' )... |
import os
from pymongo import MongoClient
MONGODB_URI = (
"mongodb://"
"{user}:{password}@{hostname}:{port}/{db}?authSource={authSource}".format(
user=os.environ.get("MONGO_INITDB_ROOT_USERNAME"),
password=os.environ.get("MONGO_INITDB_ROOT_PASSWORD"),
hostname=os.environ.get("HOSTNAME")... |
def panaherror(text, posisi_awal, posisi_akhir):
result = ''
idx_start = max(text.rfind('\n', 0, posisi_awal.indeks), 0)
idx_end = text.find('\n', idx_start + 1)
if idx_end < 0: idx_end = len(text)
line_count = posisi_akhir.baris - posisi_awal.baris + 1
for i in range(line_count):
... |
import hashlib
import hmac
import json
import logging
import platform
import sys
from time import time
from fastapi import APIRouter, BackgroundTasks, Depends, Header, HTTPException
from sqlalchemy.orm import Session
from starlette.requests import Request
from starlette.responses import Response
from dispatch.data... |
import numpy as np
from sklearn.metrics import accuracy_score
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score
from sklearn.metrics import f1_score
from sklearn.metrics import roc_curve
from sklearn.metrics import roc_auc_score
from sklearn.metrics import auc
from sklearn.met... |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
"""
"""
__version__ = "$Id$"
#end_pymotw_header
import Cookie
import datetime
def show_cookie(c):
print c
for key, morsel in c.iteritems():
print
print 'key =', morsel.key
print ' valu... |
from tamcolors import tam, tam_tools, tam_io
class TAMPrint(tam.tam_loop.TAMFrame):
def __init__(self):
super().__init__(fps=10,
char="+",
foreground_color=tam_io.tam_colors.GRAY,
background_color=tam_io.tam_colors.BLACK,
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import inspect
from collections import OrderedDict
from datetime import datetime
from . import constants as const
def get_template_context(steps):
"""Return a dict containing the context to be passed to the template."""
return... |
import os
from flask import Flask, request, jsonify
app = Flask(__name__)
FLASK_PORT = int(os.environ.get('FLASK_PORT', 8080))
@app.route("/healthz", methods=['GET'])
def health():
return jsonify({"status": True, "success": True, "msg": "I am Alive!", "cloud": None})
@app.route('/', defaults={'path': ''})
@app... |
#!/usr/bin/env python
import argparse
import re
import subprocess
import sys
useCSV = False
def main(arguments):
parser = argparse.ArgumentParser(
description='Analyze the code size in a binary')
parser.add_argument('-arch', type=str,
help='the arch to look at', default='arm... |
from __future__ import print_function
import sys
from datetime import datetime
import torch
from code.utils.cluster.cluster_eval import cluster_subheads_eval
from code.utils.cluster.transforms import sobel_process
def segmentation_eval(config, net,
mapping_assignment_dataloader,
... |
import hashlib
def make_md5(password):
md5=hashlib.md5
md5.update(password.encode('utf-8'))
return md5.hexdigest()
|
class ElevadorCheioException(Exception):
def __init__(self):
super().__init__("O elevador esta cheio!")
|
from typing import List, Tuple
from copy import deepcopy
class Hungarian():
"""
Class implementing the Hungarian algorithm. Inspired by the Python
implementation Munkres.
https://brc2.com/the-algorithm-workshop/
usage:
Hungarian([[0, 1], [0, 2]]).assignments() # [(0, 1), (1, 0)]
H... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
# Standard Library
import collections
# Third Party Stuff
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import... |
import numpy as np
import os.path, re, sys
import scipy.io as scio
from scipy.linalg import det
import cv2
import itertools
from js.data.rgbd.rgbdframe import *
import mayavi.mlab as mlab
import matplotlib.pyplot as plt
def plotMF(fig,R,col=None):
mfColor = []
mfColor.append((232/255.0,65/255.0,32/255.0)) # red
... |
"""Static file handling for HTTP component."""
from pathlib import Path
from aiohttp import hdrs
from aiohttp.web import FileResponse
from aiohttp.web_exceptions import HTTPNotFound, HTTPForbidden
from aiohttp.web_urldispatcher import StaticResource
CACHE_TIME = 31 * 86400 # = 1 month
CACHE_HEADERS = {hdrs.CACHE_CON... |
# -*- coding: utf-8 -*-
# __author__ = 'elkan1788@gmail.com'
from hiveemailjob.settings import ProjectConfig
from ppytools.csvhelper import write
from ppytools.emailclient import EmailClient
from ppytools.hiveclient import HiveClient
from ppytools.lang.timerhelper import timeMeter
import datetime
import logging
impor... |
# Autoencoder development
import numpy as np
import matplotlib.pyplot as plt
from ae_module import AE_model, add_noise_uni
from keras.datasets import mnist
if __name__ == '__main__':
# load and prep MNIST data
(x_train, _), (x_test, _) = mnist.load_data()
x_train = x_train.astype('float32') / 255.
x... |
"""Classes for managing Hubitat devices."""
from json import loads
from logging import getLogger
from typing import Any, Dict, List, Optional, Union, cast
from custom_components.hubitat.hub import Hub
from custom_components.hubitat.types import Removable, UpdateableEntity
from hubitatmaker import Device, Event
from ... |
#
# Copyright 2018 Analytics Zoo 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... |
"""
Precomputing, App Layout (Layers/Markers), Callbacks helpers.
"""
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
# import dash_colorscales
# import cufflinks as cf
import pandas as pd
import numpy as np
import re
import json
import dash_dang... |
#!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Bitcoin test... |
# Copyright (c) 2020, NVIDIA CORPORATION. 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... |
import os.path
import argparse
import json
class CmbLauncher:
def __init__(self):
pass
def run(self, token=None):
# local imports
from cmb import log, logex, CmbBot, CmbBotCommands
from disco.bot import BotConfig
from disco.client import ClientConfig, Client
#... |
from gpiozero import MCP3008
import time
R1 = 10000.0
R2 = 3300.0
analog_input = MCP3008(channel=0)
while True:
reading = analog_input.value
voltage_adc = reading * 3.3
voltage_actual = voltage_adc / (R2 / (R1 + R2))
print("Battery Voltage=" + str(voltage_actual))
time.sleep(1)
|
# coding: utf-8
"""
FlashArray REST API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2.11
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re
import six
import typing
from ... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# Modified by Qi Zhu, November 2019
"""
Implements the Generalized R-CNN framework
"""
import torch
from torch import nn
from maskrcnn_benchmark.structures.image_list import to_image_list
from maskrcnn_benchmark.structures.bounding_box import Box... |
import os
from collections import deque
import numpy as np
import math
class RoutePlanner(object):
EARTH_RADIUS = 6371e3 # 6371km
def __init__(self, global_plan, curr_threshold=20, next_threshold=75, debug=False):
self.route = deque()
self.curr_threshold = curr_threshold
self.nex... |
# -*- coding: utf-8 -*-
# Copyright 2017, Digital Reasoning
#
# 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... |
# 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, ... |
import pandas as pd
import numpy as np
import csv
from keras.layers import Dense, Lambda, dot, Activation, concatenate
from keras.layers import Layer
import keras.backend as K
# Parameters
# -------------------------------------------------------------------------------------------------------------------
bed = [631, ... |
import discord, json, requests
from discord.ext import commands
from utils import checks, rpc_module as rpc
class Wallet:
def __init__(self, bot):
self.bot = bot
self.rpc = rpc.Rpc()
@commands.command(hidden=True)
@commands.check(checks.is_owner)
async def wallet(self):
"""Sho... |
"""
Common functions and utilities to be used by other modules.
"""
import os
def get_filename_without_extension(path):
"""
Extracts the filename without the extension from the given path.
Parameters
----------
path : str
The path to get the filename form.
Returns
-------
The... |
from numpy import newaxis as na
import numpy as np
class AreaOverlappingFactor():
def overlapping_area_factor(self, wake_radius_ijlk, dw_ijlk, cw_ijlk, D_src_il, D_dst_ijl):
"""Calculate overlapping factor
Parameters
----------
dw_jl : array_like
down wind distance [... |
import urllib.parse
from functools import partial
from astroquery.vizier import Vizier
from ztf_viewer.catalogs.conesearch._base import _BaseCatalogQuery
class GcvsQuery(_BaseCatalogQuery):
id_column = 'GCVS'
type_column = 'VarType'
period_column = 'Period'
_table_ra = 'RAJ2000'
_ra_unit = 'hour... |
import pickle
import os
import numpy as np
import sys
from sklearn.preprocessing import label_binarize
from functionDefs import *
# All Cora data is stored as pickle
def pickle_read(path):
with open(path, "rb") as file:
data = pickle.load(file)
return data
def pickle_save(path, data):
with open(... |
def count_trees(forest, step):
pos = (0, 0)
nr_trees = 0
while pos[1] < len(forest):
if forest[pos[1]][pos[0] % len(forest[0])] == '#':
nr_trees += 1
pos = (pos[0] + step[0], pos[1] + step[1])
return nr_trees
with open("./input.txt") as f:
forest = []
for row in ... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
# pylint: ... |
# External Libraries
from essentia.standard import FFT, IFFT
import numpy as np
# IzunaDSP
from izunadsp import DSPPart, AudioSequence
class ApplyEQ(DSPPart):
def __init__(self):
super().__init__()
self._eq = np.array([1])
self.eq = [1]
self.fft = FFT()
self.ifft = IFFT()
... |
import os
import shutil
import sys
import time
from setuptools import setup, find_packages
from setuptools.command.install import install
v = '0.0.5'
cmds = sys.argv
installing = 'install' in cmds
def copy_cfg_sample_if_not_exists(p):
for f in os.listdir(p):
if ".cfg_sample" in f:
newf = f.r... |
"""
CryptoAPIs
Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei... |
from test.integration.base import DBTIntegrationTest, use_profile
class TestAliases(DBTIntegrationTest):
@property
def schema(self):
return "custom_aliases_043"
@property
def models(self):
return "models"
@property
def project_config(self):
return {
"macro... |
# coding: utf-8
# Copyright (c) 2016, 2020, 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... |
from __future__ import absolute_import
from .activation_maximization import visualize_activation_with_losses
from .activation_maximization import visualize_activation
from .saliency import visualize_saliency_with_losses
from .saliency import visualize_saliency
from .saliency import visualize_cam_with_losses
from .sa... |
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Vantiv eCommerce
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the 'Software'), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, ... |
# Copyright 2018 The Oppia 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 applicable ... |
from __future__ import absolute_import, division, print_function
import sys
from py._code.code import FormattedExcinfo
import py
import warnings
import inspect
import _pytest
from _pytest._code.code import TerminalRepr
from _pytest.compat import (
NOTSET, exc_clear, _format_args,
getfslineno, ge... |
# Copyright 2018 The Kubeflow 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... |
from __future__ import unicode_literals, print_function, division, absolute_import
from pprint import pprint
import logging
import copy
import pyfcm
logger = logging.getLogger(__name__)
class FCMError(Exception):
"""Base class for FCM exceptions"""
pass
class NotConnectedError(FCMError):
"""Exception... |
import pygame.display
# Main game drawing function
def draw_sprites(render_group, win, background):
"""
Draws the frame to be rendered.
- :param render_group:
A pygame LayeredUpdates sprite group which contains all of the sprites to be rendered on the given frame
- :param win:
A pygam... |
# coding: utf-8
import ipywidgets as ipyw
from IPython.display import display, HTML, clear_output
def js_alert(m):
js = "<script>alert('%s');</script>" % m
display(HTML(js))
return
|
"""Compressed Sparse Column matrix format"""
from __future__ import division, print_function, absolute_import
__docformat__ = "restructuredtext en"
__all__ = ['csc_matrix', 'isspmatrix_csc']
from warnings import warn
import numpy as np
from scipy.lib.six import xrange
from .base import isspmatrix
from .sparsetools... |
a1, b1 = map(int, input().split())
a2, b2 = map(int, input().split())
a3, b3 = map(int, input().split())
if [a1, b1, a2, b2, a3, b3].count(1) == 3 or [a1, b1, a2, b2, a3, b3].count(2) == 3 or [a1, b1, a2, b2, a3, b3].count(3) == 3 or [a1, b1, a2, b2, a3, b3].count(4) == 3:
print("NO")
else:
print("YES") |
#
# PySNMP MIB module GSM7224-SWITCHING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/GSM7224-SWITCHING-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:06:38 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... |
from unidecode import unidecode
import re
def slugify(text):
"""slugifies a string"""
text = unidecode(text).lower()
slug = re.sub(r'[\W_]+', '-', text)
while slug.endswith('-'):
slug = slug[:-1]
while slug.startswith('-'):
slug = slug[1:]
return slug
|
from os.path import join as pjoin, splitext, basename as pbasename
def generate_interface_emitter(target, source, env):
base = str(target[0])
return (['%s.pyf' % base], source)
def do_generate_fake_interface(target, source, env):
"""Generate a (fake) .pyf file from another pyf file (!)."""
# XXX: do t... |
#!/usr/bin/env python
"""
This is a script that will verify that all .py contained in our repo
contain our license and copyright.
if desired, this script can also modify each file and add the license and copyright
to each file
travis will run it with default arguments automatically, but for human use
Example:
de... |
"""
A :class:`~reclib.data.fields.field.Field` is some piece of data instance
that ends up as an array in a model.
"""
from reclib.data.fields.field import Field
from reclib.data.fields.metadata_field import MetadataField
|
# Copyright © 2020 Arm Ltd. All rights reserved.
# Copyright 2020 NXP
# SPDX-License-Identifier: MIT
import os
version_info = (23, 0, 0)
__dev_version_env = os.getenv("PYARMNN_DEV_VER", "")
if __dev_version_env:
__dev_version = "dev0"
try:
__dev_version = "dev{}".format(int(__dev_version_env))
ex... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.