text
stringlengths
475
200k
#!/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...
#!/usr/bin/env python # ---------------------------------------------------------------------------- # Copyright 2016 Nervana Systems 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 # # ...
import cgi import errno import mimetypes import os import posixpath import re import shutil import stat import sys import tempfile from optparse import make_option from os import path import django from django.template import Template, Context from django.utils import archive from django.utils.six.moves.urllib.reques...
"""Wrapper functions for Tcl/Tk. Tkinter provides classes which allow the display, positioning and control of widgets. Toplevel widgets are Tk and Toplevel. Other widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton, Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox LabelFrame and PanedWindow. ...
from __future__ import absolute_import try: import json except ImportError, e: import simplejson as json import logging import urllib2 import telnetlib import urllib from django.conf import settings from django.template import loader from django.http import HttpResponse from django import forms from django.c...
# -*- coding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in root directory ############################################################################## from openerp import models, api class SaleOrder(models.Mo...
from cloudinary.models import CloudinaryField from django.contrib.auth.models import User from django.db import models from multiselectfield import MultiSelectField group_permissions = ( ('INVITE_MEMBER', 'Send invites'), ('DELETE_MEMBER', 'Remove members'), ('BLOCK_MEMBER', 'Block members'), ('SUSPEND...
# -*- coding: utf-8 -*- # Copyright (C) Alex Urban (2019) # # This file is part of the GW DetChar python package. # # GW DetChar 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,...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compli...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2010 OpenERP S.A. http://www.openerp.com # # This program is free software: you can redistribute it and/or modify # it under the terms of the GN...
# Copyright (c) 2013 Brocade Communications Systems, 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....
#utilities.py from SCons.Script import * from SCons.Environment import Environment import os import fnmatch import json as json import sys import os.path import pic12 import StringIO sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from pymomo.utilities import build from pymomo.mib.config12 import MIB1...
#!/usr/bin/env python import time #import nose import logging l = logging.getLogger("angr_tests.counter") l.setLevel(logging.INFO) try: # pylint: disable=W0611,F0401 import standard_logging import angr_debug except ImportError: pass addresses_counter = { 'armel': None, 'armhf': None, # addr...
# Ansible module to manage CheckPoint Firewall (c) 2019 # # 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 dist...
import unittest import pandas as pd class testCompletenessOfSummarisedData(unittest.TestCase): def test_animal_data(self): """ Make sure each sample's fraction of abundance values sums very close to 1. On toy data set only. """ animal_df = pd.read_csv("./summarised_animals...
def deconstructible(*args, **kwargs): """ Class decorator that allow the decorated class to be serialized by the migrations subsystem. Accepts an optional kwarg `path` to specify the import path. """ path = kwargs.pop('path', None) def decorator(klass): def __new__(cls, *args, **kw...
# -*- coding: utf-8 -*- """ Tests for transcripts_utils. """ import unittest from uuid import uuid4 import copy import textwrap from mock import patch, Mock from django.test.utils import override_settings from django.conf import settings from django.utils import translation from nose.plugins.skip import SkipTest fro...
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013-2014, 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 p...
#!/usr/bin/env python # Copyright (c) 2012 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. '''Unit tests for the admin template gatherer.''' import os import sys if __name__ == '__main__': sys.path.append(os.path.join(o...
# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j. E Y' TIME_FORMAT = 'G.i' DATET...
#!/usr/bin/python -tt # 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 distrib...
# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- # # $Id: Tix.py 81008 2010-05-08 20:59:42Z benjamin.peterson $ # # Tix.py -- Tix widget wrappers. # # For Tix, see http://tix.sourceforge.net # # - Sudhir Shenoy ([EMAIL]), Dec. 1995. # based on an idea of Jean-Marc Lugri...
# -*- encoding: utf-8 -*- ########################################################################### # Module Writen to OpenERP, Open Source Management Solution # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). # All Rights Reserved # Credits###################################################### # ...
""" Support for Qwikswitch devices. For more details about this component, please refer to the documentation at https://home-assistant.io/components/qwikswitch/ """ import logging import voluptuous as vol from homeassistant.const import (EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_...
from django.template import TemplateSyntaxError from django.test import SimpleTestCase from ..utils import SomeClass, SomeOtherException, UTF8Class, setup class FilterSyntaxTests(SimpleTestCase): @setup({'filter-syntax01': '{{ var|upper }}'}) def test_filter_syntax01(self): """ Basic filter ...
#!/usr/bin/env python # # Copyright 2011,2013 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 optio...
""" Python Character Mapping Codec iso8859_16 generated from 'MAPPINGS/ISO8859/8859-16.TXT' with gencodec.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_table) def decode(self,input,errors...
# -*- coding: utf-8 import requests import tarfile import yaml import json import subprocess import re from retrying import retry from time import gmtime, strftime import docker from docker.types import IPAMConfig, IPAMPool from cStringIO import StringIO from commons.miscs import NoAvailableImages import commons.utils...
# Copyright (c) 2014, Alan Saul # Licensed under the BSD 3-clause license (see LICENSE.txt) import numpy as np import unittest import GPy from GPy.models import GradientChecker import functools import inspect from GPy.likelihoods import link_functions from GPy.core.parameterization import Param from functools import pa...
#!/usr/bin/env python import sys import logging import iu.i524.S17IRP013.hadoop.hbase_to_hdfs as h2h DEFAULT_STATION_ID = 'DST:IND000DEF' logging.basicConfig(format = '%(asctime)s %(message)s',\ datefmt = '%m/%d/%Y %I:%M:%S %p',\ filename = 'wda_app.log',\ ...
from __future__ import unicode_literals import errno import io import hashlib import json import os.path import re import types import sys import youtube_dl.extractor from youtube_dl import YoutubeDL from youtube_dl.utils import ( compat_str, preferredencoding, write_string, ) def get_params(override=No...
# Copyright 2015 Huawei Technologies Co., Ltd. # 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 # # Unl...
from __future__ import absolute_import import ujson NORMAL_TWEET = """{ "coordinates": null, "created_at": "Sat Sep 10 22:23:38 +0000 2011", "truncated": false, "favorited": false, "id_str": "112652479837110273", "in_reply_to_user_id_str": "783214", "text": "@twitter meets @seepicturely at #tcdisrupt c...
# Author: Nic Wolfe <[EMAIL]> # URL: http://code.google.com/p/sickbeard/ # # This file is part of Sick Beard. # # Sick Beard 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 ...
""" mbed SDK Copyright (c) 2011-2013 ARM Limited 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 wr...
#!/usr/bin/env python """Support classes for automated testing. * `AsyncTestCase` and `AsyncHTTPTestCase`: Subclasses of unittest.TestCase with additional support for testing asynchronous (`.IOLoop` based) code. * `ExpectLog` and `LogTrapTestCase`: Make test logs less spammy. * `main()`: A simple test runner (wra...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright 2018 Red Hat, Inc. and/or its affiliates # and other contributors as indicated by the @author tags. # # 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...
# Copyright 2014 Arista Networks, 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 requ...
#-*- coding: utf-8 -*- import json import sys import re import codecs out8=codecs.getwriter("utf-8")(sys.stdout) focus_h_tags=set((u"pakolaiset",u"refugeecrisis",u"syrianrefugees",u"syria",u"syyria",u"pakolaiskriisi",u"migrantcrisis",u"refugeeswelcome",u"migrants",u"réfugiés",u"syrie")) def keep(tweet): """in go...
""" Tests for `bx.seq.seq`. """ import unittest import os.path import sys import bx.seq, fasta_tests, nib_tests, qdna_tests test_fa = "test_data/seq_tests/test.fa" test2_fa = "test_data/seq_tests/test2.fa" test_nib = "test_data/seq_tests/test.nib" test_qdna = "test_data/seq_tests/test.qdna" valid_fasta ...
# -*- 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): # Deleting field 'ProjectKey.user_added' db.delete_column(u'sentry_projec...
''' Check the performance counters from SQL Server See http://blogs.msdn.com/b/psssql/archive/2013/09/23/interpreting-the-counter-values-from-sys-dm-os-performance-counters.aspx for information on how to report the metrics available in the sys.dm_os_performance_counters table ''' # stdlib import traceback # 3rd party...
from flask import Blueprint, request, jsonify, make_response from app.users.models import Users, UsersSchema from flask_restful import Api from app.baseviews import Resource from app.basemodels import db from sqlalchemy.exc import SQLAlchemyError from marshmallow import ValidationError from werkzeug.security import gen...
# -*- coding: utf-8 -*- import unittest2 from openerp.tests import common class test_single_transaction_case(common.SingleTransactionCase): """ Check the whole-class transaction behavior of SingleTransactionCase. """ def test_00(self): """Create a partner.""" cr, uid = self.cr, self.u...
""" Serialization ``django.core.serializers`` provides interfaces to converting Django ``QuerySet`` objects to and from "flat" data (i.e. strings). """ from __future__ import unicode_literals from decimal import Decimal from django.db import models from django.utils import six from django.utils.encoding import pytho...
# cmdutil.py - help for command processing in mercurial # # Copyright 2005-2007 Matt Mackall <[EMAIL]> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. from node import hex, nullid, nullrev, short from i18n import _ import os, sys,...
############################################################################## # 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...
# Copyright 2014 NeuroData (http://neurodata.io) # # 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...
from __future__ import absolute_import import datetime import logging import os import sys import socket from socket import error as SocketError, timeout as SocketTimeout import warnings from .packages import six try: # Python 3 from http.client import HTTPConnection as _HTTPConnection from http.client import...
from distutils import log, dir_util import os from setuptools import Command from setuptools import namespaces from setuptools.archive_util import unpack_archive import pkg_resources class install_egg_info(namespaces.Installer, Command): """Install an .egg-info directory for the package""" description = "In...
# Author: echel0n <[EMAIL]> # URL: https://sickrage.ca # Git: https://git.sickrage.ca/SiCKRAGE/sickrage # # This file is part of SickRage. # # SickRage 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 ve...
from hachoir_metadata.metadata import (registerExtractor, Metadata, RootMetadata, MultipleMetadata) from hachoir_parser.image import ( BmpFile, IcoFile, PcxFile, GifFile, PngFile, TiffFile, XcfFile, TargaFile, WMF_File, PsdFile) from hachoir_parser.image.png import getBitsPerPixel as pngBitsPerPixel from ha...
"""A device that can have interfaces""" from Device import * from Attachable import * class Interfaceable(Attachable): def __init__(self): """ Create a device that can have interfaces. """ Attachable.__init__(self) self.adjacentRouterList = [] self.adj...
#!/usr/bin/python # Copyright 2013 Google 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', 'status': ['preview'], ...
from django.contrib.auth.models import User from django.db import models from django.utils import timezone class RegistrationModel(models.Model): user = models.OneToOneField(User) activation_key = models.CharField(max_length=40) created_timestamp = models.DateTimeField(auto_now_add=True, auto_now=False) ...
# Copyright 2015 - Rackspace US, 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...
""" Test grade calculation. """ from django.http import Http404 from django.test.utils import override_settings from mock import patch from courseware.tests.modulestore_config import TEST_DATA_MIXED_MODULESTORE from student.tests.factories import UserFactory from xmodule.modulestore.tests.factories import CourseFactor...
"""Build and install the colormaps package.""" # Copyright (c) 2012 Andrew Dawson # # 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 right...
#!/usr/bin/env python # make new dump file by combining snapshots from multiple NEB replica dumps # Syntax: neb_combine.py -switch arg(s) -switch arg(s) ... # -o outfile = new dump file # each snapshot has NEB atoms from all replicas # -r dump1 dump2 ... = replica dump files of NEB atoms # ...
#!/usr/bin/env python # -*- encoding: utf-8 -*- # CREATED:2015-02-14 22:51:01 by Brian McFee <[EMAIL]> '''Unit tests for display module''' import warnings # Disable cache import os try: os.environ.pop('LIBROSA_CACHE_DIR') except KeyError: pass import matplotlib matplotlib.use('Agg') matplotlib.rcParams.updat...
#!/usr/bin/env python ### -- [2012-03-04 14:56:03] FlowRate and FlowSize anomaly parameter has be changed as ### -- ratio instead of absolute value ##-- [2012-04-08 22:31:20] Add GenAnomalyDot ##-- [2012-04-09 18:31:22] refactoring the whole file ## -- [2012-04-10 01:14:07] FLOW_RATE can work ##-- [2012-04-10 17:16:27...
import arrow, logging, time from pmuploader import PmDataUploader from sdserror import SdsError, SdsNoPacketError from sdssensor import SdsSensor LOGLEVEL = logging.INFO PORT = '/dev/serial0' # Time delta between measurements, in seconds: SAMPLING_PERIOD = 15 URL = "http://dusty.pythonanywhere.com/pm/sav...
# test basic complex number functionality # constructor print(complex(1)) print(complex(1.2)) print(complex(1.2j)) print(complex("1")) print(complex("1.2")) print(complex("1.2j")) print(complex(1, 2)) print(complex(1j, 2j)) # unary ops print(bool(1j)) print(+(1j)) print(-(1 + 2j)) # binary ops print(1j + False) prin...
# 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...
# Copyright (c) 2011-2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Un...
# -*- coding: utf-8 -*- from __future__ import with_statement import os, sys, unittest import ctypes from ctypes import wintypes from ctypes import c_int, c_ulong, c_char_p, c_wchar_p, c_ushort user32=ctypes.windll.user32 gdi32=ctypes.windll.gdi32 kernel32=ctypes.windll.kernel32 from MessageNumbers import msgs, sgsm...
import distutils, os from setuptools import Command from distutils.util import convert_path from distutils import log from distutils.errors import * from setuptools.command.setopt import edit_config, option_base, config_file def shquote(arg): """Quote an argument for later parsing by shlex.split()""" for c in ...
from yowsup.structs import ProtocolTreeNode from yowsup.layers.protocol_iq.protocolentities import ResultIqProtocolEntity class SuccessLeaveGroupsIqProtocolEntity(ResultIqProtocolEntity): ''' <iq type="result" from="g.us" id="{{ID}}"> <leave> <group id="{{GROUP_JID}}"></group> </le...
from portality.dao import DomainObject from portality.models import Account class EditorGroup(DomainObject): __type__ = "editor_group" @classmethod def group_exists_by_name(cls, name): q = EditorGroupQuery(name) res = cls.query(q=q.query()) ids = [hit.get("_source", {}).get("id") ...
# Licensed to the Software Freedom Conservancy (SFC) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The SFC licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
""" mbed SDK Copyright (c) 2011-2013 ARM Limited 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 wr...
#-*- coding: utf-8-*- import mysql.connector config = { 'user': 'root', 'password': 'root', 'host': '127.0.0.1', 'database': 'test', 'raise_on_warnings': True, } class save_keys_to_mysql: def __init__(self,path): self.path=path print(self.path) def __conn(self,**conf): try: conn=mysql.connector....
# -*- coding: utf-8 -*- """QGIS Unit tests for QgsLayoutUnitsComboBox .. note:: 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, or (at your option) any later version....
# # Secret Labs' Regular Expression Engine # # convert template to internal format # # Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved. # # See the sre.py file for information on usage and redistribution. # """Internal support module for sre""" import _sre, sys import sre_parse from sre_constants impo...
from __future__ import absolute_import from ..packages.six.moves import http_client as httplib from ..exceptions import HeaderParsingError def is_fp_closed(obj): """ Checks whether a given file-like object is closed. :param obj: The file-like object to check. """ try: # Check vi...
"""Sparse block 1-norm estimator. """ from __future__ import division, print_function, absolute_import import numpy as np from scipy.sparse.linalg import aslinearoperator __all__ = ['onenormest'] def onenormest(A, t=2, itmax=5, compute_v=False, compute_w=False): """ Compute a lower bound of the 1-norm of ...
from Tkinter import * from Dialog import Dialog # this shows how to create a new window with a button in it # that can create new windows class Test(Frame): def printit(self): print "hi" def makeWindow(self): """Create a top-level dialog with some buttons. This uses the Dialog class,...
from operand import O_NONE, P_none import syn_intel as intel #hack MK from syn_intel import intel_operand_syntax #from syn_att import * operator_list_invalid = [ 'invalid'] operator_list_call = ['syscall', 'call', 'vmcall', 'vmmcall'] operator_list...
# coding: utf-8 from __future__ import unicode_literals import re import random from .common import InfoExtractor from ..utils import ( int_or_none, float_or_none, unified_strdate, ) class PornoVoisinesIE(InfoExtractor): _VALID_URL = r'http://(?:www\.)?pornovoisines\.com/showvideo/(?P<id>\d+)/(?P<di...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: Ansible Project # 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 DOCUMENTATION = r''' --- author: Ansible Core Team (@ansible) modul...
# Copyright 2013-2014 MongoDB, 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 writing...
"""Queues""" __all__ = ['Queue', 'PriorityQueue', 'LifoQueue', 'JoinableQueue', 'QueueFull', 'QueueEmpty'] import collections import heapq from . import events from . import futures from . import locks from .tasks import coroutine class QueueEmpty(Exception): 'Exception raised by Queue.get(block=0)/...
import os def post_register_types(root_module): enabled_features = os.environ['NS3_ENABLED_FEATURES'].split(',') if 'EmuFdNetDevice' not in enabled_features: if 'ns3::EmuFdNetDeviceHelper'in root_module: root_module.classes.remove(root_module['ns3::EmuFdNetDeviceHelper']) if 'TapFdNet...
from datetime import datetime from django.forms import SplitHiddenDateTimeWidget from django.test import override_settings from django.utils import translation from .base import WidgetTest class SplitHiddenDateTimeWidgetTest(WidgetTest): widget = SplitHiddenDateTimeWidget() def test_render_empty(self): ...
"""Support for deCONZ covers.""" from homeassistant.components.cover import ( ATTR_POSITION, DEVICE_CLASS_WINDOW, DOMAIN, SUPPORT_CLOSE, SUPPORT_OPEN, SUPPORT_SET_POSITION, SUPPORT_STOP, CoverEntity, ) from homeassistant.core import callback from homeassistant.helpers.dispatcher import a...
# Lispy: Scheme Interpreter in Python # (c) Peter Norvig, 2010-16; See http://norvig.com/lispy.html from __future__ import division import math import operator as op # Types Symbol = str # A Lisp Symbol is implemented as a Python str List = list # A Lisp List is implemented as a Python list Numb...
""" Common utilities for tests in block_structure module """ from contextlib import contextmanager from uuid import uuid4 from unittest.mock import patch from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator from xmodule.modulestore.exceptions import ItemNotFoundError from ..api import get_cache fro...
#!/usr/bin/env python # # 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 # "L...
# -*- coding: utf-8 -*- """ *************************************************************************** NewPreconfiguredAlgorithmAction.py --------------------- Date : April 2016 Copyright : (C) 2016 by Victor Olaya Email : volayaf at gmail dot com ********...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # || ____ _ __ # +------+ / __ )(_) /_______________ _____ ___ # | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \ # +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/ # || || /_____/_/\__/\___/_/ \__,_/ /___/\___/ # # Copyright (C) 20...
# Copyright (C) 2014-2016 The BET Development Team """ This module provides methods for postprocessing probabilities and data. """ import logging import numpy as np import bet.sample as sample class dim_not_matching(Exception): """ Exception for when the dimension is inconsistent. """ class bad_object(E...
# Copyright 2017 OP5 AB # Copyright 2017 FUJITSU LIMITED # Copyright (c) 2011 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # ...
""" Test functions for models.regression """ # TODO: Test for LM from statsmodels.compat.python import long, lrange import warnings import pandas import numpy as np from numpy.testing import (assert_almost_equal, assert_approx_equal, assert_raises, assert_equal, assert_allclose) from scipy.l...
import os, sys, base64 sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) import subresource def generate_payload(request, server_data): data = ('{"headers": %(headers)s}') % server_data if "id" in request.GET: request.server.stash.put(request.GET["id"], data) # Simple base64 encoded .t...
from datetime import date, datetime, time from django.forms import SplitDateTimeWidget from .base import WidgetTest class SplitDateTimeWidgetTest(WidgetTest): widget = SplitDateTimeWidget() def test_render_empty(self): self.check_html(self.widget, 'date', '', html=( '<input type="text" ...
# -*- coding: utf-8 -*- # 第 0006 题:你有一个目录,放了你一个月的日记,都是 txt,为了避免分词的问题,假设内容都是英文,请统计出你认为每篇日记最重要的词。 import re import os # Get all files in designated path def get_files(path): filepath = os.listdir(path) files = [] for fp in filepath: fppath = path + '/' + fp if(os.path.isfile(fppath)): ...
# Generated by Django 2.1.11 on 2020-02-13 09:16 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('tracking', '0005_device_hidden'), ] operations = [ migrations.AlterField( model_name='device', name='hidden', ...
"""functools.py - Tools for working with functions and callable objects """ # Python module wrapper for _functools C module # to allow utilities written in Python to be added # to the functools module. # Written by Nick Coghlan <ncoghlan at gmail.com> # and Raymond Hettinger <python at rcn.com> # Copyright (C) 2006-2...
# $Id: io.py 7596 2013-01-25 13:42:17Z milde $ # Author: David Goodger <[EMAIL]> # Copyright: This module has been placed in the public domain. """ I/O classes provide a uniform API for low-level input and output. Subclasses exist for a variety of input/output mechanisms. """ __docformat__ = 'reStructuredText' impo...
# 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/. from __future__ import unicode_literals import json import os import sys import environment as env import products imp...