content
stringlengths
4
20k
import abc import six from typing import Any, Union, List, Optional, Tuple @six.add_metaclass(abc.ABCMeta) class ICache(object): @abc.abstractmethod def put(self, key, value, expiry=None): # type: (str, Any, Optional[int]) -> dict raise NotImplementedError @abc.abstractmethod def put...
from django.conf.urls import patterns, include, url from django.conf.urls.static import static from django.conf import settings from django.views.generic import TemplateView from project.views import add_project,add_project2 # Uncomment the next two lines to enable the admin: from django.contrib.auth.decorators import...
"""Simple module for converting data sets between supported formats, rotating around a common standard (in-memory SQLite database). """ import os import xlrd import xlwt import sqlite3 class Excel: @staticmethod def toSqlite(wb): shi = wb.sheet_names() db = sqlite3.connect(':memory:') ...
''' An auth-controlled access and retrieval mechanism for a media folder ''' import json, os from flask import Blueprint, request, url_for, flash, redirect, abort, make_response from flask import render_template from flask.ext.login import current_user import werkzeug from portality.core import app import portality...
if __name__ == "__main__": import argparse parser = argparse.ArgumentParser() parser.add_argument('--token', type=str, required=True) parser.add_argument('--url', type=str, required=True) parser.add_argument('--name', type=str) parser.add_argument('--output-secret-name-file', type=str) args ...
import weakref class BaseTypeByIdentity(object): is_array_type = False def get_c_name(self, replace_with='', context='a C file'): result = self.c_name_with_marker assert result.count('&') == 1 # some logic duplication with ffi.getctype()... :-( replace_with = replace_with.strip...
from django import db from django.db import transaction from django.conf import settings from django.core.management.base import NoArgsCommand from data.models import PopulationEst90Raw from datetime import datetime # National Priorities Project Data Repository # import_population_est_90.py # Imports yearly census po...
# coding=utf-8 """ Handles the "tourism" tag """ from PiMFD.Applications.Navigation.Tags.TagHandling import TagHandler __author__ = 'Matt Eland' class TourismTagHandler(TagHandler): """ Provides information on the 'tourism' tag """ def get_color(self, entity, value, cs): """ :type ...
"""GAEO model package """ import re from google.appengine.ext import db, search def pluralize(noun): if re.search('[sxz]$', noun): return re.sub('$', 'es', noun) elif re.search('[^aeioudgkprt]h$', noun): return re.sub('$', 'es', noun) elif re.search('[^aeiou]y$', noun): return re.su...
from oslo.config import cfg from sahara import conductor as c from sahara import context from sahara import exceptions as ex from sahara.i18n import _LE from sahara.openstack.common import log as logging from sahara.service.edp.binary_retrievers import dispatch from sahara.service.edp import job_manager as manager fro...
#!/usr/bin/python import os, sys if __name__ == "__main__": p = os.path.abspath(os.path.dirname(__file__)) if(os.path.abspath(p+"/..") not in sys.path): sys.path.append(os.path.abspath(p+"/..")) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "server.settings") from django.db import connection from algorithm.uti...
from __future__ import (absolute_import, print_function) import unittest from mantid.simpleapi import * from mantid.api import * class MeanTest(unittest.TestCase): def test_throws_if_non_existing_names(self): a = CreateWorkspace(DataX=[1,2,3],DataY=[1,2,3],DataE=[1,1,1],UnitX='TOF') try: ...
import functools import glob import gzip import os import warnings import zipfile from itertools import product from django.apps import apps from django.conf import settings from django.core import serializers from django.core.exceptions import ImproperlyConfigured from django.core.management.base import BaseCommand, ...
"""Package containing the default bundle configuration.""" from bundle.configuration.metadatas import MetadatasConfiguration from bundle.configuration.routing import RoutingConfiguration
"""Module for generating CTS test descriptions and test plans.""" import glob import os import re import subprocess import sys import xml.dom.minidom as dom from cts import tools from multiprocessing import Pool def GetSubDirectories(root): """Return all directories under the given root directory.""" return [x fo...
import Metashape import sys """ Metashape Sparse Point Cloud Filter Script (v 1.5) Matjaz Mori, CPA, June 2019 Usage: Workflow -> Batch Process -> Add -> Run script In the row "Argumets" we enter exactly 4 values ​​without spaces for: ReprojectionError, ReconstructionUncertainty, ImageCount, ProjectionAccuracy in this...
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import threading class TestHandler(BaseHTTPRequestHandler): def do_GET(self): status, headers, body = self.handler() self.send_response(status) for header in headers: self.send_header(header[0], header[1]) se...
'''Neural style transfer with Keras. Run the script with: ``` python neural_style_transfer.py path_to_your_base_image.jpg path_to_your_reference.jpg prefix_for_results ``` e.g.: ``` python neural_style_transfer.py img/tuebingen.jpg img/starry_night.jpg results/my_result ``` Optional parameters: ``` --iter, To specify ...
"""Treadmill container initialization. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import logging import os import pprint import click from treadmill import subproc from treadmill.fs import linux as fs_linux...
""" Created on Wed May 17 14:40:12 2017 @author: Mihaela Filters the traffic from specific weekdays, between specific hours Input: Structure of lists: dataframe = df weekdays =[day_of_week, ...] =[0-6, ...] Monday = 0, Tuesday = 1, ..., Sunday = 6 ...
"""Use Bayesian Inference to trigger a binary sensor.""" from collections import OrderedDict import logging import voluptuous as vol from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity from homeassistant.const import ( CONF_ABOVE, CONF_BELOW, CONF_DEVICE_CLASS, CONF_...
from __future__ import absolute_import import datetime import logging import time import calendar import json import os import weewx import weecfg import weeutil.logger from weewx.cheetahgenerator import SearchList from weewx.tags import TimespanBinder from weeutil.weeutil import TimeSpan log = logging.getLogger(__...
import logging from collections import namedtuple from see.interfaces import Hook from see.helpers import lookup_class HookParameters = namedtuple('HookParameters', ('identifier', 'configuration', 'context')) def hooks_f...
from exectiming.exectiming import Timer from exectiming.data_structures import Run import unittest from math import e, log class TestConsistentFeatures(unittest.TestCase): def test_with_no_args(self): timer = Timer(split=True, start=True) timer.log() self.assertRaisesRegex(RuntimeWarning,...
# -*- coding: utf-8 -*- import requests from collections import Callable from . import __version__ from logging import getLogger from contextlib import contextmanager __url_cache__ = {} __logs__ = getLogger(__package__) def requires_2fa(response): if (response.status_code == 401 and 'X-GitHub-OTP' in response.h...
import numpy import collada from collada.util import unittest from collada.xmlutil import etree fromstring = etree.fromstring tostring = etree.tostring class TestSource(unittest.TestCase): def setUp(self): self.dummy = collada.Collada(validate_output=True) def test_float_source_saving(self): ...
from paging.helpers import paginate as paginate_func from django import template from django.utils.safestring import mark_safe from django.template import RequestContext try: from coffin import template from coffin.shortcuts import render_to_string from jinja2 import Markup is_coffin = True except Imp...
from django.db.models import Q from django.shortcuts import get_object_or_404 import django_filters from rest_framework import serializers from rest_framework.response import Response from mozillians.api.v2.viewsets import NoCacheReadOnlyModelViewSet from mozillians.common.templatetags.helpers import absolutify, mark...
from core.himesis import Himesis import uuid class HinitSysTemp(Himesis): def __init__(self): """ Creates the himesis graph representing the DSLTrans rule initSysTemp. """ # Flag this instance as compiled now self.is_compiled = True super(HinitSys...
"""Contains definitions for the original form of Residual Networks. The 'v1' residual networks (ResNets) implemented in this module were proposed by: [1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun Deep Residual Learning for Image Recognition. arXiv:1512.03385 Other variants were introduced in: [2] Kaiming ...
# -*- coding: utf-8 -*- from django.db import models, migrations import django.utils.timezone from django.conf import settings class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='User', fields=[ ('id', m...
""" Support for Ecobee sensors. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/binary_sensor.ecobee/ """ from homeassistant.components import ecobee from homeassistant.components.binary_sensor import BinarySensorDevice DEPENDENCIES = ['ecobee'] ECOBEE_...
import logging import os, os.path from config import CONFIG conf_dir = os.path.join(os.environ['HOME'], '.wikipediafs') file = os.path.join(conf_dir, 'wikipediafs.log') # Creates .wikipediafs. in HOME if needed if not os.path.exists(conf_dir): os.mkdir(conf_dir,0700) LOGGER = logging.getLogger('wikipediafs') hdl...
import mock from oslo_config import cfg from oslotest import mockpatch from rally.benchmark.scenarios.ec2 import utils from tests.unit import test EC2_UTILS = "rally.benchmark.scenarios.ec2.utils" CONF = cfg.CONF class EC2UtilsTestCase(test.TestCase): def test_ec2_resource_is(self): resource = mock.Mag...
import rmgpy.molecule """ This module provides functionality for estimating the symmetry number of a molecule from its chemical graph representation. """ def calculateAtomSymmetryNumber(molecule, atom): """ Return the symmetry number centered at `atom` in the structure. The `atom` of interest must not be i...
""" Solve numerically the diffusion equation using the fipy package Author: Panagiotis Tsilifis Date: 6/16/2014 """ import numpy as np import fipy as fp import matplotlib.pyplot as plt def make_source(xs, mesh, time): """ Makes the source term of the diffusion equation """ #assert xs.sh...
import os import socket class TestHelper(object): CurrentDir = None ZK_PORT=2199 # def __init__(self, helixBinDir=None): # if helixBinDir: # self.HELIX_BIN_DIR = helixBinDir @staticmethod def setupCluster(clusterName, zkAddr, startPort, ...
#!/usr/bin/env python ''' fit best estimate of magnetometer offsets using the algorithm from Bill Premerlani ''' import sys, time, os, math # allow import from the parent directory, where mavlink.py is sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')) # command line opt...
# -*- coding: utf-8 -*- from __future__ import (unicode_literals, division, absolute_import, print_function) import six __license__ = 'GPL v3' __copyright__ = '2020, Jim Miller, 2011, Grant Drake <<EMAIL>>' __docformat__ = 'restructuredtext en' import logging logger = logging.getLogger(__na...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """messages.py: Messages de l'application RecoVoc.""" from textblob import TextBlob mess_fr = { "start": TextBlob("Dites quelque chose !"), "google_understand": TextBlob("Google Speech Recognition n'a pas pu comprendre l'audio."), "google_request": TextBlob(...
import sys import elasticapm.context from elasticapm.context.threadlocal import ThreadLocalContext def test_execution_context_backing(): execution_context = elasticapm.context.init_execution_context() if sys.version_info[0] == 3 and sys.version_info[1] >= 7: from elasticapm.context.contextvars impor...
import sys try: try: import dl _flags = dl.RTLD_NOW | dl.RTLD_GLOBAL except: # Some systems do no have module dl ... _flags = 0x2 | 0x100 sys.setdlopenflags(_flags) except: pass # First register first-stage warning hook to record warnings during avango import import war...
import sys import xml import xml.dom import xml.dom.minidom import math masterpartfile=file("master_part_list.csv","w") def printncommas(n): retstring="" for k in range(n): retstring+=',' return retstring def printn1(n,delim=","): retstring="" for k in range(n): retstring+='1' ...
#!/usr/bin/env python import re instructions = [] def doOperation(operator, operands): if operator == '': return operands[0] elif operator == 'NOT': return ~operands[0] elif operator == 'AND': return operands[0] & operands[1] elif operator == 'OR': return operands[0] | operands[1]...
__author__ = 'gabriel' from obd import utils class ObdParameters(object): _instance = None def __new__(cls, *args, **kwargs): if not cls._instance: cls._instance = super(ObdParameters, cls).__new__(cls, *args) return cls._instance def __init__(self): self.rpm = utils...
""" WSGI config for easy_captcha project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATI...
from coalib.misc.StringConverter import StringConverter from coalib.parsing.StringProcessing import unescape class LineParser: def __init__(self, key_value_delimiters=('=',), comment_seperators=('#',), key_delimiters=(',',), section_name_surround...
from __future__ import absolute_import, unicode_literals import logging from mopidy import models from mopidy.audio import PlaybackState from mopidy.compat import urllib from mopidy.internal import deprecation, validation from mopidy.core import triggers as triggers from mopidy.core import listener logger = logging...
import fnmatch import optparse import os import sys from util import build_utils from util import md5_check def Jar(class_files, classes_dir, jar_path): jar_path = os.path.abspath(jar_path) # The paths of the files in the jar will be the same as they are passed in to # the command. Because of this, the command...
from business.effect import Effect class UnpreventableDamageEffect(Effect): @property def name(self): return 'Smite' @property def description(self): return 'Inflict %s damages unpreventable by any mean' % self.amount @property def key(self): return 'unpreventable_dam...
from .core import (SERVICES, LANGUAGE_INDEX, SERVICE_INDEX, SERVICE_CONFIDENCE, MATCHING_CONFIDENCE, create_list_tasks, consume_task, create_download_tasks, group_by_video, key_subtitles) from .languages import list_languages import logging __all__ = ['list_subtitles', 'download_subtitles'] logger = logging.g...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import biplist import os.path # # Example settings file for dmgbuild # # Use like this: dmgbuild -s settings.py "Test Volume" test.dmg # You can actually use this file for your own application (not just TextEdit) # by doing e.g. # # dmgbuild -s setti...
from robot import model from robot.utils import is_string, secs_to_timestamp, timestamp_to_secs class SuiteConfigurer(model.SuiteConfigurer): """Result suite configured. Calls suite's :meth:`~robot.result.testsuite.TestSuite.remove_keywords`, :meth:`~robot.result.testsuite.TestSuite.filter_messages` ...
""" Generating node upgrade script """ import subprocess import uuid import gen.build_deploy.util as util import gen.calc import gen.template from dcos_installer.constants import SERVE_DIR from pkgpanda.util import write_string node_upgrade_template = """#!/bin/bash # # BASH script to upgrade DC/OS on a node # # Me...
_is_init = 0 def init(): global list_cameras, Camera, colorspace, _is_init import os,sys use_opencv = False use_vidcapture = False use__camera = True if sys.platform == 'win32': use_vidcapture = True use__camera = False elif "linux" in sys.platform: use__came...
import time class Profiler(object): def __init__(self, enabled=False): self.enabled = enabled self.cp = {} self.cp_ignored = [] self.iter = 0 self.start_time = time.time() self.last_time = self.start_time self.tot = 0. def reset(self, enabled=False): self.enabled = enabled self...
""" DESCRIPTION """ #__author__ = "Victoria Cepeda #configfile: "config.json" ruleorder: merge_reads > bowtie2_map > build_contigs rule all: input:expand('{prefix}/{sample}.{iter}.assembly.out/contigs.fasta',prefix=config['prefix'],sample=config['sample'],iter=config['iter']) rule merge_reads: input: ...
import random,os,sys,unittest,run_app,codecs,shutil,comm reload(sys) sys.setdefaultencoding("utf-8") if os.path.exists(comm.ConstPath + "/apks"): shutil.rmtree(comm.ConstPath + "/apks") os.mkdir(comm.ConstPath + "/apks") if os.path.exists(comm.ConstPath + "/testapp"): shutil.rmtree(comm.ConstPath + "/testapp")...
#!/usr/bin/env python # This program can be distributed under the terms of the GNU GPL. # See the file COPYING. try: import usb except ImportError: pass try: import hid except ImportError: pass import sys class USBScaleBase(object): VENDOR_ID = 0x0922 PRODUCT_ID = 0x8004 DATA_MODE_GRAMS ...
# -*- coding: utf-8 -*- from __future__ import absolute_import from django.contrib.auth.models import Group from django.contrib.auth import get_user_model from django.shortcuts import get_object_or_404 from rest_framework import viewsets, permissions, status from rest_framework.decorators import api_view from rest_fr...
""" Django settings for localsecrets project. Generated by 'django-admin startproject' using Django 1.9.6. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import ...
from pixie.vm.compiler import with_ns, NS_VAR from pixie.vm.reader import StringReader from rpython.jit.codewriter.policy import JitPolicy from rpython.rlib.jit import JitHookInterface, Counters from rpython.rlib.rfile import create_stdio from rpython.annotator.policy import AnnotatorPolicy from pixie.vm.code import wr...
import unittest import json from app.domain_model.domain import Message, MessageSchema import sys class MessageTestCase(unittest.TestCase): def testMarshalJson(self): message = Message('richard', 'torrance', 'hello') schema = MessageSchema() json_result = schema.dumps(message) mess...
from larray.util.misc import unique_list class OrderedSet(set): def __init__(self, d=None): set.__init__(self) if d is not None: self._list = unique_list(d) set.update(self, self._list) else: self._list = [] def add(self, element): if elemen...
import os, errno import sys sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import random def create_documents_folder(): """Create a folder in the users documents folder that will hold the config file, scraped data and taskfile. Return: str: path to created folder...
from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo, TableInfo, ) from django.db.models import Index class DatabaseIntrospection(BaseDatabaseIntrospection): # Maps type codes to Django Field types. data_types_reverse = { 16: 'BooleanField', 17: 'BinaryF...
#!/usr/bin/env python """ camshift_node.py - Version 1.1 2013-12-20 Modification of the ROS OpenCV Camshift example using cv_bridge and publishing the ROI coordinates to the /roi topic. """ import rospy import cv2 from cv2 import cv as cv from frobo_vision.ros2opencv2 import ROS2OpenCV2 from std_msgs.msg ...
import warnings from ctypes import POINTER, c_double, c_int, c_int32, c_int64, cast from .constants import * from .data import NeighList class numpy_wrapper: """lammps API NumPy Wrapper This is a wrapper class that provides additional methods on top of an existing :py:class:`lammps` instance. The methods tra...
import setuptools def read_requirements(file_): lines = [] with open(file_) as f: for line in f.readlines(): line = line.strip() if line.startswith('-e ') or line.startswith('http://') or line.startswith('https://'): extras = '' if '[' in line: ...
from recipe_engine import recipe_test_api class CIPDTestApi(recipe_test_api.RecipeTestApi): def make_resolved_version(self, v): if not v: return '40-chars-fake-of-the-package-instance_id' if len(v) == 40: return v # Truncate or pad to 40 chars. prefix = 'resolved-instance_id-of-' if ...
from __future__ import with_statement # http://docs.python.org/distutils/ # http://packages.python.org/distribute/ try: from setuptools import setup except: from distutils.core import setup import os.path version_py = os.path.join(os.path.dirname(__file__), 'usbtmc', 'version.py') with open(version_py, 'r') ...
""" Directory of Pyro daemons """ # pylint: disable=too-few-public-methods import datetime import Pyro4 from .ip import IP class PyroDaemon(object): """Encodes a reference to a remote Pyro4 daemon""" def __init__(self, name, host, port, default_timeout): self.name = name self.host = host ...
import pox.core pox.core.initialize() from pox.datapaths.switch import SoftwareSwitch from pox.datapaths.switch import ofp_hello from pox.openflow.util import make_type_to_unpacker_table from pox.core import core import logging import socket import select from binascii import hexlify HOST = socket.gethostname() #HOS...
from ZenPacks.zenoss.Microsoft.Windows.tests.mock import Mock, patch from ZenPacks.zenoss.Microsoft.Windows.tests.utils import StringAttributeObject, load_pickle from Products.ZenTestCase.BaseTestCase import BaseTestCase from ZenPacks.zenoss.Microsoft.Windows.modeler.plugins.zenoss.winrm.OperatingSystem import Operat...
from __future__ import absolute_import try: from unittest.mock import MagicMock except: # noqa: E722 from mock import MagicMock import pytest from garcon import activity from garcon import runner from garcon import task EMPTY_CONTEXT = dict() def test_execute_default_task_runner(): """Should throw an...
#!/usr/bin/python3 ''' Created on 28.05.2013 @author: vlkv ''' import os import subprocess import reggata import shutil if __name__ == '__main__': cwd = os.getcwd() assert os.path.exists(os.path.join(cwd, "dist_debian")) assert os.path.exists(os.path.join(cwd, "setup.py")) assert os.path.exists(...
from api.container import Container from api.network import Network from api.volume import Volume from api.exception import NoImage def create_container_test(): net = Network(name='test', driver='bridge') container = Container.create_container(network=net, name='ttttt', url='114.212.87.52:2376', image='ubunt...
import tensorflow as tf # http://stackoverflow.com/a/43554072/1864688 def pad_amount(k): added = k - 1 # note: this imitates scipy, which puts more at the beginning end = added // 2 start = added - end return [start, end] def neighborhood(x, kh, kw): # input: N, H, W, C # output: N, H, W,...
from glob import glob import os from nose.tools import assert_equal, assert_raises, assert_true import numpy as np from numpy.testing import assert_array_almost_equal, assert_array_less import mne from mne.transforms import (Transform, apply_trans, rotation, translation, scaling) from mne....
from django.conf.urls import url, include #we need this to use djangos default views from django.views.generic import ListView, DetailView from node.views import * from node.models import * # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = [ ur...
#python3 import requests #import logging #import json from pprint import pprint import re from subprocess import Popen, PIPE from bs4 import BeautifulSoup import misc #misc.py - personal info #token = '*****' #domen ='https://api.telegram.org/bot' + token + '/' #login = '*****' #psw = '*******' #routerIp = 'http://192...
from textwrap import dedent import os import subprocess import numpy import pandas from wqio.tests import helpers from wqio.utils import numutils def _sig_figs(x): """ Wrapper around `utils.sigFig` (n=3, tex=True) requiring only argument for the purpose of easily "apply"-ing it to a pandas dataframe. ...
import bpy import nodeitems_utils from bpy.types import Header, Menu, Panel from bpy.app.translations import pgettext_iface as iface_ from bl_ui.properties_grease_pencil_common import ( GreasePencilDrawingToolsPanel, GreasePencilStrokeEditPanel, GreasePencilStrokeSculptPanel, GreasePenci...
import unittest from mantid.geometry import * from testhelpers import can_be_instantiated, WorkspaceCreationHelper class RectangularDetectorTest(unittest.TestCase): def test_RectangularDetector_cannot_be_instantiated(self): self.assertFalse(can_be_instantiated(RectangularDetector)) def test_Rectangu...
import webob from nova.api.openstack.compute.views import flavors as flavors_view from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova.compute import flavors from nova import exception from nova.i18n import _ from nova.openstack.common import strutils from nova import utils ALIAS = ...
import sys import crypt DICT_FILE = '/usr/share/dict/words.short' def main(arg): salt = '$6$Mqe5XrQt' hashed_pass = arg with open(DICT_FILE) as f: for line in reversed(f.readlines()): line = line.strip() print(line) print(salt) print(hashed_pass == ""...
from datetime import datetime from django.utils import simplejson import logging import sys import traceback from model.testfile import TestFile JSON_RESULTS_FILE = "results.json" JSON_RESULTS_FILE_SMALL = "results-small.json" JSON_RESULTS_PREFIX = "ADD_RESULTS(" JSON_RESULTS_SUFFIX = ");" JSON_RESULTS_VERSION_KEY = ...
import logging, sys from flask import flash from . import filters from ..base import BaseInterface from ..._compat import as_unicode from ...const import LOGMSG_ERR_DBI_ADD_GENERIC, LOGMSG_ERR_DBI_EDIT_GENERIC, LOGMSG_ERR_DBI_DEL_GENERIC, \ LOGMSG_WAR_DBI_ADD_INTEGRITY, LOGMSG_WAR_DBI_EDIT_INTEGRIT...
import iso8601 import json import re from wiotp.sdk import InvalidEventException, MissingMessageDecoderException # Compile regular expressions for topic parsing DEVICE_EVENT_RE = re.compile("iot-2/type/(.+)/id/(.+)/evt/(.+)/fmt/(.+)") DEVICE_COMMAND_RE = re.compile("iot-2/type/(.+)/id/(.+)/cmd/(.+)/fmt/(.+)") DEVICE_S...
from coalib.parsing.StringProcessing import escape from coalib.tests.parsing.StringProcessing.StringProcessingTestBase import ( StringProcessingTestBase) class EscapeTest(StringProcessingTestBase): # Test escape() using a single character to escape and default parameters. def test_normal_behaviour(self):...
"""Provides functionality to notify people.""" import asyncio from functools import partial import logging from typing import Any, Dict, Optional import voluptuous as vol import homeassistant.components.persistent_notification as pn from homeassistant.const import CONF_NAME, CONF_PLATFORM from homeassistant.core impo...
""" SALTS XBMC Addon Copyright (C) 2014 tknorris This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. T...
#!/usr/bin/python # -*- coding:utf-8 -*- import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import random def loadDataSet(): ''' 读取文件加载数据集 :return: ''' dataMat = [] # 数据矩阵 labelMat = [] # 类别标签向量 fr = open('testSet.txt') # 打开文件 for line in fr.readlines(): # 遍历所...
#! /usr/bin/env python """Download data from data.caf.fr """ import argparse import logging import os import sys import urllib import urllib from ipp_macro_series_parser.config import Config app_name = os.path.splitext(os.path.basename(__file__))[0] log = logging.getLogger(app_name) parser = Config() prestatio...
from keras.preprocessing import sequence from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.layers import Embedding, LSTM from keras.layers import Conv1D, Flatten from keras.datasets import imdb import wandb from wandb.keras import WandbCallback import imdb import numpy a...
from distutils.core import setup setup(name="Bicho", version="0.9", author="GSyC/LibreSoft, Universidad Rey Juan Carlos", author_email="<EMAIL>", description="Analysis tool for Issue/Bug Tracking Systems", url="http://metricsgrimoire.github.com/Bicho/", packages=['bicho', 'bicho.bac...
import fileinput import os import sys from shutil import copyfile from shutil import rmtree from distutils.dir_util import copy_tree from pathlib import Path class CorDeployTool: def __init__(self): self.version_str = self.get_app_version() self.output_dir = f"./output/{self.version_str}" ...
import unittest import json import os import sys import mipam import mipam.manager import mipam.dnsrr import mipam.dnszone import mipam.ipnetwork import mipam.organization import mipam.utils from mipam import constants as C TEST_DATA = { 'dnsrr': {'id': 'example.org.!@', 'name': '@', 'dnszone': 'example.or...
# -*- coding: utf-8 -*- import io import csv import logging from petl.util.base import Table, data logger = logging.getLogger(__name__) warning = logger.warning info = logger.info debug = logger.debug def fromcsv_impl(source, **kwargs): return CSVView(source, **kwargs) class CSVView(Table): def __init_...
NET_STATUS_ACTIVE = 'ACTIVE' NET_STATUS_BUILD = 'BUILD' NET_STATUS_DOWN = 'DOWN' NET_STATUS_ERROR = 'ERROR' PORT_STATUS_ACTIVE = 'ACTIVE' PORT_STATUS_BUILD = 'BUILD' PORT_STATUS_DOWN = 'DOWN' PORT_STATUS_ERROR = 'ERROR' DEVICE_OWNER_ROUTER_INTF = "network:router_interface" DEVICE_OWNER_ROUTER_GW = "network:router_gat...