text
stringlengths
475
200k
# Copyright 2011 Google Inc. All Rights Reserved. # # 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,...
# # Copyright (c) 2008--2016 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. You should have received a c...
"""Tests for distutils.command.bdist_wininst.""" import unittest import os from distutils.dist import Distribution from distutils.command.bdist_wininst import bdist_wininst from distutils.tests import support class BuildWinInstTestCase(support.TempdirManager, unittest.TestCase): def te...
"""Methods for reporting bugs.""" import subprocess, sys, os __all__ = ['ReportFailure', 'BugReport', 'getReporters'] # class ReportFailure(Exception): """Generic exception for failures in bug reporting.""" def __init__(self, value): self.value = value # Collect information about a bug. cl...
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab from __future__ import unicode_literals TagNames = [ "A", "ABBR", "ACRONYM", "ADDRESS", "ALTGLYPH", "ALTGLYPHDEF", "ALTGLYPHITEM", "ANIMATE", "ANIMATEC...
# # 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 us...
from django.test import TestCase from django.contrib.contenttypes.models import ContentType from wagtail.wagtailadmin import widgets from wagtail.wagtailcore.models import Page from wagtail.tests.testapp.models import SimplePage, EventPage class TestAdminPageChooserWidget(TestCase): def setUp(self): sel...
import sys from test import support import unittest from importlib import _bootstrap from .. import util from . import util as ext_util @util.case_insensitive_tests class ExtensionModuleCaseSensitivityTest(unittest.TestCase): def find_module(self): good_name = ext_util.NAME bad_name = good_name.u...
# # 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...
# (c) 2018, NetApp, Inc # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ''' unit tests for Ansible module: na_ontap_vscan_scanner_pool ''' from __future__ import print_function import json import pytest from units.compat import unittest from units.compat.mock import patch...
#!/usr/bin/env python import optparse import os import sys import subprocess root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) def optional_dir(): return os.path.join(root_dir, 'optional') def repo_dir(repo_name): return os.path.join(root_dir, repo_name) def get_repo_names(): retur...
# Copyright 2009, Google 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: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
# coding=utf-8 # Copyright 2020 The TF-Agents 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
# This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license # to the complete wo...
# (C) British Crown Copyright 2015, Met Office # # This file is part of mo_pack. # # mo_pack 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 3 of the License, or # (at your option) any la...
# # cfg_site_sample.py - Sample site configuration # # Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) # # 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 2 of the License...
#!/usr/bin/python # 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 option) any later version. # # Ansible is distributed...
""" Alternate namespace for toolz such that all functions are curried Currying provides implicit partial evaluation of all functions Example: Get usually requires two arguments, an index and a collection >>> from toolz.curried import get >>> get(0, ('a', 'b')) 'a' When we use it in higher order ...
""" Management command to update libraries' search index """ from __future__ import print_function from textwrap import dedent from django.core.management import BaseCommand, CommandError from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.locator import LibraryLocator from contentstore.courseware_index i...
""" ============================ Underfitting vs. Overfitting ============================ This example demonstrates the problems of underfitting and overfitting and how we can use linear regression with polynomial features to approximate nonlinear functions. The plot shows the function that we want to approximate, wh...
# -*- encoding: utf-8 -*- """Test class for Template UI""" from fauxfactory import gen_string from nailgun import entities from robottelo.constants import OS_TEMPLATE_DATA_FILE, SNIPPET_DATA_FILE from robottelo.datafactory import generate_strings_list, invalid_values_list from robottelo.decorators import run_only_on, t...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
# # Copyright 2006 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio 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, or (at your option) # any later version. #...
# # 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 us...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
# -*- coding: utf-8 -*- """ pygments.lexers.igor ~~~~~~~~~~~~~~~~~~~~ Lexers for Igor Pro. :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from pygments.lexer import RegexLexer, words from pygments.token import Text, Commen...
from __future__ import absolute_import, division, unicode_literals from datrie import Trie as DATrie from six import text_type from ._base import Trie as ABCTrie class Trie(ABCTrie): def __init__(self, data): chars = set() for key in data.keys(): if not isinstance(key, text_type): ...
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2014, GeekChimp - Franck Nijhof <[EMAIL]> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
#!/usr/bin/env python from util import just_tokenize, make_tests, make_fails, TSTRING, STRING, SSTRING, ID, WHITE, NUMBER, INT, HEX, CCOMMENT, CMCOMMENT, PYCOMMENT, NEWLINE, ANY def make_single(tok, *tests): fn = just_tokenize(tok, WHITE) return make_tests(globals(), tok.__name__, fn, tests) def fail_single(...
from corehq.apps.telerivet.models import TelerivetBackend, IncomingRequest from corehq.apps.sms.api import incoming as incoming_sms from corehq.apps.sms.util import strip_plus from corehq.apps.ivr.api import incoming as incoming_ivr from celery.task import task from dimagi.utils.logging import notify_exception from dja...
# test_viz # Vizualization tests # # Author: Benjamin Bengfort <[EMAIL]> # Created: Sun Dec 06 20:45:32 2015 -0500 # # Copyright (C) 2015 University of Maryland # For license information, see LICENSE.txt # # ID: test_viz.py [] [EMAIL] $ """ Vizualization tests """ ##################################################...
# sql/util.py # Copyright (C) 2005-2017 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """High level utilities which build upon other modules here. """ from .. import exc, u...
import json, os, urllib, urlparse def redirect(url, response): response.add_required_headers = False response.writer.write_status(301) response.writer.write_header("access-control-allow-origin", "*") response.writer.write_header("location", url) response.writer.end_headers() response.writer.wri...
""" @package mi.instrument.star_asimet.bulkmet.metbk_a.driver @file marine-integrations/mi/instrument/star_aismet/bulkmet/metbk_a/driver.py @author Bill Bollenbacher @brief Driver for the metbk_a Release notes: initial version """ import re import time from mi.core.log import get_logger from mi.core.common import B...
""" Comparing two html documents. """ from __future__ import unicode_literals import re from django.utils import six from django.utils.encoding import force_text, python_2_unicode_compatible from django.utils.html_parser import HTMLParseError, HTMLParser WHITESPACE = re.compile('\s+') def normalize_whitespace(str...
#!/usr/bin/python # # 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 option) any later version. # # Ansible is distribut...
# (c) 2017 Red Hat Inc. # # 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 option) any later version. # # Ansible is dis...
# -*- coding: utf-8 -*- __author__= "Luis C. Pérez Tato (LCPT)" __copyright__= "Copyright 2016, LCPT" __license__= "GPL" __version__= "3.0" __email__= "[EMAIL]" import sys def getLg(soilClass): ''' From a length greater than de distance "lg" the soil mouvement can bi consideread as completely uncorrelated. '...
''' Created on Jan 25, 2012 @author: Trung Dong Huynh ''' import unittest from prov.model import ProvBundle, ProvRecord, ProvExceptionCannotUnifyAttribute import logging import json import examples import os logger = logging.getLogger(__name__) class Test(unittest.TestCase): def setUp(self): ...
""" ========== Kernel PCA ========== This example shows that Kernel PCA is able to find a projection of the data that makes data linearly separable. """ print(__doc__) # Authors: Mathieu Blondel # Andreas Mueller # License: BSD 3 clause import numpy as np import matplotlib.pyplot as plt from sklearn.decomp...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (C) 2013 PolyBeacon, 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...
# 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...
# The MIT License (MIT) # Copyright (c) 2016-2017 HIS e. G. # # 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, modi...
from StringIO import StringIO from django.contrib.auth import models, management from django.contrib.auth.management.commands import changepassword from django.test import TestCase class GetDefaultUsernameTestCase(TestCase): def setUp(self): self._getpass_getuser = management.get_system_username de...
# Type keys and specify shift key up/down import subprocess import sys import argparse import time import os class TypeKeys: def __init__(self, *args, **kwargs): self.shift = False self.name = 'Tally.ERP 9' self.window = 0 if 'WID' in os.environ: self.window = os.enviro...
#coding:utf8 ''' Created on 2013-5-8 @author: lan (www.9miao.com) ''' from dbpool import dbpool from MySQLdb.cursors import DictCursor from numbers import Number from twisted.python import log def forEachPlusInsertProps(tablename,props): assert type(props) == dict pkeysstr = str(tuple(props.keys())).replace...
""" Support for eQ-3 Bluetooth Smart thermostats. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/climate.eq3btsmart/ """ import logging import voluptuous as vol from homeassistant.components.climate import ( ClimateDevice, PLATFORM_SCHEMA, PRECISIO...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys,re from handlers import * from util import * from rules import * import logging logging.basicConfig(level=logging.INFO) class Parser: """ 解析器父类 """ def __init__(self, handler): self.handler = handler # 处理程序对象 self.rules = [] # 判...
# -*- coding:utf-8 -*- import os import glob import zipfile from sigal.gallery import Gallery from sigal.settings import read_settings CURRENT_DIR = os.path.dirname(__file__) SAMPLE_DIR = os.path.join(CURRENT_DIR, 'sample') SAMPLE_SOURCE = os.path.join(SAMPLE_DIR, 'pictures', 'dir1') def make_gallery(**kwargs): ...
import unittest from django.utils import checksums class TestUtilsChecksums(unittest.TestCase): def check_output(self, function, value, output=None): """ Check that function(value) equals output. If output is None, check that function(value) equals value. """ if output is...
import pytest from cli_config.tag import tag from utility.nix_error import NixError def test_tag_delete_no_tag(capsys): with pytest.raises(SystemExit) as _excinfo: tag.tag("nixconfig", ["delete"]) _out, _err = capsys.readouterr() assert "2" in str(_excinfo.value), "Exception doesn't contain exp...
# Author: Fred L. Drake, Jr. # [EMAIL] # # This is a simple little module I wrote to make life easier. I didn't # see anything quite like it in the library, though I may have overlooked # something. I wrote this when I was trying to read some heavily nested # tuples with fairly non-descriptive...
from django.utils.translation import ungettext, ugettext as _ from django.utils.encoding import force_unicode from django import template from django.template import defaultfilters from datetime import date import re register = template.Library() def ordinal(value): """ Converts an integer to its ordinal as a...
#-*- coding:utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2011 OpenERP SA (<http://openerp.com>). All Rights Reserved # # This program is free software: you can redistribute it and/or modify # it under th...
""" Zinc Python Tools A collection of Qt widgets and utilities building on the Python bindings for the OpenCMISS-Zinc Visualisation Library. """ classifiers = """\ Development Status :: 5 - Production/Stable Intended Audience :: Developers Intended Audience :: Education Intended Audience :: Science/Research License :...
# Copyright 2013 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...
#!/usr/bin/env python import urllib2 import base64 import json import xml import sys def post(): # Ensure that your stream format matches the rule format you intend to use (e.g. '.xml' or '.json') # See below to edit the rule format used when adding and deleting rules (xml or json) # Expected Enterprise Data Col...
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2013-2014, Epic Games, Inc. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
# Copyright (c) 2011 Tencent Inc. # All rights reserved. # # Author: Huan Yu <[EMAIL]> # Feng Chen <[EMAIL]> # Yi Wang <[EMAIL]> # Chong Peng <[EMAIL]> # Date: October 20, 2011 """ This is the CmdOptions module which parses the users' input and provides hint for users. """ import os imp...
import csv import codecs import cStringIO import datetime import isodate import functools import json import re from collections import OrderedDict from django import http from django.conf import settings from . import models class DateTimeEncoder(json.JSONEncoder): def default(self, obj): if isinstance...
#!/usr/bin/python # Copyright 2004 Vladimir Prus # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) # Test that the <library> property has no effect on "obj" targets. Previously, # it affected all targets, so # # project : ...
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved # $Id$ # # This program is free software: you can redistribute it and/or modify # ...
# # 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 us...
# -*- coding: utf-8 -*- import npyscreen class MyAutoComplete(npyscreen.Autocomplete): colors = ["Jaune","Bleu","Rouge","Vert", "Vert foncé"] def auto_complete(self, input): choices = [] for word in MyAutoComplete.colors: if word.startswith(self.value): choices....
import os from .. import build class ExtensionModule: def __init__(self, interpreter): self.interpreter = interpreter self.snippets = set() # List of methods that operate only on the interpreter. def is_snippet(self, funcname): return funcname in self.snippets def get_include_args(...
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..compat import ( compat_urllib_parse_unquote, compat_xpath, ) from ..utils import ( int_or_none, find_xpath_attr, xpath_text, update_url_query, ) class NozIE(InfoExtractor): _VALID_URL = r'http...
"File-based cache backend" import hashlib import os import shutil import time try: import cPickle as pickle except ImportError: import pickle from django.core.cache.backends.base import BaseCache class FileBasedCache(BaseCache): def __init__(self, dir, params): BaseCache.__init__(self, params) ...
"""Implementation of JSONDecoder """ import re import sys import struct from django.utils.simplejson.scanner import make_scanner c_scanstring = None __all__ = ['JSONDecoder'] FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL def _floatconstants(): _BYTES = '7FF80000000000007FF0000000000000'.decode('he...
r""" ===================================================================== The Johnson-Lindenstrauss bound for embedding with random projections ===================================================================== The `Johnson-Lindenstrauss lemma`_ states that any high dimensional dataset can be randomly projected i...
"""Test result object""" import io import sys import traceback from . import util from functools import wraps __unittest = True def failfast(method): @wraps(method) def inner(self, *args, **kw): if getattr(self, 'failfast', False): self.stop() return method(self, *args, **kw) ...
import glob import os import sys import warnings from pkginfo.distribution import Distribution from pkginfo._compat import STRING_TYPES class Installed(Distribution): def __init__(self, package, metadata_version=None): if isinstance(package, STRING_TYPES): self.package_name = package ...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the...
# Copyright (C) 2014 Andrey Antukh <[EMAIL]> # Copyright (C) 2014 Jesús Espino <[EMAIL]> # Copyright (C) 2014 David Barragán <[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, eith...
# 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 # distributed under the...
# Copyright (C) 2009 Ubixum, Inc. # # 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 version. # # This library is dis...
# Copyright 2010-2017, The University of Melbourne # Copyright 2010-2017, Brian May # # This file is part of Karaage. # # Karaage 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...
# -*- coding: utf-8 -*- """ werkzeug.debug ~~~~~~~~~~~~~~ WSGI application traceback debugger. :copyright: (c) 2013 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import json import mimetypes from os.path import join, dirname, basename, isfile ...
<<<<<<< HEAD <<<<<<< HEAD """Ttk wrapper. This module provides classes to allow using Tk themed widget set. Ttk is based on a revised and enhanced version of TIP #48 (http://tip.tcl.tk/48) specified style engine. Its basic idea is to separate, to the extent possible, the code implementing a widget's behavior from th...
#!/usr/local/bin/python # typelib.py (Type Class Library) # Copyright (c) 2000 David John Goodger # # This software is provided "as-is", without any express or implied warranty. # In no event will the authors be held liable for any damages arising from the # use of this software. # # Permission is granted to anyone...
from __future__ import absolute_import, division, unicode_literals from types import ModuleType try: import xml.etree.cElementTree as default_etree except ImportError: import xml.etree.ElementTree as default_etree __all__ = ["default_etree", "MethodDispatcher", "isSurrogatePair", "surrogatePairTo...
# Copyright 2014 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 required ...
""" Query subclasses which provide extra functionality beyond simple data retrieval. """ from django.conf import settings from django.core.exceptions import FieldError from django.db import connections from django.db.models.query_utils import Q from django.db.models.constants import LOOKUP_SEP from django.db.models.fi...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Business Applications # Copyright (c) 2011-2012 OpenERP S.A. <http://openerp.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of t...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-TODAY OpenERP SA (http://www.openerp.com) # # This program is free software: you can redistribute it and/or modify # it under the terms of ...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
# Copyright (C) 2007 Jan-Klaas Kollhof # Copyright (C) 2011-2015 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2016 Sebastian Ullrich. All rights reserved. # Released under Apache 2.0 license as described in the file LICENSE. # # Author: Sebastian Ullrich # # Python 2/3 compatibility from __future__ import print_function import argparse import collections import o...
import os from mi.logging import config from mi.core.log import get_logger from mi.core.exceptions import NotImplementedException __author__ = 'wordenm' log = get_logger() class ParticleDataHandler(object): def __init__(self): self._samples = {} self._failure = False def addParticleSample(...
# Copyright 2013 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 ...
import re from pprint import pprint from StringIO import StringIO ProgISO8601Date = re.compile('(\d{4})-([01]\d)-([0-3]\d)') def _get_next_row(d): def _get_next_element(_list): for element in _list: yield element return row = {} while True: for key, column in d.iteritem...
from __future__ import unicode_literals from django.contrib.auth import get_user_model from django.contrib.auth.models import Permission class ModelBackend(object): """ Authenticates against settings.AUTH_USER_MODEL. """ def authenticate(self, username=None, password=None, **kwargs): UserMod...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
# -*- coding: utf-8 -*- """ jinja2.filters ~~~~~~~~~~~~~~ Bundled jinja filters. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import re import math from random import choice from operator import itemgetter from itertools import imap, groupby from jinja2....
""" Read/write tools for nonuniform electric field .grd format. Matthew Grawe, grawe2 (at) illinois.edu January 2017 """ import numpy as np def next_line(grd_file): """ next_line Function returns the next line in the file that is not a blank line, unless the line is '', which is a typical EOF marker...
# coding=utf-8 import unittest """945. Minimum Increment to Make Array Unique https://leetcode.com/problems/minimum-increment-to-make-array-unique/description/ Given an array of integers A, a _move_ consists of choosing any `A[i]`, and incrementing it by `1`. Return the least number of moves to make every value in `...
# Copyright (c) 2012-2014, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) # Kurt Cutajar from ..core import GpGrid from .. import likelihoods from .. import kern class GPRegressionGrid(GpGrid): """ Gaussian Process model for grid inputs using Kronecker products ...
from ctypes import * import array import gc import unittest class X(Structure): _fields_ = [("c_int", c_int)] init_called = False def __init__(self): self._init_called = True class Test(unittest.TestCase): def test_fom_buffer(self): a = array.array("i", range(16)) x = (c_int * ...
#!/usr/bin/env python """ Tests of utilities for dealing with ufl indexing and components vs flattened index spaces. """ from ufl import * from ufl import product from ufl.permutation import compute_indices from uflacs.analysis.indexing import (map_indexed_arg_components, map_c...
# -*- coding: utf-8 -*- from eclcli.common import command from eclcli.common import exceptions from eclcli.common import utils from ..rcaclient.common.utils import objectify class ListUser(command.Lister): def get_parser(self, prog_name): parser = super(ListUser, self).get_parser(prog_name) ret...
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-06-27 00:23 from __future__ import unicode_literals from decimal import Decimal from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations...