text
stringlengths
1
927k
# -*- coding: utf-8 -*- def get_mode_number(nums): result, count = 0, 0 for num in nums: if result == num: count += 1 else: count -= 1 if count < 0: result = num count = 0 return result if __name__ == '__main__': nums = [3,3,4,4...
#!/usr/bin/env python3 import primes def test_primes(): assert primes.eratosthenes(60) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59] assert primes.eratosthenes(34) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]
# Generated by Django 2.0.1 on 2018-02-10 12:26 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('django_celery_beat', '0005_add_solarschedule_events_choices'), ] operations = [ migrations.AlterField( model_name='crontabschedul...
# Copyright (c) 2014-present PlatformIO <contact@platformio.org> # # 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...
# -*- coding: utf-8 -*- from __future__ import absolute_import from .. import backend as K from .. import activations from .. import initializers from .. import regularizers from .. import constraints from ..engine import Layer from ..engine import InputSpec from ..utils import conv_utils from ..legacy import interfac...
import numpy as np from piece import Piece import time from scipy.ndimage import convolve class Board: def __init__(self, size = 20, player_colors = [1,2,3,4]): self.size = size self.board = np.zeros((size,size), dtype = int) self.start_squares = [[0,0], [0, size-1], [size-1, 0], [size-1, size-1]] self.playe...
import pytest from diofant import Float, I, Matrix, Rational, Symbol, pi, sqrt from diofant.geometry import Line, Point __all__ = () x = Symbol('x', real=True) y = Symbol('y', real=True) z = Symbol('z', real=True) t = Symbol('t', real=True) k = Symbol('k', real=True) x1 = Symbol('x1', real=True) x2 = Symbol('x2', r...
import main import robocup import behavior import constants import enum import math import composite_behavior import skills.move import evaluation.ball import evaluation.passing_positioning import evaluation.passing import evaluation.shooting import functools import plays.Legacy.adaptive_formation # 2 midfielder rel...
import json from .entry import EntryClass SIGNUP_URL = '/api/v1/auth/signup' LOGIN_URL = '/api/v1/auth/login' class TestAuth(EntryClass): """ Add tests for Auth """ def test_user_registration(self): """ Test user registration works correcty """ response = self.client.post(SIGNUP_URL, ...
"""Test the module rbfopt_utils in RBFOpt. This module contains unit tests for the module rbfopt_utils. Licensed under Revised BSD license, see LICENSE. (C) Copyright International Business Machines Corporation 2016. """ from __future__ import print_function from __future__ import division from __future__ import ab...
#! /usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (C) 2017 IBM Corporation 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 ...
# -*- coding: utf-8 -*- # # STSCI documentation build configuration file, created by # sphinx-quickstart on Thu Oct 22 17:25:41 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All...
import re import nltk import random import os # Download Alice's Adventures in Wonderland if it is not yet present def read_alice_in_wonderland(): alice_file = 'alice.txt' alice_raw = None if not os.path.isfile(alice_file): from urllib import request url = 'http://www.gutenberg.org/cache/e...
import tensorflow as tf import keras.backend.tensorflow_backend as ktf from keras.callbacks import ModelCheckpoint from soclevr import load_all, Timer import os import argparse import numpy as np from model import RN, RN2 def run(attempt, gpunum): os.environ["CUDA_VISIBLE_DEVICES"] = gpunum def get_session(gp...
#!/usr/bin/env python import gzip import sys def readConversionFiles(chromosome_accessions): accession_to_chrom = {} ip = open(chromosome_accessions, 'r') for line in ip: if (line[0] != '#'): fields = line.strip().split("\t") if (fields[0] == "MT"): chrom =...
"""Firstnames Database from Github User MatthiasWinkelmann. Source: - https://github.com/MatthiasWinkelmann/firstname-database """ import sys from pathlib import Path import pandas as pd sys.path.append(str(Path(__file__).parent.parent)) import utils as ut # noqa names_url = "https://raw.githubusercontent.com...
import functools import inspect from functools import partial from django import forms from django.apps import apps from django.core import checks, exceptions from django.db import connection, router from django.db.backends import utils from django.db.models import Q from django.db.models.constants import LOOKUP_SEP f...
import numpy as np import matplotlib.pyplot as plt import pandas as pd names=['AGE','TB','DB','TP','Albumin','A/G','sgpt','sgot','ALKPHOS','GENDER'] dataset=pd.read_csv("Indian Liver Patient Dataset.csv") ##||REMOVING NAN FILES AS COLLEGE GAVE BAD DATASET||## dataset1=dataset.dropna(subset = ['AGE','TB','DB','TP','Al...
#!/usr/bin/python # Copyright (c) 2017-2019 Forcepoint ANSIBLE_METADATA = { 'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community' } DOCUMENTATION = ''' --- module: policy_push short_description: Deploy a policy to an engine description: - Each NGFW engine requires that an existi...
#!/usr/bin/env python """ A script to demonstrate how to use your own source model """ import bilby import numpy as np # First set up logging and some output directories and labels outdir = 'outdir' label = 'create_your_own_source_model' sampling_frequency = 4096 duration = 1 # Here we define out source model - this...
# -*- coding: utf-8 -*- # Generated by Django 1.11.11 on 2019-07-04 09:07 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('user', '0004_auto_20190702_1359'), ] operations = [ migrations.AlterField(...
# max length of junction read overlap to consider a target site duplication MAX_TSD = 20
#!/usr/bin/env python import io from setuptools import setup, find_packages readme = io.open("README.md").read() setup( name="migra", version="1.0.1531741707", url="https://github.com/djrobstep/migra", description="Like diff but for PostgreSQL schemas", long_description=readme, long_descriptio...
import pygame, time, math from pygame.locals import * class Box(pygame.sprite.Sprite): def __init__(self, x, y): # Call the parent class constructor pygame.sprite.Sprite.__init__(self) # Get the main window's display self.surface = pygame.display.get_surface() ...
import pprint from datetime import datetime import cdx_toolkit import pandas as pd import tqdm from typing import Optional from python import * from python.pipeline import GLOBAL, ComponentBase, DEVELOPMENT_MODE class CommonCrawl(ComponentBase): TIMESTAMP_FORMAT = "%Y%m%d%H%M%S" # applies to wayback machine a...
import time from tronx import app from pyrogram import filters from pyrogram.types import Message @app.bot.on_message(filters.command("start")) async def send_response(_, m: Message): await m.reply("How can i help you ?") @app.bot.on_message(filters.new_chat_members & filters.group) async def added_to_group_m...
import pdb import pickle import pandas as pd import os import numpy as np import sys sys.path.insert(1,"../") sys.path.insert(1,"../../") sys.path.insert(1,"../../../") from config_u import base project_base_path = base current_path = "scripts/cpmg/pathologic_classification/" sys.path.insert(1, os.path.join(project_b...
# Generated by Django 3.2.7 on 2021-09-19 05:37 import django.contrib.auth.validators from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0001_initial'), ] op...
from .megapix_scaler import MegapixScaler class MegapixDownscaler(MegapixScaler): @staticmethod def force_downscale(scale): return min(1.0, scale) def set_scale(self, scale): scale = self.force_downscale(scale) super().set_scale(scale)
import argparse import os from ppcls.modeling import architectures import paddle.fluid as fluid import paddle_serving_client.io as serving_io def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("-m", "--model", type=str, default='ResNet50_vd') parser.add_argument("-p", "--...
# SPDX-License-Identifier: Apache-2.0 # Copyright Contributors to the Rez Project from Qt import QtCore, QtWidgets from rezgui.objects.App import app from rezgui.mixins.ContextViewMixin import ContextViewMixin from rezgui.widgets.ToolWidget import ToolWidget class VariantToolsList(QtWidgets.QTableWidget, ContextVie...
""" Miscellaneous site endpoints """ from peewee import SQL from flask import Blueprint, redirect, url_for, abort, render_template from flask_login import login_required from .. import misc from ..models import SiteLog, SubPost, SubLog, Sub, SubPostComment from ..misc import engine bp = Blueprint('site', __name__) @...
import numpy as np import cv2 # ------------------Standard Type Tables------------------ NUMPY_TYPES = (np.uint8, np.int8, np.uint16, np.int16, np.int32, np.float32, np.float64, np.complex64, np.compl...
""" sleekxmpp.xmlstream.xmlstream ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module provides the module for creating and interacting with generic XML streams, along with the necessary eventing infrastructure. Part of SleekXMPP: The Sleek XMPP Library :copyright: (c) 2011 Nathanael C. Fritz :...
""" Django settings for djangobackend project. Generated by 'django-admin startproject' using Django 3.1.3. For more information on this file, see https://docs.djangoproject.com/en/3.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.1/ref/settings/ """ import ...
import os import copy import time import decimal import operator import numpy as np from distutils.dir_util import copy_tree from nball4tree.config import cgap, L0, R0, DIM, DECIMAL_PRECISION from nball4tree.util_train import get_children from nball4tree.util_vec import vec_norm, qsr_DC, qsr_DC_degree, qsr_P, qsr_P_deg...
## Maior e Menor da Sequência for c in range(1,6): peso=float(input('Digite o peso da {}ª pessoa: '.format(c))) if c == 1: leve=peso pesado=peso if peso <= leve: leve = peso if peso >= pesado: pesado = peso print('='*30) print('O mais pesado foi {}Kg'.format(pesado)) print('O mais lev...
# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve. # # 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...
import json import logging import aiohttp from opsdroid.connector import Connector from opsdroid.message import Message _LOGGER = logging.getLogger(__name__) GITHUB_API_URL = "https://api.github.com" class ConnectorGitHub(Connector): def __init__(self, config): """Setup the connector.""" logg...
import _plotly_utils.basevalidators class ColorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="color", parent_name="waterfall.totals.marker", **kwargs ): super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=...
# coding: utf-8 """ vnas Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import ncloud_vnas from ncloud_vnas.api.v2_api import V2Api # noqa: E501 from ncloud_vnas.rest import ApiException class TestV2Api(unittest.TestCase)...
""" Created on Tue Jun 23 20:15:11 2020 @author: sarroutim2 """ """Genearates a representation for an image input. """ import torch.nn as nn import torch import torchvision.models as models class EncoderCNN(nn.Module): """Generates a representation for an image input. """ def __init__(self, output_siz...
from typing import Optional from bomber_monkey.features.board.board import Tiles, TileEffect, Cell from bomber_monkey.features.physics.collision import Collision from bomber_monkey.features.player.stronger import Stronger from bomber_monkey.game_config import GameConfig from python_ecs.ecs import System, Simulator, Co...
import pdf_to_json as p2j import json url = "file:data/multilingual/Latn.PCD/Serif_8/udhr_Latn.PCD_Serif_8.pdf" lConverter = p2j.pdf_to_json.pdf_to_json_converter() lConverter.mImageHashOnly = True lDict = lConverter.convert(url) print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True))
# Generated by Django 3.0.4 on 2020-04-28 14:50 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('events', '0004_auto_20200428_1325'), ] operations = [ migrations.RemoveIndex( model_name='event', ...
import ctypes import mpi4py.MPI import numpy as np import chainer.backends try: import cupy as cp _cupy_avail = True except Exception: _cupy_avail = False class HostPinnedMemory(object): def __init__(self): if not _cupy_avail: raise RuntimeError('HostPinnedMemory cannot be used:...
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
_base_ = [ '../_base_/models/mask_rcnn_r50_fpn.py', '../_base_/datasets/coco_instance.py', '../_base_/default_runtime.py' ] model = dict( pretrained='pretrained_model/resnet50-19c8e357.pth', rpn_head=dict( _delete_=True, type='GARPNHead', in_channels=256, feat_channel...
import sys import pytest from dagster import ( DagsterExecutionStepExecutionError, DagsterInvariantViolationError, DependencyDefinition, EventMetadataEntry, Failure, InputDefinition, Output, OutputDefinition, PipelineDefinition, RunConfig, SolidDefinition, check, ex...
# # Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. # # note that any print to stdout will break node manager because its uses # stdout as communication channel and gratitious text there will break it. # stderr should be fine import sys import gevent from gevent import monkey if not 'unittest' in sys.mo...
import numpy as np, itertools as itt from scipy.linalg import expm, inv from pytriqs.operators import c as C, c_dag as CDag, n as N, dagger from cdmft.gfoperations import sum from cdmft.transformation import GfStructTransformationIndex class Hubbard: """ meant as abstract class, realization needs self._c(s, ...
import os import sys import time from copy import copy import matplotlib.pyplot as plt import numpy as np # from impedance.circuits import Randles, CustomCircuit if __package__: # can import directly in package mode print("importing actions from package path") else: # interactive kernel mode requires path...
""" Adobe character mapping (CMap) support. CMaps provide the mapping between character codes and Unicode code-points to character ids (CIDs). More information is available on the Adobe website: http://opensource.adobe.com/wiki/display/cmap/CMap+Resources """ import sys import os import os.path import gzip try: ...
import errno import json import logging import os from collections import OrderedDict from six import string_types from galaxy import util from galaxy.tools.data import TabularToolDataTable from galaxy.util.template import fill_template log = logging.getLogger(__name__) SUPPORTED_DATA_TABLE_TYPES = (TabularToolData...
#!/usr/bin/env python #-----ButtonBot.py-----# # # # made by /u/J08nY # # v2.3 # # # #----------------------# from urllib import urlencode import httplib from websocket import create_connection import re from random import choice import time from calendar i...
import unittest import os from programy.utils.security.authorise.usergrouploader import UserGroupLoader class UserGroupLoaderTests(unittest.TestCase): def test_load_from_file(self): loader = UserGroupLoader() users_dict, groups_dict = loader.load_users_and_groups_from_file(os.path.dirname(__file...
from huepy import cyan, bold menu_sites = { "Social Media": { "Facebook", "Google", "LinkedIn", "Twitter", "Instagram", "Snapchat", "FbRobotCaptcha", "VK", "Github", }, "Others": { "StackOverflow", "Wordpress", "Steam", } } SF_PROMPT = cyan(" Phishme > ") def colorize_option(chave, valor)...
from datetime import datetime from difflib import SequenceMatcher from consts.account_permissions import AccountPermissions from consts.event_type import EventType from controllers.suggestions.suggestions_review_base_controller import \ SuggestionsReviewBaseController from database.event_query import EventListQuer...
#!/usr/bin/python3 # -*-coding:utf-8-*- __author__ = "Bannings" from typing import List class Solution: def canJump(self, nums: List[int]) -> bool: max_right = 0 for i in range(len(nums)): if i > max_right: return False max_right = max(nums[i] + i, max_right) retur...
# %% IMPORTS # Package imports from matplotlib.cm import register_cmap from matplotlib.colors import ListedColormap # All declaration __all__ = ['cmap'] # Author declaration __author__ = "Ellert van der Velden (@1313e)" # Package declaration __package__ = 'cmasher' # %% GLOBALS AND DEFINITIONS # Type of this color...
#!/usr/bin/env python # -- coding: utf-8 -- #2019年6月1日 #Ver1.0 #---Guofeng----- #gf@gfshen.cn #package: pose_vision_estimation #根据摄像机采集的图像数据,识别前车aruco标志板的相对位姿 #describe: riki16/image_raw #publish: PoseEstimated.msg #依赖环境运行环境 numpy, cv2,cv2.aruco import roslib#; roslib.load_manifest('teleop_twist_keyboard') import r...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 30 17:00:15 2021 @author: ombretta """ import os from tensorboard.backend.event_processing.event_accumulator import EventAccumulator import numpy as np from matplotlib import pyplot as plt import json import sys def main(dirs_dataset_filter="mnis...
# -*- coding: utf-8 -*- # Copyright (c) 2019, stephen and Contributors # See license.txt from __future__ import unicode_literals import frappe import unittest class TestVehicleMake(unittest.TestCase): pass
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('carts', '0010_cart_tax_percentage'), ] operations = [ migrations.AlterField( model_name='cart', name...
"""This file is where all our default parameters will be placed. """ # The number of days we use to calculate R_0 R0_WINDOW = 14 # The serial interval, an empirically measured number that is the number # of days it takes a person who has just gotten COVID-19 to be come # infections. Right now I have set that number t...
# ---------------------------------------------------------------------------- # Copyright (c) 2016-2017, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
""" Code illustration: 5.06 @Tkinter GUI Application Development Blueprints """ class Model: def __init__(self): self.__play_list = [] @property def play_list(self): return self.__play_list def get_file_to_play(self, file_index): return self.__play_list[file_index] def...
""" We will begin our implementation of a binary heap with the constructor. Since the entire binary heap can be represented by a single list, all the constructor will do is initialize the list and an attribute `current_size` to keep track of the current size of the heap. The code below shows the Python code for the con...
from flask_logconfig import LogConfig import logging import json import traceback from flask import g, ctx, request from flask_sqlalchemy import SQLAlchemy import collections # Add custom log level for performance platform logs PERFORMANCE_PLATFORM_LOG_LEVEL_NUM = 51 logging.addLevelName(PERFORMANCE_PLATFORM_LOG_LEVEL...
import optparse import configparser from os import environ, path from pathlib import Path from sys import argv from common.bitmovin_argument import BitmovinArgument class ConfigProvider(object): _properties = { "BITMOVIN_API_KEY": BitmovinArgument("Your API key for the Bitmovin API.", True), ...
class Mancala: def __init__(self): print("(python) Mancala::init") self.state = 0 def get_state(self): print("(python) Mancala::get_state") self.state += 1 return "(python) current state: {!r}".format(self.state) def play_position(self, value): print("(pytho...
import base64 import datetime import hashlib import logging import time import uuid from django.db import models from couchdbkit import ResourceNotFound from couchdbkit.exceptions import PreconditionFailed from dimagi.ext.couchdbkit import ( DocumentSchema, DateTimeProperty, StringProperty, DictPrope...
import pytest from godot import RID, Environment, Node @pytest.fixture def generate_obj(): objs = [] def _generate_obj(type): obj = type.new() objs.append(obj) return obj yield _generate_obj for obj in objs: obj.free() def test_base(): v = RID() assert typ...
from sonar.ipfs import IPFS def test_retrieval_of_stored_obj(): storage = IPFS(host='127.0.0.1', port=5001) obj_to_store = {'foo': 'bar'} address = storage.store(obj_to_store) retrieved_obj = storage.retrieve(address) assert retrieved_obj == obj_to_store
""" Django settings for onsen project. Generated by 'django-admin startproject' using Django 1.9.8. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import os # B...
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2018-04-04 22:51 from __future__ import unicode_literals from django.db import migrations def remove_orphaned_sections(apps, schema_editor): Section = apps.get_model('content.Section') IconCard = apps.get_model('content.IconCard') PhotoCard = apps.g...
"""Provides the underlying transport functionality (for stomp message transmission) - (mostly) independent from the actual STOMP protocol """ import logging import math import random import sys import threading import time import re from stomp.connect import BaseConnection from stomp.protocol import Protocol11 from ...
# # PySNMP MIB module TPT-PORT-MAPPING-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPT-PORT-MAPPING-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:19:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
import os from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric import rsa from cryptography.hazmat.backends import default_backend from dcr.scenario_utils.common_utils import random_alphanum class OpenSshKey(object): """ Represents an OpenSSH key pair. ...
import nxsdk.net.net from dft_loihi.visualization.plotting import Plotter from dft_loihi.dft.field import Field from dft_loihi.dft.kernel import MultiPeakKernel from dft_loihi.inputs.simulated_input import GaussPiecewiseStaticInput from dft_loihi.dft.util import connect # set up the network net = nxsdk.net.net.NxNet...
""" pdf.py Copyright 2006 Andres Riancho This file is part of w3af, http://w3af.org/ . w3af 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 version 2 of the License. w3af is distributed in the hope that it will...
from pylabber.views.defaults import DefaultsMixin from research.filters.procedure_filter import ProcedureFilter from research.models.procedure import Procedure from research.serializers.procedure import ( ProcedureSerializer, ProcedureItemsSerializer, ) from rest_framework import viewsets from rest_framework.de...
#!/usr/bin/env python2 # Copyright (c) 2014-2015 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # Base class for RPC testing # Add python-bitcoinrpc to module search path: import os import sys import...
import collections from contextlib import suppress import json import os, os.path import string import logging logging.basicConfig(level=logging.DEBUG) from logging import debug, info, warning, error, critical panic=critical from Sorter import parser, cli from Sorter.Taxon import tag tag_counts = collections.Count...
#!/usr/bin/env python import os, sys, csv, time path = os.path.dirname(os.path.abspath(sys.argv[0])) STANDARD_FILE=os.path.join(path,'defstd.csv') STANDARD_NAME=0 STANDARD_ELEMENT=1 STANDARD_QTY=2 SAMPLE_NAME=0 SAMPLE_DATE=2 SAMPLE_ELEMENT=4 SAMPLE_QTY=9 def is_standard(label, element, standards): """Check if a la...
import json import jsonlines import tqdm import random import re from random import shuffle import PIL from PIL import Image import numpy as np import os.path as osp from torch.utils.data import Dataset import lmdb import cv2 import math random.seed(100) FLAG_TRAIN = True train = 'data_v3/label_ensemble_clean_600w_100...
# Copyright 2009-2014, Simon Kennedy, sffjunkie+code@gmail.com # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
from .vectors import *
# Copyright 2018-2021 Xanadu Quantum Technologies Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or...
from typing import Tuple from typing import List from typing import Optional import math import mediapipe as mp import numpy as np import cv2 as cv mp_face_detection = mp.solutions.face_detection mp_drawing = mp.solutions.drawing_utils def _normalized_to_pixel_coordinates( normalized_x: float, normalized_y: ...
"""Data handler for HACS.""" import asyncio import os from homeassistant.core import callback from custom_components.hacs.helpers.classes.manifest import HacsManifest from custom_components.hacs.helpers.functions.register_repository import ( register_repository, ) from custom_components.hacs.helpers.functions.sto...
""" This file is to train data with a machine learning model """ # Let's import libraries import pickle import pandas as pd from xgboost import XGBRegressor from sklearn import linear_model from sklearn.base import BaseEstimator, RegressorMixin from sklearn.model_selection import train_test_split from sklearn.metr...
#!/usr/bin/env python """Train a model remotely using Azure ML compute. This will re-use the current python environment. Argv: output-dir: A folder to store any output to kernel: Kernel type to be used in the algorithm penalty: Penalty parameter of the error term """ import argparse import sys import az...
import logging import sys import numpy as np import scipy.sparse as sps from simf.initialization import a_col, random_normal, bias_from_data, bias_zero class BaseFactorization(object): def __init__(self, max_iter=20, epsilon=0, regularization=0.02, learning_rate=0.01, init_method='random', bias=True, ...
# 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 logging from typing import List, Optional import torch from torch import nn from fairseq.models import (FairseqEncoder, FairseqEncode...
import httplib import requests from st2actions.runners.pythonrunner import Action __all__ = [ 'SendEmailAction' ] SEND_EMAIL_API_URL = 'https://api.mailgun.net/v2/%(domain)s/messages' class SendEmailAction(Action): def run(self, sender, recipient, subject, text=None, html=None): if not text and no...
""" Implementation of the PEP 3156 Event-Loop with Qt. Copyright (c) 2018 Gerard Marull-Paretas <gerard@teslabs.com> Copyright (c) 2014 Mark Harviston <mark.harviston@gmail.com> Copyright (c) 2014 Arve Knudsen <arve.knudsen@gmail.com> BSD License """ __author__ = ( "Sam McCormack", "Gerard Marull-Paretas <ge...
import subprocess as sub from qhue import Bridge b = Bridge("192.168.0.99", "username") print b.url print b.lights[1]() p = sub.Popen(('sudo', 'tcpdump', '-e', '-i', 'eth0', 'arp', '-l'), stdout=sub.PIPE) for line in iter(p.stdout.readline, b''): if line.rstrip().find("50:f5:da:ed:55:8f") >= 0: print "Found th...
# -*- coding: utf-8 -*- import os, sys; sys.path.insert(0, os.path.join("..")) import time import random import codecs import unittest from pattern import vector from pattern.en import Text, Sentence, Word, parse from pattern.db import Datasheet try: PATH = os.path.dirname(os.path.abspath(__file__)) except: ...
# (C) Datadog, Inc. 2010-2017 # All rights reserved # Licensed under Simplified BSD License (see LICENSE) ''' HDFS NameNode Metrics --------------------- hdfs.namenode.capacity_total Total disk capacity in bytes hdfs.namenode.capacity_used Disk usage in bytes hdfs.namenode.capac...