content
stringlengths
4
20k
"""A HTTPSConnection/Handler with additional proxy and cert validation features. In particular, monkey patches in Python r74203 to provide support for CONNECT proxies and adds SSL cert validation if the ssl module is present. """ __author__ = "{frew,nick.johnson}@google.com (Fred Wulff and Nick Johnson)" import base...
from django.contrib.gis.db import models from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class NamedModel(models.Model): name = models.CharField(max_length=25) objects = models.GeoManager() class Meta: abstract = True app_label = 'layermap' ...
#!/usr/bin/env python """ The dirac-pilot.py script is a steering script to execute a series of pilot commands. The commands may be provided in the pilot input sandbox, and are coded in the pilotCommands.py module or in any <EXTENSION>Commands.py module. The pilot script defines two switches in order to ch...
import kivy from kivy.app import App from kivy.lang import Builder kivy.require('1.9.0') import kivy.garden.contextmenu kv = """ FloatLayout: id: layout Label: pos: 10, self.parent.height - self.height - 10 text: "Left click anywhere outside the context menu to close it" size_hint: N...
from msrest.serialization import Model class QueryResults(Model): """A query response. Contains the tables, columns & rows resulting from a query. All required parameters must be populated in order to send to Azure. :param tables: Required. The list of tables, columns and rows. :type tables: li...
#!/usr/bin/env python3 """ Copyright 2017 Jocelyn Falempe <EMAIL> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify...
"""Functional tests for basic component wise operations using a GPU device.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import numpy as np from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from t...
""" Logical Link Control(LLC, IEEE 802.2) parser/serializer http://standards.ieee.org/getieee802/download/802.2-1998.pdf LLC format +-----------------+--------------+ | DSAP address | 8 bits | +-----------------+--------------+ | SSAP address | 8 bits | +-----------------+------...
from trove.common import cfg from trove.common.views import create_links CONF = cfg.CONF class FlavorView(object): def __init__(self, flavor, req=None): self.flavor = flavor self.req = req def data(self): # If the flavor id cannot be cast to an int, we simply return # no id...
""" Flask-JsonSchema ---------- A Flask extension for validating JSON requets with jsonschema """ from setuptools import setup setup( name='Flask-JsonSchema', version='0.1.0', url='https://github.com/mattupstate/flask-jsonschema', license='MIT', author='Matt Wright', author_email='<EMAIL>', ...
import sys import unittest __all__ = ['get_config_vars', 'get_path'] try: # Python 2.7 or >=3.2 from sysconfig import get_config_vars, get_path except ImportError: from distutils.sysconfig import get_config_vars, get_python_lib def get_path(name): if name not in ('platlib', 'purelib'): ...
from distutils.core import setup import os import shutil import tempfile import json import sys import subprocess from subprocess import call from zipfile import ZipFile from main.Common import CommonVariables packages_array = [] main_folder = 'main' main_entry = main_folder + '/handle.py' packages_array.append(main_f...
# -*- coding: utf-8 -*- import urllib import socket import threading import classes.cversion class Updater(threading.Thread): def __init__(self, config, android): self.config = config self.android = android if android is None: threading.Thread.__init__(self) @staticmethod...
""" Module with tests for the csshtmlheader preprocessor """ #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with ...
from __future__ import unicode_literals import frappe, unittest, os import frappe.translate # class TestTranslations(unittest.TestCase): # def test_doctype(self, messages=None): # if not messages: # messages = frappe.translate.get_messages_from_doctype("Role") # self.assertTrue("Role Name" in messages) # # d...
''' Logger object ============= Differents level are available : trace, debug, info, warning, error, critical. Examples of usage:: from kivy.logger import Logger Logger.info('title: This is a info') Logger.debug('title: This is a debug') try: raise Exception('bleh') except Exception, e:...
from PhysicalQuantity import PhysicalQuantity from UnitOfMeasure import UnitOfMeasure class Area(PhysicalQuantity): def __init__(self, value, unit): super(Area, self).__init__(value, unit) # Meters squared new_unit = UnitOfMeasure( 'm^2', lambda x: x, ...
from . import claim_line from . import crm_claim
"""Create / interact with Google Cloud RuntimeConfig connections.""" from google.cloud import _http class Connection(_http.JSONConnection): """A connection to Google Cloud RuntimeConfig via the JSON REST API. :type credentials: :class:`oauth2client.client.OAuth2Credentials` :param credentials: (Optiona...
"""Imports modules that should be scanned during API generation. This file should eventually contain everything we need to scan looking for tf_export decorators. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function # go/tf-wildcard-import # pylint: disable=w...
#!/usr/bin/env python3 """ "PYSTONE" Benchmark Program Version: Python/1.1 (corresponds to C/1.1 plus 2 Pystone fixes) Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013. Translated from ADA to C by Rick Richardson. Every method to preserve ADA-likeness h...
import unittest from manifest_features import ConvertDottedKeysToNested class ManifestFeaturesTest(unittest.TestCase): def testConvertDottedKeysToNested(self): docs = { 'doc1.sub2': { 'name': 'doc1.sub2' }, 'doc1': { 'name': 'doc1' }, 'doc2': { 'name': 'doc2...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} from ansible.module_utils.basic import AnsibleModule try: from ansible.module_utils.avi import ( avi_common_argument_spec, HAS_AVI, avi_ansible_api) except ImportErro...
import functools import io import six import win32file import win32pipe cERROR_PIPE_BUSY = 0xe7 cSECURITY_SQOS_PRESENT = 0x100000 cSECURITY_ANONYMOUS = 0 RETRY_WAIT_TIMEOUT = 10000 def check_closed(f): @functools.wraps(f) def wrapped(self, *args, **kwargs): if self._closed: raise Runtim...
from tkinter import * from idlelib import SearchEngine from idlelib.SearchDialogBase import SearchDialogBase import re def replace(text): root = text._root() engine = SearchEngine.get(root) if not hasattr(engine, "_replacedialog"): engine._replacedialog = ReplaceDialog(root, engine) dialog = ...
from django.template import loader from django.utils.text import capfirst from django.core.urlresolvers import reverse, NoReverseMatch from django.utils.translation import ugettext as _ from xadmin.sites import site from xadmin.filters import SEARCH_VAR from xadmin.views import BaseAdminPlugin, CommAdminView class T...
import report_intrastat # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
""" Tests the logic of problems with a delay between attempt submissions. Note that this test file is based off of test_capa_module.py and as such, uses the same CapaFactory problem setup to test the functionality of the check_problem method of a capa module when the "delay between quiz submissions" setting is set to ...
import zstackwoodpecker.test_state as ts_header TestAction = ts_header.TestAction def path(): return dict(initial_formation="template2", path_list=[[TestAction.create_volume, "volume1", "=scsi"], [TestAction.attach_volume, "vm1", "volume1"], [Te...
from khashmir import Khashmir from random import randrange import sys, os class Network: def __init__(self, size=0, startport=5555, localip='127.0.0.1'): self.num = size self.startport = startport self.localip = localip def _done(self, val): self.done = 1 def setUp...
# -*- coding: utf-8 -*- """ @author: Fabio Erculiani <<EMAIL>> @contact: <EMAIL> @copyright: Fabio Erculiani @license: GPL-2 B{EntropyTransceiver SSH URI Handler module}. """ import re import os import errno import time import shutil import codecs from entropy.const import const_isnumber, const_...
""" A decorator for marking methods/functions as deprecated. """ # Standard library imports. import logging # Logging. logger = logging.getLogger(__name__) # We only warn about each function or method once! _cache = {} def deprecated(message): """ A factory for decorators for marking methods/functions as dep...
from openerp import models, fields class ResCompany(models.Model): _inherit = 'res.company' currency_rate_max_delta = fields.Integer( string='Max Time Delta in Days for Currency Rates', default=7, help="This is the maximum interval in days between " "the date associated with the amoun...
"""Moves "featured" artists to the title from the artist field. """ from __future__ import division, absolute_import, print_function import re from beets import plugins from beets import ui from beets.util import displayable_path def split_on_feat(artist): """Given an artist string, split the "main" artist from...
# encoding: utf-8 from __future__ import unicode_literals import json import re from .common import InfoExtractor from ..utils import ( ExtractorError, ) class RBMARadioIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?rbmaradio\.com/shows/(?P<videoID>[^/]+)$' _TEST = { 'url': 'http://www.rbm...
import datetime from parsley import makeGrammar as make_grammar, _GrammarWrapper __version__ = "0.1.0" class Duplicated(Exception): """ A key group was duplicated, or contained a duplicate value. """ @classmethod def in_group(cls, key, key_group=None): group_str = "the document" if ke...
""" Block Structure Transformer Registry implemented using the platform's PluginManager. """ from openedx.core.lib.api.plugins import PluginManager class TransformerRegistry(PluginManager): """ Registry for all of the block structure transformers that have been made available. All block structure tra...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.module_utils.facts.network.base import Network, NetworkCollector class HPUXNetwork(Network): """ HP-UX-specifig subclass of Network. Defines networking facts: - default_interface - interfaces (a list ...
import urlparse from openerp import SUPERUSER_ID from openerp import http from openerp.addons.web.http import request from openerp.addons.website_mail.controllers.main import WebsiteMail class WebsiteMailController(WebsiteMail): @http.route(['/website_mail/post/json'], type='json', auth='public', website=True)...
from django import template from django.conf import settings from django.contrib.flatpages.models import FlatPage from django.contrib.sites.shortcuts import get_current_site register = template.Library() class FlatpageNode(template.Node): def __init__(self, context_name, starts_with=None, user=None): sel...
from pyflink.common.execution_config import ExecutionConfig from pyflink.common.restart_strategy import RestartStrategies from pyflink.java_gateway import get_gateway from pyflink.util.utils import load_java_class class ExecutionEnvironment(object): """ The ExecutionEnvironment is the context in which a progr...
import numpy as np import unittest import scipy.stats import nest from . import test_connect_helpers as hf from .test_connect_parameters import TestParams class TestFixedOutDegree(TestParams): # specify connection pattern and specific params rule = 'fixed_outdegree' conn_dict = {'rule': rule} # sizes ...
import os, os.path, shutil, signal, socket, sys from os import environ as env from os.path import join as joinpath, expanduser def date(): import time return time.strftime('%a %b %e %H:%M:%S %Z %Y', time.localtime()) def cleandir(dir): for root, dirs, files in os.walk(dir, False): for name in file...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: bigip_device_ntp short_description: Manage NTP serv...
""" Rule that checks for a source with a particular tag. """ #------------------------------------------------------------------------- # # Standard Python modules # #------------------------------------------------------------------------- from ....const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext...
import json from cms.plugin_pool import plugin_pool from cms.plugin_base import CMSPluginBase from django.conf import settings from django.http import HttpResponseRedirect from django.utils.translation import ugettext_lazy as _ from .forms import TableForm from .models import Table from .utils import static_url cla...
from django.contrib.auth.models import User from django.db import models from datetime import datetime """ Certificates are created for a student and an offering of a course. When a certificate is generated, a unique ID is generated so that the certificate can be verified later. The ID is a UUID4, so that it can't be...
from monascaclient import exc DASHBOARD = "monitoring" # A list of applications to be added to INSTALLED_APPS. ADD_INSTALLED_APPS = ['monitoring'] # A list of angular modules to be added as dependencies to horizon app. ADD_ANGULAR_MODULES = ['monitoringApp'] # A list of javascript files to be included for all pages...
import unittest, os, sys, re myPath = os.path.realpath(sys.argv[0]) rootDirectory = re.sub("/testing/.*", "", myPath) testingDir = os.path.join(rootDirectory, "testing") sys.path.append(rootDirectory) from testing.lib import printSeparator, printLine moduleList = [] allList = [] excludes = [ ] # Build...
""" Test suite to check compilance with PEP 247, the standard API for hashing algorithms """ import hmac import unittest from hashlib import md5, sha1, sha224, sha256, sha384, sha512 from test import support class Pep247Test(unittest.TestCase): def check_module(self, module, key=None): self.assertTrue(ha...
import textwrap import unittest from makani.lib.python.pack2 import parser class TestParserSpecialized(unittest.TestCase): def testSpecialized(self): text = textwrap.dedent("""\ enum32 FooRevision { kFooRevisionA = 0, kFooRevisionB = 1, } param BaseConfigParams { ...
""" when IDA's auto-discovery of functions in 64-bit Windows Go executables fails, scan for global (.rdata) pointers into the code section (.text) and assume these are function pointers. """ import idc import ida_name import ida_auto import ida_bytes import idautils def enum_segments(): for segstart in idautils.S...
from weblate.trans.management.commands import WeblateLangCommand class Command(WeblateLangCommand): help = 'updates checks for units' def handle(self, *args, **options): for unit in self.iterate_units(*args, **options): unit.run_checks()
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Line(_BaseTraceHierarchyType): # class properties # -------------------- _parent_path_str = "scatterpolargl" _path_str = "scatterpolargl.line" _valid_props = {"color", "dash", "shape", "w...
# coding=utf-8 """ The SlabInfoCollector collects metrics on process stats from /proc/slabinfo #### Dependencies * /proc/slabinfo """ import platform import os import diamond.collector # Detect the architecture of the system # and set the counters for MAX_VALUES # appropriately. Otherwise, rolling over # counter...
"""The base interface of RPC Framework. Implementations of this interface support the conduct of "operations": exchanges between two distinct ends of an arbitrary number of data payloads and metadata such as a name for the operation, initial and terminal metadata in each direction, and flow control. These operations m...
import StringIO import unittest import cliapp class SettingsTests(unittest.TestCase): def setUp(self): self.settings = cliapp.Settings('appname', '1.0') def test_has_progname(self): self.assertEqual(self.settings.progname, 'appname') def test_sets_progname(self): self.settings....
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.compat.tests import unittest, mock from ansible.errors import AnsibleError from ansible.plugins.cache import FactCache from ansible.plugins.cache.base import BaseCacheModule from ansible.plugins.cache.memory import Cac...
"""Test p2p mempool message. Test that nodes are disconnected if they send mempool messages when bloom filters are not enabled. """ from test_framework.messages import msg_mempool from test_framework.mininode import P2PInterface from test_framework.test_framework import BitcoinTestFramework from test_framework.util i...
from openerp import models, api class PurchaseOrder(models.Model): _inherit = 'purchase.order' @api.model def _prepare_order_line_move(self, order, order_line, picking_id, group_id): res = super(PurchaseOrder, self)._prepare_order_line_move( order, ord...
from __future__ import unicode_literals """ Syncs a database table to the `DocType` (metadata) .. note:: This module is only used internally """ import re import os import frappe from frappe import _ from frappe.utils import cstr, cint class InvalidColumnName(frappe.ValidationError): pass type_map = { 'Currency': ...
# bgenall - Generate all bgen-generated modules # import sys import os import string def bgenone(dirname, shortname): os.chdir(dirname) print '%s:'%shortname # Sigh, we don't want to lose CVS history, so two # modules have funny names: if shortname == 'carbonevt': modulename = 'CarbonEvtsca...
""" Loads the user_activity table into the warehouse through the pipeline via Hive. On the roadmap is to write a task that runs validation queries on the aggregated Hive data pre-load. """ import logging import luigi from edx.analytics.tasks.url import ExternalURL from edx.analytics.tasks.user_activity import UserActi...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import json from ansible.module_utils.network.a10.a10 import axapi_call_v3, a10_argument_s...
# Scan an Apple header file, generating a Python file of generator calls. import sys from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner_OSX LONG = "AppleHelp" SHORT = "ah" OBJECT = "NOTUSED" def main(): input = LONG + ".h" output = SHORT + "gen.py" defsou...
from Screens.Screen import Screen from Screens.MessageBox import MessageBox from Components.ActionMap import ActionMap from Components.ConfigList import ConfigListScreen from Components.MenuList import MenuList from Components.Sources.StaticText import StaticText from Components.config import config, ConfigNumber, Conf...
import inspect import os import sys import traceback from time import sleep scriptdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) maindir = os.path.abspath(os.path.join(scriptdir, '../../')) sys.path.append(maindir) transitionsdir = os.path.abspath(os.path.join(scriptdir, '../../transit...
# -*- coding: utf-8 -*- ############################################################################### # # GetAllEvents # Retrieve data for all events in a specified calendar. # # Python version 2.6 # ############################################################################### from temboo.core.choreography import...
# -*- coding: utf-8 -*- """ pythoncompat """ from .packages import chardet import sys # ------- # Pythons # ------- # Syntax sugar. _ver = sys.version_info #: Python 2.x? is_py2 = (_ver[0] == 2) #: Python 3.x? is_py3 = (_ver[0] == 3) #: Python 3.0.x is_py30 = (is_py3 and _ver[1] == 0) #: Python 3.1.x is_py31 =...
# -*- coding: utf8 -*- from example_config import * from ots2 import * import time table_name = 'GetRowExample' def create_table(ots_client): schema_of_primary_key = [('gid', 'INTEGER'), ('uid', 'INTEGER')] table_meta = TableMeta(table_name, schema_of_primary_key) reserved_throughput = ReservedThroughput...
""" Hong Kong specific Form helpers """ from __future__ import absolute_import import re from django.core.validators import EMPTY_VALUES from django.forms import CharField from django.forms import ValidationError from django.utils.encoding import smart_unicode from django.utils.translation import ugettext_lazy as _ ...
from django.http import HttpResponse from django.conf.urls.defaults import * def get_user(request): return HttpResponse(request.user.username) urlpatterns = patterns('', (r'^getuser/$', get_user), (r'^openid/', include('django_openid_auth.urls')), )
""" This module implements helpers for switching to TLS on an existing transport. @since: 11.1 """ class _TLSDelayed(object): """ State tracking record for TLS startup parameters. Used to remember how TLS should be started when starting it is delayed to wait for the output buffer to be flushed. ...
#!/usr/bin/env python """ Created on Wed Jul 15 13:46:42 2015 Author: Oren Freifeld Email: <EMAIL> """ import numpy as np from of.utils import * from pycuda.compiler import SourceModule from pycuda.driver import Context from of.gpu import * from scipy.linalg import expm krnl=""" # include <stdlib.h> # include <s...
import numpy as np import pytest import pyarrow as pa all_array_types = [ ('bool', [True, False, False, True, True]), ('uint8', np.arange(5)), ('int8', np.arange(5)), ('uint16', np.arange(5)), ('int16', np.arange(5)), ('uint32', np.arange(5)), ('int32', np.arange(5)), ('uint64', np.ar...
#!/usr/bin/python # -*- coding: utf-8 -*- r""" Coordinate importing script. Usage: python pwb.py coordinate_import -lang:en -family:wikipedia \ -cat:Category:Coordinates_not_on_Wikidata This will work on all pages in the category "coordinates not on Wikidata" and will import the coordinates on these page...
# -*- coding: utf-8 -*- """ /*************************************************************************** Name : DB Manager Description : Database manager plugin for QGIS Date : May 23, 2011 copyright : (C) 2011 by Giuseppe Sucameli email : <EMAIL> **...
import account_coda_import
# -*- coding: utf-8 -*- """ Created on Wed Oct 12 10:50:15 2016 @author: msdogan """ # This code optimizes pump-storage hydropower facility operations. # Mustafa Dogan ### 02/22/2017 from __future__ import division import numpy as np import matplotlib.pyplot as plt import scipy as sp from scipy.optimize import differe...
""" This module is home to the User class """ from pyecobee.ecobee_object import EcobeeObject class User(EcobeeObject): """ This class has been auto generated by scraping https://www.ecobee.com/home/developer/api/documentation/v1/objects/User.shtml Attribute names have been generated by converting ec...
"""Provide piped, no disk-IO, BAM preparation for variant calling. Handles independent analysis of chromosome regions, allowing parallel runs of this step. """ import os import toolz as tz from bcbio import bam, broad, utils from bcbio.distributed.transaction import file_transaction, tx_tmpdir from bcbio.pipeline imp...
import re try: from invenio.config import CFG_BIBDOCFILE_DOCUMENT_FILE_MANAGER_MISC except ImportError: CFG_BIBDOCFILE_DOCUMENT_FILE_MANAGER_MISC = { 'can_revise_doctypes': ['*'], 'can_comment_doctypes': ['*'], 'can_describe_doctypes': ['*'], 'can_delete_doctypes': ['*'], ...
import unittest import pmt import pmt_to_python as pmt2py class test_pmt_to_python(unittest.TestCase): def test_pmt_from_double(self): b = pmt.from_double(123765) self.assertEqual(pmt.to_python(b), 123765) t = pmt.to_pmt(range(5)) def test_numpy_to_uvector_and_reverse(self): i...
import urllib.request from pathlib import Path import re import structlog from dos.providers import ZipInstaller from dos.roles.role import Role from dos.roles.role import Plans log = structlog.get_logger() CONFIG_MISSING = 'required config value: "{0}"' class HashicorpRelease(Role): def ns(self): retu...
""" Django admin page for grades models """ from config_models.admin import ConfigurationModelAdmin, KeyedConfigurationModelAdmin from django.contrib import admin from lms.djangoapps.grades.config.forms import CoursePersistentGradesAdminForm from lms.djangoapps.grades.config.models import ( ComputeGradesSetting, ...
#!/usr/bin/env python import os, sys, shutil, subprocess, argparse THIS_DIR = os.path.dirname(os.path.abspath(__file__)) DIST_DIR = os.path.join(THIS_DIR, "dist") sys.path.append(os.path.join(THIS_DIR, "src", "Selenium2Library")) sys.path.append(os.path.join(THIS_DIR, "doc")) sys.path.append(os.path.join(THIS_DIR, "d...
import unittest import tempfile import os import random # validate, , validate various things, internal from yotta.lib import settings from yotta.lib.fsutils import rmRf class TestSettings(unittest.TestCase): @classmethod def setUpClass(cls): cls.test_dir = tempfile.mkdtemp() test_files = [ ...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' ========================================================================= Program: Visualization Toolkit Module: TestNamedColorsIntegration.py Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www....
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest as ut import pyvle import sys class TestConditions(ut.TestCase): def setUp(self): self.exp = pyvle.Vle("test_error.vpz", "test_port") def testCreateConditionStillExists(self): name = "cond" self.assertEqual(len(self.exp.li...
# encoding: utf-8 import datetime from south.db import db from south.v2 import DataMigration from django.db import models from django.contrib.contenttypes.models import ContentType from django.db.models.fields.related import ReverseSingleRelatedObjectDescriptor from django.contrib.sites.models import Site class Migrat...
"""Nexmark Query 1: Convert bid prices from dollars to euros. The Nexmark suite is a series of queries (streaming pipelines) performed on a simulation of auction events. This query converts bid prices from dollars to euros. It illustrates a simple map. """ from __future__ import absolute_import import apache_beam as...
DATE_FORMAT = 'j. E Y' TIME_FORMAT = 'G:i:s' DATETIME_FORMAT = 'j. E Y G:i:s' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT = 'j. F' SHORT_DATE_FORMAT = 'd.m.Y' SHORT_DATETIME_FORMAT = 'd.m.Y G:i:s' FIRST_DAY_OF_WEEK = 1 # Monday # The *_INPUT_FORMATS strings use the Python strftime format syntax, # see http://docs.pytho...
import pandas import numpy as np import scipy import statsmodels.api as sm import traceback import logging from time import time from msgpack import unpackb, packb from redis import StrictRedis from settings import ( ALGORITHMS, CONSENSUS, FULL_DURATION, MAX_TOLERABLE_BOREDOM, MIN_TOLERABLE_LENGTH,...
# generate one file x-axis is problem indexes 1-20 import os import math def stdv(implist): totalnum = len(implist) avg = 0 sq = 0 for imp in implist: avg += imp avg = avg/20 for imp in implist: sq += (imp-avg)*(imp-avg) sq = sq/20 res = math.sqrt(sq) return res de...
"""Test the Nuclear method in cclib""" from __future__ import print_function import os import re import logging import unittest import numpy from testall import getfile from cclib.method import Nuclear from cclib.parser import QChem from cclib.parser import utils class NuclearTest(unittest.TestCase): def test...
"""Leetcode 581. Shortest Unsorted Continuous Subarray Easy URL: https://leetcode.com/problems/shortest-unsorted-continuous-subarray/ Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too. Y...
import collections from operator import itemgetter from neutron_lib.api.definitions import availability_zone as az_def from neutron_lib import constants from neutron_lib.objects import exceptions from oslo_config import cfg from oslo_log import log as logging from neutron.agent.common import utils as agent_utils from...
# -*- coding: utf-8 -*- from invoke import run, task REQUIREMENTS = 'requirements-dev.txt' PACKAGE_NAME = 'alchy' FLAKE8_IGNORE = ','.join([ 'F401', # `module` imported but unused 'F811', # redefinition of unused `name` from line `N` ]) PYLINT_IGNORE = ','.join([ 'not-callable', 'no-self-argument',...
"""Provides a layer of abstraction for the issue tracker API.""" from __future__ import print_function from __future__ import division from __future__ import absolute_import import httplib import json import logging from apiclient import discovery from apiclient import errors _DISCOVERY_URI = ('https://monorail-prod...
from flask import Blueprint, jsonify, request from flask_security import login_required, roles_required from DJBot.forms.generic import SelectName from DJBot.utils.ssh import generate_key, remove_key from DJBot.models.playbook import Playbook from DJBot.models.inventory import Room, Host import os import re settings_b...