text
stringlengths
475
200k
import logging from datetime import datetime from flask import request, current_app as app from flask_restplus import Namespace, Resource, fields logger = logging.getLogger(__name__) ns = Namespace( 'predict', description='houseprice Prediction API') ResourceFields = ns.model('houseprice Predictor Resource', {...
#!/usr/bin/env python # # This is PNCconf, a graphical configuration editor for LinuxCNC # Copyright 2007 Jeff Epler <[EMAIL]> # Pncconf 1.1 revamped by Chris Morley 2014 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as pub...
# -*- coding: utf-8 -*- """ /*************************************************************************** Name : Versioning plugin for DB Manager Description : Set up versioning support for a table Date : Mar 12, 2012 copyright : (C) 2012 by Giuseppe Sucameli email ...
# coding=utf-8 """Forms for realtime app.""" from builtins import object from django import forms from django.utils.translation import ugettext_lazy as _ from realtime.models.report_template import ReportTemplate __author__ = 'myarjunar' __project_name__ = 'inasafe-django' __filename__ = 'report_template' __date__ = ...
import csv import re product_codes1 = dict() product_codes2 = dict() with open('codes-2016-produktbereiche.csv', newline='', encoding='UTF-8') as csvfile: codereader = csv.reader(csvfile, delimiter=',', quotechar='"') # https://stackoverflow.com/questions/14257373/skip-the-headers-when-editing-a-csv-file-using-pyth...
import unittest from xml.etree import ElementTree from masher import xml_rules from masher.xml_rules import MasherXmlRuleError from masher.generators import ConstantGenerator def make_xml(xml): return '<?xml version="1.0"?><data>' + xml + '</data>' class TestMisc(unittest.TestCase): def testCleanText(self): ...
#!/usr/bin/python # -*- coding: utf-8 -*- # # This module is also sponsored by E.T.A.I. (www.etai.fr) # # This file is part of Ansible # # Ansible 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, either version...
#!/usr/bin/python # This is a standalone program. Pass an image name as a first parameter of the program. import sys from math import sin, cos, sqrt, pi import cv2.cv as cv import urllib2 # toggle between CV_HOUGH_STANDARD and CV_HOUGH_PROBILISTIC USE_STANDARD = True if __name__ == "__main__": if len(sys.argv) >...
# ===================================== # # BeaEngine 4.x header for Python # using ctypes # # ===================================== from ctypes import * INSTRUCT_LENGTH = 64 class REX_Struct(Structure): _pack_= 1 _fields_= [("W_",c_uint8), ("R_",c_uint8), ("X_",c_uint8), ...
import csv import requests with open('output/scielo_brasil_documents_2018.csv', 'w') as csvfile: filewriter = csv.writer(csvfile) filewriter.writerow( [ 'pid', 'publicaton date', 'title', 'url' ]) with open('data/scielo/docs_pub_2018.csv', 'r...
#!/usr/bin/python # $Id:$ from pyglet import app from pyglet import gl from pyglet import window class Display(object): '''A display device supporting one or more screens. :Ivariables: `name` : str Name of this display, if applicable. `x_screen` : int The...
''' Created on Nov 22, 2013 @author: Scott Various utilities used for getting the write data from an image to something that can be calculated on. ''' import numpy, Image, math def get_array(filename): im = Image.open(filename) original_array = numpy.array(im) return original_array def inverse(ar...
#! /usr/bin/env python # coding:utf-8 import json from datetime import timedelta from flask import request, Response from core.api import app from core.api import mongo_client from core.api.utils.Time import get_current_local_time, timestamp_to_obj from core.api.utils.Twitter import * @app.route('/api/activity/upc...
#!/usr/bin/env python import os import shutil import BaseHTTPServer class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): def dump_Request(self): print "----------------------------------------" print "Received a %s command." % self.command print " from: %s:%s" % (str(self.client_address...
#------------------------------- #Name: Balazs Somfalvi #Program: L3Q1BS.py #------------------------------- #Trigonometry Quiz print("*** Trigonometry Quiz ***\n") nr_of_correct_answers=0 #counts correct answers answer1=input("1. Which trigonometric function of an angle equals to the opposite over hypotenu...
"""Test add-on panel.""" from unittest.mock import patch, Mock import pytest from homeassistant.setup import async_setup_component from homeassistant.const import HTTP_HEADER_HA_AUTH from tests.common import mock_coro from . import API_PASSWORD @pytest.fixture(autouse=True) def mock_all(aioclient_mock): """Moc...
from yowsup.layers import YowParallelLayer import time, logging, random from yowsup.layers import YowLayer from yowsup.layers.noise.layer import YowNoiseLayer from yowsup.layers.noise.layer_noise_segments import YowNoiseSegmentsLayer from yowsup.layers.auth import YowAuthenticationProtocolLayer f...
# coding: utf-8 """tornado IOLoop API with zmq compatibility This module is deprecated in pyzmq 17. To use zmq with tornado, eventloop integration is no longer required and tornado itself should be used. """ # Copyright (C) PyZMQ Developers # Distributed under the terms of the Modified BSD License. from __future__ i...
from tsg.crawler import crawl_site, crawl_urls, crawl_journal_url, crawl_journal_subsites import os import requests from tsg.config import RAW_DIR def test_crawl_journal(): urls = ['http://dblp.uni-trier.de/db/journals/ij3dim/ij3dim1.html', 'http://dblp.uni-trier.de/db/journals/ij3dim/ij3dim2.html', ...
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at # # https://aws.amazon.com/apache-2-0/ # # or in the "license" file accompa...
""" bofhirdev.apps.appmgmt FILE: views.py Created: 10/28/15 5:20pm """ import random from django import forms from django.conf import settings from django.contrib import messages from django.contrib.auth import get_user_model from django.contrib.auth.decorators import login_required from django.core.urlresolvers i...
from subprocess import Popen import re import subprocess import time import multiprocessing as mp #def get_winner(solution1, solution2, rounds): def get_winner(args): """ Compete in rounds rounds, the one who wins the most is returned. Args are packed for 2.7 compatibility with map_async (3.3+ has starmap) ...
# -*- coding: utf-8 -*- ''' LBS Class for Nook WeBot app. Support ak (App Key) authentication request ONLY. 已实现封装: * Place API * IP 定位 API * Geocoding API 未实现封装: * Place suggestion API * Direction API * Route Matrix API * 坐标转换 API 2014.04.28 Joker Qyou <[EMAIL]> ''' import ...
from direct.distributed.DistributedObject import DistributedObject from direct.distributed.DistributedObjectGlobal import DistributedObjectGlobal from toontown.chat.ChatGlobals import * from toontown.parties import PartyGlobals from toontown.toon import ToonDNA from toontown.toonbase import TTLocalizer from toontown.t...
# Copyright 2012 OpenStack Foundation # 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 requ...
# Copyright 2013, Nachi Ueno, NTT MCL, 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 # # Unles...
""" =============================================================================== Decision boundary of semi-supervised classifiers versus SVM on the Iris dataset =============================================================================== A comparison for the decision boundaries generated on the iris dataset by L...
# Written by Scaevolus 2010 from util import hook, http, text, execute import string import sqlite3 import re re_lineends = re.compile(r'[\r\n]*') # some simple "shortcodes" for formatting purposes shortcodes = { '[b]': '\x02', '[/b]': '\x02', '[u]': '\x1F', '[/u]': '\x1F', '[i]': '\x16', '[/i]': '\x16'} def db_ini...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>) # Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) # # This program is free software: you can redistribute it and/or ...
import os import subprocess import re import sys import fnmatch from collections import defaultdict from .. import localpaths from manifest.sourcefile import SourceFile here = os.path.abspath(os.path.split(__file__)[0]) repo_root = localpaths.repo_root def git(command, *args): args = list(args) proc_kwargs...
# Copyright 2016 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...
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import collections from dashboard.common import namespaced_stored_object from dashboard.services import gitiles_service _REPOSITORIES_KEY = 'repositories'...
# PYTHON script to write and submit pbsjobs to queue import optparse import sys import string import os import stat # User inputted values and options parser = optparse.OptionParser(description="submit GROMACS grompp and mdrun commands to cluster queue.") parser.add_option("-f", "--fileprefix", help="the full prefix ...
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2013 CERN. ## ## Invenio 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; either version 2 of the ## License, or (at your option) a...
import pkg_resources from random import randrange from itertools import repeat from mockingbird.utils import safe_range from mockingbird.compat import map class TextGenerator(object): _text = None def __init__(self, min=1, max=1, value=None, count=None): if value: self.value = value ...
import pytest from dateutil.parser import parse from freezegun import freeze_time from adhocracy4.modules import models @pytest.mark.django_db def test_running_modules(phase_factory): phase1 = phase_factory( start_date=parse('2013-01-01 17:00:00 UTC'), end_date=parse('2013-01-01 18:00:00 UTC') ...
"""Compare two HTML documents.""" import re from html.parser import HTMLParser # ASCII whitespace is U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, or U+0020 # SPACE. # https://infra.spec.whatwg.org/#ascii-whitespace ASCII_WHITESPACE = re.compile(r'[\t\n\f\r ]+') def normalize_whitespace(string): return ASCII_WHI...
''' This module provides a newnext() function in Python 2 that mimics the behaviour of ``next()`` in Python 3, falling back to Python 2's behaviour for compatibility if this fails. ``newnext(iterator)`` calls the iterator's ``__next__()`` method if it exists. If this doesn't exist, it falls back to calling a ``next()`...
from __future__ import absolute_import, division, print_function, unicode_literals from echomesh.base import Yaml _LEFT = '{[(' _RIGHT_TO_LEFT = dict(zip('}])', _LEFT)) # Assignment looks like this: # some.name.here = "123" other.name.here = [1, 2] class _ArgParser(object): def split(self, string): se...
""" Objects for dealing with Chebyshev series. This module provides a number of objects (mostly functions) useful for dealing with Chebyshev series, including a `Chebyshev` class that encapsulates the usual arithmetic operations. (General information on how this module represents and works with such polynomials is in...
from functools import wraps, partial from inspect import iscoroutine from .loop import Loop, get_current_loop from .timer import Timer from .idle import Idle from .workers import worker from .stream import Stream from . import fs from . import net from . import process get_default_loop = Loop.get_default_loop def s...
#!/usr/bin/python ''' The MIT License (MIT) Copyright (c) 2016 Charles Lin 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, c...
import copy import unittest import numpy as np import bson from hyperopt.pyll import scope uniform = scope.uniform normal = scope.normal one_of = scope.one_of from hyperopt.base import JOB_STATE_NEW from hyperopt.base import TRIAL_KEYS from hyperopt.base import TRIAL_MISC_KEYS from hyperopt.base import InvalidTrial f...
""" Vertical interpolators ====================== Vertical interpolation is achieved through use of :py:mod:`scipy.interpolate` module. The module is a wrapper of the Fortran library FITPACK. However, it does not preserve or indeed handle masked arrays elegantly. """ import numpy as np from scipy.interpolate import I...
# This file is part of victims-web. # # Copyright (C) 2013 The Victims Project # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any...
""" Tests for methods defined in mongo_utils.py """ import ddt import os from unittest import TestCase from uuid import uuid4 from pymongo import ReadPreference from xmodule.mongo_utils import connect_to_mongodb @ddt.ddt class MongoUtilsTests(TestCase): """ Tests for methods exposed in mongo_utils """ ...
# -*- coding: utf-8 -*- # This file is part of AudioLazy, the signal processing Python package. # Copyright (C) 2012-2013 Danilo de Jesus da Silva Bellini # # AudioLazy 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 Foun...
# -*- coding: utf-8 -*- ############################################################################## # # Author: Guewen Baconnier, Sébastien Beau # Copyright (C) 2011 Akretion Sébastien BEAU <[EMAIL]> # Copyright 2013 Camptocamp SA (Guewen Baconnier) # # This program is free software: you can redistribute...
# Copyright 2016 Pinterest, 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 agreed to in writi...
""" A custom layer for 'detectionout' used in 'SSD' model to produce outputs Note: Since Paddle's implementation of 'detectionout' applied 'flatten' and 'softmax' ops on the input of 'conf', while Caffe's implementation do not. Hence, you should ajust generated 'ssd.py' to remove 'softmax' and 'flatten' ops ap...
# 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 ...
#!/usr/bin/env python2 """Graph relationships between entities. For each entity in module ``nailgun.entities``, determine which entities it depends on. Print this dependency information to stdout in DOT format. To run this script and generate an image all in one go, use the ``graph-entities`` command provided by the m...
#!/usr/bin/env python3 """ PPTOOL_PSFSUB - PSF subtraction tool v1.0: 2017-12-10, [EMAIL] """ from __future__ import print_function from __future__ import division # Photometry Pipeline # Copyright (C) 2016-2018 ichael Mommert, [EMAIL] # This program is free software: you can redistribute it and/or modify # it ...
from . import Output from ..modules import CheckStatus import colored class ConsoleOutput(Output): reset = colored.attr('reset') status_string = { CheckStatus.NOT_PERFORMED: ' ---- ', CheckStatus.FAILED: '{color}FAILED{reset}'.format(color=colored.fg('red'), reset=reset), CheckStatus.S...
# Extension dedicated to test patch.diff() upgrade modes # # from mercurial import scmutil, patch, util def autodiff(ui, repo, *pats, **opts): diffopts = patch.diffopts(ui, opts) git = opts.get('git', 'no') brokenfiles = set() losedatafn = None if git in ('yes', 'no'): diffopts.git = git ==...
# Gambit scripts # # Copyright (C) USC Information Sciences Institute # Author: Nibir Bora <[EMAIL]> # URL: <http://cbg.isi.edu/> # For license information, see LICENSE # Folders #DATA_FOLDER = 'hbk/' #DATA_FOLDER = 'hbk_old/' DATA_FOLDER = 'hbk_old2/' # Hollenbeck info HBK_LOCATION_ID = 20 HBK_BOUN...
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. from torch.optim.optimizer import ...
from setuptools import setup, find_packages setup( name='django-feedparser', version=__import__('django_feedparser').__version__, description=__import__('django_feedparser').__doc__, long_description=open('README.rst').read(), author='David Thenon', author_email='[EMAIL]', url='https://gith...
import unittest from coinpy.model.protocol.structures.block import Block from coinpy.model.protocol.structures.blockheader import BlockHeader from coinpy.lib.blockchain.bockchain_work import DifficultyIterator, get_work_required, retarget, adjust from coinpy.model.protocol.runmode import TESTNET, TESTNET3, MAIN from c...
import json import os __version__ = "1.0.0" class Connect: def __init__(self, db_file): self.db = db_file self.json_data = {} # allows find to be called multiple times, without # re-reading from disk unless a change has occured self.stale = True if not os.path.exi...
# Copyright (c) 2016, Xilinx, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of ...
#!/usr/bin/env python #----------------------------------------------------------------------------- # Copyright (c) 2013--, biocore development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #-------------------------...
from __future__ import with_statement import sys from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand def version(): with open('VERSION') as f: return f.read().strip() def readme(): with open('README.md') as f: return f.read() reqs = [line.st...
import unittest import idlelib.calltips as ct import textwrap import types default_tip = ct._default_callable_argspec # Test Class TC is used in multiple get_argspec test methods class TC(): 'doc' tip = "(ai=None, *b)" def __init__(self, ai=None, *b): 'doc' __init__.tip = "(self, ai=None, *b)" def...
# -*- coding: utf-8 -*- # # This file is part of CERN Analysis Preservation. # Copyright (C) 2016 CERN. # # CERN Analysis Preservation 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; either version 2 of the # ...
# Copyright 2010-2015 RethinkDB, all rights reserved. """`driver.py` is a module for starting groups of RethinkDB cluster nodes and connecting them to each other. It also supports netsplits. It does not support administering a cluster, either through the HTTP interface or using `rethinkdb admin`. It is meant to be us...
import logging import kubernetes import pytest import powerkube as pk EXPECTED_CLUSTER = {'contents': 'foo', 'highlight_groups': ['kubernetes_cluster']} EXPECTED_NAMESPACE = {'contents': 'bar', 'highlight_groups': ['kubernetes_namespace']} EXPECTED_USER = {'contents': 'baz', 'highlight_groups': ['kubernetes_user']}...
from __future__ import unicode_literals import copy import pytest from jsonschema.exceptions import ValidationError from scrapi.linter import NormalizedDocument class TestValidation(object): def test_validate_with_clean(self): expected = { "description": "This is a test", "con...
#!/usr/bin/env python # coding=utf-8 import urllib2 from bs4 import BeautifulSoup from Importer import Importer class BBCImporter(Importer): name = 'BB Centrum Nová Brumlovka' url = 'http://www.bbcentrum.cz/cs/bb-centrum/obchody-a-sluzby/' soups = [] def download(self): super(BBCImporter, se...
# pylint:disable=wrong-import-position from .analysis import Analysis, AnalysesHub from ..misc.ux import deprecated def register_analysis(cls, name): AnalysesHub.register_default(name, cls) from .cfg import CFGFast, CFGEmulated, CFG, CFGArchOptions, CFGFastSoot from .cdg import CDG from .ddg import DDG from .vfg ...
from sharpefolio import stocks from sharpefolio import reports from sharpefolio import calc from datetime import date, timedelta import sys import MySQLdb connection = MySQLdb.connect( host="127.0.0.1", user="vagrant", passwd="vagrant", db="sharpefolio" ) # Set up stock mapper stock_repository = stocks.StockMysql...
from biicode.common.output_stream import Color from collections import defaultdict from biicode.common.exception import BiiException import fnmatch from biicode.common.model.cells import SimpleCell def print_deps(out, hive_holder, block_name=None, details=False, files=False): ''' Print the general block dependenc...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models from authentic2.compat import user_model_label class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'KeyValue.key' db.alter_column(u'saml_key...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Graphics """ from __future__ import unicode_literals from __future__ import absolute_import from __future__ import division from math import floor, ceil, log10, sin, cos, pi, sqrt, atan2, degrees, radians, exp import json import base64 from six.moves import map from ...
#!/usr/bin/env python3 import os import struct import sys from manticore.native import Manticore # Examples: # printf "\x41\x00\x00\x00" | PYTHONPATH=. ./examples/script/aarch64/basic.py # printf "++\x00\x00" | PYTHONPATH=. ./examples/script/aarch64/basic.py # printf "++++" | PYTHONPATH=. ./example...
# # Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. # # # UVEServer # # Operational State Server for UVEs # import gevent import json import copy import xmltodict import redis import datetime import sys from opserver_util import OpServerUtils import re from gevent.lock import BoundedSemaphore from pysa...
# -*- coding: utf-8 -*- import functools import httplib as http from furl import furl from flask import request from framework import status from framework.auth import Auth, cas from framework.flask import redirect # VOL-aware redirect from framework.exceptions import HTTPError, TemplateHTTPError from framework.auth...
from typing import Dict, List import pyqtgraph as pg from vnpy.trader.ui import QtWidgets, QtCore from vnpy.trader.event import EVENT_TIMER from ..base import PortfolioData from ..engine import OptionEngine, Event from ..time import ANNUAL_DAYS import numpy as np import matplotlib matplotlib.use('Qt5Agg') # noqa...
# Copyright 2017 Arie Bregman # # 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 agree...
""" Plotting -------- Plotting functions collections for exploring new data. """ from catdistrib_plot import barplot_plot from contdistrib_plot import cont_distrib_plot from geo_plotting import plot_in_map from temp_plotting import temp_distrib, distrib_across_temp def general_plot(df, info_var): """General plo...
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # Copyright (c) 2012 VMware, Inc. # Copyright (c) 2011 Citrix Systems, Inc. # Copyright 2011 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. Yo...
############################################################################### ## ## Copyright (C) 2014-2016, New York University. ## Copyright (C) 2011-2014, NYU-Poly. ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: [EMAIL] ## ## This file is part of VisTrails. ## ## "Redistributio...
from django.apps import apps from django.dispatch import Signal from django.utils import six class_prepared = Signal(providing_args=["class"]) class ModelSignal(Signal): """ Signal subclass that allows the sender to be lazily specified as a string of the `app_label.ModelName` form. """ def __in...
#!/usr/bin/python """ PN-CLI vrouter-interface-add/remove/modify """ # # This file is part of Ansible # # Ansible 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, either version 3 of the License, or # (at your...
#!/usr/bin/env python # Copyright (C) 2006-2014 CEA/DEN, EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later vers...
from collections import namedtuple from biicode.common.edition.block_holder import BIICODE_FILE from biicode.common.exception import ConfigurationFileError from biicode.common.edition.bii_config import BiiConfig ClosureItem = namedtuple('ClosureItem', 'resource version') class Closure(dict): '''A connected set ...
from flask import render_template, current_app, request, redirect, url_for, \ flash from flask.ext.login import login_user, logout_user, login_required from ..models import User from . import auth from .forms import LoginForm @auth.route('/login', methods=['GET', 'POST']) def login(): if not current_app.confi...
"""Module for sedes objects that use lists as serialization format.""" from collections import Sequence from functools import partial from itertools import izip, imap from ..exceptions import SerializationError, DeserializationError def is_sedes(obj): """Check if `obj` is a sedes object. A sedes object...
""" Dumps data from the main database, but only dumps a subset of the items To ensure we can load them on the development server We use this because the production database became too heavy to load even with optimized tools like pg_dump This script follows relations to ensure referential integrity so if you load blog...
import os import glob import json import zipfile import hashlib import datetime import contextlib from fabric.api import env from fabric.api import lcd from fabric.api import task from fabric.api import hide from fabric.api import local from fabric.api import execute from fabric.api import settings from nexiles.tools...
import BaseHTTPServer import hashlib import os import requests import urllib2 cache_ext = ('.zip', '.tgz', '.tbz2', '.tar.gz', '.tar.bz2') class CacheHandler(BaseHTTPServer.BaseHTTPRequestHandler): def allowed(self, p): for ext in cache_ext: if p.endswith(ext): return True ...
from __future__ import print_function, division from sympy.core.basic import Basic from sympy.core.mul import Mul from sympy.core.singleton import S, Singleton from sympy.core.symbol import Dummy, Symbol from sympy.core.compatibility import (range, integer_types, with_metaclass, i...
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
#!/usr/bin/env python # encoding: utf-8 """ NPSAppManaged.py """ from . import apNPSApplication from . import fmForm import weakref class NPSAppManaged(apNPSApplication.NPSApp): """This class is intended to make it easier to program applications with many screens: 1. The programmer should not now select w...
import sys def combineClusters(): MinimizedClusteredCabs = {} ClusteredCentroids = {} selectedCab = {} ClusteredCabs_labels = {} SOMcluster_index = 1 selectedCab_index = 1 ClusteredCabs_labels_index = 1 for w in open('Minimized_ClusteredCentroids_labels.clu', 'r').read().spl...
#!/usr/bin/env python # Author: Derrick H. Karimi # Copyright 2014 # Unclassified from bbot.Utils import * from bbot.Data import * from bbot.Strategy import Strategy from bbot.SpendingParser import SpendingParser from bbot.MetaData import MetaData class RegionBuy(Strategy): def __init__(self, app, num_regions=...
#!/usr/bin/env python import sys, os, optparse import chpl_platform, chpl_comm, chpl_compiler, utils from utils import memoize @memoize def get(flag='target'): if flag == 'network': atomics_val = os.environ.get('CHPL_NETWORK_ATOMICS') if not atomics_val: if chpl_comm.get() == 'ugni': ...
from carbon.aggregator.rules import RuleManager from carbon.aggregator.buffers import BufferManager from carbon.instrumentation import increment from carbon.pipeline import Processor from carbon.rewrite import PRE, POST, RewriteRuleManager class AggregationProcessor(Processor): plugin_name = 'aggregate' def proc...
#!/usr/bin/env python ## \file parallel_regression.py # \brief Python script for automated regression testing of SU2 examples # \author A. Aranake, A. Campos, T. Economon, T. Lukaczyk, S. Padron # \version 7.0.3 "Blackbird" # # SU2 Project Website: https://su2code.github.io # # The SU2 Project is maintained by the ...
# Copyright 2013: Mirantis 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 ...