content
stringlengths
5
1.05M
def plot_precision_recall_n(y_true, y_prob, model_name): # Weird because precision & recall curves have n_thresholds + 1 values. Their last values are fixed so throw away last value. y_score = y_prob from sklearn.metrics import precision_recall_curve precision_curve, recall_curve, pr_thresholds = precision_recall_c...
# This code is under BSD license. See license-bsd.txt import sys, os, os.path, subprocess import zipfile from fabric.api import * from fabric.contrib import * # TODO: could also automate the following: # - if /etc/nginx/sites-available/apptranslator doesn't exist, # copy scripts/nginx.conf as /etc/nginx/sites-avail...
from uuid import uuid4 from hazelcast import future from hazelcast.protocol.codec import executor_service_submit_to_address_codec, executor_service_shutdown_codec, \ executor_service_is_shutdown_codec, executor_service_cancel_on_address_codec, \ executor_service_cancel_on_partition_codec, executor_service_submi...
from prime_check import isprime list = [] for num in range(10,1000000): next = True for i in range(1,1+len(str(num))): str_n = '' for j in range(1,i+1): str_n += str(num)[j-1] if not isprime(int(str_n)): next = False break...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Released under the MIT license (http://choosealicense.com/licenses/mit/). # For more information see https://github.com/rblankley/rpi-grove/blob/master/LICENSE # from enum import Enum from i2c_device import I2C_Device from grove_ports import Grove_Analog_Port, Grove_D...
# -*- coding: utf8 -*- # Copyright (c) 2019 Niklas Rosenstein # # 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, mo...
#!/usr/bin/env python3 # coding: utf-8 import os def get_path(p): return os.path.join(os.path.dirname(__file__), p) TEST_CFG = get_path("test_data/test_config.ini") TEST_CFG_MULTITASK = get_path("test_data/test_config_multitask.ini") TEST_JSONL = get_path("test_data/test_jsonl.jsonl") TEST_REFERENCES = get_pat...
import pytest import torch from torch.autograd import gradcheck from torch.testing import assert_allclose from kornia import enhance from kornia.testing import tensor_to_gradcheck_var, BaseTester class TestEqualization(BaseTester): def test_smoke(self, device, dtype): C, H, W = 1, 10, 20 img = t...
# # serialize.py # # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import struct import hashlib def deser_string(f): nit = struct.unpack("<B", f.read(1))[0] if nit == 253: nit = struct.unpack("<H", f.read(2))[0] elif ...
# Autogenerated file. from .client import MotionClient # type: ignore
import subprocess def get_output(cmd): ret = '' try: ret = subprocess.check_output(cmd.split()).decode('utf-8') except subprocess.CalledProcessError: # pragma: no cover pass return ret class Format(object): BOLD = get_output('tput bold') RESET = get_output('tput sgr0') ...
# All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
import os from collections import OrderedDict from numbers import Number import skimage import numpy as np import tensorflow as tf import tensorflow_probability as tfp from flatten_dict import flatten from softlearning.models.utils import flatten_input_structure from .rl_algorithm import RLAlgorithm from softlearning...
# We represent an n-bit string --- that is, an element of {0, 1}^n --- in Python as a tuple of 0s and 1s. def string(n, m): '''Converts a non-negative Python integer m to its corresponding bit string. As necessary, pads with leading 0s to bring the number of bits up to n.''' s = () while m >= 1: ...
# import picamera from django.conf import settings from pyfirmata import Arduino, util class Car: def __init__(self): self._board = None # пины тягового двигателя self._pull_direction_pin = settings.PIN_H1 self._pull_force_pin = settings.PIN_E1 # пины руля self._ru...
#!/usr/bin/env python # $Id$ """ ? solutions """ import puzzler from puzzler.puzzles.tetrasticks import OneSidedTetrasticks8x8ClippedCorners2 puzzler.run(OneSidedTetrasticks8x8ClippedCorners2)
''' You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation. Example: [[1,2,3], ...
from . import tar from . import zip from . import lha from . import rar from . import cab from . import szip
# The Nexus software is licensed under the BSD 2-Clause license. # # You should have recieved a copy of this license with the software. # If you did not, you can find one at the following link. # # http://opensource.org/licenses/bsd-license.php import apsw, traceback from collections import deque from threading impor...
#!/usr/bin/env python3 import re import subprocess import sys from typing import List, NoReturn, Optional, Tuple python_version: Tuple[int, int] = (3, 9) cmake_version: Tuple[int, int] = (3, 14) arduino_cli_version: Tuple[int, int] = (0, 19) python_version_pattern: re.Pattern = re.compile( r"Python (?P<version>[...
""" Sample data from NCNR-NG7. This data from July, 2004, measures water with various concentrations for D2O on quartz. The particular data sets contain 20% D2O. TODO: Confirm this is correct by looking in log books! """ import numpy, os import reflectometry.reduction as reflred PATH = os.path.dirname(os.path.real...
#contains classes and tools to get py file elements by inspection. import types import inspect class module_tools(object): #class that handles basic functions of python module def get_py(name): mod = __import__(name) return mod def get_source(name): mod = __import__(name) r...
class Solution: def main(self): n = int(input()) coin_list = list(map(int, input().split())) m = int(input()) dp = [1]+[0]*(m) for coin in coin_list: for i in range(coin, m+1): # dp[i]: 이번 coin을 안쓰고 만들 수 있는 경우의 수 # dp[i-c...
# age should be between 18 and 65 age = 22 # if age >= 18 and age < 65: if 18 <= age < 65: print("Eligible")
import re import json from flask import request from sqlalchemy import tuple_, or_, select, text, func from vardb.datamodel import ( sample, assessment, allele, gene, workflow, annotationshadow, user as user_model, ) from api import schemas from api.v1.resource import LogRequestResource fro...
#!/usr/bin/python import re, sys, os from bs4 import BeautifulSoup import simplejson as json import argparse from htmltoken import tokenize import cgi import util import io def genescaped(text): """All tokens in TEXT with any odd characters (such as <>&) encoded using HTML escaping""" for tok in tokenize(text...
from eth_utils import to_canonical_address, to_checksum_address from raiden.constants import UINT256_MAX from raiden.transfer.architecture import ( ContractSendEvent, ContractSendExpirableEvent, Event, SendMessageEvent, ) from raiden.transfer.state import BalanceProofSignedState from raiden.utils impor...
import re from collections import namedtuple from typing import Dict, List import requests from bs4 import BeautifulSoup from bs4.element import Tag BASE_URL = "https://mugen.spriteclub.tv" character_cache = {} CharacterStats = namedtuple("CharacterStats", ("health", "power", "attack", "defense")) CharacterRecord =...
""" Reference implementation for the Frostbyte smart contract protocol. """ import argparse # # https://rich.readthedocs.io/en/latest/ # from rich import box # from rich.console import Console # from rich.panel import Panel def frostbyte() -> None: """ Script for the `frostbyte` command. """ ...
# -*- coding: utf-8 -*- class Solution: def flipAndInvertImage(self, A): return [[1 - el for el in row[::-1]] for row in A] if __name__ == '__main__': solution = Solution() assert [ [1, 0, 0], [0, 1, 0], [1, 1, 1], ] == solution.flipAndInvertImage([ [1, 1, 0]...
# -*- coding: utf-8 -*- import os from flask import abort, render_template, render_template_string, request, send_from_directory, url_for from jinja2 import TemplateNotFound from source import app, controller as c, model as m, pages from flask_flatpages import pygments_style_defs framework = app.config['PELLETRON_F...
# ========================================================= # import unittest import polygon from polygon import cred import datetime from requests.models import Response import asyncio import pytz from httpx import Response as HttpxResponse # ========================================================= # # Test Runners...
from arguments import args, parser import csv import numpy as np import torch from torchvision import transforms, datasets import torch.backends.cudnn as cudnn #################### Distributed learning setting ####################### import torch.distributed as dist import torch.multiprocessing as mp import torch.util...
from django.urls import path from . import views urlpatterns = [ path("", views.store, name="store"), path("<slug:category_slug>/", views.store, name="products_by_category"), path("<slug:category_slug>/<slug:product_slug>/", views.product_detail, name="product_detail"), ]
import re import requests from scrapy_facebooker.faceblib.url import get_facebook_url_from_username def get_facebook_page_id(username): """ Get Facebook page id :param username: Username of the facebook page that its page id will be fetched. :return: Facebook page id....
# Copyright (c) 2019 The Zcash developers # Distributed under the MIT software license, see the accompanying # file COPYING or https://www.opensource.org/licenses/mit-license.php. # # Common code for testing z_mergetoaddress before and after sapling activation # from test_framework.authproxy import JSONRPCException f...
#!/usr/bin/env python """ conference.py -- Conference server-side Python App Engine API; uses Google Cloud Endpoints """ from datetime import datetime from datetime import time from google.appengine.api import taskqueue, urlfetch, memcache from google.appengine.ext import ndb from models import BooleanMessage, Da...
# Copyright (C) 2021 Alberto Maria Metelli, Alessio Russo, and Politecnico di Milano. All rights reserved. # Licensed under the Apache 2.0 License. from scipy.optimize import root_scalar import numpy as np import matplotlib.pyplot as plt from ..dataset.regression import ActionDist def estimate_lambda(weights, n, del...
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved. """ Tests constants, optional, and keyword arguments. """ import dace import numpy as np import pytest def test_kwargs(): @dace.program def kwarg(A: dace.float64[20], kw: dace.float64[20]): A[:] = kw + 1 A = np.random.ran...
import numpy as np import scipy.signal as sp def find_template_1D(t, s): c = sp.correlate2d(s, t, mode='valid') raw_index = np.argmax(c) return raw_index s = np.array([[-1, 0, 0, 5, 1, 1, 0, 0, -1, -7, 2, 1, 0, 0, -1]]) t = np.array([[-1, -7, 2]]) print "Signal: \n {} \n {}".format(np.array(range(s.sha...
# Programa para aproximar derivadas e integrais para funções arbitrárias numericamente. def approx_derivative(f, x, delta=1e-6): return (f(x + delta) - f(x - delta)) / (2 * delta) def approx_derivative_2(f, delta = 1e-6): return lambda x: (f(x + delta) - f(x - delta)) / (2 * delta) def approx_integral(f, lo,...
import random import pytest from CreeDictionary.API.models import Definition, Wordform from CreeDictionary.cvd import extract_keyed_words from CreeDictionary.cvd.definition_keys import ( definition_to_cvd_key, cvd_key_to_wordform_query, ) FAKE_WORD_SET = {"loose", "leaf", "paper", "news_paper", "you're", "th...
# Brute Force: O(n ** 2) def get_pair(data, k): for i in xrange(len(data)): for j in xrange(i + 1, len(data)): if data[i] + data[j] == k: return data[i], data[j] return "NA" # Sorting: O(nlogn) def get_pair_sorting(data, k): data.sort() l = 0 r = len(data) - 1 ...
import unittest import os import tarfile import torch from ruamel.yaml import YAML from nemo.core.neural_types import * from .context import nemo, nemo_asr from .common_setup import NeMoUnitTest class TestZeroDL(NeMoUnitTest): labels = ["'", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l...
#!/usr/bin/env python3 """ absb_instr.py Implementation of ABSB format instructions. """ from pyvex.lifting.util import Type, Instruction import bitstring from .logger import log_this class ABSB_ST_T_Inst(Instruction): """ Store Bit instruction: op = 0xD5 op2 = 0x00 (2-bit) User Status Fl...
from .geojson_to_shp import geojson_to_shp from .shp_to_geojson import shp_to_geojson
# coding: utf-8 """ App Center Client Microsoft Visual Studio App Center API # noqa: E501 OpenAPI spec version: preview Contact: benedetto.abbenanti@gmail.com Project Repository: https://github.com/b3nab/appcenter-sdks """ from __future__ import absolute_import import re # noqa: F401 # pytho...
import ham_package.ham_module import eggs_package.eggs_module import spam_package.spam_module ham_package.ham_module.ham() eggs_package.eggs_module.eggs() spam_package.spam_module.spam()
''' Three different types of search ''' def simpleSearch(query,inverted_index): if query not in inverted_index: return 'No Results' #get the list from inverted dictionary results = inverted_index[query] #remove the repeat name sorted_result = list(set(results)) #dictionary to store ...
""" Module définissant les **Exception** du moteur de l'intelligence artificielle et des stratégies. """ class StopPlayerError(Exception): """ Est levée si le moteur est incapable d'envoyer la commande pour arrêter les joueurs. """ pass
''' Задание Ultra Lite 1. В master создать несколько своих модулей 2. Создать новую ветку 3. Написать в новой ветке различные способы импорта модулей и импорта функций 4. Сделать commit, push, pull-request ''' def fun1_1(): print('module1 func 1') def fun1_2(): print('module1 func 2')
from ..grpc_gen.common_pb2 import ConsistencyLevel LOGICAL_BITS = 18 LOGICAL_BITS_MASK = (1 << LOGICAL_BITS) - 1 EVENTUALLY_TS = 1 BOUNDED_TS = 2 DEFAULT_CONSISTENCY_LEVEL = ConsistencyLevel.Bounded
import os import shutil import tarfile import urllib.request as request from contextlib import closing from glob import glob from io import StringIO from os.path import join import numpy as np import pandas as pd from tqdm import tqdm DST = "../pgs_data" LIST = join(DST, "pgs_scores_list.txt") # urls: LIST_FILE = "h...
import argparse import os import re import sys import codecs import tempfile from subprocess import Popen, PIPE, call def println(msg): sys.stdout.write(msg) sys.stdout.write('\n') sys.stdout.flush() return msg class Runner: pass_count = 0 fail_count = 0 stop_on_fail = False results ...
# Acesso as elementos da tupla numeros = 1,2,3,5,7,11 print(numeros[0]) print(numeros[1]) print(numeros[2]) print(numeros[3]) print(numeros[4]) print(numeros[5])
''' Created on Feb 29, 2012 @author: mchrzanowski ''' from time import time NUMBER_LIMIT = 10 SOLUTION_SIZE = 16 GON_NUMBER = NUMBER_LIMIT / 2 def initializeSummationDict(): ''' create all possible combinations of all possible totals using 3 numbers from 1..NUMBER_LIMIT''' summationDict = {} for i in xr...
import numpy as np from scipy.integrate import quad from scipy.stats import norm import torch import torch.nn as nn def _calc_fan_in_out(layer): if isinstance(layer, nn.Linear): fan_in = layer.weight.shape[1] fan_out = layer.weight.shape[0] return (fan_in, fan_out) if isinstance(layer, nn.Conv2d): ...
from myhdl import * from unittest import TestCase from ovenbird import * class VivadoVectorOr(VivadoIP): def __init__(self): port_mappings = { 'in_A': (intbv(0)[8:], PortDirection.input, 'Op1'), 'in_B': (intbv(0)[8:], PortDirection.input, 'Op2'), 'output': (intbv(0)[...
import sys import PyFBA def suggest_reactions_without_proteins(reactions, verbose=False): """ Identify a set of reactions that don't have any proteins associated with them. It is generally a bad idea to add all of these to your model since there are about 30,000 and they will probably break your com...
# extract_field_from_characterization_xml.py from xml.etree import ElementTree def extract_field_from_characterization_xml(characterization_string: str, field_to_extract: str) -> str: """ Extract a field from the XML characterization given the full path of the field_to_extract """ characterization_string = _s...
# (C) Datadog, Inc. 2019-present # All rights reserved # Licensed under Simplified BSD License (see LICENSE) import logging import pytest from mock import MagicMock, patch from pyVmomi import vim from six import iteritems from datadog_checks.vsphere.api_rest import VSphereRestAPI from datadog_checks.vsphere.cache imp...
#!/usr/bin/env python3 import os import re import setuptools def get_version(): root = os.path.dirname(os.path.abspath(__file__)) init = open(os.path.join(root, "check_dep_updates", "__init__.py")).read() return re.compile(r"""__version__ = ['"]([0-9.]+.*)['"]""").search(init).group(1) setuptools.setu...
import importlib import pkgutil from contextlib import ( suppress, ) from functools import ( lru_cache, ) from types import ( ModuleType, ) from typing import ( Callable, Union, ) from .exceptions import ( MinosImportException, ) @lru_cache() def import_module(module_name: str) -> Union[type,...
""" https://www.codewars.com/kata/5f3142b3a28d9b002ef58f5e Return the word pattern for a given word. All words provided will be non-empty strings of alphabetic characters only, i.e. matching the regex "[a-zA-Z]+". example, the word "hello" would become "0.1.2.2.3" A word pattern is a description of the patterns of l...
from django.shortcuts import render, redirect from django.views.decorators.http import require_POST from django.views.decorators.clickjacking import xframe_options_exempt #from django.http import HttpResponseRedirect import requests from .models import Todo from .forms import TodoForm @xframe_options_exempt def ind...
from decimal import Decimal from django.db import models from django.template.defaultfilters import slugify from django.utils.translation import ugettext as _ from django.conf import settings class AbstractSource(models.Model): """ A source of payment for an order. This is normally a credit card w...
# + import pandas as pd class PandasUtils: def __init__(self): self.df = {} def read_excel(self, alias, filename): self.df[alias] = pd.read_excel(filename) def write_excel(self, alias, filename): self.df[alias].to_excel(filename, index = False) def filter_by_column_g...
# ---------------------------------------------------------------------- # /mon path # ---------------------------------------------------------------------- # Copyright (C) 2007-2020 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- # Third-party module...
import torch from inference import control_variate class ELBO: def __init__(self, config, model, variational): self.config = config self.p_z = model self.q_z = variational @torch.no_grad() def compute_objective(self): cfg = self.config z = self.q_z.sample(cfg.num_samples_print) spins = ...
from PIL import Image import numpy as np import cv2 class DeHaze(): def __init__(self,omega=0.8, k_size=9, model='origin'): self.omega = omega self.ksize = k_size self.model = model return def atmosphere(self, img: Image): #calculate the atmospheric light in this paper ...
import numpy as np import cv2 from covidxpert.counter_rotate.get_lines_based_rotation import get_lines_based_rotation, normalize_angle from covidxpert.utils import compute_linear_coefficients def test_get_rotation(): lines = [ ((250, 0), (250, 500)), ((240, 0), (250, 500)), ((240, 0), (260...
# adapted from https://github.com/maria-antoniak/goodreads-scraper # only scrapes top genres for books import argparse from datetime import datetime import json import os import re import time from urllib.request import urlopen from urllib.error import HTTPError import bs4 import pandas as pd def get_all_lists(soup...
from nanome_rmsd import RMSD if __name__ == "__main__": RMSD.main()
import random import time import countdowntourney import htmlform import cgi import gencommon import fixgen name = "Random Pairings/Groups" description = """Randomly assign players to tables, avoiding rematches if required. Prunes, if any, are placed on the highest numbered tables and are kept separate from each other...
import os import sys import types from . import common from . import overrides from . import _girepository # major python version if sys.version_info[0] == 2: PY2, PY3 = True, False elif sys.version_info[0] == 3: PY2, PY3 = False, True # cache used for modules and classes _pygirepository = None _pygirepository_modu...
import unittest import numpy as np import numpy.testing as npt from vector_quantization.codebooks import random_codebook class TestRandomCodebook(unittest.TestCase): def test_random_codebook(self): vectors = np.array([[1, 1], [2, 2], [1, 1], [3, 3], [4, 4], [1, 1]]) codebook = random_codebook(vec...
import argparse import json import urllib3 import xml.etree.ElementTree as ET def cli_args(): parser = argparse.ArgumentParser() parser.add_argument( '--label-file', required=True, help='Path to the label file which will be inserted the checker ' 'documentation URLs.') ...
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
# Copyright (c) 2021 JannesM # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from primitives.Transaction import Transaction, Input, Output import base64 array_flag = b'\xFF' tx_flag = b'\x10' tx_in = b'\x11' tx_out = b'\x12' ...
# Copyright 2020, 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...
from flask_login import current_user, login_required from srcode.community import community @login_required @community.route('/' , subdomain = 'community') def community(): return '<h1>Commmmity </h1>'
import math import os import traceback import numpy as np import tensorflow as tf from bage_utils.date_util import DateUtil from bage_utils.num_util import NumUtil from bage_utils.timer_util import TimerUtil from bage_utils.watch_util import WatchUtil from nlp4kor_tensorflow.config import SAMPLE_DATA_DIR, TENSORBOARD...
import socket import sys import os from colorama import Fore, Style top_1000 = [1,3,4,6,7,9,13,17,19,20,21,22,23,24,25,26,30,32,33,37,42,43, 49,53,70,79,80,81,82,83,84,85,88,89,90,99,100,106,109,110,111, 113,119,125,135,139,143,144,146,161,163,179,199,211,212,222,254, 255,256,259,2...
#!/usr/bin/python3 ### Author: Vinoth Manoharan, Zoho Corp ### Language : Python ### Tested in Ubuntu ### Plugin for getting the metrics of node in a cluster ### For more info refer, ### https://hadoop.apache.org/docs/r2.6.0/hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html#Cluster_Node_API import urllib.request,...
from .style_transfer import *
for number in range(3): # excludes 3 print(number, "Attempt", (number) * "*") # 0 Attempt # 1 Attempt * # 2 Attempt **
# Copyright (c) 2011-2016 Cisco Systems, 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 # # Unl...
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import operator import unittest import beanmachine.ppl as bm import torch from beanmachine.ppl.inference import BMGInference from torch imp...
import numpy as np from svc_sdss import pack_specobjid from svc_sdss import unpack_specobjid DEBUG = False def test_sdss (): ''' ''' id1 = np.array([4565636362342079488, 4565636637219987456, 4566762812004657152, 6439153884405714944], dtype=np...
import os from doit.tools import create_folder OUTPUT_PATH = "output" def task_test(): '''Performs tests''' return { 'targets': ['output/heat-pump.png'], 'actions': [ (create_folder, [OUTPUT_PATH]), 'pytest -v test'], 'clean': True } def task_examples(): '''Run examples''' return { ...
from datetime import datetime import json from time import time from django.core.checks import messages from django.http import JsonResponse, FileResponse, request from django.http.response import HttpResponse from django.views.generic import View from django.utils import timezone from django.db.models import Q, F, Avg...
import sys # print(sys.argv) # old_str = sys.argv[1] # new_str = sys.argv[2] # filename = sys.argv[3] print(sys.argv) old_str = sys.argv[1] new_str = sys.argv[2] filename = sys.argv[3] #load into the ram f = open(filename,"r+",encoding="utf-8") data = f.read() # count and replace old_str_count = data.count(old_str) ...
from reddit_oauth import RedditApp import json import requests from pathlib import Path def create_example_credentials(credential_file): with credential_file.open("w") as f: json.dump({ "client_id": "CLIENT ID GOES HERE!", "client_secret": "CLIENT SECRET GOES HERE!", "r...
import test1 def test(): test1.x += 1 print(test1.x)
# encoding: UTF-8 import re; spacere = re.compile("[ ]{2,}"); spacern = re.compile("(^\r\n?)|(\r\n?$)") def getkeys(generator): count=0; s=set(); for r in generator: s=s|r.keys(); count+=1; if count>=20: return list(s); return list(s) def ReplaceLongSpace(txt): ...
from flask import request, jsonify, make_response, render_template from utils import Utils, HexJsonEncoder, JSONEncoder from utils import tx_to_json, allowed_file, read_excel from flask.views import MethodView import json import os from werkzeug.utils import secure_filename class GetRecords(MethodView): def __ini...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Tue Sep 26 13:16:31 2017 @author: vikuo """ from sklearn import datasets import matplotlib.pyplot as plt import numpy as np import random def load_data(): boston = datasets.load_boston() X = boston.data #506 row, 13 columns #print X.shape...
"""Error classes for package.""" class ComparatorError(Exception): """General Comparator error.""" class SpreadsheetError(Exception): """General Spreadsheet error.""" class XlsformError(Exception): """General Xlsform error.""" class QlangError(Exception): """General Qlang error.""" class Casca...
#!/usr/bin/env python #Ros utilites import threading import rospy from geometry_msgs.msg import Point, Pose, Quaternion, Twist from sensor_msgs.msg import Image, CompressedImage, Imu from std_msgs.msg import Empty from tello_msgs.msg import FlightData from cv_bridge import CvBridge, CvBridgeError from nav_msgs.msg imp...
from engine.core.DebtAnalysisAggregate import DebtAnalysisAggregate import unittest import pandas as pd class DebtAnalysisAggregateTest(unittest.TestCase): def test_generate_monthly_pivot(self): r = DebtAnalysisAggregate.mean_x(pd.Series([0, 6, 4 , 0])) self.assertEquals(5, r) r ...