content
stringlengths
4
20k
{ 'name': 'Sale Order Add button on lines to display next moves', 'version': '1.0', 'category': 'Sale', 'description': """ Customization when Sale Order Lines Change during quotation =========================================================== Let users customize quotation options: * Possibility to dis...
import re # from netseen.common.logger import Logger from pysnmp.hlapi import \ bulkCmd, getCmd, nextCmd, SnmpEngine, CommunityData, UdpTransportTarget, \ ContextData, ObjectType, ObjectIdentity, UsmUserData class SnmpPoller(object): ''' Snmp Mib Poller v2c: :router_ip: device ip string format...
""" ❏DChars❏ : dchars/lstringtools.py Utilities for list of strings. """ #/////////////////////////////////////////////////////////////////////////////// def no_iterates(seq): """ seq : list,tuple return <seq> without the duplicates """ seen = set() seen_add = seen.a...
""" Package to test the openlp.plugins.songs.forms.editverseform package. """ from unittest import TestCase from PyQt4 import QtCore, QtGui, QtTest from openlp.core.lib import Registry from openlp.plugins.songs.forms.editverseform import EditVerseForm class TestEditVerseForm(TestCase): """ Test the EditVers...
import fitsio import os def reduce_image(imgfn,newfn,extname='N4',overwrite=False): print(' imgfn=%s\n newfn=%s' % (imgfn,newfn)) h=fitsio.FITS(imgfn) extname= extname.upper() extnum= h[extname].get_extnum() if os.path.exists(newfn): if overwrite: os.remove(newfn) else: ...
""" Scheduling of threads to run tasks (normally rules). A Task object is a thread, the number running concurrently is controlled by the Sched object. Since tasks usually run one external pipeline at a time, the number of concurrent tasks controls the number of process executing on a host. A scheduling group is assoc...
#-*- coding:utf-8 -*- """ This file is part of infinite-maze-of-pacman. infinite-maze-of-pacman 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 vers...
from __future__ import print_function import math import re import functools import json import os import sys import traceback import AST import globalv import util verbose = False tempFilename = 'generatedDesignInterfaceFile.json' lookupTable = {} class InterfaceMixin: def getSubinterface(self, name): ...
from django.conf.urls import include, url from olympia.stats.urls import collection_stats_urls from . import views edit_urls = [ url('^$', views.edit, name='collections.edit'), url('^addons$', views.edit_addons, name='collections.edit_addons'), url('^privacy$', views.edit_privacy, name='collections.edit...
import os import json import csv import urllib2 import base64 import logging from . import gexf def mkdir(newdir): if os.path.isdir(newdir): pass elif os.path.isfile(newdir): raise OSError("a file with the same name as the desired " \ "dir, '%s', already exists." % newdir)...
#!/usr/bin/env python3 import json import os import string from collections import defaultdict from prompt_toolkit.shortcuts import confirm from prompt_toolkit.validation import Validator from termcolor import colored ''' Basic module which defines the workspace class ''' from prompt_toolkit import prompt, PromptSes...
# -*- coding: utf-8 -*- from searx.testing import SearxTestCase from searx import plugins from mock import Mock class PluginStoreTest(SearxTestCase): def test_PluginStore_init(self): store = plugins.PluginStore() self.assertTrue(isinstance(store.plugins, list) and len(store.plugins) == 0) d...
"""Truncation Test **What is checked** Checks for controls where the text does not fit in the space provided by the control. **How is it checked** There is a function in windows (DrawText) that allows us to find the size that certain text will need. We use this function with correct fonts and other relevant ...
import unittest import os import sys import commands import comm class TestSampleAppFunctions(unittest.TestCase): def test_uninstall(self): comm.setUp() app_name = "Memorygame" cmdfind = "adb -s " + comm.device + \ " shell pm list packages |grep org.xwalk.%s" % (app_name.lower...
""" Interface for generic element-wise nearest-neighbor computation. """ import abc import os from smqtk.algorithms import SmqtkAlgorithm from smqtk.utils.plugin import get_plugins __author__ = "<EMAIL>" class NearestNeighborsIndex (SmqtkAlgorithm): """ Common interface for descriptor-based nearest-neighb...
# Copyright (c) 2016, LE GOFF Vincent # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of conditions and th...
import pytest import six import sqlalchemy as sa from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy_utils import generic_relationship @pytest.fixture def User(Base): class User(Base): __tablename__ = 'user' id = sa.Column(sa.Integer, primary_key=True) return User @pytest.fixt...
""" This routine is executed on Before Build every time user build a Visual Studio project. TODO: CHM web template with logo. Custom Icon Strip for CHM Files. Author: Tony Ho @ AR-MA 2018 """ from subprocess import call import os import fnmatch def Run(): GenerateDocsInRhino() Gene...
import aiohttp, asyncio, io, logging, os, time import hangups import plugins logger = logging.getLogger(__name__) class __registers(object): def __init__(self): self.last_event_id = '' # recorded last event to avoid re-syncing self.last_user_id = '' # recorded last user to allow message compre...
from .custom_field import IndicatorCustomField, IndicatorCustomValue from .default_period import DefaultPeriod from .disaggregation import Disaggregation from .disaggregation_target import DisaggregationTarget from .indicator_disaggregation_target import IndicatorDisaggregationTarget from .disaggregation_contribution i...
# -*- coding: utf8 -*- import os import shutil def split_url_path(path): """ Separates URL path to repository name and path. # Parameters path (str): The path from URL. # Return tuple (str, str): The repository name and the path to be listed. """ separator = '/' parts = path.split(separator) r...
# coding=utf8 from __future__ import unicode_literals from ..address import Provider as AddressProvider class Provider(AddressProvider): building_number_formats = ('###', '##', '#') postcode_formats = ('#####', ) city_formats = ('{{city_name}}', ) street_name_formats = ('{{fruit}}{{street_suff...
"""Player with actions coming from gamepad.""" from absl import logging import pygame from gfootball.env import controller_base from gfootball.env import football_action_set from gfootball.env import event_queue BUTTON_TO_ACTIONS = { 0: [football_action_set.action_short_pass, football_action_set.action_p...
import mock from oslo_serialization import jsonutils import webob from cinder import context from cinder import exception from cinder import test from cinder.tests.api import fakes # This list of fake volumes is used by our tests. Each is configured in a # slightly different way, and includes only the properties th...
import os import pickle import sys import shutil import numpy as np import pandas as pd import multiprocessing as mp from kbmodpy import kbmod as kb from astropy.io import fits from astropy.wcs import WCS from skimage import measure from filter_utils import * if __name__ == "__main__": image_folder = sys.argv[1] ...
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'SHTP.views.home', name='home'), # url(r'^SHTP/', include('SHTP.foo.urls')), # Uncommen...
"""Copyright 2008 Orbitz WorldWide 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 writing, software...
from random import randint from BaseAI import BaseAI from Node import Node import time, math from heapq import heappush, heappop timeTimlimit = 0.2 prevTime = 0 currentTime = 0 node_depth = 4 possibleNewTiles = [2, 4] defaultProbability = 0.9 class PlayerAI(BaseAI): def getMove(self, grid): prevTime = ti...
from django.shortcuts import get_object_or_404 from rest_framework import viewsets, permissions, status from rest_framework.response import Response from rest_framework.decorators import detail_route from .serializers import PostSerializer from .models import Post class PostViewSet(viewsets.ModelViewSet): seria...
import collections.abc import datetime import typing from . import ast from . import __version__ as _rezparser_version __all__ = [ "REZ_VERSION", "ArrayState", "Evaluator", "ResourceState", "eval", ] # Not a real Rez version number. Xcode 8.4's Rez and DeRez say "V3.7B1". REZ_VERSION = b"python-rezparser versio...
# Hello World # # A minimal script that tests The Grinder logging facility. # # This script shows the recommended style for scripts, with a # TestRunner class. The script is executed just once by each worker # process and defines the TestRunner class. The Grinder creates an # instance of TestRunner for each worker thre...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from ray.rllib.agents.a3c.a3c_tf_policy import A3CTFPolicy from ray.rllib.agents.trainer import with_common_config from ray.rllib.agents.trainer_template import build_trainer from ray.rllib.optimizers import As...
import argparse import ipaddr from maas_common import get_auth_ref from maas_common import get_keystone_client from maas_common import metric from maas_common import metric_bool from maas_common import print_output from maas_common import status_err from maas_common import status_ok import requests from requests impor...
from box import BoundingBox, FloatBox from entity import Entity, TileEntity from faces import faceDirections, FaceXDecreasing, FaceXIncreasing, FaceYDecreasing, FaceYIncreasing, FaceZDecreasing, \ FaceZIncreasing, MaxDirections from indev import MCIndevLevel from infiniteworld import ChunkedLevelMixin, AnvilChunk, ...
#!/usr/bin/env python # test generated python code from pidl # Andrew Tridgell August 2010 # # to run this test, use one of these: # # python -m testtools.run samba.tests.dcerpc.rpc_talloc # # or if you have trial installed (from twisted), use # # trial samba.tests.dcerpc.rpc_talloc """Tests for the talloc handl...
"""pysweng: Software engineering problems in Python """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with ope...
import asyncio from asynctest import CoroutineMock, Mock import pytest def test_repr(): from jenkins_epo.rest import Client client = Client() client = client('https://fqdn.tld/path').subpath assert '/path/subpath' in repr(client) @pytest.mark.asyncio @asyncio.coroutine def test_get(mocker): C...
import fedmsg.meta.base from fedmsg_meta_fedora_infrastructure.fasshim import avatar_url class AbstractCoprConglomerator(fedmsg.meta.base.BaseConglomerator): def can_handle(self, msg, **config): return '.copr.' in msg['topic'] def merge(self, constituents, **config): ms = constituents # shor...
import mock from sahara.i18n import _ from sahara.tests.unit import base as b from sahara.tests.unit.plugins.cdh import utils as ctu from sahara.utils import files CONFIGURATION_SCHEMA = { 'node_configs': { 'yarn.scheduler.minimum-allocation-mb': ( 'RESOURCEMANAGER', 'yarn_scheduler_minimum_al...
from .utils import idw try: from exceptions import AttributeError except ImportError: pass import numpy as np class Colormap(object): """ Colormap management class """ def __init__(self, size=None, palette=None): if size is not None: self.size = size self.cma...
import os import unittest from telemetry.core import browser_finder from telemetry.core import util from telemetry.unittest import options_for_unittests class TabTestCase(unittest.TestCase): def __init__(self, *args): self._extra_browser_args = [] self.test_file_path = None self.test_url = None sup...
#!/usr/bin/env python # -*- coding:utf-8 -*- """ modbus网络的串口数据采集插件 1、device_id的组成方式为ip_port_slaveid 2、设备类型为0,协议类型为modbus 3、devices_info_dict需要持久化设备信息,启动时加载,变化时写入 4、device_cmd内容:json字符串 """ import time from setting import * from libs.daemon import Daemon from libs.plugin import * from libs.mqttclie...
import pytest from unittest.mock import Mock from anchore_engine.services.policy_engine.engine.policy.gates import gems from anchore_engine.services.policy_engine.engine.policy.gate import ExecutionContext from anchore_engine.db.entities.policy_engine import Image, ImagePackage, GemMetadata image_id = "1" user = "admi...
import tkinter as tk from tkinter.filedialog import askopenfilename import application start = None value = None code = None delete = False canvas_width = 800 master = tk.Tk() f1 = tk.Frame(master) canvas1 = tk.Canvas(f1, width=800, height=300, bd=0, highlightthickness=0) canvas1.pack() f...
""" Support for MQTT binary sensors. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/binary_sensor.mqtt/ """ import asyncio import logging import voluptuous as vol from homeassistant.core import callback import homeassistant.components.mqtt as mqtt from...
import os import pytest from django.core.urlresolvers import reverse from django.utils.translation import activate from shuup.core import cache from shuup.core.models import ShopProduct from shuup.testing.browser_utils import wait_until_condition from shuup.testing.factories import ( create_product, get_default_c...
#!/usr/bin/env python from peyotl.phylografter.nexson_workaround import workaround_phylografter_export_diffs, \ add_default_prop from peyotl.phylesystem.git_actions import get_filepath_for_namespaced_id from peyotl import get_logger from subprocess import cal...
""" Test objconfig.reader.Ini """ import pytest from objconfig.exception import RuntimeException from objconfig.reader import Ini import os def test_emptyinstantiation_ini(): ini = Ini() assert ini.getNestSeparator() == '.', "Empty Instantiation Failed" def test_readfromfile_ini(): ini = Ini() confi...
import struct from ryu import utils from ryu.lib import type_desc from ryu.ofproto import nicira_ext from ryu.ofproto import ofproto_common from ryu.lib.pack_utils import msg_pack_into from ryu.ofproto.ofproto_parser import StringifyMixin def generate(ofp_name, ofpp_name): import sys import string import...
from experimental import * def test_rhythm_01(): '''Sixteenths. ''' leaf_lists = library.sixteenths([(4, 8), (3, 8)]) containers = [Container(x) for x in leaf_lists] staff = Staff(containers) assert systemtools.TestManager.compare( staff, r''' \new Staff { ...
#!/usr/bin/env python # Client connects with a certificate to a server that has use_identity_as_username=true. Shouldn't be rejected. import subprocess import socket import ssl import sys import time if sys.version < '2.7': print("WARNING: SSL not supported on Python 2.6") exit(0) import inspect, os, sys # F...
""" Unit Tests for qos specs internal API """ import mock import six import time from oslo_db import exception as db_exc from cinder import context from cinder import db from cinder import exception from cinder import test from cinder.tests.unit import fake_constants as fake from cinder.volume import qos_specs from ...
import pygame from libs.lasergen import generate class Laser(pygame.sprite.Sprite): def __init__(self, size, vertical, time, number, location, *groups): super(Laser, self).__init__(*groups) self.activeimage = generate(size, vertical) self.inactiveimage = pygame.surface.Surface((0, 0)) ...
"""Custom logger class.""" import logging import os import tempfile from logging.config import dictConfig # Define the logging configuration LOGGING_CFG = { 'version': 1, 'disable_existing_loggers': False, 'root': { 'level': 'INFO', 'handlers': ['file', 'console'] }, 'formatters': ...
#!/usr/bin/python __author__ = 'anson' import optparse import os import sys from utils.utils_cmd import execute_sys_cmd from utils.utils_sys_config import utils_sys_config from lib_monitor.disk_info_collect import smartctl_info, disk_status from lib_monitor.monitor_default_format import nagios_state from lib_monitor.mo...
from django.http import HttpResponse, HttpResponseRedirect from django.template import RequestContext, loader from django.shortcuts import get_object_or_404, render from django.core.urlresolvers import reverse from .models import Question, Choice def index(request): latest_question_list = Question.objects.order_...
"""Trigonometric functions.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops from tensorflow.python.ops import clip_ops from tensorflow.python.ops ...
# -*- coding: utf-8 -*- """Payload system for IPython. Authors: * Fernando Perez * Brian Granger """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in...
# -*- coding: utf-8 -*- import os, base64 from PIL import Image, ImageFont, ImageDraw, ImageChops __all__ = ['generate_email'] # from http://stackoverflow.com/questions/10615901/trim-whitespace-using-pil def trim(im): bg = Image.new(im.mode, im.size, im.getpixel((0,0))) diff = ImageChops.difference(im, bg) ...
from django.http import HttpResponseRedirect from django.shortcuts import render, get_object_or_404 from django.core.urlresolvers import reverse from django.views import generic from django.utils import timezone from polls.models import Choice, Poll class IndexView(generic.ListView): template_name = 'polls/index....
import datetime from unittest import TestCase, mock import requests import params from vcr_setup import custom_vcr from wblib import exceptions from wblib.client import WattbikeHubClient class WattbikeHubClientTest(TestCase): def setUp(self): self.client = WattbikeHubClient() def test_init(self): ...
from twisted.trial import unittest from buildbot.data import patches from buildbot.test.fake import fakemaster from buildbot.test.util.misc import TestReactorMixin class Patch(TestReactorMixin, unittest.TestCase): def setUp(self): self.setUpTestReactor() self.master = fakemaster.make_master(self...
# -*- coding: utf-8 -*- import os import inspect import glob import types from flask import Flask, url_for, json, jsonify, g, request, Response, \ render_template, make_response, send_from_directory from jinja2 import Environment, FileSystemLoader # -------------------- def basedir(): cwd = os.g...
"""Command to remove a principal from a service's access policy.""" import httplib from googlecloudsdk.api_lib.service_management import services_util from googlecloudsdk.api_lib.util import http_retry from googlecloudsdk.calliope import base from googlecloudsdk.command_lib.iam import iam_util from googlecloudsdk.com...
#!/usr/bin/env python """Lark based STIX2 Pattern Parser""" # standard library import os from typing import Union # third-party from lark import Lark, Transformer, Tree, v_args class Indicator: """Indicator Object as recognized by the parser. Indicators have path and value properties, and may be acces...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='History', fields=[ ('id', models.AutoField(verb...
import os import sys import string def execute1(command): if(len(sys.argv)>2): args = string.join(sys.argv[2:]) else: args = '' cin, cout ,cerr = os.popen3(command+' %s' % (args)) while 1: text = cout.read() if text: print text ...
""" Pymazon - A Python based downloader for the Amazon.com MP3 store Copyright (c) 2010 Steven C. Colbert 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 ...
from entities.constants import DamageTypes from events import event_manager from listeners.tick import Delay from memory import make_object from weapons.entity import Weapon from ....internal_events import InternalEvent from ....resource.strings import build_module_strings from ...damage_hook import ( protected_p...
import Crypto.Cipher.AES import Crypto.PublicKey.RSA as RSA import json import os import skarphedadmin.data.Server from Instance import InstanceType from skarphedcommon.errors import ProfileException class Profile(object): STATE_EMPTY = 0 STATE_LOADED = 1 DATA_STRUCT = { 'privateKe...
""" Script to show the results of the two marching cubes algorithms on different data. """ import time import numpy as np import visvis as vv from skimage.measure import marching_cubes_classic, marching_cubes_lewiner from skimage.draw import ellipsoid # Create test volume SELECT = 3 gradient_dir = ...
## -*- encoding: utf-8 -*- import os import sys from setuptools import setup from codecs import open # To open the README file with proper encoding from setuptools.command.test import test as TestCommand # for tests # Get information from separate files (README, VERSION) def readfile(filename): with open(filename...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Payment.is_notify' db.add_column(u'payments_payment', 'is...
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2012-2017 Alex Forencich 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...
from Tkinter import * class StatusBar(Frame): def __init__(self, master): Frame.__init__(self, master) self.is_on = False self.config(border=1) self.msg = Label(self, bd=1, relief=SUNKEN, anchor=W) self.msg.pack(side='left', expand=True, fill=X) self.column = Labe...
import os import ycm_core flags = [ ] # Set this to the absolute path to the folder (NOT the file!) containing the # compile_commands.json file to use that instead of 'flags'. See here for # more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html # # You can get CMake to generate this file for you by ad...
""" Avatar chooser dialog """ import os import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, GdkPixbuf # When testing, no _() is available try: _("") except NameError as err: def _(message): return message class Avatars(Gtk.Dialog): """ Avatar chooser dialog """ AVATARS...
from mpi4py import MPI import mpiunittest as unittest import arrayimpl def maxvalue(a): try: typecode = a.typecode except AttributeError: typecode = a.dtype.char if typecode == ('f'): return 1e30 elif typecode == ('d'): return 1e300 else: return 2 ** (a.item...
#!/usr/bin/env python # -*- coding: utf-8 -*- from sys import argv from math import sqrt from rpy2 import robjects import math import os def fillOccurences(content, occ): for symbol in content: if symbol in occ: occ[symbol] +=1 else: occ[symbol] = 1 return occ def pa...
from django.conf import settings ''' RTF quick reference (from Word2007RTFSpec9.doc): \fs24 : sets the font size to 24 half points \header : header on all pages \headerf : header on first page only \pard : resets any previous paragraph formatting \plain : resets any previous character formattin...
from xml.etree import ElementTree as Etree from xml.dom import minidom from elavonvtpv.enum import RequestType from elavonvtpv.Response import Response import datetime import hashlib import requests class Request: def __init__(self, secret, request_type, merchant_id, order_id, currency=None, amount=None, card=Non...
import numpy as np from ..core import GP from .. import likelihoods from .. import kern class GPRegression(GP): """ Gaussian Process model for regression This is a thin wrapper around the models.GP class, with a set of sensible defaults :param X: input observations :param Y: observed values :...
import logging _LOGGER = logging.getLogger('pcepy.message') PCEP_VERSION = 1 class _CodeMeta(type): """Metaclass for Code classes: Converts the _values definitions into true objects and adds access to individual components by _names""" # Default value for the second level attribute _value = 0 c...
""" URLConf for Django user registration and authentication. If the default behavior of the registration views is acceptable to you, simply use a line like this in your root URLConf to set up the default URLs for registration:: (r'^accounts/', include('registration.urls')), This will also automatically set up th...
# Test MTU exchange (initiated by both central and peripheral) and the effect on # notify and write size. # Seven connections are made (four central->peripheral, three peripheral->central). # # Test | Requested | Preferred | Result | Notes # 0 | 300 (C) | 256 (P) | 256 | # 1 | 300 (C) | 200 (P) | 200...
from __future__ import print_function import argparse import logging import pprint import time,re import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt logger = logging.getLogger() args = None p = dict() def checkrange(x,mini,maxi): x = float(x) if x < mini: ra...
"""The avri component.""" import asyncio from datetime import timedelta import logging from avri.api import Avri from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from .const import ( CONF_COUNTRY_CODE, CONF_HOUSE_NUMBER, CONF_HOUSE_NUMBER_EXTENSION, CO...
# -*- coding: utf-8 -*- import numpy as np from pyfr.backends.base import NullComputeKernel, NullMPIKernel from pyfr.solvers.baseadvecdiff import (BaseAdvectionDiffusionBCInters, BaseAdvectionDiffusionIntInters, BaseAdvectionDiffusionMPII...
" fit constraint set " from __future__ import print_function from __future__ import division from gpkit import ConstraintSet from gpkit import Variable, NomialArray, NamedVariables, VectorVariable from numpy import amax, array, hstack, where # pylint: disable=too-many-instance-attributes, too-many-locals, # pylint: di...
from django import forms from bootcamp.questions.models import Answer, Question class QuestionForm(forms.ModelForm): title = forms.CharField( widget=forms.TextInput(attrs={'class': 'form-control'}), max_length=255) description = forms.CharField( widget=forms.Textarea(attrs={'class': '...
"""python-cjdns is a library for communicating with the cjdns admin interface""" from __future__ import print_function import os import sys import socket import hashlib import json import threading import time try: import queue except ImportError: import Queue as queue import random import string from hashlib...
from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import pyqtSignal as Signal class LineEdit(QLineEdit): def __init__(self, parent=None): super(LineEdit, self).__init__(parent) self.setMaximumWidth(60) self.setText(str(0)) class SpinBox(...
import sys import datetime import json import logging logging.basicConfig(level=logging.CRITICAL) from time import sleep import hpfeeds HOST = 'hpfeeds.honeycloud.net' PORT = 10000 CHANNELS = ['dionaea.capture',] IDENT = '' SECRET = '' OUTFILE = 'hpfeedcsv.log' def main(): try: outfd = open(OUTFILE, 'a') except: ...
# -*- coding: utf-8 -*- from django.test import TestCase from djangocms_text_ckeditor import html, settings class HtmlSanitizerAdditionalProtocolsTests(TestCase): def test_default_tag_escaping(self): settings.TEXT_ADDITIONAL_TAGS = [] parser = html._get_default_parser() text = html.clean...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'TimelineItem' db.create_table('timeline_timelineitem', ( ('id', self.gf('django....
class Solution(object): def isMatch(self, s, p): """ :type s: str :type p: str :rtype: bool """ n_s = len(s) n_star = 0 seg = [] i = len(p) - 1 while i > -1: if p[i] == '*': n_star += 1 ...
from __future__ import unicode_literals from django.core.management.base import BaseCommand from django.db.models import Model from django.db.transaction import atomic from shoop.core.defaults.order_statuses import create_default_order_statuses from shoop.core.models import ( Category, OrderStatus, PaymentMethod, P...
import os import subprocess import time import unittest import qubes.devices import qubes.ext.pci import qubes.tests @qubes.tests.skipUnlessEnv('QUBES_TEST_PCIDEV') class TC_00_Devices_PCI(qubes.tests.SystemTestCase): def setUp(self): super(TC_00_Devices_PCI, self).setUp() if self._testMethodName...
import logging try: from urllib import urlencode except ImportError: # python3 fix from urllib.parse import urlencode from .utils import json from .clients import Client from .cursor import Cursor from .db import Database __all__ = ("Connection", "Response", "Resultset") logger = logging.get...
""" In a row of seats, 1 represents a person sitting in that seat, and 0 represents that the seat is empty. There is at least one empty seat, and at least one person sitting. Alex wants to sit in the seat such that the distance between him and the closest person to him is maximized. Return that maximum distance to c...