src
stringlengths
721
1.04M
#!/usr/bin/env python # Based on previous work by # Charles Menguy (see: http://stackoverflow.com/questions/10217067/implementing-a-full-python-unix-style-daemon-process) # and Sander Marechal (see: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/) # Adapted by M.Hendrix [2015] (deprecated)...
# Copyright (c) 2015 Kurt Yoder # See the file LICENSE for copying permission. import logging import uuid import persistent import transaction module_logger = logging.getLogger(__name__) class FlavorNameException(Exception): pass class Name(persistent.Persistent): def __init__(self, name): self.name...
from identityprovider.const import LAUNCHPAD_TEAMS_NS from identityprovider.tests.helpers import OpenIDTestCase class OpenIDTeamsTestCase(OpenIDTestCase): def test(self): # = Launchpad OpenID Teams Extension = # The Launchpad OpenID server implements a custom team membership # extension....
# -*- coding: utf-8 -*- import pytest from pylyskom.protocol import MAX_TEXT_SIZE from pylyskom.datatypes import ( AuxItemInput, PrivBits, ConfType, ExtendedConfType, LocalTextNo, InfoOld, CookedMiscInfo, MIRecipient) from pylyskom import requests, komauxitems def test_all_requests_has_response_type(): f...
#encoding:utf-8 from utils import weighted_random_subreddit # Subreddit that will be a source of content subreddit = weighted_random_subreddit({ 'battlestations': 1.0, # If we want get content from several subreddits # please provide here 'subreddit': probability # 'any_other_subreddit': 0.02 }) # Te...
import logging from helpers.logging_helper import log_entrance from interfaces.LTS import LTS from interfaces.solver_interface import SolverInterface from synthesis.coreach_encoder import CoreachEncoder from synthesis.smt_format import make_check_sat @log_entrance() def search(min_size:int, max_size:int, ...
import argparse import json import os from github import Github def _get_value(body, tag): pos = body.lower().find(tag.lower()) if pos != -1: cl = body[pos + len(tag):].splitlines()[0] return cl.strip() return None def get_tag_from_pr(pr_number, tag): """Given a PR number and a tag...
from api import * from datetime import datetime # OAuth2 resource mapping def current_user(): try: if 'id' in session: uid = int(session['id']) return User.get(User.id == uid) except ValueError: pass return None @oauth.usergetter def user_get(username, password, c...
import copy import math import re import subprocess import sys import time ret = subprocess.check_output(["resize"]) m = re.match("COLUMNS=(\d+);\nLINES=(\d+);", ret) WIDTH = int(m.group(1)) HEIGHT = int(m.group(2)) SCALE = 7 X = 0 Y = 1 Z = 2 POINTS = [ [-1, -1, 1], [-1, 1, 1], [1, 1, 1], [1, -1, 1...
#!/usr/bin/python """ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Rigol Lattice: postprocessing of Petsc Matrix data * Copyright (c) 2013 Analabha Roy (daneel@utexas.edu) * * This is free software: you can redistribute it and/or modify it under the * terms of version 3 of th...
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe import frappe.defaults from frappe.utils import cstr, cint, flt, comma_or, nowdate from frappe import _ from erpnext.stock.utils impo...
# -*- coding: utf-8 -*- """ /*************************************************************************** PostTelemac A QGIS plugin Post Traitment or Telemac ------------------- begin : 2015-07-07 git sha : $Form...
from django.contrib import messages from django.core.urlresolvers import reverse from django.db import transaction from django.db.models import Count from django.shortcuts import redirect from django.utils.translation import ugettext_lazy as _ from misago.admin.views import generic from ...forms import SearchAttachme...
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- from tornado import ioloop, httpclient, gen from tornado.gen import Task import pdb, time, logging import tornado.ioloop import tornado.iostream import socket #Init logging def init_logging(): logger = logging.getLogger() logger.setLevel(logging.DEBUG) sh = loggi...
import _setup import inspect import pprint from httpmessage._multidict import MultiDict def header_case(header_key): return "-".join([part.capitalize() for part in header_key.split("-")]) def _key_wrap(func): """creates a function where the value of the 'key' argument, if there is one, has the function ...
from collections import namedtuple from functools import wraps import os import shutil import threading # Python 2/3 compatibility. from six.moves.queue import Queue from plover import log, system from plover.dictionary.loading_manager import DictionaryLoadingManager from plover.exception import InvalidConfiguration...
""" integration pattern classes for message processing (c) integrationLabs 1996- 2004 coded by: thanos and friends integrationLabs opensource $RCSfile: __init__.py,v $ $Date: 2004/07/16 17:31:19 $ $Revision: 1.3 $ """ from types import ListType, TupleType from ilabs.core import Node, RoutingStrategy, RouteTable,...
#!/usr/bin/python3 ########################################################################## ## ## ## dkb: Simple Python Keybinder for Linux ## ## Copyright (C) 2014 chevalierdenis@gmx.com ## #...
#!/usr/bin/env python # Copyright (c) 2011-2018, wradlib developers. # Distributed under the MIT License. See LICENSE.txt for more info. """ Data Quality ^^^^^^^^^^^^ This module will serve two purposes: #. provide routines to create simple radar data quality related fields. #. provide routines to decide ...
#!/usr/bin/env python """Universal feed parser Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds Visit http://feedparser.org/ for the latest version Visit http://feedparser.org/docs/ for the latest documentation Required: Python 2.1 or later Recommended: Python 2.3 or later Recommended: CJKCodecs...
import os import tempfile import unittest import axelrod as axl import axelrod_dojo as axl_dojo class TestCyclerParams(unittest.TestCase): def setUp(self): pass def test_default_single_opponent_e2e(self): temp_file = tempfile.NamedTemporaryFile() # we will set the objective to be ...
import os import yaml from PyQt4.QtCore import * import stellarya class Preferences(QObject): changed = pyqtSignal(str) def __init__(self): QObject.__init__(self) self._data = {} @property def _cfgpath(self): return os.path.join(stellarya._.confdir, "stellarya.cfg") d...
# coding:utf-8 """ tcc3portal.tcc_frontend ~~~~~~~~~~~~~~~~~~~ tcc3portal tcc_frontend ui templates package. :copyright: (c) 2015 by Vito. :license: GNU, see LICENSE for more details. """ from flask import Blueprint, Flask, url_for, current_app def tcc_frontend_find_resource(filename, cdn, local...
from rest_framework.viewsets import ViewSet from rest_framework.response import Response from rest_framework import status from rest_extensions.utils import get_model_object class ReadOnlyModelViewSet(ViewSet): """ The viewset for a read-only model. Must specify model_class and serializer_class, and can suppl...
#!/usr/bin/env python # vim: set filetype=python ts=4 sw=4 et si # -*- coding: utf-8 -*- # Author: Vladimir Blokhin ########################### import sys,os,re,tempfile,subprocess def run_command(command): p = subprocess.Popen(command,stdout=subprocess.PIPE, shell=True) return p.communicate()[0] def...
import datetime from django.conf import settings from django.contrib import admin from django.contrib.admin.options import FORMFIELD_FOR_DBFIELD_DEFAULTS from django.core import urlresolvers from django.db import models from django.utils.importlib import import_module from django.utils.translation import ugettext_lazy...
# -*- coding: utf-8 -*- ''' Specto Add-on Copyright (C) 2015 lambda 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 l...
""" Project: Parallel.Stacker Date: 6/12/18 10:28 AM Author: Demian D. Gomez """ import dbConnection import pyOptions import argparse import pyETM import pyJobServer import numpy import pyDate from pyDate import Date from tqdm import tqdm import traceback from pprint import pprint import os import numpy as np from sci...
#------------------------------------------------------------------------------- # Imports #------------------------------------------------------------------------------- import re import copy from functools import lru_cache import pyramid.request import pyramid.response import pyramid.events import pyramid.decorato...
""" A module of contractive autoencoder modified from the Deep Learning Tutorials (www.deeplearning.net/tutorial/). Copyright (c) 2008-2013, Theano Development Team All rights reserved. Modified by Yifeng Li CMMT, UBC, Vancouver Sep 23, 2014 Contact: yifeng.li.cn@gmail.com """ from __future__ import division import ...
# -*- coding: utf-8 -*- """ Assessment - Model @author: Fran Boon @author: Dominic König @author: Michael Howden This module currently contains 2 types of Assessments * Flexible Impact Assessments * Rapid Assessment Tool (from ECB: http://www.ecbproject.org/page/48) @ToDo Validati...
#!/usr/bin/env python """GenericService encapsulates any methods which are common across all service modules. @author: Steve Coward (steve<at>sugarstack.io) @version 1.0 """ import os import re class GenericService(object): static_path = '%s/../static' % os.path.dirname(os.path.realpath(__file__)) compiled_...
""" mbed SDK Copyright (c) 2011-2013 ARM Limited Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wr...
# #!/usr/bin python3 import urllib.request as Request import sqlite3 import os.path as Path class ProxyHandlerStatus(): """ Check IP Proxy status and check if a string is in the HTML output """ def run(self, url, proxy_ip_port, word): """ Main function """ error = "ERROR" try: print("[+] Setup proxy...
import os import plugin import config from item import Item import config, menu, rc, plugin, skin, osd, util class PluginInterface(plugin.MainMenuPlugin): """ Home Automation Plugin Activate: | plugin.activate('home_automation') This plugin is for controlling home automation items, such as X10 d...
# testparser.py # Test the moose_parse parser. # This code is released to the public domain. # "Share and enjoy..." :) from moose_parse2 import * grammar = Literal("Just") + Literal("a") + Literal("test") grammar2 = Literal("foo") | Literal("bar") | Literal("baz") procname = (Literal("print") |...
#!/usr/bin/python3 import unittest from DataGenerator import \ InMemoryDataSource, \ Person, \ Household import locale # View all available locales # locale -a # # View current locale settings # locale # # Add locale to system # sudo locale-gen de_DE.utf8 # class TestDataSource(unittest.TestCase): ...
# -*- Mode: Python; py-indent-offset: 4 -*- # ltihooks.py: python import hooks that understand libtool libraries. # Copyright (C) 2000 James Henstridge. # # 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 Fou...
import datetime import hashlib import random import re from django.conf import settings from django.contrib.auth.models import User from django.db import models from django.db import transaction from django.template.loader import render_to_string from django.utils.translation import ugettext_lazy as _ try: from d...
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org # from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest): """...
def handleTurn(heading, turn): if heading == 'N': if turn == 'L': return 'W' else: return 'E' elif heading == 'S': if turn == 'L': return 'E' else: return 'W' elif heading == 'E': if turn == 'L': return 'N' ...
from __future__ import unicode_literals import datetime import json import pytz from temba_client.types import Contact as TembaContact, Run from django.core.urlresolvers import reverse from django.utils import timezone from tracpro.polls.models import Response from tracpro.test import factories from tracpro.test.ca...
""" Handles task generation from templates. """ from random import uniform, shuffle, choice import json from sympy import sympify from sympy.parsing.sympy_parser import (parse_expr, standard_transformations, implicit_multiplication_application, convert_xor) from oppgavegen....
from openerp.osv import osv, fields import logging _logger = logging.getLogger(__name__) import openerp.addons.decimal_precision as dp class pos_order(osv.osv): _inherit = 'pos.order' def _amount_all(self, cr, uid, ids, name, args, context=None): cur_obj = self.pool.get('res.currency') res =...
## # Copyright (c) 2005-2015 Apple 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 l...
#-*- coding:utf-8 -*- from __future__ import unicode_literals import logging from functools import update_wrapper from django import forms, template from django.contrib import admin from django.contrib.admin.util import unquote from django.db import models from django.shortcuts import get_object_or_404, render_to_resp...
import logging from pyvisdk.exceptions import InvalidArgumentError ######################################## # Automatically generated, do not edit. ######################################## log = logging.getLogger(__name__) def AndAlarmExpression(vim, *args, **kwargs): '''A data object type that links multiple 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. # pylint: disable=too-many-lines from __future__ import print_function from __future__ import division from __future__ import absolute_import import datetim...
# Copyright 2021, The TensorFlow Federated Authors. # # 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 o...
#!/usr/bin/env python """ @package mi.dataset.parser.wfp_c_file_common @file marine-integrations/mi/dataset/parser/wfp_c_file_common.py @author Emily Hahn @brief Parser for the c file type for the wfp Release notes: initial release """ __author__ = 'Emily Hahn' __license__ = 'Apache 2.0' import copy import re impor...
# -*- coding: utf-8 -*- import datetime import fauxfactory import pytest from cfme.rest.gen_data import dialog as _dialog from cfme.rest.gen_data import services as _services from cfme.rest.gen_data import service_data as _service_data from cfme.rest.gen_data import service_catalogs as _service_catalogs from cfme.rest...
import requests, json, functools import base64 import os path = 'http://127.0.0.1:8500' from va_master.handlers.datastore_handler import DatastoreHandler from va_master.consul_kv.datastore import ConsulStore import tornado.ioloop folder_pwd = os.path.join(os.path.dirname(os.path.realpath(__file__)), '') datastore = ...
#!/usr/bin/env python """ -------------------------------------------------------------------------- Routine to perform aperture photometry on CHIMERA science frames. Usage: python fastphot.py [options] image coords Authors: Navtej Saini, Lee Rosenthal Organization: Caltech, Pas...
from typing import List def longest_increasing_subsequence(numbers: List[int]) -> int: """ >>> longest_increasing_subsequence([]) 0 >>> longest_increasing_subsequence([4321]) 1 >>> longest_increasing_subsequence([1,2,3,4,5]) 5 >>> longest_increasing_subsequence([1,2,3,4,5,5]) 5 ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2011 Geisha Tokyo Entertainment, Inc. # # 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 withou...
# -*- 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_FO...
#!/usr/bin/python # -*- coding: utf-8 -*- #KhtSimpleText Setup File import khtsimpletext import sys reload(sys).setdefaultencoding("UTF-8") changelog = '* Implement rename and delete feature in contextual menu * fix package display name' buildversion = '1' try: from sdist_maemo import sdist_maemo as _sdist_maemo...
from Interactors.Interactor import Interactor from Interactors.Search.Params.SearchInteractorParams import SearchInteractorParams from Interactors.Search.SearchInteractor import SearchInteractor from Tests.Interactors.InteractorTestBase import InteractorTestBase class TestSearchInteractor(InteractorTestBase): de...
# Sebastian Raschka 08/13/2014 # mlxtend Machine Learning Library Extensions # matplotlib utilities for removing chartchunk def remove_borders(axes, left=False, bottom=False, right=True, top=True): """ A function to remove chartchunk from matplotlib plots, such as axes spines, ticks, and labels. ...
# Copyright (C) Linaro Limited 2015 # Author: Milo Casagrande <milo.casagrande@linaro.org> # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 2.1 of the License, or (at your...
from math import fabs, sqrt __author__ = 'keyvan' def unpack(relation, start_reference=0, length_reference=1): before, same, after = relation similarity = same / (1 - fabs(before - after)) solutions = [] lengths = length_reference / similarity**2, length_reference * similarity**2 for i in xrang...
# ============================================================================= # # Copyright (C) 2011 Asymworks, LLC. All Rights Reserved. # www.pydivelog.com / info@pydivelog.com # # This file is part of the Python Dive Logbook (pyDiveLog) # # This file may be used under the terms of the GNU General Public # Lice...
# -*- coding: utf-8 -*- """ Flixnet Add-on Copyright (C) 2016 Viper2k4 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) an...
#!/usr/bin/python3 import os import sys if sys.version_info[0] < 3: raise Exception("Python 3 or a more recent version is required.") import json import subprocess average_num_times = 3 max_accum_time = 60 # don't take too long on a test - stop averaging if time exceeds some amount of seconds with open('tests.js...
import unittest from prestans import exception from prestans.http import STATUS from prestans.rest import ErrorResponse from prestans.serializer import JSON class ErrorResponseTest(unittest.TestCase): def test_init(self): raised_exception = exception.NoEndpointError() json_serializer = JSON() ...
import datetime import pickle from pathlib import Path from bottle import Bottle, run, get, post, redirect, request, response, jinja2_template class Message(object): def __init__(self, title, handle, message): self.title = title self.handle = handle self.message = message self.crea...
""" Provides functionality to interact with fans. For more details about this component, please refer to the documentation at https://home-assistant.io/components/fan/ """ from datetime import timedelta import logging import os import voluptuous as vol from homeassistant.components import group from homeassistant.co...
from django.conf import settings from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.http import HttpResponse from tardis.tardis_portal.auth import decorators as authz from tardis.tardis_portal.models import Dataset from tardis.tardis_portal.shortcuts import get_experiment_referer from tard...
from templeplus.pymod import PythonModifier from toee import * import tpdp # Sudden Maximize: Complete Arcane, p. 83 print "Registering Sudden Maximize" def SuddenMaximizeRadial(attachee, args, evt_obj): #Add a checkbox to turn on and off sudden Maximize if there is a carge available, otherwise just don't show it ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('deals', '0005_auto_20150709_1442'), ] operations = [ migrations.AddField( model_name='deal', name='c...
__author__ = "chawood@pdx.edu" import requests import ping import socket import time import re # Code originally pulled from here # http://web.cecs.pdx.edu/~mperkows/CLASS_479/Projects-2012/Mathias_Sunardi-iSobot_controller_report.pdf # And subsequently changed entirely for use with ESP8266s over wifi commands = { '...
# # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2010 Michiel D. Nauta # Copyright (C) 2011 Tim G L Lyons # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as publi...
# Foris - web administration interface for OpenWrt based on NETCONF # Copyright (C) 2017, 2020 CZ.NIC, z.s.p.o. <http://www.nic.cz> # # 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 versi...
# -*- coding: utf-8 -*- # # This file is part of the Christine project # # Copyright (c) 2006-2008 Marco Antonio Islas Cruz # # Christine 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...
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def lowestCommonAncestor(self, root, p, q): """ :type root: TreeNode :type p: TreeNode :...
from unittest import TestCase from missandei.translator import translator, get_value_at_path, set_value_at_path class TranslatorValidationTest(TestCase): def test_valid_spec(self): translator({ "some_field": "some_other_field", "dynamic_field": lambda d: d['stuff'].lower() ...
#!env/bin/python import csv, os, urllib2 import xml.etree.ElementTree as ET from app import db from app.models import Route, Stop from bs4 import BeautifulSoup from config_local import STOPS_FILE from zipfile import ZipFile # Define URLs and file name url = 'https://data.cityofchicago.org/download/84eu-buny/applicatio...
from setuptools import setup, find_packages import os version = '1.0.0.dev0' tests_require = [ 'ftw.builder', 'ftw.testbrowser', 'plone.app.testing', ] setup(name='ftw.pdfify', version=version, description='Create PDF from documents.', long_description=open('README.md').read() + '\n...
############################################################################ ## ## Copyright (c) 2000-2015 BalaBit IT Ltd, Budapest, Hungary ## Copyright (c) 2015-2018 BalaSys IT Ltd, Budapest, Hungary ## ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General...
""" Self-Driving Car: Following Distance Name: Date: """ # global constants VEHICLE_LENGTH = 4 # meters MIN_DISTANCE = VEHICLE_LENGTH / 2 # functions def get_equal_distance(dist_front, dist_rear): """ Function to return target following distance, ensuring that the vehicle in front an...
#!/usr/bin/env python # Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra # # This file is part of Essentia # # Essentia is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation (FSF), e...
import io import json import warnings from .agent import request, urlencode, urlopen from pycoin.serialize import b2h, h2b from pycoin.tx import Spendable class BlockchainInfoProvider(object): def __init__(self, netcode): if netcode != 'BTC': raise ValueError("BlockchainInfo only supports ma...
#!/usr/bin/python # -*- coding: utf-8 -*- # # The MIT License (MIT) # # Copyright (c) 2016 Tintri, Inc. # # 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 withou...
from MrBam.main import init from helper import make_bam from argparse import Namespace from pysam import AlignmentFile from pytest import raises def test_init_1(): "it should raise exception if neither of cfdna and gdna are not provided" o = Namespace(query="test.vcf", cfdna=None, gdna=None, output=None) w...
# Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.9/howto/static-files/ import os from .base import BASE_DIR from .base import PROJECT_ROOT_DIR STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, "english_diary", "static"), ] STATIC_ROOT = os.path.join(PROJECT_ROOT_DI...
import numpy as np import urllib import matplotlib.pyplot as plt import sys import pylab as pl from sklearn import svm from sklearn import svm, cross_validation from sklearn.grid_search import GridSearchCV # Load our matched data from the catalog cat_data = 'catalog_data_final/matched_data.csv' catalog = np.genfromtxt...
# -*- coding: utf-8 -*- # # Copyright 2019-2021 Ramil Nugmanov <nougmanoff@protonmail.com> # Copyright 2019 Alexander Nikanshin <17071996sasha@gmail.com> # Copyright 2019 Tagir Akhmetshin <tagirshin@gmail.com> # This file is part of CGRtools. # # CGRtools is free software; you can redistribute it and/or modify # ...
import pymel.core as pmc def get_attribute_tree(node): """ traverses attributes on given node and gets dict in form the attribute tree widget expects Args: node: PyNode Returns: dict """ parents = {} for attr in node.listAttr(): if not attr.isChild() and not attr.isMulti():...
# 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...
""" exceptionStreamHook.py A custom stderr hook by Denis Dube, http://msdl.cs.mcgill.ca/people/denis/ """ import tkMessageBox, sys class exceptionStreamHook: """ This class pretends to be an open stderr file stream Perhaps it should subclass File to be safer... but what would be the default ...
# Copyright 2014 Google Inc. # 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...
# Copyright 2021 Google LLC. 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 o...
#!/usr/bin/python # encoding: utf-8 import os import sys from testlib import repo_path import testlib.pylint_cmk as pylint_cmk def test_pylint_inventory_plugins(pylint_test_dir): f = file(pylint_test_dir + "/cmk-inventory-plugins.py", "w") # Fake data structures where checks register (See cmk_base/checks.py)...
#!/usr/bin/env python import memcache as mc import redis import time import unittest2 as unittest import yaml import string import random def id_generator(size=8, chars=string.ascii_letters + string.digits): return ''.join(random.choice(chars) for x in range(size)) def load_conf(filename): return yaml.load(o...
# Python test set -- part 1, grammar. # This just tests whether the parser accepts them all. # NOTE: When you run this test as a script from the command line, you # get warnings about certain hex/oct constants. Since those are # issued by the parser, you can't suppress them by adding a # filterwarnings() call t...
import random import string import logging import contextlib import idaapi from netnode import netnode # get the IDA version number ida_major, ida_minor = list(map(int, idaapi.get_kernel_version().split("."))) using_ida7api = (ida_major > 6) TEST_NAMESPACE = '$ some.namespace' def get_random_data(N): ''' ...
# encoding: utf-8 # # # 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/. # # Contact: Kyle Lahnakoski (kyle@lahnakoski.com) # from __future__ import absolute_import, divis...
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------- # Name: sfp_whois # Purpose: SpiderFoot plug-in for searching Whois servers for domain names # and netblocks identified. # # Author: Steve Micallef <steve@binarypool.com> # #...
# -*- encoding: utf-8 -*- import traceback import pprint import uuid import time import sys from django.db.models.fields.related import ManyToManyField, ForeignKey from django.core.mail import EmailMessage, EmailMultiAlternatives try: from django.core.urlresolvers import reverse, NoReverseMatch except ImportErro...
# -*- coding: utf-8 -*- # # Dropwizard documentation build configuration file, created by # sphinx-quickstart on Mon Feb 13 11:29:49 2012. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # ...