text
stringlengths
475
200k
# Copyright 2014 Rackspace, 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 writin...
# -*- coding: utf-8 -*- """ Created on Fri May 30 22:56:57 2014 Author: Josef Perktold License: BSD-3 """ import numpy as np from numpy.testing import assert_allclose, assert_raises from statsmodels.base._constraints import (TransformRestriction, transform_params_constraint, fit_constrained) if...
"""\ A library of useful helper classes to the SAX classes, for the convenience of application and driver writers. """ import os, urllib.parse, urllib.request import io import codecs from . import handler from . import xmlreader def __dict_replace(s, d): """Replace substrings of a string using a dictionary.""" ...
# Copyright (C) 2013 Adam Stokes <[EMAIL]> # # This file is part of the sos project: https://github.com/sosreport/sos # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # version 2 of the GNU General Public License. # # See...
""" Make sure that existing RainMachine support isn't broken. https://github.com/home-assistant/core/issues/31745 """ from homeassistant.helpers import device_registry as dr, entity_registry as er from tests.components.homekit_controller.common import ( Helper, setup_accessories_from_file, setup_test_acc...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ setup.py Packaging for dax """ from glob import glob import os from setuptools import setup, find_packages import subprocess def git_version(): def _minimal_ext_cmd(cmd): env = {} for k in ['SYSTEMROOT', 'PATH', 'HOME']: v = os.envir...
# -*- coding: utf-8 -*- """ make_dataset.py: Walks the raw data dirs and cleans the files placing them in the associated processed directory. """ __author__ = "Tyler Marrs" import os import sys # Hack to get src dir on module path project_dir = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir) if p...
# Eloipool - Python Bitcoin pool server # Copyright (C) 2011-2012 Luke Dashjr <[EMAIL]> # # 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 o...
# Copyright (C) 2012,2013,2016 # Max Planck Institute for Polymer Research # Copyright (C) 2008,2009,2010,2011 # Max-Planck-Institute for Polymer Research & Fraunhofer SCAI # # This file is part of ESPResSo++. # # ESPResSo++ is free software: you can redistribute it and/or modify # it under the terms of ...
# -*- coding: utf-8 -*- """ Tests for xss_linter.py """ import re import textwrap from StringIO import StringIO from unittest import TestCase import mock from ddt import data, ddt from scripts.xss_linter import ( FileResults, JavaScriptLinter, MakoTemplateLinter, ParseString, PythonLinter, Rul...
from random import choice, randrange as rrange, shuffle from time import sleep, ctime from sys import getsizeof from decimal import Decimal class Game: def __init__(self): self.empty = '' self.create_word = '' self.word_hint = '' self.life = 0 self.bank = [] self.cou...
"""Module for testing the basic features of pyas2.""" from pyas2lib import as2 from . import Pyas2TestCase class TestBasic(Pyas2TestCase): def setUp(self): self.org = as2.Organization( as2_name="some_organization", sign_key=self.private_key, sign_key_pass="test", ...
import copy import operator from functools import partial, reduce, update_wrapper from django import forms from django.conf import settings from django.contrib import messages from django.contrib.admin import widgets, helpers from django.contrib.admin.util import (unquote, flatten_fieldsets, get_deleted_objects, m...
#!/usr/bin/env python # -*- coding: utf-8 -*- # The path to enlightenment starts with the following: import unittest from koans.about_asserts import AboutAsserts from koans.about_strings import AboutStrings #from koans.about_string_manipulation import AboutStringManipulation #from koans.about_none import AboutNone f...
from __future__ import division, print_function, absolute_import import warnings from distutils.version import LooseVersion import numpy as np from numpy.testing import (TestCase, assert_array_almost_equal, assert_array_equal, assert_array_less, assert_raises, ass...
# This is used to draw three comparisons for SGD+BN, SVRG+BN and Streaming SVRG +BN import matplotlib import matplotlib.pyplot as plt plt.switch_backend('agg') import pylab import numpy as np import sys # all the methods are with BN layers!!! def deminish(a) : end_factor=0.4 length = len(a) for i in ...
import uuid from gevent import spawn, wait from gevent.event import Event from gevent.monkey import patch_all from gevent.queue import Queue, Empty from gevent.select import select from werkzeug.exceptions import HTTPException from .websocket import WebSocket, WebSocketMiddleware from ._uwsgi import uwsgi class Gev...
# Copyright (c) 2003-2016 LOGILAB S.A. (Paris, FRANCE). # http://www.logilab.fr/ -- mailto:[EMAIL] # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html # For details: https://github.com/PyCQA/pylint/blob/master/COPYING """functional/non regression tests for pylint""" from __future__ import ...
from django.conf import settings from django.conf.urls import include, url from django.conf.urls.static import static from django.contrib import admin from django.contrib.auth import views as auth_views from django.urls import path from django.utils.translation import ugettext_lazy as _ from helpers.views.show_page im...
import copy import cerberus import tornado.escape def extend_schema(addenda): base_schema = copy.deepcopy(BaseObject.schema) base_schema.update(addenda) return base_schema class BaseObject: """ Base object subclassed by all filesystem representations. Uses cerberus for data validation. Provi...
# -*- coding: utf-8 -*- import unittest import datetime import officehours new_years_eve = datetime.date(2015, 12, 31) new_year = datetime.date(2016, 1, 1) saturday = datetime.date(2016, 1, 2) sunday = datetime.date(2016, 1, 3) monday = datetime.date(2016, 1, 4) tuesday = datetime.date(2016, 1, 5) new_years_eve_ear...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'CalibrationRecord.rubric_scores' db.add_column('peer_grading_calibrationrecord', 'rubric_sco...
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
# Adapted for numpy/ma/cdms2 by convertcdms.py """ # Fillarea (Tf) module """ ################################################################################# # # # Module: fillarea (Tf) module ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # legendrefdnum, a numerical FD-method solver for Sturm-Liouville problems # Copyright (C) 2013, Danyil Bohdan, Denys Dragunov # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as publi...
""" piuflgen.py Copyright 2016 OSIsoft, 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 agr...
## ## Biskit, a toolkit for the manipulation of macromolecular structures ## Copyright (C) 2002-2005 Wolfgang Rieping ## ## This program 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 th...
from compiler import Asm, nextlabel from codeitembase import CodeItemBase class BooleanExpressionBase(CodeItemBase): constantExpression = False class BooleanConstant(BooleanExpressionBase): argumentNames = ('value',) passiveArguments = ('value',) constantExpression = True def transformToAsm(self, containingF...
from watson_developer_cloud import SpeechToTextV1 as SpeechToText class Speech_to_text(): speechcreds = {} def __init__(self, url, username, password): self.speechcreds['url'] = url self.speechcreds['username'] = username self.speechcreds['password'] = password self.Speech_to...
# ################################################################################ # ## # ## https://github.com/NetASM/NetASM-python # ## # ## File: # ## profile.py # ## # ## Project: # ## NetASM: A Network Assembly Language for Programmable Dataplanes # ## # ## Author: # ## Muhammad Shahbaz # ...
import gym from gym import wrappers import numpy as np import tensorflow as tf import os import string from secrets import OPENAI_GYM_API_KEY class Config: def __init__(self, state_dim, n_actions, memory_size, batch_size, discount, learning_rate, epsilon_initial, epsilon_decay_steps, epsilon_d...
## -*- mode: python; coding: utf-8; -*- ## ## This file is part of Invenio. ## Copyright (C) 2008, 2010, 2011 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 ## Li...
import gzip import os import urllib2 import threading import time import Queue import StringIO from checksum import calc_checksum from format_memory import format_memory import progress DOWNLOAD_THREAD_COUNT = 12 def get_url_root(): return 'http://res.eveonline.ccpgames.com' def DownloadResourceFile(target_url...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2012 Didotech Inc. (<http://www.didotech.com>) # All Rights Reserved # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero Ge...
import os, re, sys match = re.search('(.*)/', sys.argv[0]) if match != None: os.chdir(match.group(1)) os.chdir('../') source_exts = [".c", ".cpp", ".h"] def parse_source(): stringtable = {} def process_line(line): if 'Localize("'.encode() in line: fields = line.split('Localize("'.encode(), 1)[1].split('"'.enc...
# Copyright 2018 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...
#!/usr/bin/env python from __future__ import division from __future__ import print_function import getpass usrName = getpass.getuser() import argparse import sys import os import csv import warnings import math import numpy as np import numpy.ma as ma from scipy import stats from PIL import Image import datetime as d...
from .common import * import numpy import scipy import scipy.special # Datatypes bool = numpy.bool float16 = numpy.float16 float32 = numpy.float32 float64 = numpy.float64 uint8 = numpy.uint8 int16 = numpy.int16 int32 = numpy.int32 int64 = numpy.int64 float_fmts.update({ 'float16': float16, '...
#!/usr/bin/env python # This is a simple demonstration client for the "0install slave" JSON API. # This file is in the Public Domain. import subprocess, json import logging, sys # 0 = low # 1 = show our messages # 2 = enabled logging in slave verbosity = 0 if verbosity > 0: logging.getLogger("").setLevel(logging.I...
import batalha import sys import cliente import server if (len(sys.argv) > 1 and (sys.argv[1] == '-s' or sys.argv[1] == '-S' or sys.argv[1] == '-c' or sys.argv[1] == '-C')): NPC = False if (len(sys.argv) > 2): NPC = (sys.argv[2] == '-i') if (sys.argv[1] == '-c' or sys.argv[1] == '-C'): c = cliente.Cliente(True,...
# Copyright (c) 2013 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.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
#!/usr/bin/env python print """ netkickern - by Thomas Hirsch 2008-2009 This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under the conditions of the GNU General Public Licence version 3 (GPLv3) see: http://www.gnu.org/licenses/gpl-3.0.html """ imp...
# -*- coding: utf-8 -*- u""" Copyright 2013-2014 Olivier Cortès <[EMAIL]>. This file is part of the 1flow project. 1flow 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...
#!/usr/bin/env python #============================================================================== # Copyright 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Amazon Software License (the "License"). You may not use # this file except in compliance with the License. A copy of the...
#!/usr/bin/env python3 ## INFO ######################################################################## ## ## ## cutils ## ## ====== ...
import os from django.contrib.auth.models import User from django.template import Context, Template from django.test import TestCase from storybase.tests.base import FileCleanupMixin, PermissionTestCase from cmsplugin_storybase.models import create_news_item from storybase_story.models import create_story from storybas...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'Pageview.url' db.alter_column('tracking_pageview', 'ur...
# coding=utf-8 """Tests for map creation in QGIS plugin.""" from future import standard_library standard_library.install_aliases() __author__ = 'Tim Sutton <[EMAIL]>' __revision__ = '$Format:%H$' __date__ = '17/10/2010' __license__ = "GPL" __copyright__ = 'Copyright 2012, Australia Indonesia Facility for ' __copyright...
from __future__ import (absolute_import, print_function, division) """ A small collection of useful user-agent header strings. These should be kept reasonably current to reflect common usage. """ # pylint: line-too-long # A collection of (name, shortcut, string) tuples. UASTRINGS = [ ("andro...
# -*- coding: utf-8 -*- # # 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, software ...
from lib.common import helpers class Module: def __init__(self, mainMenu, params=[]): self.info = { 'Name': 'Invoke-SearchGAL', 'Author': ['@xorrior'], 'Description': ("returns any exchange users that match the specified search criteria. Searchable fields are FirstNa...
#!/usr/bin/env python # -*- encoding: utf-8 -*- """It's the ``setup.py``; you know the drill.""" import io import re from glob import glob from os.path import basename from os.path import dirname from os.path import join from os.path import splitext from setuptools import find_packages from setuptools import setup d...
from django.shortcuts import render_to_response from django.http import HttpResponse, HttpResponseRedirect from django.core.urlresolvers import reverse_lazy, resolve from django.views import generic from django.contrib.auth.models import User from django.contrib.auth.decorators import user_passes_test from django.templ...
#!/usr/bin/env python # Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """FreeBSD platform implementation.""" import errno import os import sys import warnings import _psutil_bsd import _psu...
import array import copy import pyglet from unlock.view.pyglet_sprite import * from unlock.view.pyglet_text import * from unlock.view.view import * from unlock.view.grid import * from unlock.view.fastpad_view import * from unlock.view.scope_view import * from unlock.view.robot_view import * class UnlockViewFactory(...
# Django settings for lmhome project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ('Lukasz Machura', '[EMAIL]'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': '/home/lukasz/works...
#!/usr/bin/env python # $Id: basic_ftpd.py 1174 2013-02-19 11:25:49Z g.rodola $ # pyftpdlib is released under the MIT license, reproduced below: # ====================================================================== # Copyright (C) 2007-2013 Giampaolo Rodola' <[EMAIL]> # # All Rights Reser...
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import nose import numpy as np from pims import plot_to_frame, plots_to_frame from nose.tools import assert_true, assert_equal import unittest try: import matplotlib.pyplot as plt except ImportEr...
# 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 b...
from __future__ import print_function from twisted.python import util from twisted.spread import pb from twisted.cred import portal, checkers, credentials class Avatar(pb.Avatar): def perspective_exception(self, x): return x / 0 class Realm: def requestAvatar(self, interface, mind, *interfaces): ...
import re import logging import time from autotest.client.shared import error from virttest import qemu_io, data_dir from virttest.qemu_storage import QemuImg from autotest.client import utils @error.context_aware def run(test, params, env): """ Run qcow2 performance tests: 1. Create image with given para...
################################################################################ # 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...
# -*- encoding: utf-8 -*- ############################################################################## # # Odoo, Open Source Management Solution # This module copyright (C) 2015 JPJ # ( http://www.savoirfairelinux.com). # # This program is free software: you can redistribute it and/or modify # it under...
# -*- coding: utf-8 -*- ########################################################################### # OCRFeeder - The complete OCR suite # Copyright (C) 2009 Joaquim Rocha # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as pub...
import os import cPickle import logging from sam import constants import web from sam import common import sam.models.ports logger = logging.getLogger(__name__) class Subscriptions: CREATE_MYSQL = os.path.join(constants.base_path, 'sql/setup_subscription_tables_mysql.sql') CREATE_SQLITE = os.path.join(consta...
from django.utils.translation import ugettext_lazy as _ # returned via redirect, email notification, http notification RESULT_SUCCESS = '0' RESULT_AUTHORIZED_ONLY = '5' # returned only via email notification, http notification RESULT_ANNOUNCED = '2' RESULT_AUTHORIZED = '3' RESULT_PROCESSING = '4' # returned only vi...
# # Copyright (c) 2001 - 2019 The SCons Foundation # # 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, modify, merge...
"""Tests related to the Injector classes.""" from inspect import isclass import pytest from dependencies import Injector from dependencies import value from dependencies.exceptions import DependencyError from helpers import CodeCollector def test_lambda_dependency(): """Inject lambda function.""" class Foo...
#!/usr/bin/python # # Copyright 2014-2015 Timothy Sutton # Adapted for the GitHub downloads API endpoint by # Justin L R Graham <[EMAIL]> # # 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 #...
import pylab from collections import OrderedDict import argparse import numpy as np class DataSet(object): def __init__(self, headers, ls): self.ls = ls self.headers = OrderedDict([(h,i) for i, h in enumerate(headers)]) def filter(self, kwargs): a = DataSet(self.headers.keys(), []) ...
""" Checks that classes uses valid __slots__ """ # pylint: disable=too-few-public-methods, missing-docstring, no-absolute-import # pylint: disable=using-constant-test from collections import deque def func(): if True: return ("a", "b", "c") else: return [str(var) for var in range(3)] class N...
#! /usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions...
import os import pylearn2 os.environ['PYLEARN2_DATA_PATH'] = '/home/mclaughlin6464/GitRepos/pylearn2/data' path = os.path.join(pylearn2.__path__[0], 'myStuff', 'milli_sam_1.yaml') with open(path, 'r') as f: train = f.read() hyper_params = {'dim_h0' : 20, 'max_epochs' : 1000, 'learnin...
import serial import sys import globalVariable class SerialOperation(object): def __init__(self): self.com = globalVariable.serial_config['serial_port'] self.xonxoff = globalVariable.serial_config['xonxoff'] self.baudrate = globalVariable.serial_config['baudrate'] self.timeout = g...
# # The Python Imaging Library. # $Id$ # # the Image class wrapper # # partial release history: # 1995-09-09 fl Created # 1996-03-11 fl PIL release 0.0 (proof of concept) # 1996-04-30 fl PIL release 0.1b1 # 1999-07-28 fl PIL release 1.0 final # 2000-06-07 fl PIL release 1.1 # 2000-10-20 fl PIL release 1.1.1...
# -*- coding: utf-8 -*- # # Copyright 2012 James Thornton (http://jamesthornton.com) # BSD License (see LICENSE for details) # """ Bulbs supports pluggable backends. This is the Neo4j Server client. """ import re from bulbs.config import Config, DEBUG, ERROR from bulbs.registry import Registry from bulbs.utils import...
"""engine.SCons.Tool.icl Tool-specific initialization for the Intel C/C++ compiler. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 201...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2017 Anmol Gulati <[EMAIL]> # Copyright (C) 2017 Radim Rehurek <[EMAIL]> """Python wrapper around `Varembed model <https://github.com/rguthrie3/MorphologicalPriorsForWordEmbeddings>`_. Original paper:`"Morphological Priors for Probabilistic Neural Word Emb...
#!/usr/bin/env python3 from testUtils import Utils from datetime import datetime from datetime import timedelta import time from Cluster import Cluster from WalletMgr import WalletMgr from TestHelper import TestHelper from TestHelper import AppArgs import json import os import re import shutil import signal import sy...
from delegate.geni.v3.rspecs.tnrm.advertisement_formatter import DEFAULT_XS,\ TNRMv3AdvertisementFormatter, DEFAULT_XMLNS, DEFAULT_SHARED_VLAN,\ DEFAULT_AD_SCHEMA_LOCATION from lxml import etree class SERMv3AdvertisementFormatter(TNRMv3AdvertisementFormatter): def __init__(self, xmlns=DEFAULT_XMLNS, xs=DE...
# -*- coding: utf-8 -*- # This file is part of beets. # Copyright 2016, Adrian Sampson. # # 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 t...
# -*- coding: utf-8 -*- import jinja2 from datetime import date from markdown import markdown from .utils import slugify from . import app, __author__ as author @app.template_filter('html') def to_html(text): """Converts a markdown string to a HTML document. Uses the `CodeHilite <http://pythonhosted.org/M...
# coding=utf-8 """Helper module for gui test suite.""" import codecs import hashlib import inspect import logging import os import re import shutil import sys from PyQt4 import QtGui # pylint: disable=W0621 from itertools import izip from os.path import exists, splitext, basename, join from tempfile import mkdtemp f...
""" pypayd database handling """ import time import logging from datetime import datetime from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String, DateTime, Boolean, Text from sqlalchemy import Sequence from sqlalchemy import create_engine from sqlalchemy.orm import scoped...
# Copyright 2015 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...
#!/usr/bin/env python import Globals, sys, ast, yaml, os, tempfile from transaction import commit from Products.ZenUtils.ZenScriptBase import ZenScriptBase if len(sys.argv) < 3: sys.exit('\nError faltan argumentos\n\nUsage: %s "fichero_MIBS" "cabecera_TRAPS"\n\n' % sys.argv[0]) file = sys.argv[1] cabece...
# -*- coding: utf-8 -*- from django.db import models from decimal import Decimal import datetime, calendar class HistoryManager(models.Manager): def income_daily(self, start=datetime.date.today()+datetime.timedelta(weeks=-1), end=datetime.date.today(), partner=None): """ Calcul...
# -*- coding: utf-8 -*- #!/usr/bin/python ''' Created on 14/08/2013 @author: roberto DOT antolin AT forestry DOT gis.gov.uk ''' import pylab import sys, os import numpy as np def sortLists(L1, L2): """(list, list) -> [list, list] Sort two list >>> L1 = [2,1] >>> L2 = [a,b] >>> l1, l2 = sort...
# Copyright 2012-2013 NEC Corporation. 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...
""" This file contains some utils for connecting to Logentries as well as storing logs in a queue and sending them.""" VERSION = '2.0.7' from logentries import helpers as le_helpers import logging import threading import socket import random import time import sys import certifi # LE appender signature - used ...
import time from datetime import timedelta from unittest.mock import patch, Mock from superdesk.utc import utcnow from superdesk.tests import TestCase from superdesk.storage import AmazonMediaStorage from superdesk.storage.amazon_media_storage import _guess_extension class AmazonMediaStorageTestCase(TestCase): ...
from __future__ import unicode_literals try: import unittest2 as unittest except ImportError: import unittest from werkzeug.test import Client from werkzeug.wrappers import Response from isso.wsgi import CORSMiddleware, origin def hello_world(environ, start_response): start_response('200 OK', [('Conte...
# 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...
from cwbot.modules.BaseDungeonModule import BaseDungeonModule class TurnsModule(BaseDungeonModule): """ A stateless module that keeps track of number of turns spent in Hobopolis. No configuration options. """ requiredCapabilities = ['chat', 'hobopolis'] _name = "turns" d...
#!/usr/bin/env python # Encoding: utf-8 # ----------------------------------------------------------------------------- # Project : OKF - Spending Stories # ----------------------------------------------------------------------------- # Author : Edouard Richard <[EMAIL]> # -------------...
""" test views """ import datetime import json import re import pytz import ddt from mock import patch, MagicMock from nose.plugins.attrib import attr from capa.tests.response_xml_factory import StringResponseXMLFactory from courseware.courses import get_course_by_id # pyline: disable=import-error from courseware.fie...
# coding: utf-8 from __future__ import unicode_literals from .adobepass import AdobePassIE from ..utils import ( extract_attributes, int_or_none, parse_age_limit, smuggle_url, update_url_query, ) class FXNetworksIE(AdobePassIE): _VALID_URL = r'https?://(?:www\.)?(?:fxnetworks|simpsonsworld)\.com/video/(?P<id>\...
from typing import cast import functools import logging from simple_salesforce.api import SFType from simple_salesforce.exceptions import SalesforceMalformedRequest from cumulusci.core.exceptions import PackageInstallError from cumulusci.salesforce_api.utils import get_simple_salesforce_connection from cumulusci.util...
import unittest from server import make_server_thread, make_server, DEFAULT_CERTS class HTTPDummyServerTestCase(unittest.TestCase): scheme = 'http' host = 'localhost' port = 18081 certs = DEFAULT_CERTS @classmethod def _start_server(cls): cls.server_thread = make_server_thread(make_s...
# -*- coding: utf-8 -*- """ unit test for the meta module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2009 by the Jinja Team. :license: BSD, see LICENSE for more details. """ from jinja2 import Environment, meta def test_find_undeclared_variables(): env = Environment() ast = env.parse('{% s...