content
stringlengths
4
20k
from __future__ import print_function import numpy as np import tables basedim = 4 file = "array4.h5" # Open a new empty HDF5 file fileh = tables.open_file(file, mode="w") # Get the root group group = fileh.root # Set the type codes to test dtypes = [np.int8, np.uint8, np.int16, np.int, np.float32, np.float] i = 1 for...
""" Tests for course_info """ import ddt from django.conf import settings from milestones.tests.utils import MilestonesTestCaseMixin from nose.plugins.attrib import attr from xmodule.html_module import CourseInfoModule from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore ...
# coding: utf-8 from __future__ import absolute_import, division, print_function import sys import _pytest._code import pytest from six import text_type from test_excinfo import TWMock try: import mock except ImportError: import unittest.mock as mock def test_ne(): code1 = _pytest._code.Code(compile('...
#!/usr/bin/env python """ This script implements branching and tagging in the DOC group repository, and automates the process of creating sets. """ import os def parse_args (): from optparse import OptionParser parser = OptionParser ("usage: %prog [options] name") parser.add_option ("-A", "--ACE", dest=...
from __future__ import print_function, division, absolute_import from six.moves import reduce import numpy as np import math import abstract_rendering.core as core import abstract_rendering.util as util # ----------- Aggregators ----------- class Count(core.GlyphAggregator): """Count the number of items that fal...
{ 'name': 'Sales Management', 'version': '1.0', 'category': 'Sales Management', 'sequence': 14, 'summary': 'Quotations, Sales Orders, Invoicing', 'description': """ Manage sales quotations and orders ================================== This application allows you to manage your sales goals in an...
"""A helper script to print paths of NaCl binaries, includes, libs, etc. It is similar in behavior to pkg-config or sdl-config. """ import argparse import os import posixpath import sys import getos if sys.version_info < (2, 7, 0): sys.stderr.write("python 2.7 or later is required run this script\n") sys.exit(...
from django.contrib.gis.gdal.base import GDALBase from django.contrib.gis.gdal.error import GDALException, OGRIndexError from django.contrib.gis.gdal.field import Field from django.contrib.gis.gdal.geometries import OGRGeometry, OGRGeomType from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api fro...
# ABANDONWARE ### ABANDONWARE ### ABANDONWARE ### ABANDONWARE ### ABANDONWARE ### ABANDONWARE ### # ABANDONWARE ### ABANDONWARE ### ABANDONWARE ### ABANDONWARE ### ABANDONWARE ### ABANDONWARE ### # # import random,types # from DIRAC.Core.Utilities.List import sortList # # class NamespaceBrowser: # # def __init__(se...
{"name": "Tax analysis", "version": "1.0", "depends": ["base", "account"], "author": "Camptocamp SA,Odoo Community Association (OCA)", "category": 'Accounting & Finance', "website": "http://www.camptocamp.com", "license": "AGPL-3", "data": ["account_tax_analysis_view.xml"], 'installable': True, "active": False...
import random, unittest from pyutil.assertutil import _assert from pyutil.humanreadable import hr from pyutil import memutil from pyutil import cache class Bencher: def __init__(self, klass, MAXREPS=2**8, MAXTIME=5): print klass self.klass = klass self.MAXREPS = MAXREPS self.MAXTI...
import os import urllib import urllib2 from ansible import utils try: import prettytable HAS_PRETTYTABLE = True except ImportError: HAS_PRETTYTABLE = False class CallbackModule(object): """This is an example ansible callback plugin that sends status updates to a HipChat channel during playbook e...
from .obus_c import main
from openerp.osv import fields, osv from openerp.tools.translate import _ class procurement_order(osv.osv): _name = "procurement.order" _inherit = "procurement.order" _columns = { 'task_id': fields.many2one('project.task', 'Task'), 'sale_line_id': fields.many2one('sale.order.line', 'Sales o...
import os from spack import * class Pdt(AutotoolsPackage): """Program Database Toolkit (PDT) is a framework for analyzing source code written in several programming languages and for making rich program knowledge accessible to developers of static and dynamic analysis tools. PDT implements a ...
from __future__ import unicode_literals import frappe from frappe import msgprint, _ from frappe.utils import cint from erpnext.accounts.doctype.sales_invoice.sales_invoice import set_account_for_mode_of_payment from frappe.model.document import Document class POSProfile(Document): def validate(self): self.check_f...
import time import six import IECore import Gaffer import GafferTest import GafferUI import GafferUITest class BackgroundMethodTest( GafferUITest.TestCase ) : class TestWidget( GafferUI.NumericWidget ) : def __init__( self, **kw ) : GafferUI.NumericWidget.__init__( self, 0, **kw ) self.__script = Gaffer...
# -*- coding: utf-8 -*- """ Created on Tue Feb 24 08:02:02 2015 @author: Jared J. Thompson """ import psycopg2 from psycopg2.extras import DictCursor import sys,os def connect_to_db(dbname, user, host, password, port='5432' ): try: conn = psycopg2.connect(dbname=dbname, user=user, \ host=host...
from __future__ import print_function from __future__ import unicode_literals from localization import N_ from outputable import Outputable from changes import FileDiff import comment import changes import datetime import filtering import format import gravatar import interval import multiprocessing import re import su...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import traceback try: import ovirtsdk4.types as otypes except ImportError: pass from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.ovirt impo...
# -*- coding: utf-8 -*- """Constants used by Mutagen.""" GENRES = [ u"Blues", u"Classic Rock", u"Country", u"Dance", u"Disco", u"Funk", u"Grunge", u"Hip-Hop", u"Jazz", u"Metal", u"New Age", u"Oldies", u"Other", u"Pop", u"R&B", u"Rap", u"Reggae", ...
"""port_management.py code for dealing with the various tasks around handing out and managing server ports that we need to run tests """ # imports import os import sys class portManager: """ class for doing the work of handing out and tracking ports """ def __init__(self, system_manager, debug = 0):...
import os import sys import time import shutil from lib.util.mysqlBaseTestCase import mysqlBaseTestCase server_requirements = [[]] servers = [] server_manager = None test_executor = None # we explicitly use the --no-timestamp option # here. We will be using a generic / vanilla backup dir backup_path = None class ba...
"""Extra symbol documents Guidelines ---------- To add extra doc to the operator `XXX`, write a class `XXXDoc`, deriving from the base class `SymbolDoc`, and put the extra doc as the docstring of `XXXDoc`. The document added here should be Python-specific. Documents that are useful for all language bindings should b...
"""Tests NumpySource and PandasSource.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf from tensorflow.contrib.learn.python.learn.dataframe.transforms import in_memory_source # pylint: disable=g-import-not-at-t...
# Functions for rasterizing import numpy as np import pandas as pd import matplotlib.pyplot as plt from pyfor import gisexport import pyfor.metrics class Grid: """The Grid object is a representation of a point cloud that has been sorted into X and Y dimensional bins. From \ the Grid object we can derive other...
from collections import defaultdict import mock from searx.engines import spotify from searx.testing import SearxTestCase class TestSpotifyEngine(SearxTestCase): def test_request(self): query = 'test_query' dicto = defaultdict(dict) dicto['pageno'] = 0 params = spotify.request(que...
"""Insert feedback UI in feed entry.""" import bs4 as bs from colour import Color from content_extraction import get_text, get_url from feature_extraction import text2sentences from flask import request from fuzzywuzzy import fuzz import logging as log import numpy as np from scipy.stats import rankdata from traceback...
from __future__ import unicode_literals try: from urlparse import urlparse except ImportError: from urllib.parse import urlparse import logging from oauthlib.common import add_params_to_uri, urldecode from oauthlib.oauth1 import SIGNATURE_HMAC, SIGNATURE_TYPE_AUTH_HEADER import requests from . import OAuth1...
"""Tests for slim.losses.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf from inception.slim import losses class LossesTest(tf.test.TestCase): def testL1Loss(self): with self.test_session(): shape = [5, 5, 5] ...
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ Validation of the CSDF class usign unittests author: Rinse Wester """ import unittest from csdfgraph import CSDFGraph class SDFGraphTestCase(unittest.TestCase): def setUp(self): # create a graph with a cycle self.cycle_cons_sdf_graph = CSDFGraph(...
import json import mock import os import re import traceback import yaml from rally import api from rally.task import scenario from rally.task import engine from tests.unit import test class TaskSampleTestCase(test.TestCase): samples_path = os.path.join( os.path.dirname(__file__), os.pardir, os....
""" A image instance represents a ISO or virt image we want to track and repeatedly install. It differs from a answer-file based installation. Copyright 2006-2009, Red Hat, Inc Michael DeHaan <<EMAIL>> This software may be freely redistributed under the terms of the GNU general public license. You should have recei...
""" Utility classes for defining the time saving transfer of data from the reader to the write using a LightQueue as a Pipe between the reader and the writer. """ from eventlet import event from eventlet import greenthread from eventlet import queue from cinder import exception from cinder.openstack.common import log...
import mock from heat.engine.clients.os import monasca as client_plugin from heat.engine import resource from heat.engine.resources.openstack.monasca import alarm_definition from heat.engine import stack from heat.engine import template from heat.tests import common from heat.tests import utils sample_template = { ...
# -*- coding: utf-8 -*- ''' Production Configurations - Use djangosecure ''' from __future__ import absolute_import, unicode_literals import ldap from django_auth_ldap.config import LDAPSearch, GroupOfNamesType from .common import * # noqa # SECRET CONFIGURATION # -----------------------------------------------...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models, connection class Migration(SchemaMigration): def forwards(self, orm): table_names = connection.introspection.table_names() if 'cmsplugin_video' in table_names: ...
#!/usr/bin/env python2 # coding: utf-8 import argparse import copy import sys import logging import os from pykit import dictutil logger = logging.getLogger(__name__) def command(**kwargs): root, parser = add_command_help(kwargs) inputs = sys.argv[1:] try: cmds = [] while len(inputs)...
# This test can be run stand-alone with something like: # > PYTHONPATH=. python2 openerp/tests/test_view_validation.py from lxml import etree from StringIO import StringIO import unittest2 from openerp.tools.view_validation import (valid_page_in_book, valid_att_in_form, valid_type_in_colspan, ...
"""oslo.i18n integration module. See http://docs.openstack.org/developer/oslo.i18n/usage.html """ try: import oslo_i18n # NOTE(dhellmann): This reference to o-s-l-o will be replaced by the # application name when this module is synced into the separate # repository. It is OK to have more than one tr...
import Image def i32(c, o=0): return ord(c[o])+(ord(c[o+1])<<8)+(ord(c[o+2])<<16)+(ord(c[o+3])<<24) ## # Load texture from a Quake2 WAL texture file. # <p> # By default, a Quake2 standard palette is attached to the texture. # To override the palette, use the <b>putpalette</b> method. # # @param filename WAL file ...
get_db = None reset_db = None def load(get_db_fn, reset_db_fn): global get_db, reset_db get_db = get_db_fn reset_db = reset_db_fn def reset(): global get_db, reset_db get_db = None reset_db = None
from django.core.exceptions import ImproperlyConfigured from django.utils import lru_cache, six from django.utils.functional import cached_property from django.utils.module_loading import import_string from .base import Context, Template from .context import _builtin_context_processors from .exceptions import Template...
import os from datetime import datetime from twisted.trial import unittest from scrapy.contrib.spiderstate import SpiderState from scrapy.spider import BaseSpider class SpiderStateTest(unittest.TestCase): def test_store_load(self): jobdir = self.mktemp() os.mkdir(jobdir) spider = BaseSpi...
# k Nearest Neighbours implemented from Scratch in Python import csv import random import math import operator def loadDataset(filename, split, trainingSet=[], testSet=[]): with open(filename, "rt") as csvfile: lines = csv.reader(csvfile) dataset = list(lines) for x in range(len(dataset) ...
import requests from time import sleep from base64 import b64encode url = "http://localhost:5001/v1" def post_users(): for i in range(10): email = "andrew.d.lapin{0}@gmail.com".format(i) user = dict(email=email, password="root") requests.post(url+"/users", data=user, headers=headers) def ...
import os from numpy.distutils.fcompiler.gnu import GnuFCompiler compilers = ['VastFCompiler'] class VastFCompiler(GnuFCompiler): compiler_type = 'vast' compiler_aliases = () description = 'Pacific-Sierra Research Fortran 90 Compiler' version_pattern = r'\s*Pacific-Sierra Research vf90 '\ ...
'''Base classes and helpers for building zone specific tzinfo classes''' from datetime import datetime, timedelta, tzinfo from bisect import bisect_right try: set except NameError: from sets import Set as set import pytz from pytz.exceptions import AmbiguousTimeError, NonExistentTimeError __all__ = [] _time...
# -*- coding: utf8 -*- """ This is part of shot detector. Produced by w495 at 2017.05.04 04:18:27 """ from __future__ import absolute_import, division, print_function import itertools import logging import multiprocessing as mp from concurrent.futures import ProcessPoolExecutor, as_completed from shot_detect...
""" creating tables in selected database. launch this script in case of new database """ import models import json print "creating tables..." models.Player.create_table() models.Playfield.create_table() models.CoreLog.create_table() models.HeartBeat.create_table() models.PlayerLogonEvent.create_table() models.PlayerTra...
import unittest import sys import os #override sys.path for testing only sys.path.insert(0,'./src/main/python') import conveyor import conveyor.address class TestAddress(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_address_factory(self): with sel...
""" Checker panels: - CheckerPanel: draw checker messages in front of each line - GlobalCheckerPanel: draw all checker markers as colored rectangle to offer a global view of all errors """ from pyqode.core import icons from pyqode.core.api import DelayJobRunner, TextHelper, CodeEdit from pyqode.core.api....
import os, sys lib_path = os.path.abspath('../all') sys.path.append(lib_path) from SetupTest import * import unittest from mock import * from array import * class TestPostGenerationScript(unittest.TestCase): def setUp(self): self.seq = range(10) def test_minOccurs_zero_on_orderId_orderSource_amount_...
import sys import unittest from test import support pwd = support.import_module('pwd') class PwdTest(unittest.TestCase): def test_values(self): entries = pwd.getpwall() for e in entries: self.assertEqual(len(e), 7) self.assertEqual(e[0], e.pw_name) self.assert...
from __future__ import absolute_import, division, print_function, with_statement import traceback from tornado.concurrent import Future from tornado import gen from tornado.httpclient import HTTPError, HTTPRequest from tornado.log import gen_log, app_log from tornado.testing import AsyncHTTPTestCase, gen_test, bind_u...
# -*- coding: utf-8 -*- """ Density Filter Tool Created on Thu May 11 11:03:05 2017 @author: cheny """ from arcpy import Parameter import arcpy from section_cpu import dens_filter_cpu from multiprocessing import cpu_count class DensFilterTool(object): def __init__(self): """Classify Tool""" self...
import config import sys import psycopg2 as sqldb import re class XDB: """ Class for storage of data. """ def __init__(self, name): """ Creates an XDB object. """ self.db=sqldb.connect( host=config.xdbDriver_pgsql["server"], user=config.xdbDriver_pgsql["username"], password=config.xdbDriver_pgsql["pas...
from slicc.ast.ExprAST import ExprAST class OodAST(ExprAST): def __init__(self, slicc): super(OodAST, self).__init__(slicc) def __repr__(self): return "[Ood:]" def generate(self, code): code += "NULL" return "OOD"
#!/usr/bin/env python3.6 from decimal import * import gzip import random import sys import math ops = { "*": "multiplication", "+": "addition", "-": "subtraction", "/": "division", "qC": "comparison", "quant": "quantization", "A": "absolute-value", "cfd": "convert-to-string", "~": ...
from django.conf.urls import include from django.conf.urls import patterns from django.conf.urls import url from openstack_dashboard.dashboards.project.networks.ports \ import urls as port_urls from openstack_dashboard.dashboards.project.networks.ports \ import views as port_views from openstack_dashboard.dash...
from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import unified_strdate class TeleTaskIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?tele-task\.de/archive/video/html5/(?P<id>[0-9]+)' _TEST = { 'url': 'http://www.tele-task.de/archive/video/html5/2...
from datetime import datetime from django.contrib.gis.db import models from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic from django.utils.translation import ugettext_lazy as _ from jsonfield import JSONField from nodeshot.core.base.models import BaseDate fro...
import os from tempfile import NamedTemporaryFile from mock import patch from test_inischema import SAMPLE_CONFIGURATION from test_inischema import SAMPLE_SCHEMA SAMPLE_CONFIGURATION += """ [env] somekey = somevalue """ class TestCommand(object): with NamedTemporaryFile(delete=False) as config_file: ...
"""Python functions for directly manipulating TFRecord-formatted files. See the @{$python/python_io} guide. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function # go/tf-wildcard-import # pylint: disable=wildcard-import from tensorflow.python.lib.io.tf_recor...
from __future__ import absolute_import import pytest from ansible.module_utils import basic from ansible.module_utils.network.ftd.common import HTTPMethod from ansible.module_utils.network.ftd.fdm_swagger_client import FILE_MODEL_NAME, OperationField from ansible.modules.network.ftd import ftd_file_download from unit...
from __future__ import absolute_import, print_function import random import unittest import six from support import TestCase from pyskiplist import SkipList from pyskiplist.skiplist import check, dump, getsize class TestSkipList(TestCase): """Unit test suite for SkipList.""" size = 100 def _create_ski...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ *************************************************************************** r.external.all.py --------------------- Date : July 2009 Copyright : (C) 2009 by Lorenzo Masini Email : rugginoso at develer dot c...
import unittest import matchcompiler class MatchCompilerTest(unittest.TestCase): def setUp(self): self.mc = matchcompiler.MatchCompiler(verify_mode=False) def test_parseMatch(self): self.assertEqual(self.mc.parseMatch(' Token::Match(tok, ";") ', 2), [ 'Token::Match(...
#!/bin/local/bin/python3 # A utility, script, or potentially one day class to convert audio waveforms in to windowed, reduced descriptors, for some machine learning algorithm to go nuts on later # Authors: James Nichols, Darwin Vickers # Includes a test of converting then reversing the predictor to see how things so...
import time from lxml import etree from openerp.osv import fields, osv class account_payment_populate_statement(osv.osv_memory): _name = "account.payment.populate.statement" _description = "Account Payment Populate Statement" _columns = { 'lines': fields.many2many('payment.line', 'payment_line_rel...
# -*- coding: utf-8 -*- """ The MIT License (MIT) Copyright (c) 2015-2016 Rapptz 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 u...
import proto # type: ignore __protobuf__ = proto.module( package="google.ads.googleads.v7.enums", marshal="google.ads.googleads.v7", manifest={"MatchingFunctionOperatorEnum",}, ) class MatchingFunctionOperatorEnum(proto.Message): r"""Container for enum describing matching function operator. """ ...
"""Invenio search engine utilities.""" from invenio.legacy.dbquery import run_sql from invenio.legacy.bibrecord import get_fieldvalues def record_exists(recID): """Return 1 if record RECID exists. Return 0 if it doesn't exist. Return -1 if it exists but is marked as deleted. """ from inveni...
import unittest import os import logging from osm2gtfs.tests.creators.creators_tests import CreatorsTestsAbstract # Define logging level logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO")) class TestCreatorsCrGam(CreatorsTestsAbstract): def _get_selector(self): return "cr_gam" def _get_re...
"""Fixer for __unicode__ methods. Uses the django.utils.encoding.python_2_unicode_compatible decorator. """ from __future__ import unicode_literals from lib2to3 import fixer_base from lib2to3.fixer_util import find_indentation, Name, syms, touch_import from lib2to3.pgen2 import token from lib2to3.pytree import Leaf,...
from django.shortcuts import render_to_response from equilibrator.gibbs import constants from django.template.context import RequestContext def AboutPage(request): """Renders the about page.""" return render_to_response('about.html', {}) def FAQPage(request): """Renders the FAQ page.""" return rende...
from pyassa.logger import result_logger from pyassa.utils import add_description from custom_utils import report_parser import re @add_description(" - [ERROR] Summary field should not be empty string.") def rule_error_incorrect_summary(**kwargs): report = kwargs["script"] parsed_report = report_parser(report)...
__import__( "GafferSceneUI" ) from ._GafferArnoldUI import * from . import ArnoldShaderUI from . import ArnoldRenderUI from . import ShaderMenu from . import ArnoldOptionsUI from . import ArnoldAttributesUI from . import ArnoldLightUI from . import ArnoldVDBUI from . import InteractiveArnoldRenderUI from . import Arn...
from django.apps import AppConfig from . import __description__, __verbose_name__, __version__ class VoteCollectorAppConfig(AppConfig): name = 'openslides_votecollector' verbose_name = __verbose_name__ description = __description__ version = __version__ angular_site_module = True angular_proj...
import esccmd from esctypes import Point from escutil import AssertEQ, GetCursorPosition, knownBug class CHTTests(object): @knownBug(terminal="iTerm2", reason="iTerm2 doesn't support CHT") def test_CHT_OneTabStopByDefault(self): esccmd.CHT() position = GetCursorPosition() AssertEQ(position.x(), 9) @...
# -*- encoding: utf-8 -*- from __future__ import unicode_literals import unittest from django.core.checks import Error from django.db import connection, models from .base import IsolatedModelsTestCase class AutoFieldTests(IsolatedModelsTestCase): def test_valid_case(self): class Model(models.Model): ...
import re event_type_pattern = re.compile('^\[[0-9]{10}] (?:HOST|SERVICE) (ALERT|NOTIFICATION|FLAPPING|DOWNTIME|EVENT)(?: ALERT)?:.*') event_types = { 'NOTIFICATION': { # ex: "[1402515279] SERVICE NOTIFICATION: admin;localhost;check-ssh;CRITICAL;notify-service-by-email;Connection refused" 'pattern': '\[([...
from django.core.urlresolvers import reverse, resolve from test_plus.test import TestCase class TestUserURLs(TestCase): """Test URL patterns for users app.""" def setUp(self): self.user = self.make_user() def test_list_reverse(self): """users:list should reverse to /users/.""" s...
"""Blob helper functions.""" import numpy as np import cv2 def im_list_to_blob(ims): """Convert a list of images into a network input. Assumes images are already prepared (means subtracted, BGR order, ...). """ max_shape = np.array([im.shape for im in ims]).max(axis=0) num_images = len(ims) b...
from m5.params import * from m5.proxy import * from m5.SimObject import SimObject class KvmVM(SimObject): type = 'KvmVM' cxx_header = "cpu/kvm/vm.hh" coalescedMMIO = \ VectorParam.AddrRange([], "memory ranges for coalesced MMIO")
from ctypes import * from ctypes.util import find_library import os import logging import platform import re import sys import tempfile import filecmp import shutil import codecs def gen_enum_value(value): return 'k' + value[0].upper() + value[1:] class EnumType: name = '' enumValues = [] def __init__...
from flumotion.common import testsuite from flumotion.component.misc.porter import porter class FakeTransport: connected = True _fileno = 5 def __init__(self, protocol): self.written = '' self.protocol = protocol def loseConnection(self): self.connected = False self.p...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['stableinterface'], 'supported_by': 'curated'} try: import boto.ec2 HAS_BOTO = True except ImportError: HAS_BOTO = False from ansible.module_utils._text import to_bytes import random import string def main...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting field 'Tree.created_by' db.delete_column(u'treemap_tree', 'created_by_id') # Deleting fi...
import json, http, urllib import time import logging CACHE_FILE = "../synth_logs/dark_sky_cache.txt" KEY_FILE = "../synth_accounts/default.json" API_DOMAIN = "api.darksky.net" HOUR = 60 * 60 DAY = HOUR * 24 if __name__ == "__main__": CACHE_FILE = "../../../" + CACHE_FILE KEY_FILE = "../../../" + KEY_FILE # ...
import logging import math import time import Queue import mini_driver import threading import time import DrivebyXMC #--------------------------------------------------------------------------------------------------- class RobotController: MIN_ANGLE = 0.0 MAX_ANGLE = 180.0 CENTRE_ANGLE = (MIN_ANGLE...
#!/usr/bin/env python import os import csv import math from geometry_msgs.msg import Quaternion from styx_msgs.msg import Lane, Waypoint import tf import rospy CSV_HEADER = ['x', 'y', 'z', 'yaw'] MAX_DECEL = 1.0 class WaypointLoader(object): def __init__(self): rospy.init_node('waypoint_loader', log...
# -*- coding: utf-8 -*- """ requests.structures ~~~~~~~~~~~~~~~~~~~ Data structures that power Requests. """ class CaseInsensitiveDict(dict): """Case-insensitive Dictionary For example, ``headers['content-encoding']`` will return the value of a ``'Content-Encoding'`` response header.""" @property...
import argparse import matplotlib.pyplot as plt import numpy as np import os from os import path import sys import warnings HB_LOG_IDX_START_TIME = 7 HB_LOG_IDX_END_TIME = HB_LOG_IDX_START_TIME + 1 HB_LOG_IDX_START_ENERGY = 14 HB_LOG_IDX_END_ENERGY = HB_LOG_IDX_START_ENERGY + 1 ENERGY_PROFILER_NAME = 'ApplicationHear...
"""Pure-Python AES implementation.""" from cryptomath import * from AES import * from rijndael import rijndael def new(key, mode, IV): return Python_AES(key, mode, IV) class Python_AES(AES): def __init__(self, key, mode, IV): AES.__init__(self, key, mode, IV, "python") self.rijndael = rijnda...
#!/usr/bin/env python3 """ Compare the output of two codecs. (c) Copyright 2005, Marc-Andre Lemburg (<EMAIL>). Licensed to PSF under a Contributor Agreement. """ import sys def compare_codecs(encoding1, encoding2): print('Comparing encoding/decoding of %r and %r' % (encoding1, encoding2)) mismatch...
from django.conf import settings from django.contrib.staticfiles.handlers import StaticFilesHandler from django.core.management.commands.runserver import \ Command as RunserverCommand class Command(RunserverCommand): help = "Starts a lightweight Web server for development and also serves static files." d...
""" registration tool for cobbler. Copyright 2009 Red Hat, Inc. Michael DeHaan <<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 2 of the License, or (at your option) any late...
import sys import unittest from wp_parser.wp_chat import main as parser # for capturing print() output from contextlib import contextmanager try: from StringIO import StringIO except ImportError: #python3 from io import StringIO @contextmanager def captured_output(): new_out, new_err = StringIO(), Strin...
# coding: utf-8 from __future__ import unicode_literals import json from .common import InfoExtractor from ..utils import ( ExtractorError, ) class EllenTVIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?(?:ellentv|ellentube)\.com/videos/(?P<id>[a-z0-9_-]+)' _TEST = { 'url': 'http://www.elle...