code
stringlengths
1
1.72M
language
stringclasses
1 value
""" Settings module Nuka1195 """ import sys import os import xbmc import xbmcgui from resources.lib.utilities import * _ = sys.modules[ "__main__" ].__language__ __scriptname__ = sys.modules[ "__main__" ].__scriptname__ __version__ = sys.modules[ "__main__" ].__version__ __svn_revision__ = sys.modul...
Python
""" Update module Nuka1195 """ import sys import os import xbmcgui import urllib import socket from sgmllib import SGMLParser socket.setdefaulttimeout( 10 ) _ = sys.modules[ "__main__" ].__language__ __scriptname__ = sys.modules[ "__main__" ].__scriptname__ __version__ = sys.modules[ "__main__" ]._...
Python
""" Language module Nuka1195 """ import os import xbmc import xml.dom.minidom class Language: """ Language Class: creates a dictionary of localized strings { int: string } """ def __init__( self ): """ initializer """ # language folder base_path = os.path.join( os.get...
Python
""" Credits modules Nuka1195 """ import sys import xbmcgui from resources.lib.utilities import * _ = sys.modules[ "__main__" ].__language__ __scriptname__ = sys.modules[ "__main__" ].__scriptname__ __version__ = sys.modules[ "__main__" ].__version__ __svn_url__ = sys.modules[ "__main__" ].__svn_url__ ...
Python
""" Credits: EnderW: Original Author Stanley87: PM3 Integration and AD Removal solexalex: TomKun: Thor918: MyPlayer Class Smuto: Skinning Mod Spiff: Unicode support Nuka1195: lyricwiki & embedded Scraper and Modulization Please report any bugs: http://www.xboxmedi...
Python
""" Catchall module for shared functions and constants Nuka1195 """ import sys import os import xbmc import xbmcgui DEBUG_MODE = 0 _ = sys.modules[ "__main__" ].__language__ __scriptname__ = sys.modules[ "__main__" ].__scriptname__ __version__ = sys.modules[ "__main__" ].__version__ __svn_revision__...
Python
# Dummy file to make this directory a package.
Python
""" This script will create a playlist by recursively searching MUSIC_PATH and adding songs. """ import os import xbmc # add all music paths here, no subdirectories needed MUSIC_PATH = ( "E:\\Music", "F:\\Music", ) # add all music extensions wanted in lowercase MUSIC_EXT = ".nsv|.m4a|.flac|.aac|.strm|.pls|.rm|...
Python
# XBMC Lyrics script revision: 2111 - built with build.bat version 1.0 # # main import's import sys import os import xbmcgui import xbmc # Script constants __scriptname__ = "XBMC Lyrics" __author__ = "XBMC Lyrics Team" __url__ = "http://code.google.com/p/xbmc-scripting/" __svn_url__ = "http://xbmc-scrip...
Python
#!/usr/bin/python # # Lightpack hardware main tests # import lightpack, time, re, random, sys print ('') print ('Lightpack hardware main tests') print ('') print ('WARN: Disable authorization for proper execution of the script.') print (' Open software, check "Profiles->Expert mode" and off auth on "Dev tab".')...
Python
import socket, time, imaplib, re, sys class lightpack: # host = '127.0.0.1' # The remote host # port = 3636 # The same port as used by the server # apikey = 'key' # Secure API key which generates by Lightpack software on Dev tab # ledMap = [1,2,3,4,5,6,7,8,9,10] #mapped LEDs def __init...
Python
#inaccurate pyLightpack class animation examples for 10 LED Lightpack configuration (3+2+3+2 clockwise from the left edge). import lightpack, time, re, random lpack = lightpack.lightpack('127.0.0.1', 3636, [2,3,6,7,8,9,10,4,5,1] ) lpack.connect() lpack.lock() first = True while True : for k in range (0, 10...
Python
from xml.dom import minidom from xml.dom import EMPTY_NAMESPACE try: import json except ImportError: import simplejson as json import lightpack import time import urllib import urllib2 username = '***********' password = '*************' lpack = lightpack.lightpack('127.0.0.1', 3636, [2,3,6,7,8,9,10,...
Python
#Skype contact waiting script. It flashes Lightpack when target buddy in contact list are changed his online status. #You need Skype4Py module and lightpack.py class for using it. import Skype4Py, lightpack, time, sys skype = Skype4Py.Skype() # Create an instance of the Skype class lpack = lightpack.lightpack('...
Python
#inaccurate pyLightpack class animation examples for 10 LED Lightpack configuration (3+2+3+2 clockwise from the left edge). import lightpack, time, re, random lpack = lightpack.lightpack('127.0.0.1', 3636, [2,3,6,7,8,9,10,4,5,1] ) lpack.connect() lpack.lock() print ('***pyLightpack animation examples (read scr...
Python
# Gmail checker script. It check you mail thru IMAP and run clockwise "snake" effect if you have unread messages in the box import lightpack, time, imaplib, re, getpass def gmail_checker(username,password): import imaplib,re i=imaplib.IMAP4_SSL('imap.gmail.com') try: i....
Python
import socket, time, imaplib, re, sys class lightpack: # host = '127.0.0.1' # The remote host # port = 3636 # The same port as used by the server # apikey = 'key' # Secure API key which generates by Lightpack software on Dev tab # ledMap = [1,2,3,4,5,6,7,8,9,10] #mapped LEDs def __init...
Python
""" addons.xml generator """ import os import md5 class Generator: """ Generates a new addons.xml file from each addons addon.xml file and a new addons.xml.md5 hash file. Must be run from the root of the checked-out repo. Only handles single depth folder structure. """ def __init_...
Python
import Global proc_name = '' local_flag = 0 index = -1 s_index = 0 sav1 = '' sav2 = '' l_parameter = {} l_value = [] env = ['.486\n.model flat, stdcall\noption casemap: none\n', 'include \masm32\include\windows.inc\n', 'include \masm32\include\kernel32.inc\n', 'include \masm32\include\m...
Python
import io from collections import deque import Global, Parser def printSemanticsStack(): if Global.flag[12] == 1: Global.outputFile.write(' The semantics stack now: ') for i in range(len(Global.semantics_stack)): Global.outputFile.write(Global.semantics_stack[i]+' | ') Global....
Python
from collections import deque flag = [0 for x in range(0, 32)] outputFile = '' count_line = 0 tokens = {} lexical_queue = deque([]) symbol_queue = deque([]) semantics_queue = deque([]) count_syntax_stack = 0 syntax_stack = [0] symbol_stack = [] semantics_stack = [] symbol_table = [[],[]] index = 0 T_m = 0 L_m =...
Python
import io, re import Global flag_l = 0 tokensPath = './Tokens.txt' def insertToQueue(s1, s2, s3): Global.lexical_queue.append(s1) Global.symbol_queue.append(s2) Global.semantics_queue.append(s3) def importTokens(): tokensFile = file(tokensPath, 'r') i = 1 for line in tokensFile: Globa...
Python
import datetime, sys import Global, Lexical, Parser, Semantics, Pragmatics testDataPath = './Parser_Test_Data.txt' #testDataErrorPath = './Parser_Test_Data_Error.txt' outputPath = './output.txt' if len(sys.argv) == 3 : testDataPath = sys.argv[1] outputPath = sys.argv[2]; testDataFile = open(testDataPath, 'r'...
Python
import io, re, string from collections import deque import Global,Semantics matrixPath = './Matrix.txt' reductionPath = './Reduction.txt' flag_insert = 0 matrix = [] reductions = [] def pushStack(): Global.syntax_stack.append(Global.lexical_queue.popleft()) Global.symbol_stack.append(Global.symbol_queue.popl...
Python
#==================================================================== # 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 ...
Python
#!/usr/bin/env python #text = None #name = '/opt/local/include/curl/curl.h' #name = '/usr/include/curl/curl.h' #f = open(name) #text = f.read() #f.close(); import sys text = sys.stdin.read() import re longargs = []; objargs = []; fnargs = []; print "static JSConstDoubleSpec easycurl_options[] = {" for mo in re.fin...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __version__ = '1.0' __author__ = 'Liao Xuefeng (askxuefeng@gmail.com)' ''' Python client SDK for sina weibo API using OAuth 1.0 ''' try: import json except ImportError: import simplejson as json import time import hmac import uuid import base64 import urllib impo...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __version__ = '1.04' __author__ = 'Liao Xuefeng (askxuefeng@gmail.com)' ''' Python client SDK for sina weibo API using OAuth 2. ''' try: import json except ImportError: import simplejson as json import time import urllib import urllib2 import logging def _obj_ho...
Python
#!/usr/bin/env python """ client module for memcached (memory cache daemon) Overview ======== See U{the MemCached homepage<http://www.danga.com/memcached>} for more about memcached. Usage summary ============= This should give you a feel for how this module operates:: import memcache mc = memcache.Client(...
Python
# mako/runtime.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """provides runtime services for templates, including Context, Namespace, and various helper funct...
Python
# mako/codegen.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """provides functionality for rendering a parsetree constructing into module source code.""" impo...
Python
# mako/pygen.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """utilities for generating and formatting literal Python code.""" import re, string from StringIO ...
Python
# mako/cache.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php from mako import exceptions cache = None class BeakerMissing(object): def get_cache(self, name...
Python
# mako/filters.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php import re, urllib, htmlentitydefs, codecs from StringIO import StringIO from mako import util xm...
Python
# mako/template.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """Provides the Template class, a facade for parsing, generating and executing template strings, ...
Python
# mako/util.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php import sys py3k = getattr(sys, 'py3kwarning', False) or sys.version_info >= (3, 0) py24 = sys.versi...
Python
# mako/exceptions.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """exception classes""" import traceback, sys, re from mako import util class MakoException(E...
Python
# mako/pyparser.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """Handles parsing of Python code. Parsing to AST is done via _ast on Python > 2.5, otherwise th...
Python
# mako/ast.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """utilities for analyzing expressions and blocks of Python code, as well as generating Python from A...
Python
# ext/preprocessors.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """preprocessing functions, used with the 'preprocessor' argument on Template, TemplateLooku...
Python
# ext/pygmentplugin.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php import re try: set except NameError: from sets import Set as set from pygments.lexer...
Python
# ext/turbogears.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php import re, inspect from mako.lookup import TemplateLookup from mako.template import Template cl...
Python
# ext/babelplugin.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """gettext message extraction via Babel: http://babel.edgewall.org/""" from StringIO import Str...
Python
# ext/autohandler.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """adds autohandler functionality to Mako templates. requires that the TemplateLookup class is...
Python
# mako/__init__.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php __version__ = '0.5.0'
Python
# mako/lexer.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """provides the Lexer class for parsing template strings into parse trees.""" import re, codecs fro...
Python
# mako/parsetree.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """defines the parse tree components for Mako templates.""" from mako import exceptions, ast, u...
Python
# mako/_ast_util.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """ ast ~~~ The `ast` module helps Python applications to process trees of the Pyth...
Python
# mako/lookup.py # Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php import os, stat, posixpath, re from mako import exceptions, util from mako.template import Template...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao' import json import time from datetime import date from datetime import datetime from datetime import timedelta import urllib2 import hashlib import logging import web from weibo import APIClient from framework import handler from framework i...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging import web from framework import WebError import urls __author__ = 'Michael Liao' class PageHandler(object): def __init__(self): self.mapping = {} for s in dir(urls): f = getattr(urls, s) if callable(f) and ge...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging import web from framework import WebError import urls __author__ = 'Michael Liao' class PageHandler(object): def __init__(self): self.mapping = {} for s in dir(urls): f = getattr(urls, s) if callable(f) and ge...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging import os import web import uuid from mako.lookup import TemplateLookup from mako import exceptions __author__ = 'Michael Liao' class emptyobject(object): def __getattr__(self, attr): return '' def __setattr__(self, attr, value): ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- APP_KEY = 'hidden' APP_SECRET = 'hidden'
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __version__ = '1.04' __author__ = 'Liao Xuefeng (askxuefeng@gmail.com)' ''' Python client SDK for sina weibo API using OAuth 2. ''' try: import json except ImportError: import simplejson as json import time import urllib import urllib2 import logging def _obj_ho...
Python
import os, time class MyException(Exception): pass def passing(*args): pass def sleeping(s): seconds = s while seconds > 0: time.sleep(min(seconds, 0.1)) seconds -= 0.1 os.environ['ROBOT_THREAD_TESTING'] = str(s) return s def returning(arg): return arg def failing(msg='...
Python
#!/usr/bin/env python """Helper script to run all Robot Framework's unit tests. usage: run_utest.py [options] options: -q, --quiet Minimal output -v, --verbose Verbose output -d, --doc Show test's doc string instead of name and class (implies verbosity) -h, --help ...
Python
#!/usr/bin/env python import urllib2 import shutil import os from os.path import join, exists, dirname, abspath from glob import glob from subprocess import call from zipfile import ZipFile JASMINE_REPORTER_URL='https://github.com/larrymyers/jasmine-reporters/zipball/0.2.1' BASE = abspath(dirname(__file__)) REPORT_DI...
Python
import os THIS_PATH = os.path.dirname(__file__) GOLDEN_OUTPUT = os.path.join(THIS_PATH, 'golden_suite', 'output.xml') GOLDEN_OUTPUT2 = os.path.join(THIS_PATH, 'golden_suite', 'output2.xml') GOLDEN_JS = os.path.join(THIS_PATH, 'golden_suite', 'expected.js')
Python
__author__ = 'janne'
Python
#!/usr/bin/env python import fileinput from os.path import join, dirname, abspath import sys import os BASEDIR = dirname(abspath(__file__)) OUTPUT = join(BASEDIR, 'output.xml') sys.path.insert(0, join(BASEDIR, '..', '..', '..', '..', 'src')) import robot from robot.conf.settings import RebotSettings from robot.repo...
Python
"""Robot Framework post-install script for Windows. This script is executed as the last part of the graphical Windows installation and during un-installation started from `Add/Remote Programs`. For more details: http://docs.python.org/distutils/builtdist.html#postinstallation-script """ from __future__ import with_s...
Python
#!/usr/bin/env python import sys import os from os.path import join, dirname from distutils.core import setup execfile(join(dirname(__file__), 'src', 'robot', 'version.py')) # Maximum width in Windows installer seems to be 70 characters -------| DESCRIPTION = """ Robot Framework is a generic test automation framewor...
Python
#!/usr/bin/env python """A script for running Robot Framework's acceptance tests. Usage: run_atests.py interpreter [options] datasource(s) Data sources are paths to directories or files under `robot` folder. Available options are the same that can be used with Robot Framework. See its help (e.g. `pybot --help`) fo...
Python
import subprocess import os import signal import ctypes class ProcessManager(object): def __init__(self): self._process = None self._stdout = None self._stderr = None def start_process(self, *args): self._process = subprocess.Popen(args, stderr=subprocess.PIPE, ...
Python
from __future__ import with_statement import os import re from os.path import abspath, dirname, join from subprocess import call, STDOUT import tempfile from robot.utils.asserts import assert_equals, assert_true from robot.utils import decode_output ROBOT_SRC = join(dirname(abspath(__file__)), '..', '..', '..', 'sr...
Python
import json import os import pprint import tempfile from os.path import join, dirname, abspath from subprocess import call, STDOUT from robot.api import logger from robot.utils import decode_output ROBOT_SRC = join(dirname(abspath(__file__)), '..', '..', '..', 'src') class LibDocLib(object): def __init__(self, ...
Python
from __future__ import with_statement import os from robot.utils import utf8open def output_should_have_correct_line_separators(path): with utf8open(path) as infile: content = infile.read() content = content.replace(os.linesep, '') extra_r = content.count('\r') extra_n = content.count('\n') ...
Python
from __future__ import with_statement from robot.api import logger class WrongStat(AssertionError): ROBOT_CONTINUE_ON_FAILURE = True def get_total_stats(path): return get_all_stats(path)[0] def get_tag_stats(path): return get_all_stats(path)[1] def get_suite_stats(path): return get_all_stats(path)...
Python
from robot.libraries.BuiltIn import BuiltIn BIN = BuiltIn() def start_keyword(*args): if BIN.get_variables()['${TESTNAME}'] == 'Listener Using BuiltIn': BIN.set_test_variable('${SET BY LISTENER}', 'quux')
Python
from __future__ import with_statement from os.path import abspath, dirname, join from fnmatch import fnmatchcase from operator import eq from robot.api import logger CURDIR = dirname(abspath(__file__)) def verify_output(actual, expected): actual = _read_file(actual, 'Actual') expected = _read_file(join(CURD...
Python
import os import time class ListenAll: ROBOT_LISTENER_API_VERSION = '2' def __init__(self, *path): path = ':'.join(path) if path else self._get_default_path() self.outfile = open(path, 'w') def _get_default_path(self): return os.path.join(os.getenv('TEMPDIR'), 'listen_all.txt') ...
Python
import os class OldListenAll: def __init__(self, *path): if not path: path = os.path.join(os.getenv('TEMPDIR'), 'listen_all.txt') else: path = ':'.join(path) self.outfile = open(path, 'w') def start_suite(self, name, doc): self.outfile.write("SUITE STA...
Python
import os outpath = os.path.join(os.getenv('TEMPDIR'), 'listen_by_module.txt') OUTFILE = open(outpath, 'w') ROBOT_LISTENER_API_VERSION = 2 def start_suite(name, attrs): metastr = ' '.join('%s: %s' % (k, v) for k, v in attrs['metadata'].items()) OUTFILE.write("SUITE START: %s '%s' [%s]\n" % ...
Python
import os class ListenSome: def __init__(self): outpath = os.path.join(os.getenv('TEMPDIR'), 'listen_some.txt') self.outfile = open(outpath, 'w') def startTest(self, name, doc, tags): self.outfile.write(name + '\n') def endSuite(self, stat, msg): self.outfile.write(msg +...
Python
import os from robot.libraries.BuiltIn import BuiltIn class ListenSome: ROBOT_LISTENER_API_VERSION = '2' def __init__(self): outpath = os.path.join(os.getenv('TEMPDIR'), 'listen_some.txt') self.outfile = open(outpath, 'w') def startTest(self, name, attrs): self.outfile.write(nam...
Python
import os outpath = os.path.join(os.getenv('TEMPDIR'), 'listen_by_module.txt') OUTFILE = open(outpath, 'w') def start_suite(name, doc): OUTFILE.write("SUITE START: %s '%s'\n" % (name, doc)) def start_test(name, doc, tags): tags = [ str(tag) for tag in tags ] OUTFILE.write("TEST START: %s '%s' %s\n" % (n...
Python
import os ROBOT_LISTENER_API_VERSION = '2' OUTFILE = open(os.path.join(os.getenv('TEMPDIR'), 'listener_attrs.txt'), 'w') START_ATTRS = 'doc starttime ' END_ATTRS = START_ATTRS + 'endtime elapsedtime status ' EXPECTED_TYPES = {'elapsedtime': (int, long), 'tags': list, 'args': list, 'metadata': dict, ...
Python
def get_variables(*args): return { 'PPATH_VARFILE_2' : ' '.join(args), 'LIST__PPATH_VARFILE_2' : args }
Python
PPATH_VARFILE = "Variable from variable file in PYTHONPATH"
Python
list1 = [1, 2, 3, 4, 'foo', 'bar'] dictionary1 = {'a': 1} dictionary2 = {'a': 1, 'b': 2}
Python
class TraceLogArgsLibrary(object): def only_mandatory(self, mand1, mand2): pass def mandatory_and_default(self, mand, default="default value"): pass def multiple_default_values(self, a=1, a2=2, a3=3, a4=4): pass def mandatory_and_varargs(self, mand, *varargs): pass ...
Python
class FailUntilSucceeds: ROBOT_LIBRARY_SCOPE = 'TESTCASE' def __init__(self, times_to_fail=0): self.times_to_fail = int(times_to_fail) def fail_until_retried_often_enough(self, message="Hello"): self.times_to_fail -= 1 if self.times_to_fail >= 0: raise Exce...
Python
import exceptions class ObjectToReturn: def __init__(self, name): self.name = name def __str__(self): return self.name def exception(self, name, msg=""): exception = getattr(exceptions, name) raise exception, msg
Python
class SameNamesAsInBuiltIn: def noop(self): """Using this keyword without libname causes an error"""
Python
from robot.libraries.BuiltIn import BuiltIn class NamespaceUsingLibrary(object): def __init__(self): self._importing_suite = BuiltIn().get_variable_value('${SUITE NAME}') self._easter = BuiltIn().get_library_instance('Easter') def get_importing_suite(self): return self._importing_suit...
Python
class ZipLib: def kw_from_zip(self, arg): print '*INFO*', arg return arg * 2
Python
class PythonVarArgsConstructor: def __init__(self, mandatory, *varargs): self.mandatory = mandatory self.varargs = varargs def get_args(self): return self.mandatory, ' '.join(self.varargs)
Python
import os _dirs = __file__.split(os.sep) while True: if _dirs.pop() == 'atest': break _BITMAP = os.path.join(os.sep.join(_dirs), 'robot.bmp') class BinaryDataLibrary: def print_bytes(self): """Prints all bytes in range 0-255. Many of them are control chars.""" for i in range(256...
Python
import ExampleJavaLibrary import DefaultArgs class ExtendJavaLib(ExampleJavaLibrary): def kw_in_java_extender(self, arg): return arg*2 def javaSleep(self, secs): raise Exception('Overridden kw executed!') def using_method_from_java_parent(self): self.divByZero() class ExtendJa...
Python
import os # Tests that standard modules can be imported from libraries import sys class ImportRobotModuleTestLibrary: """Tests that robot internal modules can't be imported accidentally""" def import_logging(self): try: import logging except ImportError: if os.name ==...
Python
class ArgumentsPython: # method docs are used in unit tests as expected min and max args def a_0(self): """(0,0)""" return 'a_0' def a_1(self, arg): """(1,1)""" return 'a_1: ' + arg def a_3(self, arg1, arg2, arg3): """(3,3)""" return ' ...
Python
from robot import utils class RunKeywordLibrary: ROBOT_LIBRARY_SCOPE = 'TESTCASE' def __init__(self): self.kw_names = ['Run Keyword That Passes', 'Run Keyword That Fails'] def get_keyword_names(self): return self.kw_names def run_keyword(self, name, args): try: m...
Python
def keyword_from_deeper_submodule(): return 'hi again' class Sub: def keyword_from_class_in_deeper_submodule(self): return 'bye'
Python
attribute = 42
Python
library = "It should be OK to have an attribute with same name as the module" def keyword_from_submodule(arg='World'): return "Hello, %s!" % arg
Python
some_string = 'Hello, World!' class _SomeObject: pass some_object = _SomeObject()
Python
class KwargsLibrary(object): def __init__(self, arg1=None, arg2=None, **kws): self.arg1 = arg1 self.arg2 = arg2 self.kws = kws def check_init_arguments(self, exp_arg1, exp_arg2, **kws): if self.arg1 != exp_arg1 or self.arg2 != exp_arg2 or kws != self.kws: raise Asse...
Python
class ParameterLibrary: def __init__(self, host='localhost', port='8080'): self.host = host self.port = port def parameters(self): return self.host, self.port
Python
from robot import utils def passing_handler(*args): for arg in args: print arg, return ', '.join(args) def failing_handler(*args): if len(args) == 0: msg = 'Failure' else: msg = 'Failure: %s' % ' '.join(args) raise AssertionError(msg) class GetKeywordNamesLibrary: ...
Python