Robot Framework
__init__.py
Go to the documentation of this file.
1 # Copyright 2008-2015 Nokia Networks
2 # Copyright 2016- Robot Framework Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 
35 
36 from .argumentparser import ArgumentParser, cmdline2list
37 from .application import Application
38 from .compress import compress_text
39 from .connectioncache import ConnectionCache
40 from .dotdict import DotDict
41 from .encoding import (CONSOLE_ENCODING, SYSTEM_ENCODING, console_decode,
42  console_encode, system_decode, system_encode)
43 from .error import (get_error_message, get_error_details, ErrorDetails)
44 from .escaping import escape, glob_escape, unescape, split_from_equals
45 from .etreewrapper import ET, ETSource
46 from .filereader import FileReader
47 from .frange import frange
48 from .markuputils import html_format, html_escape, xml_escape, attribute_escape
49 from .markupwriters import HtmlWriter, XmlWriter, NullMarkupWriter
50 from .importer import Importer
51 from .match import eq, Matcher, MultiMatcher
52 from .misc import (classproperty, isatty, parse_re_flags, plural_or_not,
53  printable_name, seq2str, seq2str2, test_or_task)
54 from .normalizing import normalize, normalize_whitespace, NormalizedDict
55 from .platform import PY_VERSION, PYPY, UNIXY, WINDOWS, RERAISED_EXCEPTIONS
56 from .recommendations import RecommendationFinder
57 from .robotenv import get_env_var, set_env_var, del_env_var, get_env_vars
58 from .robotinspect import is_init
59 from .robotio import binary_file_writer, create_destination_directory, file_writer
60 from .robotpath import abspath, find_file, get_link_path, normpath
61 from .robottime import (elapsed_time_to_string, format_time, get_elapsed_time,
62  get_time, get_timestamp, secs_to_timestamp,
63  secs_to_timestr, timestamp_to_secs, timestr_to_secs,
64  parse_time)
65 from .robottypes import (is_bytes, is_dict_like, is_falsy, is_integer, is_list_like,
66  is_number, is_pathlike, is_string, is_truthy, is_union,
67  type_name, type_repr, typeddict_types)
68 from .setter import setter, SetterAwareType
69 from .sortable import Sortable
70 from .text import (cut_assign_value, cut_long_message, format_assign_message,
71  get_console_length, getdoc, getshortdoc, pad_console_length,
72  split_tags_from_doc, split_args_from_name_or_path)
73 from .unic import prepr, safe_str
74 
75 
76 def read_rest_data(rstfile):
77  from .restreader import read_rest_data
78  return read_rest_data(rstfile)
79 
80 
81 # Quietly deprecated utils. Should be deprecated loudly in RF 7.0.
82 # https://github.com/robotframework/robotframework/issues/4501
83 
84 from .robottypes import FALSE_STRINGS, TRUE_STRINGS
85 
86 
87 # Deprecated Python 2/3 compatibility layer. Not needed by Robot Framework itself
88 # after RF 5.0 when Python 2 support was dropped. Should be deprecated loudly in
89 # RF 7.0. Notice that there's also `PY2` in the `platform` submodule.
90 # https://github.com/robotframework/robotframework/issues/4501
91 
92 from io import StringIO
93 
94 
95 PY3 = True
96 PY2 = JYTHON = IRONPYTHON = False
97 is_unicode = is_string
98 unicode = str
99 unic = safe_str
100 roundup = round
101 
102 
103 
104 def py2to3(cls):
105  if hasattr(cls, '__unicode__'):
106  cls.__str__ = lambda self: self.__unicode__()
107  if hasattr(cls, '__nonzero__'):
108  cls.__bool__ = lambda self: self.__nonzero__()
109  return cls
110 
111 
112 
113 def py3to2(cls):
114  return cls
def py3to2(cls)
Deprecated since RF 5.0.
Definition: __init__.py:113
def read_rest_data(rstfile)
Definition: __init__.py:76
def py2to3(cls)
Deprecated since RF 5.0.
Definition: __init__.py:104