content
stringlengths
4
20k
import sys import time from django.conf import settings from django.db.backends.creation import BaseDatabaseCreation from django.db.utils import DatabaseError from django.utils.six.moves import input TEST_DATABASE_PREFIX = 'test_' PASSWORD = 'Im_a_lumberjack' class DatabaseCreation(BaseDatabaseCreation): # Thi...
from enum import Enum from blivet.size import Size from pykickstart.constants import AUTOPART_TYPE_PLAIN, AUTOPART_TYPE_BTRFS, AUTOPART_TYPE_LVM, \ AUTOPART_TYPE_LVM_THINP from pyanaconda.core.configuration.base import Section from pyanaconda.core.configuration.utils import split_name_and_attributes class Part...
from make_apex_cubes import all_lines from spectral_cube import SpectralCube,BooleanArrayMask import pyspeckit from astropy.io import fits from numpy.lib.stride_tricks import as_strided from paths import mpath import numpy as np import time from astropy import log from astropy import constants from astropy import units...
""" "Takes some of the rocket science out of socket science." Normally, calling the recv method on a socket object doesn't guarantee that you'll get as many bytes as you ask for. Because of this fact (which is because UNIX works this way), this module makes it easy to say, "I want X number of bytes in N seconds or...
import re import ibis.common.exceptions as com import ibis.expr.datatypes as dt import ibis.expr.operations as ops import ibis.expr.rules as rlz import ibis.expr.signature as sig import ibis.udf.validate as v import ibis.util as util from ibis.backends.base.sql.registry import fixed_arity, sql_type_names from .compil...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Additional string handling functions for omorfi processing. Includes some neat error logging for debugs and stuff.""" # 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 # ...
from java.util import Date from java.util import Calendar from java.lang import String from com.googlecode.fascinator.common import JsonObject from java.util import HashMap from java.util import ArrayList from java.util import Collections from com.googlecode.fascinator.portal.report import RedboxReport from org.apache....
""" Sets up Zimmermann's problem. This is problem 8 of testbed 1 in [1] and [2]. Solution: Min of 0 @ Vector[0] Reference: [1] Storn, R. and Price, K. Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces. Journal of Global Optimization 11: 341-359, 1997. [2] Storn...
import json import logging import re import sys from django.urls import reverse from django.utils.html import escape from desktop.conf import USE_NEW_EDITOR from desktop.lib.django_util import JsonResponse, render from desktop.lib.exceptions_renderable import PopupException from desktop.models import Document2, Docum...
#SpnPatchParser.py """ This is a patch file parser for spoon fight. A patch really is just a collection of audio files and slices if specified [loop_name] filepath:pathtofile slicepoints: 0 , 123, 231, 300, #if slicepoints are listed, then this has priority as long as it's real. #or slicestyle: even #or peak """ f...
from enum import Enum class FileSystem(Enum): """ File system used on a partition """ FAT32 = 0 EXFAT = 1 # use for huge storage capacity, for instance SD card of 32Go or higher
''' This program is to combine the features of serveral types It works by concatenate line by line of each features file Note: feature file contains numbers of words per line that are described in the following format word [space] freq1 freq2 freq3 ... @usage: Parameter list is described as following: @param1: (N...
#encoding:utf-8 from Configs.GlobalConfig import Hosts, DataStorages, IsoStorages, ExportStorages ''' --------------------------------------------------------------------------------------------------- @note: ModuleTestData --------------------------------------------------------------------------------------------...
# -*- coding: utf-8 -*- """ werkzeug.contrib.wrappers ~~~~~~~~~~~~~~~~~~~~~~~~~ Extra wrappers or mixins contributed by the community. These wrappers can be mixed in into request objects to add extra functionality. Example:: from werkzeug import Request as RequestBase from werkze...
""" Lifeline diagram item. Implementation Details ====================== Represented Classifier ---------------------- It is not clear how to attach a connectable element to a lifeline. For now, ``Lifeline.represents`` is ``None``. Ideas: - drag and drop classifier from tree onto a lifeline - match lifeline's name wi...
__all__ = ['Bug'] from typing import List, Dict, Optional, Any, Tuple, Iterable import os import warnings import logging import attr from .language import Language from .test import TestSuite from .coverage import CoverageInstructions from ..compiler import Compiler logger = logging.getLogger(__name__) # type: log...
import tspl,tspl_utils import lariat_utils from analyze_conf import lariat_path class Data(object): ts = None ld = None def __init__(self,jobid,k1,k2,aggregate=True,stats=None): ## Build ts and ld object for a job self.k1=k1 self.k2=k2 self.jobid=jobid ...
""" This module provides the L{MainPanel} component. That contains the editors main notebook and command bar. @summary: Main Panel """ __author__ = "Cody Precord <<EMAIL>>" __svnid__ = "$Id: ed_mpane.py 72278 2012-08-02 14:24:23Z CJP $" __revision__ = "$Revision: 72278 $" #-----------------------------...
# -*- coding: utf-8 -*- """This module contains API Wrapper implementations of the Dynamic DNS service """ from dyn.compat import force_unicode from dyn.tm.accounts import User from dyn.tm.session import DynectSession from dyn.tm.utils import Active __author__ = 'jnappi' __all__ = ['DynamicDNS'] class DynamicDNS(obj...
from __future__ import with_statement import pprint from globalVars import * import re import os import time __author__ = 'elhassouni' # Variable Globals ################################################################################################### # Variable path = '/media/elhassouni/donnees/Noeud-plante-pro...
#!/usr/bin/env python import os import sys import shutil from setuptools import setup, find_packages from setuptools.command.install import install with open('requirements.txt', 'r') as fh: dependencies = [l.strip().split("#")[0] for l in fh] extras = {} with open('requirements-extras.txt', 'r') as fh: ext...
from django import forms from bootstrap3_datetime.widgets import DateTimePicker class ChooseReportForm(forms.Form): date_from = forms.DateField( widget=DateTimePicker(options={"locale": "ru", "pickTime": False, "startDate": "1/...
"""Tests ability to cycle through multiple page templates """ __version__='''$Id$''' from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation setOutDir(__name__) import sys, os, time from string import split, strip, join, whitespace from operator import truth from types import String...
#!/usr/bin/env python import sys import bisect bedIn = open(sys.argv[1]) countFile = open(sys.argv[2]) bedOut = open(sys.argv[3], 'w') # # Build a lookup table for finding intervals. # start = {} end = {} counts = {} nIntervals = 0 for line in bedIn: vals = line.split() chrom = vals[0] if (chrom not i...
import mock from oslotest import mockpatch from rally.plugins.openstack import scenario as base_scenario from tests.unit import test class OpenStackScenarioTestCase(test.TestCase): def setUp(self): super(OpenStackScenarioTestCase, self).setUp() self.osclients = mockpatch.Patch( "rally...
from osv import osv from osv import fields class OeMedicalProcedure(osv.Model): _name = 'oemedical.procedure' _columns = { 'description': fields.char(size=256, string='Long Text', translate=True), 'name': fields.char(size=256, string='Code', required=True), ...
import sys from neutronclient.neutron.v2_0.lb.v2 import pool from neutronclient.tests.unit import test_cli20 class CLITestV20LbPoolJSON(test_cli20.CLITestV20Base): def test_create_pool_with_mandatory_params(self): """lbaas-pool-create with mandatory params only.""" resource = 'pool' cmd_...
### This is a copy of ali/interface.py from the ALI project import theano from theano import tensor from blocks.serialization import load from blocks.utils import shared_floatx class AliModel: def __init__(self, filename=None, model=None): if model is not None: self.model, = model.top_bricks ...
from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, flash, jsonify import json #to get the picture name import time #to call raspistill from subprocess import call #to get the most recent file name import os app = Flask(__name__) app.config.from_object(__name__) configuratio...
__author__ = 'ywang' from gevent import monkey monkey.patch_all() from flask import Flask, render_template from flask_socketio import SocketIO, emit # from flask.ext import assets app = Flask(__name__) socketio = SocketIO(app) # import os # env = assets.Environment(app) # env.load_path = [ # os.path.join(os.pat...
CXT_RESP_HEADERS = 'headers' CXT_RESP_BODYFD = 'bodyFd' CXT_CONNECTION = 'connection' class ResponseContext: """ This class provides a response context for use by the proxy broker and redirect components. This context provides a stackable set of response, header, and connection sets which can b...
# -*- coding:utf-8 -*- __author__ = 'Randolph' import os import sys import time import logging sys.path.append('../') logging.getLogger('tensorflow').disabled = True import numpy as np import tensorflow as tf from tensorboard.plugins import projector from text_ann import TextANN from utils import checkmate as cm fro...
class shapes_index(): SPHERE = 0 ELLIPSOID = 1 BOX = 2 CYLINDER = 3 CONVEXHULL = 4 TRIANGLEMESH = 5 BARREL = 6 CAPSULE = 7 CONE = 8 ROUNDEDBOX = 9 ROUNDEDCYL = 10 ROUNDEDCONE = 11 BEZIER = 12 def import_shapes(filepath): shapes_data = [] with open(file...
""" This is a reasonably tiny API for serializing and deserializing UPAs for storage in Narrative documents. """ import re from app_util import system_variable external_tag = "&" def is_upa(upa): """ Returns True if the given upa string is valid, False, otherwise. """ return re.match("^\d+(\/\d+){2...
""" multi_disk test for Autotest framework. :copyright: 2011-2012 Red Hat Inc. """ import logging import re import random import string from autotest.client.shared import error from autotest.client.shared import utils from virttest import qemu_qtree from virttest import env_process from virttest import utils_misc _...
import unittest from tests.baseclass import CommandTest from pykickstart.errors import KickstartParseError, KickstartValueError class FC3_TestCase(CommandTest): command = "driverdisk" def runTest(self): # pass self.assert_parse("driverdisk /dev/sdb2", "driverdisk /dev/sdb2\n") self.ass...
# -*- coding: utf-8 -*- # # CVXOPT documentation build configuration file, created by # sphinx-quickstart on Sat Dec 27 20:54:35 2008. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pickleab...
# -*- coding: utf-8 -*- """The data range file-like object.""" import os from dfvfs.file_io import file_io from dfvfs.lib import errors from dfvfs.resolver import resolver class DataRange(file_io.FileIO): """File input/output (IO) object that maps an in-file data range. The data range object allows to expose a...
#!/usr/bin/env python # This code was taken from: # http://stackoverflow.com/questions/10604048/pythonic-way-to-fix-broken-xml import sys from xml.sax import handler, make_parser class TagHandler(handler.ContentHandler): def __init__(self): handler.ContentHandler.__init__(self) self.stack = [] ...
from datetime import datetime, date import os from pathlib import Path import shutil import string import piexif from .utils import datetime_to_string, to_base, exiftool from .metadata import MetadataFile class Library: @staticmethod def find_library(path: str): location = Path(path).absolute() ...
#!/usr/bin/env python3 #Script to detect filenames with long paths before transferring to NTFS volumes. #Dependencies: argparse, pathlib, python3.6 or above, csv #Assumptions: # 1. Destination is an NTFS volume with a 255-character cap on paths # 2. That the total path length calculated here will not be 100% accurat...
import unittest import subprocess import json import os import util import time from TestConfig import * config = {} test_env = os.getenv('test_env', 'aiaas') env_setup = TestConfig() config = env_setup.setEnvironment(test_env) cli = os.path.abspath('./pb-cli/index.js') class TestPBRemove(unittest.TestCase): @cl...
import bi # Python 2.3 does not have 'set' in normal namespace. # But it can be imported from 'sets' try: set() except NameError: from sets import Set as set def render_bi_groups(): html.write("<ul>") for group in bi.aggregation_groups(): bulletlink(group, "view.py?view_name=aggr_group&aggr_gr...
""" High-level parallelisation with PVM. Python jobs can be distributed from a TrackingJobMaster to many JobSlaves running on different machines. The general mechanism is shown in ExampleMaster.py and ExampleSlave.py The compilation of PVM/pypvm can be tricky on some architectures. In order to support installations ...
"""Decrypt a message that was XOR'd against a single character.""" from encode_decode import decode_hex from fixed_xor import xor import requests from operator import itemgetter def xor_with_char(bytes, char): """XOR a sequence of bytes with a single character.""" return xor(bytes, char * len(bytes)) def a...
# -*- coding:utf-8 -*- '''Trains a simple convnet on the MNIST dataset. Gets to 99.25% test accuracy after 12 epochs (there is still a lot of margin for parameter tuning). 16 seconds per epoch on a GRID K520 GPU. ''' from __future__ import print_function import keras from keras.datasets import mnist from keras.models ...
""" A simple-to-use web worker that collects website data as it crawls Author: Mark Boon Date: 06/09/2017 Version: 2.3.1 """ import threading from urllib.request import urlopen from urllib.parse import urljoin from bs4 import BeautifulSoup class Worker: base_url = '' queue = [] crawled...
import numpy as np import scipy.spatial.distance as dist import pyparticles.forces.force as fr class LenardJones( fr.Force ) : r""" Compute the lenard jones force between the particles The L. J. force between two particles is defined as follow: .. math:: \mathbf{F}(r) = 4 \epsilon \left(12...
"""Export paths""" import os import pkg_resources import sys def get_path(var): if var == "lib": return os.path.abspath( pkg_resources.resource_filename(__name__, "lib")) elif var == "elements": return os.path.abspath( pkg_resources.resource_filename(__name__, "element...
__Author__ = "Yoshihiro Tanaka" __date__ = "2014-12-04" __version__ = "1.0.0" def createList(flag): with open("dataProcessing/sample_population.tsv") as f: lines = f.readlines() cList = list(set([r.split("\t")[1] for r in lines])) country = {} spcDict = {} for line in lines: i...
# coding: utf-8 """ Wavefront REST API <p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ...
from django.utils.translation import ugettext_lazy as _ from connected_accounts.conf import settings from connected_accounts.provider_pool import providers from .base import OAuthProvider, ProviderAccount class TwitterAccount(ProviderAccount): def get_screen_name(self): return self.account.extra_data.ge...
#!/bin/usr/env python """ Flash card quiz script based on https://openhatch.org/wiki/Flash_card_challenge. """ import random import sys def main(path): """ Reads in cards from file and runs quiz. """ try: with open(path.strip()) as file: lines = file.read()[:-1] except: print "C...
from nfs4_const import * from environment import check, checklist from nfs4lib import get_attr_name def _try_mandatory(t, env, path): c = env.c1 mandatory = [attr.bitnum for attr in env.attr_info if attr.mandatory] ops = c.use_obj(path) ops += [c.getattr(mandatory)] res = c.compound(ops) check(...
from django import forms from django.test import TestCase from setman.forms import SettingsForm from setman.utils import AVAILABLE_SETTINGS from testproject.core.choices import ROLE_CHOICES from testproject.core.validators import abc_validator, xyz_validator __all__ = ('TestForms', ) SETTINGS_FIELDS = { 'BOOL...
#!/usr/bin/env python import argparse import os import sqlite3 as sq import plantcv as pcv import pandas as pd from random import randrange from shutil import copy # Parse command-line arguments def options(): parser = argparse.ArgumentParser(description="Extract VIS object shape data from an SQLite database") ...
import os from helpers import unittest class ImportTest(unittest.TestCase): def import_test(self): """Test that all module can be imported """ luigidir = os.path.join( os.path.dirname(os.path.abspath(__file__)), '..' ) packagedir = os.path.join(l...
import proto # type: ignore __protobuf__ = proto.module( package="google.ads.googleads.v6.errors", marshal="google.ads.googleads.v6", manifest={"DatabaseErrorEnum",}, ) class DatabaseErrorEnum(proto.Message): r"""Container for enum describing possible database errors.""" class DatabaseError(pr...
# Imports {{{ from collections import OrderedDict, Callable from string import join from django.http import HttpResponseRedirect, HttpResponse from django.core.urlresolvers import reverse from django.core.context_processors import csrf from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.tem...
# -*- coding: utf-8 -*- """ Prepares a DOEE pip delimited csv for `load_doee.sh`. """ import os, sys, csv, argparse replacement_headers="pid|dc_real_pid|pm_pid|property_name|pm_parent_pid|parent_property_name|year_ending|report_status|address_of_record|owner_of_record|ward|reported_address|city|state|postal_code|yea...
from sparktk.propobj import PropertiesObject class Histogram(PropertiesObject): def __init__(self, cutoffs, hist, density): self._cutoffs = cutoffs self._hist = hist self._density = density @property def cutoffs(self): return self._cutoffs @property def density(sel...
import time from flask import current_app, request from pony.orm import delete from pony.orm import ObjectNotFound from ..db import Track, Album, Artist, Folder from ..db import StarredTrack, StarredAlbum, StarredArtist, StarredFolder from ..db import RatingTrack, RatingFolder from ..lastfm import LastFm from . impo...
""" Support for Satel Integra zone states- represented as binary sensors. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/binary_sensor.satel_integra/ """ import logging from homeassistant.components.binary_sensor import BinarySensorDevice from homeassis...
# -*- coding: utf-8 -*- from flask import Flask, render_template, g, current_app from flask_mongoengine import MongoEngine from flask_session import Session from flask_login import LoginManager from flask_debugtoolbar import DebugToolbarExtension from pymongo import MongoClient from make_celery import make_celery from ...
# -*- coding: utf-8 -*- """ export_catalog Exports Catalog :copyright: (c) 2013 by Openlabs Technologies & Consulting (P) Limited :license: AGPLv3, see LICENSE for more details. """ import magento from openerp.osv import osv, fields from openerp.tools.translate import _ class ExportCatalog(osv.Trans...
import tensorflow as tf a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a') b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b') c = tf.matmul(a, b) # Creates a session with log_device_placement set to True. with tf.Session(config=tf.ConfigProto(log_device_placement=True)) as ses...
#!/usr/bin/python2 from sys import argv from os import listdir from os.path import isdir from logger import debug from utils import composepath from string import Template TEMPLATE_HEADER = '''[Icon Theme] Name=$tp_name Comment=$tp_comment $tp_inherit ''' TEMPLATE_KED_SPECIAL = '''# KDE Specific Stuff DisplayDepth=...
from bitcoin_frespo.models import * from django.conf import settings from bitcoin_frespo.utils import bitcoin_adapter import logging logger = logging.getLogger(__name__) class BitcoinFrespoException(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.v...
""" import the necessary modules """ from flask_sqlalchemy import SQLAlchemy from sqlalchemy.sql import text # Create a class that will give us an object that we can use to connect to a database class MySQLConnection(object): def __init__(self, app, db): config = { 'host': 'localhost', ...
#!/usr/bin/env python import numpy as np import matplotlib matplotlib.use('agg') matplotlib.rcParams['font.family']='serif' import matplotlib.pyplot as plt import json import pdb import argparse import logging #pdb.set_trace() #python -m pdb script.py class Humans(): def __init__(self, S, E, I, D, roaming, beta)...
from pprint import pformat from ansible.plugins.action import ActionBase from ansible import constants as C class ActionModule(ActionBase): def _install_lua_json(self): ''' checks if json4lua package is present or install it otherwise ''' lua_json=self._low_level_execute_command("lua -e \"require('...
''' **Purpose:** This is a basic test harness which creates files to be processed by XFERO. The script creates X number of file per minute for Y minutes. It takes a list of file name suffixes which it selects randomly from to create the file names **Unit Test Module:** None +------------+-------------+-----------...
import json from django.conf import settings from django.contrib.messages.storage.base import BaseStorage, Message from django.http import SimpleCookie from django.utils.crypto import constant_time_compare, salted_hmac from django.utils.safestring import SafeData, mark_safe class MessageEncoder(json.JSONEncoder): ...
"""Handle MySensors messages.""" from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.util import decorator from .const import CHILD_CALLBACK, MYSENSORS_GATEWAY_READY, NODE_CALLBACK from .device import get_mysensors_devices from .helpers import d...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('loads', '0011_auto_20151031_0106'), ] operations = [ migrations.CreateModel( name='ModuleSize', fiel...
import socket import select import ipaddress import ifaddr from collections import OrderedDict from unittest.mock import patch, MagicMock as Mock, PropertyMock, call from soco import discover from soco import config from soco.discovery import ( any_soco, by_name, _find_ipv4_addresses, _find_ipv4_netw...
import os import sys from stat import * import pwd import grp def main(): module = AnsibleModule( argument_spec = dict( path = dict(required=True, type='path'), follow = dict(default='no', type='bool'), get_md5 = dict(default='yes', type='bool'), get_checksum...
from decimal import Decimal as D from django.template.loader import render_to_string from oscar.apps.shipping import base class Standard(base.ShippingMethod): code = 'standard' name = 'Standard shipping' description = render_to_string('shipping/standard.html') def basket_charge_incl_tax(self): ...
from UM.Application import Application from typing import Any import numpy class LayerPolygon: NoneType = 0 Inset0Type = 1 InsetXType = 2 SkinType = 3 SupportType = 4 SkirtType = 5 InfillType = 6 SupportInfillType = 7 MoveCombingType = 8 MoveRetractionType = 9 SupportInterf...
from chirribackup.Config import CONFIG from chirribackup.Logger import logger import chirribackup.actions.BaseAction import chirribackup.LocalDatabase import os import json import sys class DbAttributeList(chirribackup.actions.BaseAction.BaseAction): fix = 0 rebuild = 0 help = { "synopsis": "Lis...
import threading from django.conf import settings from django.test.client import RequestFactory from django.core.urlresolvers import reverse as django_reverse from django.utils.translation.trans_real import parse_accept_lang_header # Thread-local storage for URL prefixes. Access with (get|set)_url_prefix. _locals = ...
#!/usr/bin/python import sys import numpy as np from SimMain import main ########################################################################## # Calculate the cost and link usage vs. cache ratio for every AS #main(asn = 1221, cacheRatio=0.1, delayLimit = 3, alpha = 0.7, algo = 0) def CalResultOfRatio(asn): A...
# video_processing.py import numpy as np from methods.settings import * fgbg_mog2 = cv2.createBackgroundSubtractorMOG2() fgbg_knn = cv2.createBackgroundSubtractorKNN() def background_subtractor_mog2(frame): try: fgmask = fgbg_mog2.apply(frame) frame = cv2.cvtColor(fgmask, cv2.COLOR_GRAY2RGB) ...
import numpy as np import pytest import hessianfree as hf from hessianfree.tests import use_GPU pytestmark = pytest.mark.parametrize("use_GPU", use_GPU) def test_ff_CG(use_GPU): rng = np.random.RandomState(0) inputs = rng.randn(100, 1).astype(np.float32) targets = rng.randn(100, 1).astype(np.float32) ...
#!/usr/bin/env python spheres = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'] def main(): # twos() # threes() # fours() # fives() # sixes() sevens() def twos(): d1 = {} for v1 in spheres: for v2 in spheres: if v1 == v2: continue ...
__author__ = '<EMAIL> Arnaud BRETON (UniShared)' import collections import unittest from utils import FileUtils, UrlUtils class TestFileUtils(unittest.TestCase): def test_get_empty_file(self): returned_f = FileUtils.get_empty_file() self.assertEqual(returned_f, { 'version': FileUtil...
""" MIT License Copyright (c) 2017 Brandon Hoffman 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, merge, publis...
import unittest from stix.test import EntityTestCase, assert_warnings from stix.test import data_marking_test from stix.test.common import related_test, identity_test, kill_chains_test from stix.core import STIXPackage import stix.ttp as ttp from stix.ttp import ( resource, infrastructure, exploit_targets, malwar...
#! /usr/bin/env python # Queue Python file for Efrain, Mark and Henry class Node(object): """A Node Class representing a Node in a queue. Each node has a pointer to the next node and a value. """ def __init__(self, value, back=None, front=None ): """Create Node with value and optional pointer...
import pytest import requests import time def test_reload (launch): with launch ("./examples/app.py") as engine: resp = requests.get ("http://127.0.0.1:30371/sub") assert resp.status_code == 200 assert "i am sub" in resp.text with open ("./examples/services/sub.py") as f:...
import os from functools import lru_cache as cache from JAK.Utils import check_url_rules, get_current_path, bindings from JAK.Widgets import Dialog from JAK.RequestInterceptor import Interceptor if bindings() == "PyQt5": from PyQt5.QtCore import QUrl, Qt from PyQt5.QtWebEngineCore import QWebEngineUrlSchemeHand...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import datetime from django.core.exceptions import ImproperlyConfigured from django.test import TestCase, override_settings from django.utils.encoding import force_str from django.views.generic.base import View from .models import Artist, Author, Book, ...
from django.conf.urls import url from django.http import HttpResponse def twitter_cards(req): return HttpResponse(''' <!DOCTYPE html> <html> <head> <title>Twitter Cards Embed</title> <meta name="twitter:card" content="player"> <meta name="twitter:site" content="...
# -*- coding: utf-8 -*- """Test CLR property support.""" import pytest from Python.Test import PropertyTest def test_public_instance_property(): """Test public instance properties.""" ob = PropertyTest() assert ob.PublicProperty == 0 ob.PublicProperty = 1 assert ob.PublicProperty == 1 with...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import os from collections import OrderedDict, namedtuple from hashlib import sha1 import six from twitter.common.dirutil import Fileset from pants.backend.jvm.targe...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.utils import translation from django.db.models import ObjectDoesNotExist from pybb import util class PybbMiddleware(object): def process_request(self, request): if request.user.is_authenticated(): try: ...
""" Generates the menu for arm, binding options with their related actions. """ import functools import cli.popups import cli.controller import cli.menu.item import cli.graphing.graphPanel from util import connections, torTools, uiTools from stem.util import conf, str_tools CONFIG = conf.config_dict("arm", { "fe...
"""Command-line interface to the OpenStack APIs""" import getpass import logging import sys import traceback from cliff import app from cliff import command from cliff import complete from cliff import help import openstackclient from openstackclient.common import clientmanager from openstackclient.common import com...
from unittest import TestCase import tempfile import os from wifi import Cell from wifi.scheme import extract_schemes, Scheme from wifi.exceptions import ConnectionError NETWORK_INTERFACES_FILE = """ # This file describes the network interfaces available on your system # and how to activate them. For more informatio...
from heat_integrationtests.functional import functional_base cfn_template = ''' AWSTemplateFormatVersion: 2010-09-09 Parameters: env_type: Default: test Type: String AllowedValues: [prod, test] zone: Type: String Default: beijing Conditions: Prod: {"Fn::Equals" : [{Ref: env_type}, "prod"]} ...