content
stringlengths
4
20k
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import pytest import sys if sys.version_info < (2, 7): pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7") from ansible.module_utils.basic import AnsibleModule try: from librar...
"""Traversing Python modules and classes.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys from tensorflow.python.util import tf_inspect __all__ = ['traverse'] def _traverse_internal(root, visit, stack, path): """Internal helper for trave...
#!/usr/bin/env python """ Get ansible vault password from a local pass vault. pass: https://www.passwordstore.org/ apt install pass brew install pass """ import sys import shlex import subprocess from pathlib import Path VAULT_NAME='oxborrow.net/ansible/vault' def find_pass() -> str: locations = [ Path...
from operator import add import time import pytest pytest.importorskip('dask.distributed') from tornado import gen from streamz.dask import scatter from streamz import Stream from distributed import Future, Client from distributed.utils import sync from distributed.utils_test import gen_cluster, inc, cluster, loop,...
""" Utility classes for defining the time saving transfer of data from the reader to the write using a LightQueue as a Pipe between the reader and the writer. """ from eventlet import event from eventlet import greenthread from eventlet import queue from nova import exception from nova.openstack.common.gettextutils i...
import unittest import sys from test import test_support class G: 'Sequence using __getitem__' def __init__(self, seqn): self.seqn = seqn def __getitem__(self, i): return self.seqn[i] class I: 'Sequence using iterator protocol' def __init__(self, seqn): self.seqn = seqn ...
from __future__ import absolute_import from collections import Mapping, MutableMapping try: from threading import RLock except ImportError: # Platform-specific: No threads available class RLock: def __enter__(self): pass def __exit__(self, exc_type, exc_value, traceback): ...
# -*- coding: utf-8 -*- from matplotlib import gridspec import math import matplotlib import nanopores as nano import nanopores.geometries.pughpore as pughpore import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter import numpy as np import os import sys import nanopores.tools.fields as f HOME...
import asyncio import secrets import aiohttp import discord from lxml import html from .mech.utils import scramble ongoing_list = [] async def animechargame(cmd, message, args): if message.channel.id not in ongoing_list: try: ongoing_list.append(message.channel.id) mal_icon = 'h...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import atexit import errno import mmap import socket import traceback from ansible.module_u...
""" Copyright (C) 2016 Quinn D Granfor <<EMAIL>> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT AN...
""" 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 not use this ...
"""Test the wallet.""" from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * class WalletTest (BitcoinTestFramework): def check_fee_amount(self, curr_balance, balance_with_fee, fee_per_byte, tx_size): """Return curr_balance after asserting the fee was in range"""...
"""A parser of RFC 2822 and MIME email messages.""" __all__ = ['Parser', 'HeaderParser'] import warnings from cStringIO import StringIO from email.feedparser import FeedParser from email.message import Message class Parser: def __init__(self, *args, **kws): """Parser of RFC 2822 and MIME email messag...
import numpy as np import numpy.testing as npt import pandas as pd from unittest import TestCase, main from skbio import OrdinationResults from skbio.stats.ordination import rda from skbio.util import get_data_path, assert_ordination_results_equal class TestRDAErrors(TestCase): def setUp(self): pass ...
"""turtledemo.two_canvases Use TurtleScreen and RawTurtle to draw on two distinct canvases in a separate windows. The new window must be separately closed in addition to pressing the STOP button. """ from turtle import TurtleScreen, RawTurtle, TK def main(): root = TK.Tk() cv1 = TK.Canvas(root, width=300, he...
#!/usr/bin/env python #-*- coding: UTF-8 -*- """ This module uses the sample.py script to load all test models it finds. Note: this is not an exhaustive test suite, it does not check the data structures in detail. It just verifies whether basic loading and querying of 3d models using pyassimp works. """ import os im...
#!env/python3 # coding: utf-8 import ipdb import os import json import datetime import uuid import psycopg2 import hashlib import asyncio import ped_parser from config import * from core.framework.common import * from core.model import * # =========================================================================...
from django import forms from readthedocs.builds.models import VersionAlias, Version from readthedocs.projects.models import Project from readthedocs.core.utils import trigger_build class AliasForm(forms.ModelForm): class Meta: model = VersionAlias fields = ( 'project', '...
from weboob.tools.test import BackendTest from weboob.capabilities.base import NotLoaded class ParolesnetTest(BackendTest): MODULE = 'parolesnet' def test_search_song_n_get(self): l_lyrics = list(self.backend.iter_lyrics('song', 'chien')) for songlyrics in l_lyrics: assert songlyr...
import shutil from spack import * class Qbox(MakefilePackage): """Qbox is a C++/MPI scalable parallel implementation of first-principles molecular dynamics (FPMD) based on the plane-wave, pseudopotential formalism. Qbox is designed for operation on large parallel computers.""" homepage = "http://qbox...
"""Integrate with DuckDNS.""" from asyncio import iscoroutinefunction from datetime import timedelta import logging import voluptuous as vol from homeassistant.const import CONF_ACCESS_TOKEN, CONF_DOMAIN from homeassistant.core import CALLBACK_TYPE, callback from homeassistant.helpers.aiohttp_client import async_get_...
import time import datetime from openerp.osv import fields, osv from openerp import tools from openerp.tools.translate import _ class project_project(osv.osv): _inherit = 'project.project' def onchange_partner_id(self, cr, uid, ids, part=False, context=None): res = super(project_project, self).onchan...
from concurrent import futures import time import unittest import grpc from grpc.framework.foundation import logging_pool from tests.unit.framework.common import test_constants import grpc_testing from tests.testing import _application_common from tests.testing import _application_testing_common from tests.testing im...
import user_timesheet import users_timesheet # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
import os import sys import fnmatch import xml.sax.saxutils from gi.repository import GObject, Gio, GLib, Gdk, Gtk, Pango, Pluma from .virtualdirs import VirtualDirectory class Popup(Gtk.Dialog): __gtype_name__ = "QuickOpenPopup" def __init__(self, window, paths, handler): Gtk.Dialog.__init__(self, ...
""" Packet Driver """ from libcloud.utils.py3 import httplib from libcloud.common.base import ConnectionKey, JsonResponse from libcloud.compute.types import Provider, NodeState, InvalidCredsError from libcloud.compute.base import NodeDriver, Node from libcloud.compute.base import NodeImage, NodeSize, NodeLocation fro...
# -*- coding: utf-8 -*- """ jinja2.testsuite.core_tags ~~~~~~~~~~~~~~~~~~~~~~~~~~ Test the core tags like for and if. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import pytest from jinja2 import Environment, TemplateSyntaxError, UndefinedError, \ D...
from fire_risk.models import DIST from fire_risk.models.DIST.providers.ahs import ahs_building_areas from fire_risk.backends import PostgresBackend from fire_risk.backends.queries import RESIDENTIAL_FIRES_BY_FDID_STATE from firecares.firestation.models import FireDepartment from django.core.management.base import BaseC...
"""Fixes bug 907305 - Add processed_crashes Revision ID: 1aa9adb91413 Revises: 4d8345089e2a Create Date: 2014-02-12 11:35:48.115591 """ # revision identifiers, used by Alembic. revision = '1aa9adb91413' down_revision = '4d8345089e2a' from alembic import op from socorro.lib import citexttype, jsontype, buildtype fro...
from ..lib.hl_api_types import CreateParameter __all__ = [ 'exponential', 'lognormal', 'normal', 'uniform', 'uniform_int', ] def uniform(min=0.0, max=1.0): """ Draws samples from a uniform distribution. Samples are distributed uniformly in [min, max) (includes min, but excludes max)....
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from dnf.i18n import _ import dnf.logging import dnf.pycomp import dnf.util import fnmatch import glob import importlib import iniparse.compat import inspect import logging import operator import os imp...
''' Graphics ======== This package assemble all low level function to draw object. The whole graphics package is compatible OpenGL ES 2.0, and have a lot of rendering optimizations. The basics ---------- For drawing on a screen, you will need : 1. a :class:`~kivy.graphics.instructions.Canvas` object. 2. :cl...
from sahara.utils import patches patches.patch_all() import os import sys import oslo_i18n # If ../sahara/__init__.py exists, add ../ to Python search path, so that # it will override what happens to be installed in /usr/(local/)lib/python... possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[...
# cs.???? = currentstate, any variable on the status tab in the planner can be used. # Script = options are # Script.Sleep(ms) # Script.ChangeParam(name,value) # Script.GetParam(name) # Script.ChangeMode(mode) - same as displayed in mode setup screen 'AUTO' # Script.WaitFor(string,timeout) # Script.SendRC(channel,pwm...
from django.core.urlresolvers import reverse from tastypie import authorization from tastypie.authentication import MultiAuthentication from crits.events.event import Event from crits.events.handlers import add_new_event from crits.core.api import CRITsApiKeyAuthentication, CRITsSessionAuthentication from crits.core.a...
from boto.exception import BotoServerError class InternalServerException(BotoServerError): pass class LimitExceededException(BotoServerError): pass class IdempotentParameterMismatchException(BotoServerError): pass class ResourceInUseException(BotoServerError): pass class ResourceNotFoundExcept...
import unittest from collections import deque import numpy as np import pandas as pd import pandas.util.testing as tm from zipline.utils.data import RollingPanel class TestRollingPanel(unittest.TestCase): def test_basics(self): items = ['foo', 'bar', 'baz'] minor = ['A', 'B', 'C', 'D'] ...
from setuptools import setup, find_packages with open('README.md', 'r') as fh: long_description = fh.read() with open('requirements.txt', 'r') as fr: requirements = fr.read().splitlines() setup( name='wloc', version='0.7.0', packages=find_packages(exclude=['tests']), package_dir={ 'wl...
# -*- coding: utf-8 -*- """ Copyright 2015 Telefonica Investigación y Desarrollo, S.A.U This file is part of telefonica-iotqatools iotqatools 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, either version...
#################################################################################################### # Copyright 2013 John Crawford # # This file is part of PatchCorral. # # PatchCorral is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the ...
""" Helper module for Python version 2.6 and below - Ordered dictionaries - Encoding/decoding urls - Unicode - Exception handling (except Exception, e) """ import base64 from urllib import unquote, quote try: from ordereddict import OrderedDict except: pass def modulename(): return "Helper module for Python versio...
import re from queue import Queue import pytest import itertools from telegram.utils.deprecate import TelegramDeprecationWarning from telegram import Message, Update, Chat, Bot from telegram.ext import CommandHandler, Filters, CallbackContext, JobQueue, PrefixHandler from tests.conftest import ( make_command_mess...
from __future__ import unicode_literals import numpy as np from sklearn.feature_extraction import FeatureHasher from nose.tools import assert_raises, assert_true from numpy.testing import assert_array_equal, assert_equal def test_feature_hasher_dicts(): h = FeatureHasher(n_features=16) assert_equal("dict",...
"""Signal processing operations. See the [tf.signal](https://tensorflow.org/api_guides/python/contrib.signal) guide. @@frame @@hamming_window @@hann_window @@inverse_stft @@inverse_stft_window_fn @@mfccs_from_log_mel_spectrograms @@linear_to_mel_weight_matrix @@overlap_and_add @@stft [hamming]: https://en.wikipedia....
import pyeclib from pyeclib.ec_iface import ECDriver import random import string import sys import os import argparse parser = argparse.ArgumentParser( description='PyECLib tool to determine fragment indexes needed to ' 'recover missing fragments.') parser.add_argument('k', type=int, help='number o...
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ Init database Create tables Insert data Query data """ from sqlalchemy import * # from sqlalchemy.orm import * #define egine engine = create_engine('sqlite:///../DB/raspberrypi.db') #bind metadata metadata = MetaData(engine) #create tables, init database pilot = Ta...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['stableinterface'], 'supported_by': 'community'} OLD_SLACK_INCOMING_WEBHOOK = 'https://%s/services/hooks/incoming-webhook?token=%s' SLACK_INCOMING_WEBHOOK = 'https://hooks.slack.com/services/%s' # Escaping quotes and ap...
import difflib import itertools import sys import time import vim # Mercurial's graphlog code -------------------------------------------------------- def asciiedges(seen, rev, parents): """adds edge info to changelog DAG walk suitable for ascii()""" if rev not in seen: seen.append(rev) nodeidx = ...
""" This module defines tests for courseware.access that are specific to group access control rules. """ import ddt from nose.plugins.attrib import attr from stevedore.extension import Extension, ExtensionManager from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.fac...
import logging import re from django import http from django.conf import settings from django.core import urlresolvers from django.core.exceptions import PermissionDenied from django.core.mail import mail_managers from django.utils.cache import get_conditional_response, set_response_etag from django.utils.encoding imp...
""" Example smearing script This script: * Reads in spectrum from hdf5 * Rebins spectrum with user input number of bins * Saves rebinned spectrum to given output or, by default, to the same directory with _rebin added to the filename. Examples: To rebin hdf5 file ``example.hdf5`` that has 3 dimensions wit...
#!/usr/bin/env python """ setup.py for installing F2PY Usage: python setup.py install Copyright 2001-2005 Pearu Peterson all rights reserved, Pearu Peterson <<EMAIL>> Permission to use, modify, and distribute this software is given under the terms of the NumPy License. NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT...
from pyrcon import RConnection class q2RConnection(RConnection): current_map = '' Players = [] def __init__(self, host=None, port=27910, password=None): super(Q2RConnection, self).__init__(host, port, password) self._maplist = self.maplist() self.servervariables() def statu...
import unittest import json import os from pokemongo_bot import PokemonGoBot, ConfigException, MismatchTaskApiVersion, TreeConfigBuilder, PluginLoader, BaseTask from pokemongo_bot.cell_workers import HandleSoftBan, CatchPokemon from pokemongo_bot.test.resources.plugin_fixture import FakeTask, UnsupportedApiTask def co...
class Proxy(object): """ This class represents the information of a proxy """ def __init__(self, use_proxy=False, host='', port='', use_auth=False, user='', passwd=''): """ Constructor. use_proxy -- boolean that indicates if the proxy should be used host...
__doc__ = """ Compatibility idioms for builtins names This module adds names to the builtins module for things that we want to use in SCons but which don't show up until later Python versions than the earliest ones we support. This module checks for the following builtins names: all() any() m...
""" FastCGI (or SCGI, or AJP1.3 ...) server that implements the WSGI protocol. Uses the flup python package: http://www.saddi.com/software/flup/ This is a adaptation of the flup package to add FastCGI server support to run Django apps from Web servers that support the FastCGI protocol. This module can be run standalo...
import logging from ringo.lib.imexport import ( JSONExporter, CSVExporter, XLSXExporter ) from ringo.lib.renderer import ( ExportDialogRenderer ) from ringo.views.helpers import get_item_from_request from ringo.views.base.list_ import set_bundle_action_handler log = logging.getLogger(__name__) def ex...
import metomi.rose.config import metomi.rose.macro import metomi.rose.variable _OPTIONS_KEY = "options" _REPORTED_SECTION_KEY = "reported config sect" _SECTION_IS_COMPULSORY_KEY = "section is compulsory" class CompulsoryChecker(metomi.rose.macro.MacroBaseRoseEdit): """Returns sections and options that are comp...
""" Directives for additional body elements. See `docutils.parsers.rst.directives` for API details. """ __docformat__ = 'reStructuredText' import sys from docutils import nodes from docutils.parsers.rst import Directive from docutils.parsers.rst import directives from docutils.parsers.rst.roles import set_classes f...
#!/usr/bin/python from __future__ import print_function from usb import USBError import usb.core, usb.util from array import array from collections import defaultdict, Counter import logging, time, sys import threading log = logging.getLogger(__name__) class Command(object): def __init__(self, byte_array=None):...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.core.validators class Migration(migrations.Migration): dependencies = [ ('gym', '0006_auto_20150401_1542'), ] operations = [ migrations.RenameField( model_n...
""" Tests for split_migrator """ import random import uuid import mock from nose.plugins.attrib import attr from xblock.fields import Reference, ReferenceList, ReferenceValueDict, UNIQUE_ID from xmodule.modulestore.split_migrator import SplitMigrator from xmodule.modulestore.tests.test_split_w_old_mongo import Split...
from django.db.backends.creation import BaseDatabaseCreation class DatabaseCreation(BaseDatabaseCreation): # This dictionary maps Field objects to their associated MySQL column # types, as strings. Column-type strings can contain format strings; they'll # be interpolated against the values of Field.__dict...
from LogAnalyzer import Test,TestResult import DataflashLog class TestEvents(Test): '''test for erroneous events and failsafes''' # TODO: need to check for vehicle-specific codes def __init__(self): Test.__init__(self) self.name = "Event/Failsafe" def run(self, logdata, verbose): self.result = TestResult(...
#!/usr/bin/env python # -*- coding: utf-8 -*- from runner.koan import * class AboutComprehension(Koan): def test_creating_lists_with_list_comprehensions(self): feast = ['lambs', 'sloths', 'orangutans', 'breakfast cereals', 'fruit bats'] comprehension = [delicacy.capitalize() for de...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.compat.tests.mock import patch from ansible.modules.network.nxos import nxos_banner from .nxos_module import TestNxosModule, set_module_args class TestNxosBannerModule(TestNxosModule): module = nxos_banner ...
import datetime import io import logging import os import re from urllib.parse import urlparse from flask import jsonify from github import Github # type: ignore from unidiff import PatchSet # type: ignore import lib.utils from app.exceptions import InvalidIdentifierException from lib.vcs_handler.vcs_handler impo...
""" Various data structures used in query construction. Factored out from django.db.models.query to avoid making the main module very large and/or so that they can be used by other modules without getting into circular import difficulties. """ import functools import inspect from collections import namedtuple from dj...
from __future__ import absolute_import, division, print_function __metaclass__ = type import pytest from ansible.errors import AnsibleParserError from ansible.parsing.mod_args import ModuleArgsParser from ansible.utils.sentinel import Sentinel class TestModArgsDwim: # TODO: add tests that construct ModuleArgsP...
from sys import argv from rdflib import Graph, RDF, Namespace, Literal, URIRef import logging logging.basicConfig() g = Graph() movie = Namespace('http://data.linkedmdb.org/resource/movie/') g.bind('movie',movie) oddlinker = Namespace('http://data.linkedmdb.org/resource/oddlinker/') g.bind('oddlinker',oddli...
import mock import pecan from pecan.testing import load_test_app from oslo_config import cfg import st2common.bootstrap.runnersregistrar as runners_registrar from st2common.rbac.types import SystemRole from st2common.persistence.auth import User from st2common.persistence.rbac import UserRoleAssignment from st2common...
"""The tests for the Demo vacuum platform.""" import unittest from homeassistant.components import vacuum from homeassistant.components.vacuum import ( ATTR_BATTERY_LEVEL, ATTR_COMMAND, ATTR_ENTITY_ID, ATTR_FAN_SPEED, ATTR_FAN_SPEED_LIST, ATTR_PARAMS, ATTR_STATUS, DOMAIN, ENTITY_ID_ALL_VACUUMS, SERVICE...
# -*- coding: utf-8 -*- """ Display the total number of open tickets from GLPI. Configuration parameters: - critical : set bad color above this threshold - db : database to use - host : database host to connect to - password : login password - user : login user - warning : set degraded color ab...
import m5 from m5.objects import * m5.util.addToPath('../configs/') from common.Caches import * #MAX CORES IS 8 with the fals sharing method nb_cores = 8 cpus = [ MemTest() for i in xrange(nb_cores) ] # system simulated system = System(cpu = cpus, physmem = SimpleMemory(), membus = Sys...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.network.fort...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} import os import os.path import tempfile from ansible.module_utils.basic import AnsibleModu...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} try: from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver from libcloud.loadbalancer.types import Provider as Provider_lb ...
# Dialog.py -- Tkinter interface to the tk_dialog script. from Tkinter import * from Tkinter import _cnfmerge if TkVersion <= 3.6: DIALOG_ICON = 'warning' else: DIALOG_ICON = 'questhead' class Dialog(Widget): def __init__(self, master=None, cnf={}, **kw): cnf = _cnfmerge((cnf, kw)) self....
from lib.hachoir_core.field import Field, FieldSet, ParserError, Bytes, MissingField from lib.hachoir_core.stream import FragmentedStream class Link(Field): def __init__(self, parent, name, *args, **kw): Field.__init__(self, parent, name, 0, *args, **kw) def hasValue(self): return True d...
""" ExactTarget OAuth support. Support Authentication from IMH using JWT token and pre-shared key. Requires package pyjwt """ from datetime import timedelta, datetime import jwt from social.exceptions import AuthFailed, AuthCanceled from social.backends.oauth import BaseOAuth2 class ExactTargetOAuth2(BaseOAuth2): ...
#!/usr/bin/env python3 """Generate an updated requirements_all.txt.""" import importlib import os import pkgutil import re import sys COMMENT_REQUIREMENTS = ( 'RPi.GPIO', 'rpi-rf', 'Adafruit_Python_DHT', 'Adafruit_BBIO', 'fritzconnection', 'pybluez', 'bluepy', 'python-lirc', 'gattli...
""" Set of searching filters. """ __import__('pkg_resources').declare_namespace(__name__)
""" This is a localdev test for the Microsite processing pipeline """ # We intentionally define lots of variables that aren't used, and # want to import all variables from base settings files # pylint: disable=W0401, W0614 from .dev import * from ..dev import ENV_ROOT, FEATURES MICROSITE_CONFIGURATION = { "opene...
from vent.helpers.templates import Template def test_options(): """ Test the options function """ instance = Template() instance.options('foo') def test_option(): """ Test the option function """ instance = Template() instance.option('foo', 'bar') def test_add_option(): """ Test the ad...
"""Locked file interface that should work on Unix and Windows pythons. This module first tries to use fcntl locking to ensure serialized access to a file, then falls back on a lock file if that is unavialable. Usage: f = LockedFile('filename', 'r+b', 'rb') f.open_and_lock() if f.is_locked(): ...
import sys from os.path import dirname, join import pygame from rx import operators as ops from rx.subject import Subject from rx.scheduler.mainloop import PyGameScheduler #FORMAT = '%(asctime)-15s %(threadName)s %(message)s' #logging.basicConfig(format=FORMAT, level=logging.DEBUG) #log = logging.getLogger('Rx') d...
""" Quick conversion command module. """ from __future__ import print_function from optparse import make_option import sys from django.core.management.base import BaseCommand from django.core.management.color import no_style from django.conf import settings from django.db import models from django.core import manage...
__author__ = 'akarapetyan' from numpy import loadtxt # A simple function for reading the file and checking whether it is compatible with the input rules def checkMe(function): #Loading the input file temp = loadtxt('test.in', dtype='str') #Checking if the input parameters are right if temp[0].isdigit(...
from nltk.parse.stanford import StanfordParser from nltk.stem.porter import PorterStemmer from nltk.tokenize import sent_tokenize, word_tokenize import math class SentenceParser: __parser = None __alpha = 1.0 __beta = 1.0 __gamma = 0.1 __var_d = 0.0 __var_s = 0.0 d...
"""This test checks for correct wait4() behavior. """ import os import time import sys from test.fork_wait import ForkWait from test.support import run_unittest, reap_children, get_attribute # If either of these do not exist, skip this test. get_attribute(os, 'fork') get_attribute(os, 'wait4') class Wait4Test(ForkW...
import os import sys from setuptools import setup, find_packages # When pip installs anything from packages, py_modules, or ext_modules that # includes a twistd plugin (which are installed to twisted/plugins/), # setuptools/distribute writes a Package.egg-info/top_level.txt that includes # "twisted". If you later un...
''' @author: Pedram Amini @license: GNU General Public License 2.0 or later @contact: <EMAIL> @organization: www.openrce.org ''' from my_ctypes import * from defines import * # macos compatability. try: kernel32 = windll.kernel32 except: kernel32 = CDLL("libmacdll.dylib") class pdx (Excepti...
''' Provides unit tests for the Json-RPC2 client-server integration. ''' import random import unittest from jsonrpc2 import base from jsonrpc2 import client from jsonrpc2 import server from jsonrpc2 import errors class TestIface(server.JsonRpcIface): def test_result(self, a, b=2): self.server.request = s...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = { 'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community' } DOCUMENTATION = r''' --- module: vmware_host_vmnic_facts short_description: Gathers facts about vmnics available on th...
# coding=utf-8 from tkinter import * import numpy as np from numpy import array as vector from numpy.linalg import norm as normalize import random from math import sqrt, sin, cos from Box2D import (b2PolygonShape, b2World, b2CircleShape) WIDTH = 800 HEIGHT = 600 mousepos = np.array([WIDTH / 2, HEIGHT / 2]) is_mouse...
from __future__ import unicode_literals from django.core import management from django.core.management import CommandError from django.test import TestCase from .models import Article class SampleTestCase(TestCase): fixtures = ['fixture1.json', 'fixture2.json'] def testClassFixtures(self): "Test ca...
import logging import time from openerp.osv import fields, osv _logger = logging.getLogger(__name__) class payment_mode(osv.osv): _name= 'payment.mode' _description= 'Payment Mode' _columns = { 'name': fields.char('Name', required=True, help='Mode of Payment'), 'bank_id': fields.many2one(...
from django.conf import settings from django.conf.urls import url from django.contrib import admin, messages from django.contrib.admin.options import IS_POPUP_VAR from django.contrib.admin.utils import unquote from django.contrib.auth import update_session_auth_hash from django.contrib.auth.forms import ( AdminPass...