(機械翻訳) pyramid.compat
¶
`` pyramid.compat``モジュールは、Pythonプラットフォームとバージョンの違いを超えて、Pyramidとそのアドオンのプラットフォームとバージョンの互換性を提供します。 Pyramidが互換性のあるインポートを必要とするシステムをサポートしなくなると、APIはこのモジュールから削除されます。
-
ascii_native_
(s)[ソース]¶ Python 3: `` s``が `` text_type``のインスタンスであれば `` s.encode( 'ascii') ``を返し、そうでない場合は `` str(s、 'ascii'、 'strict') ` `
Python 2: `` s``が `` text_type``のインスタンスであれば、 `` s.encode( 'ascii') ``を返し、そうでなければ `` str(s) ``
-
binary_type
¶ このプラットフォームのバイナリタイプ。 Python 3では `` bytes``です。 Python 2の場合、それは `` str``です。
-
bytes_
(s, encoding='latin-1', errors='strict')[ソース]¶ `` s``が `` text_type``のインスタンスであれば `` s.encode(encoding、errors) ``を返し、そうでなければ `` s``を返します
-
class_types
¶ このプラットフォームのクラス型のシーケンス。 Python 3では、 ``(type、) ``です。 Python 2では ``(type、types.ClassType) ``です。
-
configparser
¶ Python 2では、 `` ConfigParser``モジュール、Python 3では `` configparser``モジュールです。
-
exec_
(code, globs=None, locs=None)¶ Python 2と3の両方で互換性のある方法でコードを実行します。
-
im_func
¶ Python 2では、文字列値 `` im_func``、Python 3では文字列値 `` __func__``を使用します。
-
input_
(v)¶ Python 2では、 `` raw_input``関数、Python 3では `` input``関数です。
-
long
¶ このプラットフォームのロングタイプ。 Python 3では `` int``です。 Python 2では `` long``です。
-
pickle
¶ `` cPickle``モジュールがあればそれを、 `` pickle``モジュールを返します。
-
PY3
¶ Python 3では `` True``、そうでなければ `` False``です。
-
PYPY
¶ PyPy上で実行している場合は `` True``、そうでなければ `` False``です。
-
reraise
(tp, value, tb=None)[ソース]¶ `` reraise(* sys.exc_info()) ``のように、Python 2とPython 3の両方で互換性のある例外を発生させます。
-
SimpleCookie
[ソース]¶ Python 2では、 `` Cookie.SimpleCookie``クラス、Python 3では、 `` http.cookies.SimpleCookie``モジュールです。
-
text_
(s, encoding='latin-1', errors='strict')[ソース]¶ `` s``が `` binary_type``のインスタンスであれば `` s.decode(encoding、errors) ``を返し、そうでなければ `` s``を返します
-
text_type
¶ このプラットフォームのテキストタイプ。 Python 3では `` str``です。 Python 2では、 `` unicode``です。
-
native_
(s, encoding='latin-1', errors='strict')[ソース]¶ Python 3: `` s``が `` text_type``のインスタンスであれば `` s``を返し、そうでなければ `` str(s、encoding、errors)
Python 2: `` s``が `` text_type``のインスタンスであれば、 `` s.encode(encoding、errors) ``を返し、そうでなければ `` str(s) ``
-
urlparse
¶ Python 2の `` urlparse``モジュール、Python 3の `` urllib.parse``モジュールです。
-
url_quote
¶ Python 2の `` urllib.quote``関数、Python 3の `` urllib.parse.quote``関数です。
-
url_quote_plus
¶ Python 2の `` urllib.quote_plus``関数、Python 3の `` urllib.parse.quote_plus``関数です。
-
url_unquote
¶ Python 2の `` urllib.unquote``関数、Python 3の `` urllib.parse.unquote``関数です。
-
url_encode
¶ Python 2の `` urllib.urlencode``関数、Python 3の `` urllib.parse.urlencode``関数です。
-
url_open
¶ Python 2の `` urllib2.urlopen``関数、Python 3の `` urllib.request.urlopen``関数です。