content
stringlengths
5
1.05M
#!/usr/bin/env python # # get uncertainty of a single DEM, using the provided reference points (e.g. ICESAT). # last modified: Whyjay Zheng, June 6, 2019 # # # usage: DEMUncertainty.py [-h] [-z Z_FIELD] Refpts_file DEM_file # positional arguments: # Refpts_file Path to the reference poin...
import b def x(): print('x') if __name__ == '__main__': b.y()
import json import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import MaxNLocator import exact_solver def plot_json(file, fig): #data = json.load(file) #results = json.loads(data.get('data')) #print(results) results = file size = [x.get('size') for x in results] max_size ...
""" Snippet for creating a tamr client object with manual passing of credentials during runtime. Note: This approach cannot be coupled with fully automated workflows (e.g., crontab jobs) """ from getpass import getpass from tamr_toolbox import utils as tbu # load configuration variables that do not include AUTH crede...
#----------------------------------------------------------------------------- # Copyright (c) 2013-2020, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License (version 2 # or later) with exception for distributing the bootloader. # # The full license is in the file COPYING.txt...
import mmcv def split_combined_polys(polys, poly_lens, polys_per_mask): """Split the combined 1-D polys into masks. A mask is represented as a list of polys, and a poly is represented as a 1-D array. In dataset, all masks are concatenated into a single 1-D tensor. Here we need to split the te...
#################################################################### ## Author: ## Xiang Ruan ## http://ruanxiang.net ## ruanxiang@gmail.com ## License: ## GPL 2.0 ## Version: ## 1.0 ## ## ---------------------------------------------------------------- ## A simple live demo showing how to...
""" A set of PyQt distutils extensions for build qt ui files in a pythonic way: - build_ui: build qt ui/qrc files """ __version__ = '0.7.3'
from Acquire.Service import Service as _Service __all__ = ["IdentityService"] class IdentityService(_Service): """This is a specialisation of Service for Identity Services""" def __init__(self, other=None): if isinstance(other, _Service): from copy import copy as _copy self._...
#!/usr/bin/python bowtie_build = "/mnt/home/grcuser/GRC_projects/GRC_miseq-quality_UI/Phi-X" fasta_file = "/mnt/home/grcuser/GRC_projects/GRC_miseq-quality_UI/Phi-X.fa" def directory_crawler(pathname): import sys import os lst_R1_R2= [] i = 0 if pathname[-1] != '/': pathname += '/' if os.path.isdir(pathn...
"""Classes for specifying probe pytorch modules.""" import torch.nn as nn import torch class Probe(nn.Module): pass class TwoWordPSDProbe(Probe): """ Computes squared L2 distance after projection by a matrix. For a batch of sentences, computes all n^2 pairs of distances for each sentence in the batch. """...
import numpy as np import os from gym import utils from gym.envs.mujoco import mujoco_env class AntEnv(mujoco_env.MujocoEnv, utils.EzPickle): def __init__(self): dir_path = os.path.dirname(os.path.realpath(__file__)) mujoco_env.MujocoEnv.__init__(self, '%s/assets/ant.xml' % dir_path, 5) u...
#方框滤波函数 import cv2 #读取图像,存储于 img 中 img = cv2.imread("1.jpg") #result = cv2.cvtColor(img,cv2.COLOR_BGR2RGB) ################################################################# #进行方框滤波 #cv2.boxFilter( # InputArray src, # OutputArray dst, # int ddepth, # ...
from block import Block from rainbow import rainbowcolors class Number: number_pixels = [ [[1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 1, 1]], [[0, 0, 0, 2], [0, 0, 0, 2], [0, 0, 0, 2], [0, 0, 0, 2], [0, 0...
from __future__ import annotations import re from configparser import ConfigParser from functools import partial from typing import Callable, Mapping from .util import fix_and_reorder, to_boolean def format_tox_section(parser: ConfigParser, pin_toxenvs: list[str]) -> None: if not parser.has_section("tox"): ...
# SOLIDA PATHS SOLIDA_CONFIG_FILE = '/home/appuser/.config/solida/config.yaml' SOLIDA_PROFILES_ROOT = '/home/appuser/.local/share/solida/' SOLIDA_PROFILE_NAME = 'sample' SOLIDA_PROJECTS_PATH = '/home/appuser/projects' SOLIDA_TMP_PATH = '/home/appuser/.tmp' SOLIDA_DEPLOY_MODES = [dict(value='ssh', label='in remote hosts...
import cv2, numpy as np # 플로우 결과 그리기 ---① def drawFlow(img,flow,step=16): h,w = img.shape[:2] print('h, w', h ,',', w) # 16픽셀 간격의 그리드 인덱스 구하기 ---② idx_y,idx_x = np.mgrid[step/2:h:step,step/2:w:step].astype(np.int) #print('idx_y',idx_y,'idx_y.shape',np.shape(idx_y),'idx_x',idx_x,'idx_x.shape',np.shape(idx_x))...
import dec print ('Preparing mnist data. This could take a while...') dec.make_mnist_data()
from pathlib import Path import boto3 import superannotate as sa s3_client = boto3.client('s3') S3_PREFIX = 'frex9' S3_PREFIX2 = 'frex_temp' S3_BUCKET = 'superannotate-python-sdk-test' PROJECT_NAME_EXPORT = "Example project test export upload s3 export " PROJECT_NAME_UPLOAD = "Example project test export upload s3 ...
from contextlib import contextmanager import functools import syft class Trace: """ Manage logging operations on the fly as they run Attributes: active: if True, recording of operation is active out_of_operation: it True, is ready to record the next operation, means that it's...
# Copyright 2018,2019,2020,2021 Sony Corporation. # Copyright 2021 Sony Group 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 #...
import numpy as np import matplotlib.pyplot as plt import os from SLIP import imread from SLIP import Image as Image_SLIP import time from PIL import Image from skimage.color import rgb2hsv, rgb2lab, hsv2rgb, lab2rgb import torch torch.set_default_tensor_type('torch.DoubleTensor') import imageio from torch.nn.fun...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
from cgitb import small import threading import traceback from decimal import ROUND_DOWN, ROUND_UP from croutils import json, time, Decimal, query, public_query, create_pair, get_ratio, get_settings TRADING_ENGINE_ACTIVE = 0 CRYPTO_CURRENCY_KEY = "CRYPTO_CURRENCY" BASE_CURRENCY_KEY = "BASE_CURRENCY" ORDER_TIME_INTERVA...
from harness.wires.uvicorn import ServerWire from mccoy_wires import WiresIn, WiresOut async def app(scope, receive, send): assert scope["type"] == "http" await send( { "type": "http.response.start", "status": 200, "headers": [[b"content-type", b"text/plain"]], ...
from django.db import models from db.baseModel import * # Create your models here. class SystemSetup(models.Model): loginTitle = models.CharField(max_length=20, null=True, blank=True, verbose_name='登录标题') mainTitle = models.CharField(max_length=20, null=True, blank=True, verbose_name='系统标题') headTitle = m...
"""Globals shared across modules """ from __future__ import absolute_import from __future__ import unicode_literals from __future__ import print_function import pprint EMPTY_STR = '' LOCAL_PATH_INDICATOR = '.' VERSION_SEPERATOR = '.' LOG_FILE_NAME = 'manage_externals.log' PPRINTER = pprint.PrettyPrinter(indent=4) V...
#!/usr/bin/python # Copyright (C) 2009 The Android Open Source Project # # 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 require...
import pytest import epics import recordwhat from .util import skip_if_pv_unavailable motor_pv = 'XF:31IDA-OP{Tbl-Ax:X1}Mtr' records = [ ('ai', 'Py:ai1'), ('ao', 'Py:ao1'), ('bi', 'Py:bi1'), ('bo', 'Py:bo1'), ('fanout', 'Py:mylinker'), ('longin', 'Py:long1'), ('longout', 'Py:long2'), ...
import math import gym import numpy as np import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.optim as optim import torch.autograd as autograd import torch.nn.functional as F from rllite.common import PrioritizedReplayBuffer from rllite.common import make_atari, wrap_deepmind, wrap_pytorch...
# import demoji emojilist = "SERIUS.. ADA APA LOE SAMA BETRAND PETO⁉️ RUBEN ONSU. IVAN GUNAWAN - Deddy Corbuzier Podcast" # demoji.findall(emojilist) o="Team yg nonton doang ketawa2 sampe sedih2 tapi gak vote awra qarisma🙋🙋🙋asdasdasd addasd" import re my_str = "hey th~!ere" my_new_string = re.sub('[^a-zA-Z0-9 \n...
""" 2D sprite creation and rendering module. """ from typing import Sequence, Tuple, Any, cast, Optional from _beer import lib, ffi from beer.texture import Texture class Sheet: """ Spritesheet geometry on top of a texture. """ def __init__(self, texture: Texture, frames: Sequence[Tuple[int, int, int...
import sys, time from gensim import corpora, models, similarities from gensim.corpora import SvmLightCorpus input_file = sys.argv[1] output_file = sys.argv[2] ### print "loading data..." print time.strftime("%H:%M:%S", time.localtime()) c = SvmLightCorpus( input_file ) print "starting tf-idf..." print tfidf = mod...
import numpy as np def new_target(): while True: x = np.random.random(2) * 4 - 2 if np.sum(x**2) < 8: break return x
from . import postgres_connection
from starlette.endpoints import HTTPEndpoint from starlette.responses import PlainTextResponse, JSONResponse from starlette.routing import Route from app.model import Application def assert_json(data: dict, field: str, data_type: type) -> bool: value = data.get(field) return value is not None and type(value)...
# Generated by Django 4.0.1 on 2022-02-10 02:33 from django.db import migrations, models import users.models.user class Migration(migrations.Migration): dependencies = [ ('users', '0002_user_biography_user_gender_user_phone_number_and_more'), ] operations = [ migrations.AddField( ...
# This code takes images and calibrates the camera based of the images # we expect the object to be detected in the bottom middle of the cameras view. This will calibrate on the largest object # in this view import cv2 import numpy as np myDebug = False def nothing(x): pass ###################################...
from django.conf.urls import include, url from foundation_email import views urlpatterns = ( url(r'^email/task/(.*)/(.*)/$', views.task_page, name='foundation_email_task'), url(r'^email/intake/pending/(.*)/$', views.pending_intake_page, name='foundation_email_pending_intake'), url(r'^email/intake/approved...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import io import re import time import math import json import random import sqlite3 import weakref import warnings import itertools import collections import configparser import collections.abc import concurrent.futures import pycurl import prcoords import tor...
"""__init__.py - the javabridge package python-javabridge is licensed under the BSD license. See the accompanying file LICENSE for details. Copyright (c) 2003-2009 Massachusetts Institute of Technology Copyright (c) 2009-2013 Broad Institute All rights reserved. """ import os.path try: from _version import __...
import os import argparse import torch from torch.utils.data import DataLoader from transformers import BertTokenizer, BertForTokenClassification from dataset import prepare_data, TypoDataset from utils import load_config from train_typo_detector import evaluate def main(config, test_json, checkpoint, threshold): ...
from .models import Bot
import os import pandas import numpy as np from bokeh.palettes import Viridis4 as palette from bokeh.layouts import layout, column, row from bokeh.plotting import figure, output_file, show, ColumnDataSource from bokeh.models import HoverTool, Div, DataTable, TableColumn, NumberFormatter, LinearAxis, Select, CustomJS, ...
# This needs a lot of work and unit testing for failures # As failure occurs, and it will, especially with the printer routine below # a test should be added - christopher.warner@nyu.edu from zope.interface import Interface from zope import schema from zope.component import getUtility from Products.Five.browser import...
import os from dotenv import load_dotenv import pprint import requests import json pp = pprint.PrettyPrinter(indent = 4) dotenv_path = os.path.join(os.path.dirname(__file__), '.env') load_dotenv(dotenv_path) key = os.getenv('TRELLO_KEY') token = os.getenv('TRELLO_TOKEN') def get_all_boards(): boards_url = 'htt...
from distutils.core import setup, Extension def main(): setup(name="mpkmemalloc", version="1.0.0", description="Python interface for MPK memory allocators", author="Swaroop Kotni", author_email="jjkotni@github.com", ext_modules=[Extension("mpkmemalloc", ["mpkmemall...
# To get the number of occurrences of a specified element in an array import array as a ar = a.array('i', [34, 67, 84, 67, 80, 32, 54]) print('Occurence of 67 -> ', ar.count(67)) c, m = 0, 67 for x in ar: if x == m: c = c + 1 print('Occurence -> ', c)
s="Face_Recognition" def show_text(s): print(s) show_text(s)
from sqlalchemy.exc import IntegrityError from Hinkskalle.models.Manifest import Manifest, ManifestContentSchema, ManifestSchema, ManifestTypes from Hinkskalle.models.Tag import Tag from Hinkskalle import db from ..model_base import ModelBase from .._util import _create_image class TestManifest(ModelBase): def tes...
# Generated by Django 3.0.2 on 2020-03-17 08:44 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('myApp', '0016_usergroup_buyer'), ] operations = [ migrations.CreateModel( name='Chat', fields=[ ('id...
import numpy as np from PIL import Image, ImageOps import cv2 import streamlit as st import tensorflow as tf model = tf.keras.models.load_model('Model_4_classes.h5') st.write("""# Rock-Paper-Scissor Hand Sign Prediction""") st.write("This is a simple image classification web app to predict rock-paper-scissor hand sign"...
# -*- coding: utf-8 -*- """Sum of Multiple elements.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1vck1vNUPglLGZ2MxRjUlPD7j8v1DVGfP """ x = input("Enter Values") y = x.split() sum = 0 for i in y: sum = sum + int(i) print("The Sum of Entered...
#!/usr/bin/env python """reducer.py""" import sys from collections import Counter def main(): word_count=Counter() for line in sys.stdin: # line = line.translate(None, string.punctuation) word, count=line.strip().split() try: count=int(count) except: ra...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from .base import BaseProperty from .battery import BatteryProperty from .boolean import BooleanProperty from .button import ButtonProperty from .color import ColorProperty from .contact import ContactProperty from .datetime import DateTimeProperty from .dimmer import Dim...
import unittest import time from tests.lib.client import get_client from tests.lib.utilities import Utilities from tests.lib.user_verifications import verify_card_holder_model class TestUsersList(unittest.TestCase): """Tests for the users.list endpoint.""" @classmethod def setUpClass(cls): """Se...
import os import boto3 import logging import cx_Oracle from botocore.exceptions import ClientError from cfn_resource_provider import ResourceProvider log = logging.getLogger() request_schema = { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "oneOf": [ {"required": ["Datab...
import streamlit as st import pandas as pd import numpy as np import altair as alt import pydeck as pdk import nltk from nltk.tokenize import TweetTokenizer from nltk.corpus import stopwords import string from wordcloud import WordCloud import json import matplotlib.pyplot as plt import matplotlib.colors as mcolors...
from __future__ import print_function import os import torch from model_def import Net def model_fn(model_dir): device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model = Net() with open(os.path.join(model_dir, "model.pth"), "rb") as f: model.load_state_dict(torch.load(f)) ...
from abb_deeplearning.abb_neuralnet_helpers import nn_tfrecords_creator import datetime as dt import abb_deeplearning.abb_data_pipeline.abb_clouddrl_constants as ac import argparse parser = argparse.ArgumentParser() parser.add_argument("suffix", help="") parser.add_argument("image_per_sample", help="") parser.add_ar...
"""""" from os import getenv from typing import Dict, List import unittest import shimoku_api_python as shimoku from shimoku_api_python.exceptions import ApiClientError api_key: str = getenv('API_TOKEN') universe_id: str = getenv('UNIVERSE_ID') business_id: str = getenv('BUSINESS_ID') environment: str = getenv('ENVI...
# generates list of large airports """ Creates csv of large airports. To run, first download csv from http://ourairports.com/data/ Run script using the following command to generate csv called 'large_airport.csv' cat path/to/downloaded/csv | python large_airports.py > large_airports.csv We generate a list of bo...
def format_customer(first, last, location=None): full_name = '%s %s' % (first, last) if location: return '%s (%s)' % (full_name, location) else: return full_name
# -*- coding: utf-8 -*- """EAST_TFLite Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/github/sayakpaul/Adventures-in-TensorFlow-Lite/blob/master/EAST_TFLite.ipynb This notebook relies on this PyImageSearch blog post [OpenCV Text Detection (EAST text detecto...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Luzac Rooster PDF to Google Calendar # Developed by Sander Laarhoven (c) 2016 # Licensed under the MIT License # https://git.io/luzac # Import required default modules. import sys import os.path import subprocess import json import datetime # Import our files. import ...
#!/usr/bin/env python3 # vim: set ts=8 sts=4 et sw=4 tw=99: # # A better CSV manipulation library for the OpenPowerlifting format. # import codecs class Csv: def __init__(self, filename=None): if filename: with open(filename, 'r', encoding='utf-8') as fd: self.fieldnames = fd...
# Sets types_of_people variable to 10 # sets x to formatted string referencing # the types_of_people variable types_of_people = 10 x = f"There are {types_of_people} types of people." # sets binary variable to binary string # sets do_not varialbe to don't string # sets y variable to formatting string # referencing bina...
# Exercício Python 081: Crie um programa que vai ler vários números e colocar em uma lista. Depois disso, mostre: # A) Quantos números foram digitados. # B) A lista de valores, ordenada de forma decrescente. # C) Se o valor 5 foi digitado e está ou não na lista. lista = [] quantos = 0 while True: numero = int(input...
# -*- coding: utf-8 -*-# # # December 23 2014, Christian Hopps <chopps@gmail.com> # # Copyright (c) 2015, Deutsche Telekom AG # # 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.ap...
from torchvision import transforms, models, datasets from torchvision.transforms import Compose from torch.utils.data import DataLoader import torchvision import torch import torch.nn as nn from packaging import version from adadamp.damping import BaseDamper from adadamp.utils import _get_resnet18 def test_resnet18()...
# flake8: NOQA # "flake8: NOQA" to suppress warning "H104 File contains nothing but comments" # class c_(object): # class r_(object): # class s_(object): import numpy import cupy # TODO(okuta): Implement indices def ix_(*args): """Construct an open mesh from multiple sequences. This function takes N 1-D ...
# Autogen with with open("../datasets/lvis/lvis_v1_train.json", "r") as f: a = json.load(f) c = a["categories"] all_image_count = len(set([_["image_id"] for _ in a["annotations"]])) for x in c: x["image_count_frequency"] = x["image_count"] / all_image_count LVIS_CATEGORIES = repr(c) + " # noqa" NUM_CLASSES = ...
class Solution: def convert(self, s: str, numRows: int) -> str: if numRows == 1: return s res = [] for i in range(numRows): res.append("") now = 0 x = 1 for i in s: res[now]+=i now += x if now == numRows-1: ...
from __future__ import ( annotations, ) import sys from .. import ( Input, ) from typing import ( List, NoReturn, ) class Reader: def __init__( self, src: Input=( sys.stdin.buffer ), ): self.src = src def __enter__( self, ) -> Reader: src_is_path = False src = s...
import itertools import random from typing import Dict, List import numpy as np import matplotlib.pyplot as plt import networkx as nx def drawGraphWithCommunities(graph: nx.Graph, communities: Dict[int, List[int]] = None, weighted=False): if communities is None: communities = {n: [vertex] for n, vertex i...
from django.urls import path from django.conf import settings from django.conf.urls.static import static from . import views app_name = 'article' urlpatterns = [ path('', views.ArticleList.as_view(), name='article'), path('comment/<int:article_id>', views.CommentOfArticle.as_view(), name='comment'),...
"""testing some analysis of the data""" import itertools import math from typing import Any import networkx as nx from processing.model import Location def publications_by_country(papers: dict[str, Any]) -> dict[Location, int]: """returns number of published papers per country""" countries_publications = {}...
import pytest from elasticsearch_metrics import metrics from elasticsearch_metrics.registry import registry from tests.dummyapp.metrics import DummyMetric class MetricWithAppLabel(metrics.Metric): class Meta: app_label = "dummyapp" def test_metric_in_app_is_in_registry(): assert "dummyapp" in regis...
import pickle as pk import numpy as np # import os import os.path as osp # import torch # from torch import Tensor, nn # from torch.nn import functional as F from torch.utils.data import Dataset # from torchvision import datasets, transforms JOINT_NAMES = [ 'base of the spine', 'middle of the spine', 'neck',...
QUEST_IDS = [ 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, ...
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst import multiprocessing import warnings from collections.abc import Iterable import astropy.units as u import emcee import numpy as np from astropy import log from .utils import sed_conversion, validate_data_table __all__ = [ ...
class DynaTableWidge: def setStatusText(self, text): self.navbar.status.setText(text)
# sbv_translate.py # NOTE: used pyinstaller to create a single executable file # pyinstaller -F sbv_translate.py # there is a problem with pyinstaller # (I had to include this file for the executable to run) import pkg_resources.py2_warn # Import the argparse library to handle command line arguments import argparse ...
from argparse import ArgumentParser from pathlib import Path import os from icecap_framework import BaseComposition from runtime_manager import RuntimeManager from virtio_console_server import VirtioConsoleServer class Composition(BaseComposition): def compose(self): self.virtio_console_server = self.comp...
import bisect import csv import os import shutil import sys import tempfile import matplotlib matplotlib.use('Agg') # noqa from matplotlib import pyplot # Graph settings Y_LABEL = 'Counts' X_LABEL = 'Number of matched replicates' TICK_WIDTH = 3 # Amount to shift the graph to make labels fit, [left, right, top, botto...
from distutils.core import setup setup( name = 'ex3groupf', packages = ['ex3groupf'], version = '0.1', description = 'Group F final project for Financial Analytics', author = 'group F', author_email = 'ljohnnes@student.ie.edu', url = 'https://github.com/LJohnnes/iembdfa', download_url = 'https://github.com/LJo...
from django.contrib.admin.sites import AdminSite from django.test import TestCase from handypackages.contact.admin import ContactAdminPanel from handypackages.contact.models import Contact class MockRequest: def __init__(self, user=None): self.user = user request = MockRequest() class ModelAdminTests...
import unittest import requests from application import app # set the application to testing mode app.testing = True class TestApi(unittest.TestCase): BASE = "http://127.0.0.1:5000/" def test_get_everyone(self): expected = {"tony": {"name": "Tony Stark", "salary": 10000}, "bruce"...
import os from flask import Flask, request, redirect, url_for from flask import flash from werkzeug.utils import secure_filename from keras.models import Sequential, load_model import keras, sys import numpy as np from PIL import Image classes = ["bns-v","btk","dsp","hcr","hdr25"] num_classes = len(classes) image_size...
# -*- coding: utf-8 -*- #------------------------------------------------------------------------- # drawElements Quality Program utilities # -------------------------------------- # # Copyright 2018 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use t...
"""Tests for Example Plugin.""" from ee.utils import test class ExamplePluginTestCase(test.EETestCase): def test_load_example_plugin(self): self.app.setup() self.app.plugin.load_plugin('example')
import os import csv import numpy as np import pickle from datetime import datetime import matplotlib.pyplot as plt import constants find_text = [ "dulles town center", "reston", "adams field", "albuquerque international airport", "amarillo international airport", "bangor international airport", "bem...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('analytics', '0008_auto_20160222_2117'), ] operations = [ migrations.CreateModel( name='AtmEventViewerEvent', ...
from django.apps import AppConfig from django.conf import settings from django.core.exceptions import ImproperlyConfigured import redis class ExtrasConfig(AppConfig): name = "extras" def ready(self): import extras.signals # Check that we can connect to the configured Redis database. ...
# coding: utf-8 import sys,os import logging import datetime import urllib from logging.handlers import TimedRotatingFileHandler def is_stdout_attached_to_terminal(): '''判断当前进程组是不是前台进程组(主要关注stdout是否被关联到/dev/tty)''' try: # 如果stdout被绑定到终端设备上,则是前端进程组 if os.getpgrp() == os.tcgetpgrp(sys.stdout.file...
class HashVersionType(basestring): """ Hash Version Possible values: <ul> <li> "all_versions" - Version 1 and 2 (V1 and V2)., <li> "version1" - Version 1 (V1)., <li> "version2" - Version 2 (V2). </ul> """ @staticmethod def get_api_name(): return "has...
import six, base64 def encode(b): # takes bytes, returns native string assert isinstance(b, bytes), (type(b), b) out = base64.b32encode(b).lower().rstrip(b"=") return six.ensure_str(out) # we use the rfc4648 base32 alphabet, in lowercase BASE32_ALPHABET = 'abcdefghijklmnopqrstuvwxyz234567' def is_base32(...
"""Classification model tuning example. https://www.kaggle.com/c/ieee-fraud-detection Current configuration: * use 10000 rows subset of train and test. * use lgbm. * custom metric example to pass_custom__kw_args. * three-stage optimization: 1. default mlshell.model_selection.RandomizedSearchOptimizer on 'roc_auc'...
#!/usr/bin/python import pandas as pd import matplotlib.pyplot as plt from cycler import cycler from math import log, ceil import numpy as np import sys import itertools import math from matplotlib import container #multichrome = cycler(color=list('bgrbgr')) + cycler(marker=['o','^','v','d','8','*']) + cycler(linestyl...
from . import _cpu_base_backend as B from ._cpu_base_backend import Network from ._kernels import kernels_numpy class DenseLayer(B.DenseLayer): _update_state = staticmethod(kernels_numpy.update_state) _softmax_minicolumns = staticmethod(kernels_numpy.softmax_minicolumns) _update_counters = staticmethod(k...