text
stringlengths
475
200k
"""General floating point formatting functions. Functions: fix(x, digits_behind) sci(x, digits_behind) Each takes a number or a string and a number of digits as arguments. Parameters: x: number to be formatted; or a string resembling a number digits_behind: number of digits behind the decimal point """ f...
# Copyright (C) 2004 Anders Carlsson # Copyright (C) 2004-2006 Red Hat Inc. <http://www.redhat.com/> # Copyright (C) 2005-2006 Collabora Ltd. <http://www.collabora.co.uk/> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Softw...
#!/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...
"""Support for Xiaomi aqara binary sensors.""" import logging from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.xiaomi_aqara import (PY_XIAOMI_GATEWAY, XiaomiDevice) from homeassistant.core import callback from homeass...
#! /usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions...
# -*- coding: utf-8 -*- """ Tests of extended hints """ import unittest from ddt import ddt, data, unpack # With the use of ddt, some of the data expected_string cases below are naturally long stretches # of text text without whitespace. I think it's best to leave such lines intact # in the test code. Therefore: # ...
from __future__ import absolute_import from __future__ import print_function from .._abstract.abstract import BaseRenderer import json ######################################################################## class SimpleRenderer(BaseRenderer): """ A simple renderer is a renderer that uses one symbol only. The type...
# 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...
from __future__ import unicode_literals import calendar import datetime import re import sys try: from urllib import parse as urllib_parse except ImportError: # Python 2 import urllib as urllib_parse import urlparse urllib_parse.urlparse = urlparse.urlparse from email.utils import formatdate fro...
# (C) Copyright David Abrahams 2001. Permission to copy, use, modify, sell and # distribute this software is granted provided this copyright notice appears in # all copies. This software is provided "as is" without express or implied # warranty, and with no claim as to its suitability for any purpose. from b2...
""" ===================================================================== kvmsg - key-value message class for example applications Author: Min RK <[EMAIL]> """ import struct # for packing integers import sys from uuid import uuid4 import zmq # zmq.jsonapi ensures bytes, instead of unicode: import zmq.utils.jsonapi ...
# 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 ...
#! /usr/bin/env python # Change the #! line occurring in Python scripts. The new interpreter # pathname must be given with a -i option. # # Command line arguments are files or directories to be processed. # Directories are searched recursively for files whose name looks # like a python module. # Symbolic links are al...
# Copyright (c) 2015 MaxPoint Interactive, Inc. # # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the # following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this list of conditi...
"""Provide functionality to stream HLS.""" from aiohttp import web from homeassistant.core import callback from homeassistant.util.dt import utcnow from .const import FORMAT_CONTENT_TYPE from .core import StreamView, StreamOutput, PROVIDERS @callback def async_setup_hls(hass): """Set up api endpoints.""" ha...
from __future__ import unicode_literals import binascii import unittest from unittest import skipUnless from django.contrib.gis.geos import ( HAS_GEOS, GEOSGeometry, WKBReader, WKBWriter, WKTReader, WKTWriter, ) from django.utils.six import memoryview @skipUnless(HAS_GEOS, "Geos is required.") class GEOSIOTest(...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
from django.contrib import messages from django.core.urlresolvers import reverse from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from oscar.apps.dashboard.orders.views import ( OrderListView as CoreOrderListView, OrderDetailView as CoreOrderDetailView ) from osc...
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2020 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source, # Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS # SPDX - License - Identifier: GPL - 3.0 + impo...
""" This module provides a pool manager that uses Google App Engine's `URLFetch Service <https://cloud.google.com/appengine/docs/python/urlfetch>`_. Example usage:: from urllib3 import PoolManager from urllib3.contrib.appengine import AppEngineManager, is_appengine_sandbox if is_appengine_sandbox(): ...
# (c) 2012-2014, Michael DeHaan <[EMAIL]> # (c) 2014, Serge van Ginderachter <[EMAIL]> # # 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 Licen...
#!/usr/bin/env python """ NAME: sparser.py SYNOPSIS: sparser.py [options] filename DESCRIPTION: The sparser.py script is a Specified PARSER. It is unique (as far as I can tell) because it doesn't care about the delimiter(s). The user specifies what is expected, and the order, for ...
from __future__ import unicode_literals from nose.tools import assert_raises import datetime import boto import boto3 from boto.exception import EC2ResponseError from botocore.exceptions import ClientError import pytz import sure # noqa from moto import mock_ec2, mock_ec2_deprecated from moto.backends import get_mod...
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyCsvkit(PythonPackage): """A library of utilities for working with CSV, the king of tabul...
#! /usr/bin/env python from __future__ import division # System imports from distutils.util import get_platform from math import sqrt import os import sys import unittest # Import NumPy import numpy as np major, minor = [ int(d) for d in np.__version__.split(".")[:2] ] if major == 0: BadListError = Type...
"""wrapper for libmpq""" # 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. # # This program is distributed in the hope th...
from django.conf import settings from django.db.models import Count from django.shortcuts import get_object_or_404 from rest_framework import status from rest_framework.decorators import action from rest_framework.exceptions import PermissionDenied from rest_framework.response import Response from extras.api.views imp...
# -*- coding: utf-8 -*- """ Created on Wed Aug 13 10:31:13 2014 NTII Demo - Quellencodierung - Auswirkungen auf Spektrum des Sendesignals Systemmodell: Quelle --> QPSK --> Pulsformung @author: Michael Schwall """ from __future__ import division import numpy as np import matplotlib.pylab as plt import scipy.signal a...
from dbfread import DBF class SPARKSReader: """These objects can be used to read SPARKS formatted files. SPARKS uses the dBase format for data storage For more information on SPARKS see http://www2.isis.org/support/SPARKS/Pages/home.aspx For more information on dBase see https://en.wikipedia.org...
#!/usr/bin/env python # Encoding: utf-8 # ----------------------------------------------------------------------------- # Project : OKF - Spending Stories # ----------------------------------------------------------------------------- # Author : Edouard Richard <[EMAIL]> # -------------...
import pytest import logging import os import subprocess import tempfile from dtest import Tester from shutil import rmtree since = pytest.mark.since logger = logging.getLogger(__name__) @since('4.0') class TestFQLTool(Tester): """ Makes sure fqltool replay and fqltool compare work @jira_ticket CASSANDR...
#!/usr/bin/env python # Copyright (c) 2004-2009 Zooko "Zooko" Wilcox-O'Hearn # This file is part of pyutil; see README.rst for licensing terms. import unittest from pyutil.assertutil import _assert from pyutil import strutil class Teststrutil(unittest.TestCase): def test_short_input(self): self.failUnl...
from django.apps import apps from django.test import TestCase from misago.core import migrationutils from misago.core.models import CacheVersion class CacheBusterUtilsTests(TestCase): def test_cachebuster_register_cache(self): """ cachebuster_register_cache registers cache on migration successful...
# -*- coding: utf-8 -*- ''' ================================================================================ This confidential and proprietary software may be used only as authorized by a licensing agreement from Thumb o'Cat Inc. In the event of publication, the following notice is applicable: Copyright (C...
#!/usr/bin/env python """ toggle between two images by pressing "t" The basic idea is to load two images (they can be different shapes) and plot them to the same axes with hold "on". Then, toggle the visible property of them using keypress event handling If you want two images with different shapes to be plotted wit...
# 2016 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 distri...
# # Copyright (c) 2014 Olemis Lang. All rights reserved. # # Choose either Javascript (faster) or Python engine based on regex complexity # with a noticeable preference for the former. # r"""Support for regular expressions (RE). This module provides regular expression matching operations similar to those found in Pe...
# -*- coding: utf-8 -*- """ werkzeug.contrib.fixers ~~~~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 0.5 This module includes various helpers that fix bugs in web servers. They may be necessary for some versions of a buggy web server but not others. We try to stay updated with the status of the bug...
"""Jython bug with cell variables and yield""" from __future__ import generators def single_closure_single_value(): value = 0 a_closure = lambda : value yield a_closure() yield a_closure() def single_closure_multiple_values(): value = 0 a_closure = lambda : value yield a_closure() valu...
import discord from discord.ext import commands import sqlite3 from cogs.utils import errors from ast import literal_eval import re import datetime import aiohttp from urllib.parse import parse_qs from lxml import etree # Google functions are copied from RoboDanny, accessed on April 6, 2017. https://github....
""" Read and write ZIP files. """ import struct, os, time, sys, shutil import binascii, cStringIO, stat import io import re try: import zlib # We may need its compression method crc32 = zlib.crc32 except ImportError: zlib = None crc32 = binascii.crc32 __all__ = ["BadZipfile", "error", "ZIP_STORED", "Z...
# -*- coding: utf-8 -*- """ *************************************************************************** SagaAlgorithmProvider.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com *****************...
#!/usr/bin/python ''' Extract _("...") strings for translation and convert to Qt4 stringdefs so that they can be picked up by Qt linguist. ''' from subprocess import Popen, PIPE import glob import operator import os import sys OUT_CPP="qt/bitcoinstrings.cpp" EMPTY=['""'] def parse_po(text): """ Parse 'po' for...
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
from hpp.corbaserver.rbprm.rbprmbuilder import Builder from hpp.corbaserver.rbprm.rbprmfullbody import FullBody from hpp.gepetto import Viewer import time from hpp.corbaserver.rbprm.tools.cwc_trajectory_helper import step, clean,stats, saveAllData, play_traj from hpp.gepetto import PathPlayer def act(i, numOptim = 0...
import time from datetime import timedelta class Metrics(object): def __init__(self, bot): self.bot = bot self.start_time = time.time() self.dust = {'start': None, 'latest': None} self.xp = {'start': None, 'latest': None} self.distance = {'start': None, 'latest': None} ...
# -*- 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 = r'j \d\e F \d\e Y' TIME_FORMAT = '...
# -*- coding: utf-8 -*- """ ========================== Bipartite Graph Algorithms ========================== """ # Copyright (C) 2013-2015 by # Aric Hagberg <[EMAIL]> # Dan Schult <[EMAIL]> # Pieter Swart <[EMAIL]> # All rights reserved. # BSD license. import networkx as nx __author__ = """\n""".join(...
import ocl import camvtk import time import vtk import datetime import math import random import numpy as np import gc def drawVertex(myscreen, p, vertexColor, rad=1): myscreen.addActor( camvtk.Sphere( center=(p.x,p.y,p.z), radius=rad, color=vertexColor ) ) def drawEdge(myscreen, e, edgeColor=camvtk.yellow): ...
##################################################################### # -*- coding: iso-8859-1 -*- # # # # Frets on Fire X # # Copyright (C) 2006 Sami Kyöstilä ...
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
from tests.unit import unittest from tests.unit import AWSMockServiceTestCase from boto.vpc import VPCConnection, RouteTable class TestDescribeRouteTables(AWSMockServiceTestCase): connection_class = VPCConnection def default_body(self): return b""" <DescribeRouteTablesResponse xmlns="ht...
# -*- coding: utf-8 -*- # # This file is part of PyBuilder # # Copyright 2011-2015 PyBuilder Team # # 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/l...
import json from collections import namedtuple from django.core.urlresolvers import reverse from django.contrib.auth.models import Group, User from rest_framework import serializers from hs_core.hydroshare import utils from hs_core import hydroshare from .utils import validate_json, validate_user, validate_group from ...
#!/usr/bin/python # Copyright: (c) 2018, Pluribus Networks # 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': ['...
#!/usr/bin/python -u import sys import libxml2 # Memory debug specific libxml2.debugMemory(1) # # Testing XML Node comparison and Node hash-value # doc = libxml2.parseDoc("""<root><foo/></root>""") root = doc.getRootElement() # Create two different objects which point to foo foonode1 = root.children foonode2 = root....
# -*- coding: utf-8 -*- """ Models used to implement SAML SSO support in third_party_auth (inlcuding Shibboleth support) """ from config_models.models import ConfigurationModel, cache from django.conf import settings from django.core.exceptions import ValidationError from django.db import models from django.utils impor...
import numpy as np from bokeh.layouts import row from bokeh.models import ColumnDataSource, CustomJS, Rect from bokeh.plotting import figure, output_file, show output_file('range_update_callback.html') N = 4000 x = np.random.random(size=N) * 100 y = np.random.random(size=N) * 100 radii = np.random.random(size=N) * ...
"""HTML utilities suitable for global use.""" from __future__ import unicode_literals import re import string try: from urllib.parse import quote, unquote, urlsplit, urlunsplit except ImportError: # Python 2 from urllib import quote, unquote from urlparse import urlsplit, urlunsplit from django.utils...
# -*- coding: utf-8 -*- """ jinja2.testsuite.ext ~~~~~~~~~~~~~~~~~~~~ Tests for the extensions. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import re import unittest from jinja2.testsuite import JinjaTestCase from jinja2 import Environment, DictLoader...
# A solution to the British Informatics Olympiad 2011 Question 3 # Scores 24/24 from __future__ import print_function try: input = raw_input except: pass def number_with_n_digits(n): return 9**(n//2) def nth_with_n_digits(number_of_digits, n): if number_of_digits == 0: return "" if number_of_digits % 2 == 1: ...
# event_analyzing_sample.py: general event handler in python # # Current perf report is already very powerful with the annotation integrated, # and this script is not trying to be as powerful as perf report, but # providing end user/developer a flexible way to analyze the events other # than trace points. # # The 2 dat...
# -*- coding: utf-8 -*- # Django test settings for cms project. import os PROJECT_DIR = os.path.dirname(__file__) TEST_PROJ = 'pages.testproj' DEBUG = True USE_TZ = True ADMINS = ( # ('Your Name', '[EMAIL]'), ) CACHE_BACKEND = 'locmem:///' MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'dj...
# 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...
############################################################################## # # PROJECT: ownCloud v1.0 # LICENSE: See LICENSE in the top level directory # ############################################################################## import collections import os import polib from optparse import OptionPars...
from django.conf.urls import include, url from rest_framework.routers import SimpleRouter from rest_framework_nested.routers import NestedSimpleRouter from olympia.bandwagon.views import CollectionAddonViewSet, CollectionViewSet from . import views accounts = SimpleRouter() accounts.register(r'account', views.Acco...
from django.contrib.syndication import views from django.core.exceptions import ObjectDoesNotExist import warnings # This is part of the deprecated API from django.contrib.syndication.views import FeedDoesNotExist, add_domain class Feed(views.Feed): """Provided for backwards compatibility.""" def __init__(sel...
# Copyright 2015 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 a...
# Copyright 2015 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. DEPS = [ 'file', 'recipe_engine/path', 'recipe_engine/platform', 'recipe_engine/properties', 'recipe_engine/step', 'cipd', ] def RunSteps(api): ...
# 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) 2007 The Hewlett-Packard Development Company # All rights reserved. # # The license below extends only to copyright in the software and shall # not be construed as granting a license to any other intellectual # property including but not limited to intellectual property relating # to a hardware implemen...
# # 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...
"""Config flow for National Weather Service (NWS) integration.""" import logging import aiohttp from pynws import SimpleNWS import voluptuous as vol from homeassistant import config_entries, core, exceptions from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE from homeassistant.helpers import ...
""" Test the pulp.server.db.model.criteria module. """ import unittest from pulp.server import exceptions from pulp.server.db.model import criteria FIELDS = set(('sort', 'skip', 'limit', 'filters', 'fields')) class TestAsDict(unittest.TestCase): def test_empty(self): c = criteria.Criteria() re...
"""End to end test for Puppet funcionality :Requirement: Puppet :CaseAutomation: Automated :CaseLevel: Acceptance :CaseComponent: Puppet :TestType: Functional :CaseImportance: High :Upstream: No """ import pytest from robottelo.config import settings from robottelo.decorators import run_in_one_thread from robot...
# -*- encoding: utf-8 -*- ############################################################################### # # Copyright (C) 2009 Renato Lima - Akretion # # 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 th...
#!/usr/bin/env python3 # Copyright (c) 2021 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """ This checks that all files in the repository have correct filenames and permissions """ import os import ...
# Copyright 2014 Donald Stufft # # 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, so...
import unittest, sys from ctypes.test import need_symbol class SimpleTypesTestCase(unittest.TestCase): def setUp(self): import ctypes try: from _ctypes import set_conversion_mode except ImportError: pass else: self.prev_conv_mode = set_conversion...
from __future__ import unicode_literals from django.db import connection from django.test import TestCase from .models import A01, A02, B01, B02, C01, C02, Unmanaged2, Managed1 class SimpleTests(TestCase): def test_simple(self): """ The main test here is that the all the models can be created w...
""" SWF (Macromedia/Adobe Flash) file parser. Documentation: - Alexis' SWF Reference: http://www.m2osw.com/swf_alexref.html - http://www.half-serious.com/swf/format/ - http://www.anotherbigidea.com/javaswf/ - http://www.gnu.org/software/gnash/ Author: Victor Stinner Creation date: 29 october 2006 """ from li...
import hashlib from django.db import models from opencontext_py.apps.ldata.linkentities.models import LinkEntityGeneration # This class stores linked data annotations made on the data contributed to open context class LinkAnnotation(models.Model): # predicates indicating that a subject has an object that is a bro...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2015 Futur Solo # # 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 # # ...
# coding: utf-8 from __future__ import unicode_literals import re import socket from .common import InfoExtractor from ..compat import ( compat_etree_fromstring, compat_http_client, compat_urllib_error, compat_urllib_parse_unquote, compat_urllib_parse_unquote_plus, ) from ..utils import ( clea...
""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP864.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_map) def decode(self,input,errors='strict'): ...
# -*- coding: utf-8 -*- # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe, json from frappe.model.document import Document from frappe import _ from frappe.utils import date_diff, add_days, flt c...
# Caltech SURF 2013 # FILE: grid.py # 07.17.13 ''' do stuff with grid diagrams to prepare for CFK^\infty ''' # winding matrix done by rows (consistent with gridlink) # TODO bottom row first??? # TODO only knots no links... from fractions import Fraction import itertools # list(itertools.permutations([1,2,3])) # TOD...
# mako/lookup.py # Copyright (C) 2006-2016 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php import os import stat import posixpath import re from mako import exceptions, util from mako.templa...
#!/usr/bin/env python import sys import os import argparse import json from netaddr import IPNetwork labtainer_dir = os.getenv('LABTAINER_DIR') if labtainer_dir is None: print('Must define LABTAINER_DIR environment variable') exit(1) sys.path.append(os.path.join(labtainer_dir, 'scripts', 'labtainer-student','bi...
import numpy as np from scipy import ndimage, misc from matplotlib import pyplot as plt import glob from MyViola import MyViolaClassifier from Svm import Svm import funcs def find_face(img, shape, mv): res_i = (0, 0) res_j = (0, 0) res_scl = 1 max_ = 0 scales = np.arange(.2, .35, .025) m, n = ...
# 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/. """Manifest structure used to store paths that should be included in a test run. The manifest is represented by a tree ...
# Request finder import time from mediamonkey import MediaMonkey from what import WhatCD from whatdao import WhatDAO from whatconfig import WhatConfigParser from whatparser import Parser class RequestFinder(): def dump_page(self, filename, page): f = open(filename, 'w') f.write(page) f.close() def find_req...
from test import CollectorTestCase from test import get_collector_config from mock import call, Mock, patch from unittest import TestCase from diamond.collector import Collector from portstat import get_port_stats, PortStatCollector class PortStatCollectorTestCase(CollectorTestCase): TEST_CONFIG = { '...
# # gdb helper commands and functions for Linux kernel debugging # # common utilities # # Copyright (c) Siemens AG, 2011-2013 # # Authors: # Jan Kiszka <[EMAIL]> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb class CachedType: def __init__(self, name): self._type = Non...
# Copyright 2017 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...
"""JSON token scanner """ import re try: from _json import make_scanner as c_make_scanner except ImportError: c_make_scanner = None __all__ = ['make_scanner'] NUMBER_RE = re.compile( r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?', (re.VERBOSE | re.MULTILINE | re.DOTALL)) def py_make_scanner(context): ...
# -*- coding: utf8 -*- #!/usr/bin/python # # This was originaly derived from a cadquery script for generating PDIP models in X3D format # from https://bitbucket.org/hyOzd/freecad-macros # author hyOzd # # Adapted by easyw for step and vrlm export # See https://github.com/easyw/kicad-3d-models-in-freecad ## requirement...
# -*- coding: utf-8 -*- ''' Created on Oct 16, 2015 @author: nlp ''' import sys import traceback from store_model import Single_weibo_store import datetime from datetime import timedelta import pprint import jieba reload(sys) sys.setdefaultencoding('utf8') from sklearn import svm X = [[0, 0], [1, 1]] y = [...
# # create symlinks for picons # usage: create_picon_sats lamedb # run in picon directory. # It will read the servicenames from the lamedb and create symlinks # for the servicereference names. # # by pieterg, 2008 import os, sys f = open(sys.argv[1]).readlines() f = f[f.index("services\n")+1:-3] while len(f) > 2:...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 IBM Corp. # # 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 # # ...