text
stringlengths
2
999k
# https://github.com/cthoyt/cookiecutter-snekpack how to make folder structure # https://bmcbioinformatics.biomedcentral.com/articles/10.1186/1471-2105-14-340 article for this analysis CRED = '\033[91m' CEND = '\033[0m' EXPRESSION = "../../data/GSE161533.top.table.tsv" EXPRESSION2 = "../../data/GGSE54129.top.table.tsv...
import numpy as np # I program as close as possible to C... def boost(x, px, y, py, sigma, delta, parboost): sphi = parboost.sphi cphi = parboost.cphi tphi = parboost.tphi salpha = parboost.salpha calpha = parboost.calpha h = ( delta + 1.0 - np.sqrt((1.0 + delta) * (...
""" Detect a face in webcam video and check if mouth is open. """ import face_recognition import cv2 from mouth_open_algorithm import get_lip_height, get_mouth_height from datetime import datetime def is_mouth_open(face_landmarks): top_lip = face_landmarks['top_lip'] bottom_lip = face_landmarks['bottom_lip'] ...
import urllib.request import urllib.parse #x = urllib.request.urlopen('https://www.google.com') #print(x.read()) ''' url = 'http://pythonprogramming.net' values = {'s':'basic','submit':'search'} data = urllib.parse.urlencode(values) data = data.encode('utf-8') req = urllib.request.Request(url,data) resp =...
from subsbml import * # Create a System object to hold the Subsystem cell = System('cell') IFFL = cell.createNewSubsystem() # Create a Model object inside the Subsystem object # Usage - self.createNewModel(modelID, modelTimeUnits, modelExtentUnits, modelSubstanceUnits) model = IFFL.createNewModel('IFFLmodel', 'sec...
""" tiles.py Zhiang Chen, Jan 7 2020 To process tornado damage tiles """ import os import numpy as np import pickle import sys sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages') import cv2 import matplotlib.pyplot as plt class Tiles(object): def __init__(self, size=(1000, 1000)): self.size = ...
# -*- coding: utf-8 -*- import autograd.numpy as anp from lifelines.fitters import ParametricUnivariateFitter class MixtureCureFitter(ParametricUnivariateFitter): r""" This class implements a Mixture Cure Model for univariate data with a configurable distribution for the non-cure portion. The model survi...
"""Tests for the HelmAnalyzer class.""" from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING import pytest from aioresponses import aioresponses from neophile.analysis.helm import HelmAnalyzer from neophile.inventory.helm import HelmInventory from neophile.scanner.helm import...
import numpy as np def angle_between(vec1, vec2, deg=True): """ This function computes the angle between vectors along the last dimension of the input arrays. This version is a numerically stable one based on arctan2 as described in this post: - https://scicomp.stackexchange.com/a/27769/39858 Par...
import argparse import os import platform import subprocess import sys def do_configure(args): # Get absolute path to source directory abs_src_dir = os.path.abspath(args.src_dir if args.src_dir else os.path.join(__file__, "../..")) # Get absolute path to build directory abs_obj_dir = os.path.abspath(ar...
# Generated by Django 2.2.3 on 2019-07-28 14:59 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('contenttypes', '0002_remove_content_type_name'), migrations.swa...
from django.conf import settings from allauth.account import app_settings as account_settings # Request e-mail address from 3rd party account provider? E.g. OpenID AX QUERY_EMAIL = getattr(settings, "SOCIALACCOUNT_QUERY_EMAIL", account_settings.EMAIL_REQUIRED) # Attempt to bypass the signup fo...
#------------------------------------------------------------------------------ # Copyright (c) 2013-2017, Nucleic Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. #------------------------------------------------...
""" Linear exponential smoothing models Author: Chad Fulton License: BSD-3 """ import numpy as np import pandas as pd from statsmodels.base.data import PandasData from statsmodels.genmod.generalized_linear_model import GLM from statsmodels.tools.validation import (array_like, bool_like, float_like, ...
# SPDX-License-Identifier: Apache-2.0 # # The OpenSearch Contributors require contributions made to # this file be licensed under the Apache-2.0 license or a # compatible open source license. import os from typing import Any, Dict from urllib.parse import urljoin from manifests.build_manifest import BuildComponent, B...
from tornado.iostream import IOStream from tornado.testing import AsyncHTTPTestCase, LogTrapTestCase, get_unused_port from tornado.util import b from tornado.web import RequestHandler, Application import socket class HelloHandler(RequestHandler): def get(self): self.write("Hello") class TestIOStream(Async...
from fastapi import APIRouter from shared import bikecalc router = APIRouter() @router.get("/calculate/gear_ratios") async def calculate_gear_ratios( min_chainring: int = 36, max_chainring: int = 50, min_cog: int = 14, max_cog: int = 28): """Calculates a hierarchy of gear ratios f...
arbreHistoire = [[0,1,2],[1,3,4],[2,9,10],[3,"R1"],[4,5,6],[5,"R2"],[6,7,8],[7,"R3"],[8,"G"],[9,"R4"],[10,11,12],[11,"R5"],[12,13,14],[13,"R6"],[14,"P"]] MessagesEtapes =[[0,u"Vous vous réveillez subitement. \n Vous êtes seul, étendu au milieu d’une petite clairière bordée d’arbres. \n Un rapide tour de la clair...
import os import os.path as osp import plotly.io as pio import plotly.graph_objs as go import numpy as np import argparse as arp from common.plot import generate_line_scatter from config import * if __name__ == '__main__': parser = arp.ArgumentParser(description='Plot ROC') parser.add_argument('-m', '--model...
# Copyright 2021 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...
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn from mmcv.cnn import ConvModule, constant_init, kaiming_init, normal_init from mmcv.utils.parrots_wrapper import _BatchNorm from ..builder import BACKBONES from .base_backbone import BaseBackbone def make_vgg_layer(in_channels, ...
#!/usr/bin/python """ PN CLI cluster-create/cluster-delete """ # Copyright 2016 Pluribus Networks # # 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/LICEN...
""" This file offers the methods to automatically retrieve the graph Chryseobacterium vrystaatense. The graph is automatically retrieved from the STRING repository. References --------------------- Please cite the following if you use the data: ```bib @article{szklarczyk2019string, title={STRING v11: protein--...
# Copyright (c) 2021 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 ap...
import pytest from lvmnps.actor.actor import lvmnps as NpsActor pytestmark = [pytest.mark.asyncio] async def test_command_error_on(actor: NpsActor): assert actor
#!/bin/python3 import unittest from pylib.example import example class TestExample(unittest.TestCase): def test_example(self): example() if __name__ == '__main__': unittest.main()
import numpy as np from collections import OrderedDict class TrackState(object): # 轨迹的四种状态 New = 0 # 创建新的轨迹 Tracked = 1 # 追踪状态 Lost = 2 # 丢失 Removed = 3 # 轨迹完成了,将其从当前帧中删除 # 存储一条轨迹信息的基本单元 class BaseTrack(o...
import logging from aiohttp import web from ledfx.api import RestEndpoint from ledfx.config import save_config from ledfx.events import Event _LOGGER = logging.getLogger(__name__) class QLCEndpoint(RestEndpoint): """REST end-point for querying and managing a QLC integration""" ENDPOINT_PATH = "/api/integr...
""" PyGeM CAD init """ try: import OCC except ModuleNotFoundError as e: print('\nOCC not found, but required to deal with CAD files') print('Install it using:') print('\tconda install -c conda-forge pythonocc-core=7.4.0') print('or visit https://github.com/tpaviot/pythonocc-core for more info\n') ...
import arff import ConfigSpace import json import numpy as np import openmldefaults import pandas as pd from typing import List def get_setup_dirname(resized_grid_size, num_defaults): return 'c%d_d%d' % (resized_grid_size, num_defaults) def print_columns(df, params): for param in params: unique = n...
# Copyright 2019 Microsoft 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 applicable law or agreed to in...
class Alignment: 'Class to describe a DIAMOND alignment' def __init__( self, sseqid="", pident=0, length=0, mismatch=0, gapopen=0, qstart=0, qend=0, sstart=0, send=0, evalue=10, bitscore=0): """Initiate a CDS instance""" self.sseqid = sseqid self.pident = pident ...
input() a = tuple(map(int, input().split())) print("{} {}".format(max(a), min(a)))
# encoding: utf-8 from typing import Dict, Tuple import numpy as np def make_densebox_target(gt_boxes: np.array, config: Dict) -> Tuple: """ Model training target generation function for densebox Arguments --------- gt_boxes : np.array ground truth bounding boxes with class, shape=(N, 5)...
# Given a non-empty array of integers, every element appears twice except for one. # Find that single one. # EXAMPLE # Input: [4,1,2,1,2] # Output: 4 class Solution: def singleNumber(self, nums: List[int]) -> int: ''' Time: O(N), number of elements in nums array Space: 0(1), no extra space...
import argparse import os import rasterio as rio import numpy as np import cv2 as cv import importlib.resources as pkg_resources from . import resources def get_castellon_image_path(): path_ctx = pkg_resources.path(resources, 'castellon.tif') return path_ctx def generate(base_name, count, output_folder): ...
#!python3 # License: Apache 2.0. See LICENSE file in root directory. # Copyright(c) 2020 Intel Corporation. All Rights Reserved. # # Syntax: # unit-test-config.py <dir> <build-dir> # # Looks for possible single-file unit-testing targets (test-*) in $dir, and builds # a CMakeLists.txt in $builddir to compile them....
# Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from common.tf_layer_test_class import CommonTFLayerTest class TestBatchToSpace(CommonTFLayerTest): def create_batch_to_space_net(self, in_shape, crops_value, block_shape_value, out_shape, ir_version): """ ...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # (C) British Crown Copyright 2017-2020 Met Office. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions a...
from operator import truediv data_item = ['Barang 1', 'Barang 2', 'Barang 3', 'Barang 4', 'Barang 5', 'Barang 6'] data_weight = [100, 50, 45, 20, 10, 5] data_value = [40, 35, 18, 4, 10, 2] data_eff = map(truediv, data_value, data_weight) order = [i[0] for i in sorted(enumerate(data_eff), key=lambda x:x[1], reverse=True...
""" Base settings to build other settings files upon. """ from django.utils.translation import ugettext_lazy as _ import environ ROOT_DIR = ( environ.Path(__file__) - 3 ) # ({{ cookiecutter.project_slug }}/config/settings/base.py - 3 = {{ cookiecutter.project_slug }}/) APPS_DIR = ROOT_DIR.path("{{ cookiecutter....
import logging import simplejson import urllib2 import datetime import urlparse from deploy import DEPLOY_STATUS from google.appengine.api import urlfetch import grequests logging.basicConfig() logger = logging.getLogger(__name__) class RequestProcessor: def __init__(self, url_list): self.url_list = url_...
import json import logging import re from datetime import datetime from random import random from typing import List, NamedTuple, Optional from urllib.parse import urlparse import requests from streamlink.exceptions import NoStreamsError, PluginError from streamlink.plugin import Plugin, PluginArgument, PluginArgumen...
import logging import re from django.db import models from django.utils.translation import ugettext_lazy as _ from .document import Document from .folder import Folder logger = logging.getLogger(__name__) class Automate(models.Model): """ Automates: * moving of documents into destination folder ...
#!/usr/bin/env python3 # 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. """ Retrievers for RAG. """ from abc import ABC, abstractmethod import copy import csv import gzip import numpy as np impo...
# Copyright 2020 Huawei Technologies Co., Ltd # # 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...
from pygame import Surface from .player import Team, Player class Game: """ The state of the game. Is determined by the state of the canvas, the list of player states, the list of team states, and the game format. """ def __init__(self, form, canvas = None): if canvas: self.canvas = canvas e...
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyVector(PythonPackage): """Vector classes and utilities""" homepage = "https://githu...
#!/usr/bin/env python #encoding: utf8 import sys, rospy, math from pimouse_ros.msg import MotorFreqs from geometry_msgs.msg import Twist class Motor(): def __init__(self): if not self.set_power(True): sys.exit(1) rospy.on_shutdown(self.set_power) self.sub_raw = rospy.Subscriber('motor_raw'...
import pytest import sys import os os.environ['SENTINEL_CONFIG'] = os.path.normpath(os.path.join(os.path.dirname(__file__), '../test_sentinel.conf')) sys.path.append(os.path.normpath(os.path.join(os.path.dirname(__file__), '../../lib'))) @pytest.fixture def valid_papel_address(network='mainnet'): return 'yYe8Kwya...
import numpy as np def indirect_ops_cost(launch_rate, launch_provider_type): """Find the indirect operations cost per launch. Arguments: launch_rate (positive scalar): launch rate [units: launches/year] launch_provider_type: letter designation indicating the launch provider type Returns: ...
from selenium import webdriver from fixture.session import SessionHelper from fixture.group import GroupHelper from fixture.contact import ContactHelper class Application: def __init__(self, browser, base_url): if browser == "firefox": self.wd = webdriver.Firefox(capabilities={"marionette": Fa...
# -*- coding: utf-8 -*- # Copyright 2014 Telefonica Investigación y Desarrollo, S.A.U # # This file is part of FI-WARE 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: # ...
from django.contrib.auth.mixins import ( LoginRequiredMixin ) from django.views.generic import TemplateView class CompanyPageView(TemplateView): template_name = 'pages/company.html' class ProductPageView(TemplateView): template_name = 'pages/product.html' class DashboardView(LoginRequiredMixin, Templa...
import os import shutil import sys import pytest from conda_build import post, api from conda_build.utils import on_win, package_has_file, get_site_packages from .utils import add_mangling, metadata_dir def test_compile_missing_pyc(testing_workdir): good_files = ['f1.py', 'f3.py'] bad_file = 'f2_bad.py' ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="victoriaepi", version="0.0.1", author="Marcos Capistran, Antonio Capella, Andres Christen", author_email="", description="""Victoria epidemi...
from unittest.mock import patch from io import StringIO from django.core.management import call_command from .base import VvBaseTest class VVTestConf(VvBaseTest): """def test_titles(self): out = StringIO() call_command( "vvcheck", stdout=out, stderr=out, ) print("CMD", ...
def main() -> None: n = int(input()) a = list(map(int, input().split())) now = 0 l = 0 r = n - 1 for _ in range(n): if a[r] == now: r -= 1 continue if a[l] != now: print("No") return l += 1 now ^= 1 ...
""" Django settings for routerecord project. Generated by 'django-admin startproject' using Django 3.0.7. For more information on this file, see https://docs.djangoproject.com/en/3.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.0/ref/settings/ """ import o...
import os import numpy as np import cv2 import loadData6_vgg as loadData HEIGHT = loadData.IMG_HEIGHT WIDTH = loadData.IMG_WIDTH output_max_len = loadData.OUTPUT_MAX_LEN tokens = loadData.tokens num_tokens = loadData.num_tokens vocab_size = loadData.num_classes + num_tokens index2letter = loadData.index2letter FLIP = ...
# https://docs.python.org/2/library/fnmatch.html import fnmatch import os import numpy as np from scipy.sparse import coo_matrix from rdflib import Graph from collections import defaultdict from scipy.sparse import csr_matrix from numpy import ones from rfc3987 import parse def loadDfromTTL(inputFile): g = Graph() g...
import re import json import sys import os args = sys.argv if (len(args) < 2): sys.exit(1) path = args[1] if(path[-1:] == "/"): path = path[:-1] result_filedata_list = [] target_filepath_list = [] target_filepath_list.append('/0/stdout.txt') for target_filepath in target_filepath_list: filepath = path +...
import os from unittest import TestCase class TestCLI(TestCase): def setUp(self): pass def tearDown(self): pass def test_get_command(self): pass def test_index_of(self): pass def test_contains(self): pass def test_get_or_die(self): pass ...
__all__ = ['to_itk_image', 'to_point_set', 'to_geometry', 'vtkjs_to_zarr', 'zarr_to_vtkjs'] import itk import numpy as np def is_arraylike(arr): return hasattr(arr, 'shape') and \ hasattr(arr, 'dtype') and \ hasattr(arr, '__array__') and \ hasattr(arr, 'ndim') # from IPython.core.debugger...
# 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...
""" Some codes from https://github.com/Newmu/dcgan_code """ from __future__ import division import math import json import random import pprint import scipy.misc import numpy as np from time import gmtime, strftime from six.moves import xrange import tensorflow as tf import tensorflow.contrib.slim as slim pp = pprint...
# 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...
from google.appengine.api import mail from BaseHandler import BaseHandler, user_required, admin_required from utils import render_text_template import logging import datetime class UserCreateHandler(BaseHandler): @admin_required def get(self): self.render_template('user_create.html') @admin_requir...
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
# -*- coding: utf-8 -*- # Copyright 2017 Google 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 ...
import core.node import price_node import math from general_osc_node import GeneralOSCNode class ROSCNode(GeneralOSCNode): def __init__(self, nm, from_name, days1 = 5, days2 = 11): GeneralOSCNode.__init__(self, nm, "%s_R_OSC_%d_%d" % (from_name, days1, days2), ...
# coding: utf-8 from __future__ import unicode_literals, print_function, division, absolute_import import unittest from django.core.urlresolvers import reverse from onadata.apps.main.models import UserProfile from onadata.apps.main.views import profile_settings from .test_base import TestBase class TestUserSettings(...
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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...
#!/usr/bin/env python """Test suite for aospy.utils module.""" import sys import unittest import numpy as np import aospy.utils.vertcoord as vertcoord class AospyUtilsTestCase(unittest.TestCase): def setUp(self): self.p_in_hpa = np.array([1000, 925, 850, 775, 700, 600, 500, 400, 300, ...
#Chapter 1 - Preparing data #--------------------------------------------------------------------------------------------# #Reading DataFrames from multiple files in a loop # Import pandas import pandas as pd # Create the list of file names: filenames filenames = ['Gold.csv', 'Silver.csv', 'Bronze.csv'] ...
import requests import base64 import json import re import cv2 import argparse import numpy as np import os from .correct_eng import minor_adjustmenteng from .resizing import only_resize def number_array(image): name = "yuuka" UPLOAD_DIR = os.path.dirname(os.path.abspath(__file__)) + '/jpg_uploads/' ...
import numpy as np from libHLR import randclust as rclust ## set paths inputpath = './input/' ## Generate Random Clustered Data for training and testing ################################################################################ ## Total number of clustering instances K = 100 ## maximum number of clu...
#!/usr/bin/env python3 # If there are n elements in the array # How many poins in the tree? # It's full binary tree and it has n leave nodes # So it has 2n-1 nodes. This can be proved using induction # So if we include dummy nodes, it is going to be 2 * (2^x)-1 # x = math.ceil(math.log2(n)) # For example: when n = 10,...
""" Rename to local.py and set variables from config.py that You want to override. """ from test_ella.settings.base import TEMPLATE_LOADERS TEMPLATE_LOADERS = list(TEMPLATE_LOADERS) + ['django.template.loaders.app_directories.Loader',] DEBUG = True TEMPLATE_DEBUG = DEBUG DISABLE_CACHE_TEMPLATE = DEBUG ROOT_URLCONF =...
#!/usr/bin/env python # Copyright (c) 2016 Hewlett Packard Enterprise Development Company, L.P. # # 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...
"""Rides URLs.""" # Django from django.urls import include, path # Django REST Framework from rest_framework.routers import DefaultRouter # Views from .views import rides as ride_views router = DefaultRouter() router.register( r'circles/(?P<slug_name>[-a-zA-Z0-9_]+)/rides', ride_views.RideViewSet, basen...
""" This includes: LossComputeBase and the standard NMTLossCompute, and sharded loss compute stuff. """ from __future__ import division import torch import torch.nn as nn import torch.nn.functional as F import onmt from onmt.modules.sparse_losses import SparsemaxLoss from onmt.modules.sparse_activations...
import discord import classes.osu as osu class OsuRecentEmbed(discord.Embed): def __init__(self, score:osu.Score, beatmap:osu.Beatmap, color: str): if score.performance.completion != 100: score.rank = osu.Rank.F #Weird non-bancho API behaviour description = f""" > {score.rank.icon} > ...
#!/usr/bin/python3 from ctf_gameserver.checker import BaseChecker, OK, NOTFOUND import time import telnetlib import re import random import logging class Faust2048Checker(BaseChecker): def __init__(self, tick, team, service, ip): BaseChecker.__init__(self, tick, team, service, ip) self._connectio...
import os from setuptools import find_packages, setup with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: README = readme.read() # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='django-business-rules',...
if False: from argparse import Namespace def pod(args: 'Namespace'): """ Start a Pod :param args: arguments coming from the CLI. """ from jina.peapods.pods.factory import PodFactory try: with PodFactory.build_pod(args) as p: p.join() except KeyboardInterrupt: ...
from django.conf.urls import patterns, include, url from django.conf import settings from django.contrib import admin from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.conf.urls.static import static admin.autodiscover() urlpatterns = patterns('', (r'^admin/filebrowser/', include('fi...
from json_graph import json_plot_data from plot import plot_drawer d = json_plot_data(path="cifer-10_accuacy.json") graph = plot_drawer(plot_data=d) graph.show() graph.save()
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc. # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2011 Piston Cloud Computing, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (...
""" In a given grid, each cell can have one of three values: the value 0 representing an empty cell; the value 1 representing a fresh orange; the value 2 representing a rotten orange. Every minute, any fresh orange that is adjacent (4-directionally) to a rotten orange becomes rotten. Return the minimum n...
# -*-coding:Utf-8 -* # Copyright (c) 2010-2017 LE GOFF Vincent # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # ...
import numpy as np # fmt: off clon, clat = 0.0, 10.0 rad_km = 800.0 area_km2 = np.pi*rad_km**2 nlat, nlon = 31, 31 lat1d = np.linspace(2.5, 17.5, nlat) lon1d = np.linspace(-7.5, 7.5, nlon) lat2d, lon2d = np.meshgrid(lat1d, lon1d) _, X = 0, 1 mask = np.array([ [_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_...
''' Convert split raw data into indices; the data will be splitted into separated domain data ''' import pickle import os from keras.preprocessing.sequence import pad_sequences if __name__ == '__main__': data_list = [ ('amazon', 'amazon_year'), ('dianping', 'dianping_year'), ('economy', '...
from django.db import connection, IntegrityError from django.db.transaction import atomic from django.test import TransactionTestCase from cacheops.transaction import queue_when_in_transaction from tests.models import Category, Post from tests.utils import run_in_thread def get_category(): return Category.objec...
import logging from .command import Command from cli import printf class Logout(Command): cmd_name = 'logout' help_text = """ Summary: Logout from a server with our address book. Usually, you'll want to login again immediately. Usage: logout Options: -f, attempt to force logout Examples: lo...
#!/bin/env python # Convert dash files to json representation for custom dashboard try: import ConfigParser except ImportError: import configparser as ConfigParser import argparse import json import os import requests import sys import logging from six.moves import urllib logger = logging.getLogger() def u...
# -*- coding: utf-8 -*- import math import matplotlib.pyplot as plt import numpy as np from mas_tools.os import get_parameters from mas_tools.ml import plot_history from mas_tools.data import create_timeseries_matrix from mas_tools.data import get_delta, get_diff, get_log_diff from mas_tools.data import get_sigmoid_to...
# Copyright 2012 Grid Dynamics # Copyright 2013 Inktank Storage, Inc. # Copyright 2014 Mirantis, 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.or...
#importando as bibliotecas que vamos usar nesse exemplo from airflow import DAG from datetime import datetime, timedelta from airflow.operators.bash_operator import BashOperator #Definindo alguns argumentos básicos default_args = { 'owner': 'Howard', 'depends_on_past': False, 'start_date': date...
import click import halo from kindly import config from kindly import driver from kindly import orchestrator from kindly import packager from kindly import spec from kindly import util @click.command() @click.pass_context def apply(ctx): '''Apply configs to an existing cluster. ''' args = ctx.obj.get('args'...