massive refactoring to switch from camelCase to snake_case:

historically, Libervia (SàT before) was using camelCase as allowed by PEP8 when using a
pre-PEP8 code, to use the same coding style as in Twisted.

However, snake_case is more readable and it's better to follow PEP8 best practices, so it
has been decided to move on full snake_case. Because Libervia has a huge codebase, this
ended with a ugly mix of camelCase and snake_case.

To fix that, this patch does a big refactoring by renaming every function and method
(including bridge) that are not coming from Twisted or Wokkel, to use fully snake_case.

This is a massive change, and may result in some bugs.
This commit is contained in:
Goffi 2023-04-08 13:54:42 +02:00
commit 6a6f15707a
8 changed files with 9945 additions and 9945 deletions

View file

@ -384,7 +384,7 @@ like this:
The encoding is explained in the documentation of the following method:
.. automethod:: sat.plugins.plugin_comp_ap_gateway.APGateway.getJIDAndNode
.. automethod:: sat.plugins.plugin_comp_ap_gateway.APGateway.get_jid_and_node
.. [#AP_chars] Most if not all AP implementations use webfinger `acct` URI as a de-facto
@ -859,10 +859,10 @@ Using the Component (for developers)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Publication of AP items can be tested using the following method (with can be accessed
through the ``APSend`` bridge method, client is then replaced by the ``profile`` name, as
through the ``ap_send`` bridge method, client is then replaced by the ``profile`` name, as
last argument):
.. automethod:: sat.plugins.plugin_comp_ap_gateway.APGateway.publishMessage
.. automethod:: sat.plugins.plugin_comp_ap_gateway.APGateway.publish_message
The method can be used either with CLI's :ref:`debug bridge method
<li_debug_bridge_method>` or with any D-Bus tool like ``qdbus`` or ``d-feet`` (only if you
@ -875,7 +875,7 @@ On its ``example.net`` Mastodon instance, Pierre has published a message with th
``https://example.net/@pierre/106986412193109832``. To send a reply to this message,
Louise can use the following command::
$ li debug bridge method -c APSend '"{\"node\": \"https://example.net/@pierre/106986412193109832\", \"content\": \"A lille hello from XMPP\"}","pierre\\40example.net@ap.example.org", "louise"'
$ li debug bridge method -c ap_send '"{\"node\": \"https://example.net/@pierre/106986412193109832\", \"content\": \"A lille hello from XMPP\"}","pierre\\40example.net@ap.example.org", "louise"'
Note the double escaping, one for the shell argument, and the other to specify JSON
object.

View file

@ -60,9 +60,9 @@ To save resources, not all nodes are fully cached. When a node is checked, a ser
analysers are checked, and the first one matching is used to determine if the node must be
synchronised or not.
Analysers can be registered by any plugins using ``registerAnalyser`` method:
Analysers can be registered by any plugins using ``register_analyser`` method:
.. automethod:: sat.plugins.plugin_pubsub_cache.PubsubCache.registerAnalyser
.. automethod:: sat.plugins.plugin_pubsub_cache.PubsubCache.register_analyser
If no analyser is found, ``to_sync`` is false, or an error happens during the caching,
the node won't be synchronised and the pubsub service will always be requested.

View file

@ -333,11 +333,11 @@ Get description of ``dotclear`` importer::
$ li blog import dotclear
Import a Dotclear blog::
import a Dotclear blog::
$ li blog import dotclear /path/to/dotclear.dump
Import a Dotclear blog without uploading images::
import a Dotclear blog without uploading images::
$ li blog import --no-images-upload dotclear /path/to/dotclear.dump

View file

@ -17,7 +17,7 @@ Python arguments as many shell arguments, or put them in a single shell argument
You profile is automatically set if the method requires it (using the value of ``-p
PROFILE, --profile PROFILE``), so you must not specify it as an extra argument.
You can refer to `Bridge API documentation`_ to get core methods signatures
You can refer to `bridge API documentation`_ to get core methods signatures
.. _Bridge API documentation: https://wiki.goffi.org/wiki/Bridge_API
@ -26,12 +26,12 @@ examples
--------
Send a message using a single shell arguments for all Python arguments. We
use first the method name (``messageSend``), then the required arguments (see `Bridge
use first the method name (``message_send``), then the required arguments (see `bridge
API documentation`_ for details), without the profile as it is automatically set. We
specify them as Python in one shell argument, so we use single quote (``\```)first for
s hell string, and inside it we use double quote (``"``) for Python strings::
$ li debug bridge method messageSend '"louise@example.org", {"": "test message"}, {}, "auto", {}'
$ li debug bridge method message_send '"louise@example.org", {"": "test message"}, {}, "auto", {}'
.. note::
@ -39,7 +39,7 @@ s hell string, and inside it we use double quote (``"``) for Python strings::
Get version string of Libervia::
$ li debug bridge method getVersion
$ li debug bridge method version_get
bridge signal
@ -56,7 +56,7 @@ Send a note with ``info`` level and hand written XMLUI. Here me use a shell vari
store the level, so we can easily change it if we want to use an other level for tests.
Note the use of quotes (to escape both for shell and Python)::
$ LEVEL='info'; li debug bridge signal -c actionNew '{"xmlui": '"'"'<?xml version="1.0" ?><sat_xmlui title="test title" type="dialog"><dialog level="'$LEVEL'" type="note"><message>test message\non\nseveral\nlines</message></dialog></sat_xmlui>'"'"'}' '""' -1
$ LEVEL='info'; li debug bridge signal -c action_new '{"xmlui": '"'"'<?xml version="1.0" ?><sat_xmlui title="test title" type="dialog"><dialog level="'$LEVEL'" type="note"><message>test message\non\nseveral\nlines</message></dialog></sat_xmlui>'"'"'}' '""' -1
monitor

View file

@ -35,10 +35,10 @@ Create a new event. You can specify the starting time of the event with ``-S TIM
If your organsise an item, the ``--rsvp`` flag should be used: it will use the default
RSVP form which ask for attendance. If you want to request more information to your guest,
``--rsvp_json JSON`` can be used: the JSON argument is a data dict as described in
``dataDict2dataForm`` function where the ``namespace`` key is not necessary (it's set
``data_dict_2_data_form`` function where the ``namespace`` key is not necessary (it's set
automatically):
.. autofunction:: sat.tools.xml_tools.dataDict2dataForm
.. autofunction:: sat.tools.xml_tools.data_dict_2_data_form
If the event links to an other one, ``--external JID NODE ITEM`` can be user

View file

@ -68,7 +68,7 @@ Delete item with id ``456`` from tickets on PubSub service ``pubsub.example.org`
import
======
Import lists from an external source. This works in the same way as
import lists from an external source. This works in the same way as
:ref:`libervia-cli_blog_import`: you need to specify an importer and a data location. If you let
both positional argument empty, you'll get list of importers, if you specify importer but
not data location, you'll get a description on how the importer works.
@ -99,7 +99,7 @@ Get description of list importer for Bugzilla::
$ li list import bugzilla
Import lists from a Bugzilla XML export file at ``~/bugzilla_export.xml`` to the
import lists from a Bugzilla XML export file at ``~/bugzilla_export.xml`` to the
``pubsub.example.org`` PubSub service. We use default lists node and want a progression
bar::

View file

@ -66,7 +66,7 @@ Display details for merge request with id 456::
import
======
Import a merge request into your project. You mainly have to be in the project repository
import a merge request into your project. You mainly have to be in the project repository
(or specify it using ``-r PATH, --repository PATH``) and to specify the id of the patch to
import (using ``-i ITEM, --item ITEM``). The behaviour depends of the type of the patch,
for Mercurial, the patch will be imported as `MQ`_ patch.
@ -76,6 +76,6 @@ for Mercurial, the patch will be imported as `MQ`_ patch.
example
-------
Import the merge request with id 321::
import the merge request with id 321::
$ li merge-request import -i 321

View file

@ -93,7 +93,7 @@ Make the ``public_notes`` node accessible to the world::
import
======
Import a raw XML containing items to create in the node. The path to the XML file is used
import a raw XML containing items to create in the node. The path to the XML file is used
as positional argument.
The XML file must contain full `<item>` element for each item to import. The output of ``pubsub get`` can be used directly.
@ -103,7 +103,7 @@ If you want to change publisher of one or more items (i.e. if you want to use an
example
-------
Import a node backup which has previously been saved using ``li blog get -M -1 -n
import a node backup which has previously been saved using ``li blog get -M -1 -n
some_node > some_node_backup.xml``::
$ li pubsub node import -n some_node ~/some_node_backup.xml