text
stringlengths
475
200k
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
from optparse import make_option from django.contrib.gis import gdal from django.core.management.base import LabelCommand, CommandError def layer_option(option, opt, value, parser): """ Callback for `make_option` for the `ogrinspect` `layer_key` keyword option which may be an integer or a string. """ ...
# -*- coding: utf-8 -*- from .common import KARMA, TestForumCommon from ..models.forum import KarmaError from openerp.exceptions import UserError, AccessError from openerp.tools import mute_logger class TestForum(TestForumCommon): @mute_logger('openerp.addons.base.ir.ir_model', 'openerp.models') def test_as...
# test_targets.py - Unit tests for swift_build_support.targets -*- python -*- # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See https://swift.org/LICENSE.txt...
"""Generate a keymap.json from a keymap.c file. """ import json from milc import cli import qmk.keymap import qmk.path @cli.argument('--no-cpp', arg_only=True, action='store_false', help='Do not use \'cpp\' on keymap.c') @cli.argument('-o', '--output', arg_only=True, type=qmk.path.normpath, help='File to write to')...
from __future__ import unicode_literals import base64 import binascii import hashlib from django.dispatch import receiver from django.conf import settings from django.test.signals import setting_changed from django.utils import importlib from django.utils.datastructures import SortedDict from django.utils.encoding im...
# Implements _both_ a connectable client, and a connectable server. # # Note that we cheat just a little - the Server in this demo is not created # via Normal COM - this means we can avoid registering the server. # However, the server _is_ accessed as a COM object - just the creation # is cheated on - so this is still ...
# 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...
__all__ = ['BaseRepresenter', 'SafeRepresenter', 'Representer', 'RepresenterError'] from error import * from nodes import * import datetime import sys, copy_reg, types class RepresenterError(YAMLError): pass class BaseRepresenter(object): yaml_representers = {} yaml_multi_representers = {} d...
''' Created on Aug 22, 2011 @author: hussain.bohra @author: fabioz ''' import os import sys import unittest #======================================================================================================================= # Test #================================================================================...
# Copyright 2013 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 unittest from metrics import test_page_test_results from metrics import timeline from telemetry.timeline import model as model_module from telemetry....
# Copyright (C) 2012 Balazs Ankes ([EMAIL]) University of Szeged # # 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 conditio...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Budgets Management', 'version': '1.0', 'category': 'Accounting & Finance', 'description': """ This module allows accountants to manage analytic and crossovered budgets. ========================...
import os import mock from nectar.report import DownloadReport import base_downloader from pulp_puppet.common import constants from pulp_puppet.plugins.importers.downloaders import exceptions, web from pulp_puppet.plugins.importers.downloaders.web import HttpDownloader TEST_SOURCE = 'http://forge.puppetlabs.com/' ...
#!/usr/bin/python # # Copyright 2012 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 b...
#!/usr/bin/env python # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t -*- # # NetProfile: Entities module # © Copyright 2013-2014 Alex 'Unik' Unigovsky # # This file is part of NetProfile. # NetProfile is free software: you can redistribute it and/or # modify it under the terms of the GNU Affero General Public #...
import inspect import re from django.apps import apps as django_apps from django.conf import settings from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.middleware.csrf import rotate_token from django.utils.crypto import constant_time_compare from django.utils.module_loading import i...
# Flexlay - A Generic 2D Game Editor # Copyright (C) 2014 Ingo Ruhnke <[EMAIL]> # # 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 the License, or # (at your option) any later...
# Copyright 2016 Hewlett Packard Enterprise Development Company LP. # 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...
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright: (c) 2017, F5 Networks 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', ...
#!/usr/bin/python # coding=utf-8 ########################################################################## from test import CollectorTestCase from test import get_collector_config from test import unittest from mock import Mock from mock import patch from mock import call from collections import Iterator from diamon...
import time DAYS_PER_MONTH = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] def is_leap(year): return (year % 4) == 0 def test(): seconds = 0 wday = 5 # Jan 1, 2000 was a Saturday for year in range(2000, 2034): print("Testing %d" % year) yday = 1 for month in range(1, ...
from __future__ import print_function import re, time, threading, socket, SocketServer from binascii import hexlify, unhexlify from nacl.secret import SecretBox from ..util import ipaddrs from ..util.hkdf import HKDF class TransitError(Exception): pass # The beginning of each TCP connection consists of the follow...
# Copyright (c) 2012 NetApp, Inc. # Copyright (c) 2014 Red Hat, 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...
from django.conf import settings from django.contrib.flatpages.admin import FlatpageForm from django.test import TestCase class FlatpageAdminFormTests(TestCase): def setUp(self): self.form_data = { 'title': "A test page", 'content': "This is a test", 'sites': [settings.S...
""" CORE MARKDOWN BLOCKPARSER =========================================================================== This parser handles basic parsing of Markdown blocks. It doesn't concern itself with inline elements such as **bold** or *italics*, but rather just catches blocks, lists, quotes, etc. The BlockParser is made up ...
# -*- 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...
from client import exceptions as ex from client.sources import ok_test from client.sources.ok_test import models import mock import unittest class LoadTest(unittest.TestCase): NAME = 'valid' VALID_FILE = 'test/' + NAME + '.py' INVALID_FILE = 'invalid.ext' def setUp(self): self.patcherIsFile = ...
''' Created on Sep 29, 2010 @author: ivan ''' import logging from gi.repository import Gtk from foobnix.gui.state import LoadSave from foobnix.util.mouse_utils import is_double_left_click, is_rigth_click,\ right_click_optimization_for_trees, is_empty_click from foobnix.helpers.menu import Popup from foobnix.help...
from crits.core.crits_mongoengine import EmbeddedCampaign def migrate_indicator(self): """ Migrate to the latest schema version. """ migrate_2_to_3(self) def migrate_2_to_3(self): """ Migrate from schema 2 to 3. """ if self.schema_version < 2: migrate_1_to_2(self) if sel...
from django.shortcuts import get_object_or_404 from django_rest_logger import log from knox.auth import TokenAuthentication from knox.models import AuthToken from rest_framework import status from rest_framework.authentication import BasicAuthentication from rest_framework.decorators import api_view from rest_framework...
# -*- coding: utf-8 -*- """ Created on Mon Jul 31 20:05:23 2017 @author: DIP @Copyright: Dipanjan Sarkar """ from sklearn import metrics import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.preprocessing import LabelEncoder from sklearn.base import clone from sklearn.preprocessing impor...
#mainscript from __future__ import print_function from collections import Counter import csv,ast,re, itertools, glob,sys,os,datetime import dresher_LSA as d import main_1inventoryMover as m import main_2inventoryParser2 as k import main_3min_analysis as a1 import main_4efficiency_analysis as a2 """ 2017.0...
# Create the quick lookup organism table import Config import sys, string import MySQLdb import Database with Database.db as cursor : # EMPTY EXISTING DATA cursor.execute( "TRUNCATE TABLE " + Config.DB_QUICK + ".quick_organisms" ) cursor.execute( "TRUNCATE TABLE " + Config.DB_QUICK + ".quick_refseq_o...
#**************************************************************************# #* FILE ************** accelerate_tools.py ************************# #**************************************************************************# #* Author: Patrick Miller February 9 2002 *# #***********...
#!/usr/bin/python # # Test for smbcontrol command line argument handling. # import comfychair class NoArgs(comfychair.TestCase): """Test no arguments produces usage message.""" def runtest(self): out = self.runcmd("smbcontrol", expectedResult = 1) self.assert_re_match("Usage: smbcontrol", out[...
from .lexerconstants import CHAR_MAP, HAS_ARGS, IMP_CONST, \ STACK_MANIPULATION_CONST, ARITHMETIC_CONST, HEAP_ACCESS_CONST, \ FLOW_CONTROL_CONST, IO_CONST, NUM_CONST from .ws_token import Tokeniser class IntError(ValueError): '''Exception when invalid integer is found''' class Lexer(object): def __i...
# -*- coding: utf-8 -*- # # Copyright (C) 2013-2017 Gauvain Pocentek <[EMAIL]> # # This program 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...
# # Copyright 2016 Red Hat | Ansible # # 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. # # ...
#!/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...
# 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...
# Copyright 2020 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...
# -*- coding: utf-8 -*- # # Copyright (C) 2011-2014 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file LICENSE, which # you should have received as part of this distribution. # import sys import simpleubjson from ..draft8 import Draft8Decoder from ..draft9 import Draft9Decod...
from pyparser.grammar.pclass import Class as BaseClass, Extractor as BaseExtractor from pyparser.grammar.exception import InvalidSyntax from pyparser.lang.php.grammar.method import Extractor as MethodExtractor from pyparser.lang.php.grammar.classprop import Extractor as PropExtractor keywords = ['abstract', 'class'] ...
"""SCons.Conftest Autoconf-like configuration support; low level implementation of tests. """ # # Copyright (c) 2003 Stichting NLnet Labs # Copyright (c) 2001, 2002, 2003 Steven Knight # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation file...
# -*- coding: utf-8 -*- # # 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 #...
""" Forms and validation code for user registration. Note that all of these forms assume Django's bundle default ``User`` model; since it's not possible for a form to anticipate in advance the needs of custom user models, you will need to write your own forms if you're using a custom model. """ from django.contrib....
''' Created on Apr 7, 2012 @author: Demicow ''' import pygame #Tie circle collion to self. leftside etc class customSprite(pygame.sprite.DirtySprite): def __init__(self, scene, image, location): #init the sprite! pygame.sprite.DirtySprite.__init__(self) #info about t...
# -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ from cms.plugin_pool import plugin_pool from cms.plugin_base import CMSPluginBase from djangocms_accordion.models import Accordion, AccordionEntry class AccordionPlugin(CMSPluginBase): model = Accordion name = _('Accordion') ...
# -*- 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...
from __future__ import division, absolute_import, print_function import numpy as np from numpy.compat import long from numpy.testing import ( TestCase, assert_, assert_equal, assert_array_equal, run_module_suite ) from numpy.lib.type_check import ( common_type, mintypecode, isreal, iscomplex, isposinf, isn...
#!/usr/bin/env python # Copyright 2016 Criteo # # 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...
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2011, 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 opt...
import sys import json import requests import re class BitportAPI: access_token = "" apiBaseUrl = "https://api.bitport.io/v2" isTvShowRegex = re.compile("[Ss]\d{1,2}[Ee]\d{1,2}") getNameRegex = re.compile("(^[a-zA-Z. _\-0-9()'\"]*?)\(?2\d\d\d|(^[a-zA-Z. _\-0-9()'\"]*)([Ss]\d{1,2}[Ee]\d{1,2})") ...
from __future__ import division # required for float results when dividing ints import os, sys from glob import glob from os.path import isfile, join from itertools import islice INPUT=sys.argv[1] # zoom=int(sys.argv[3]) def convert(filename): # todo: get zoom from filename zoom=15# current zoom level - sets x & y...
from django.conf.urls import url from django.contrib import messages from django.core.urlresolvers import reverse from django import forms from django.http import HttpResponseRedirect, HttpResponse from django.template import RequestContext, Template from django.template.response import TemplateResponse from django.vie...
#!/usr/bin/env python # Copyright (c) 2009 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Test that environment variables are ignored when --ignore-environment is specified. """ import os import TestGyp os.environ['GYP_DEFI...
# -*- coding: utf-8 -*- """ RealWorldish Benchmark ~~~~~~~~~~~~~~~~~~~~~~ A more real-world benchmark of Jinja2. Like the other benchmark in the Jinja2 repository this has no real-world usefulnes (despite the name). Just go away and ignore it. NOW! :copyright: (c) 2009 by the Jinja Team. ...
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # 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...
""" This module houses the GDAL & SRS Exception objects, and the check_err() routine which checks the status code returned by GDAL/OGR methods. """ # #### GDAL & SRS Exceptions #### class GDALException(Exception): pass # Legacy name OGRException = GDALException class SRSException(Exception): pass cla...
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import re import codecs class MalformedLocaleFileError(Exception): pass def parse_file(path): return parse(rea...
#!/usr/bin/env python # # Copyright 2012-2015 clowwindy # # 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 la...
'''examples to check summary, not converted to tests yet ''' from __future__ import print_function if __name__ == '__main__': from statsmodels.regression.tests.test_regression import TestOLS #def mytest(): aregression = TestOLS() TestOLS.setupClass() results = aregression.res1 r_summary = s...
from rope.base import ast, evaluate, builtins, pyobjects from rope.refactor import patchedast, occurrences class Wildcard(object): def get_name(self): """Return the name of this wildcard""" def matches(self, suspect, arg): """Return `True` if `suspect` matches this wildcard""" class Suspec...
# # Paul W. Frields <[EMAIL]> # # Copyright 2009 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, modify, # copy, or redistribute it subject to the terms and conditions of the GNU # General Public License v.2. This program is distributed in the hope that it # will be useful, but ...
""" Utilities to use when interfacing with Postgres. - These utilities support the workflow wherein you store annoated sentences in a database. """ __author__ = 'arunchaganty' import os import stanza import requests import logging def unescape_sql(inp): """ :param inp: an input string to be unescaped :re...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Business Applications # Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of ...
# # 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...
""" Tests for the Studio authoring XBlock mixin. """ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.partitions.partitions import Group, UserPartition class AuthoringMixinTestCase(ModuleStoreTestCase): ...
# Time: O(nlogn + nlogk) = O(nlogn), k is the length of the result. # Space: O(1) # You have a number of envelopes with widths and heights given # as a pair of integers (w, h). One envelope can fit into another # if and only if both the width and height of one envelope is greater # than the width and height of the ot...
""" Jawbone OAuth2 backend, docs at: http://psa.matiasaguirre.net/docs/backends/jawbone.html """ from social.utils import handle_http_errors from social.backends.oauth import BaseOAuth2 from social.exceptions import AuthCanceled, AuthUnknownError class JawboneOAuth2(BaseOAuth2): name = 'jawbone' AUTHORIZA...
import asyncio import datetime import math import time import unittest from SimpleCommander.src.simple_commander.game.hero import Hero from SimpleCommander.src.simple_commander.game.invader import Invader class Controller(): game_field = {'height': 1000, 'width': 1000} collisions = {} @asyncio.coroutine...
#!/usr/bin/env python # # Copyright 2001-2002 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright n...
# Copyright (C) 2011 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 ...
# -*- coding: utf-8 -*- """ werkzeug._internal ~~~~~~~~~~~~~~~~~~ This module provides internally used helpers and constants. :copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import re import string import inspect from weakre...
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of whoson. # https://github.com/heynemann/whos-on-server # Licensed under the MIT license: # http://www.opensource.org/licenses/MIT-license # Copyright (c) 2015, Bernardo Heynemann <[EMAIL]> from setuptools import setup, find_packages from whoson impo...
#!/usr/bin/python -u # # this tests the DTD validation with the XmlTextReader interface # import sys import glob import string import libxml2 try: import StringIO str_io = StringIO.StringIO except: import io str_io = io.StringIO # Memory debug specific libxml2.debugMemory(1) err="" expect="""../../tes...
# Beedraw/Hive network capable client and server allowing collaboration on a single image # Copyright (C) 2009 Thomas Becker # # 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; eith...
# encoding: 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 'Song.album_art' db.add_column('djpandora_song', 'album_art', self.gf('django.db.models.fie...
from string import ascii_letters from hashlib import md5 from CodernityDB.tree_index import MultiTreeBasedIndex, TreeBasedIndex from couchpotato.core.helpers.encoding import toUnicode, simplifyString class MediaIndex(MultiTreeBasedIndex): _version = 3 custom_header = """from CodernityDB.tree_index import Mu...
from django_webtest import WebTest from django.core.urlresolvers import reverse from django.core import mail from oscar.apps.customer.models import ProductAlert from oscar.test.factories import create_product, create_stockrecord from oscar.test.factories import UserFactory class TestAUser(WebTest): def test_can...
# -*- coding: utf-8 -*- """ werkzeug.useragents ~~~~~~~~~~~~~~~~~~~ This module provides a helper to inspect user agent strings. This module is far from complete but should work for most of the currently available browsers. :copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more deta...
"""Tests for 'site'. Tests assume the initial paths in sys.path once the interpreter has begun executing have not been removed. """ import unittest import sys import os import subprocess import shutil from copy import copy, deepcopy from test.support import (run_unittest, TESTFN, unlink, get_attribute, ...
from django.contrib.auth.models import AnonymousUser from nose.tools import eq_ from kitsune.questions.forms import NewQuestionForm, WatchQuestionForm from kitsune.questions.tests import TestCaseBase from kitsune.users.tests import user class WatchQuestionFormTests(TestCaseBase): """Tests for WatchQuestionForm....
import mmap # import tempfile # import shutil # import os class LargeFileReader (object): """ FOr mapping file to virtual memory. File-like (read-only) object trimmed for low memory footprint. Reading and finding does not advance the offset. Usage: # open file = LargeFileReader("/f...
import threading from django.conf import settings from corehq.toggles import NEW_EXPORTS, TF_DOES_NOT_USE_SQLITE_BACKEND _thread_local = threading.local() def get_local_domain_sql_backend_override(domain): try: return _thread_local.use_sql_backend[domain] except (AttributeError, KeyError): ...
#!/usr/bin/python # # Copyright (C) 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
#! /usr/bin/env python """Read/write support for Maildir, mbox, MH, Babyl, and MMDF mailboxes.""" # Notes for authors of new mailbox subclasses: # # Remember to fsync() changes to disk before closing a modified file # or returning from a flush() method. See functions _sync_flush() and # _sync_close(). import sys im...
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, [EMAIL], All rights reserved. # LLNL-CODE-647188 # # F...
class classifier(object): # initialize classifier setting all weights to 0.5: def __init__(self, tag, feat_vec, lmi_dict, top_x): self.tag = tag self.top_x = top_x self.lmi_dict = lmi_dict self.feat_vec = feat_vec self.weight_vector = [0.0 for ind in range(len(feat_vec))...
# Copyright 2017 RedHat, 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 i...
""" Authors: Tim Bedin Copyright 2015 CSIRO, Australian Government Bureau of Meteorology 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 ...
#!/usr/bin/env python # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2016,2017 Contributor # # 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 co...
#! /usr/bin/env python """Tool for measuring execution time of small code snippets. This module avoids a number of common traps for measuring execution times. See also Tim Peters' introduction to the Algorithms chapter in the Python Cookbook, published by O'Reilly. Library usage: see the Timer class. Command line ...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import calendar from datetime import datetime,date from dateutil import relativedelta import json import time from openerp import api from openerp import SUPERUSER_ID from openerp import tools from openerp.osv import fie...
# coding=utf-8 """ Supports the definition of commands in separate classes to be composed into cmd2.Cmd """ from typing import Optional, Type from .constants import COMMAND_FUNC_PREFIX from .exceptions import CommandSetRegistrationError # Allows IDEs to resolve types without impacting imports at runtime, breaking cir...
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import argparse import cStringIO import gzip import json import os import requests import urlparse treeherder_base = "h...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from .common import InfoExtractor class SztvHuIE(InfoExtractor): _VALID_URL = r'http://(?:(?:www\.)?sztv\.hu|www\.tvszombathely\.hu)/(?:[^/]+)/.+-(?P<id>[0-9]+)' _TEST = { 'url': 'http://sztv.hu/hirek/cserkeszek-nepszerusitettek-a-kornye...
# 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...
# -*- coding: utf-8 -*- import os import urllib import logging from django.db import models from addons.base import exceptions from addons.base.models import (BaseOAuthNodeSettings, BaseOAuthUserSettings, BaseStorageAddon) from addons.onedrive import settings from addons.onedrive.clien...