~cjwatson/storm/py39

« back to all changes in this revision

Viewing changes to storm/store.py

  • Committer: Colin Watson
  • Date: 2020-05-26 12:26:41 UTC
  • mfrom: (554.1.3 docstring-syntax)
  • Revision ID: cjwatson@canonical.com-20200526122641-591kmbjqf24em97w
Improve various docstrings, mainly fixing reST/epytext syntax. [r=ilasc,doismellburning]

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
    def execute(self, statement, params=None, noresult=False):
106
106
        """Execute a basic query.
107
107
 
108
 
        This is just like L{storm.database.Database.execute}, except
 
108
        This is just like L{storm.database.Connection.execute}, except
109
109
        that a flush is performed first.
110
110
        """
111
111
        if self._implicit_flush_block_count == 0:
119
119
    def begin(self, xid):
120
120
        """Start a new two-phase transaction.
121
121
 
122
 
        @param xid: A L{Xid} instance holding identification data for the
123
 
            new transaction.
 
122
        @param xid: A L{Xid <storm.xid.Xid>} instance holding identification
 
123
            data for the new transaction.
124
124
        """
125
125
        self._connection.begin(xid)
126
126
 
127
127
    def prepare(self):
128
128
        """Prepare a two-phase transaction for the final commit.
129
129
 
130
 
        @note: It must be call inside a two-phase transaction started
131
 
            with begin().
 
130
        @note: It must be called inside a two-phase transaction started
 
131
            with L{begin}.
132
132
        """
133
133
        self._connection.prepare()
134
134
 
627
627
        """Fill missing values in variables of the given obj_info.
628
628
 
629
629
        This method will verify which values are unset in obj_info,
630
 
        and set them to AutoReload, or if it's part of the primary
 
630
        and set them to L{AutoReload}, or if it's part of the primary
631
631
        key, query the database for the actual values.
632
632
 
633
633
        @param obj_info: ObjectInfo to have its values filled.
889
889
 
890
890
        This method is hooked into the obj_info to resolve variables
891
891
        set to lazy values when they're accessed.  It will first flush
892
 
        the store, and then set all variables set to AutoReload to
 
892
        the store, and then set all variables set to L{AutoReload} to
893
893
        their database values.
894
894
        """
895
895
        if lazy_value is not AutoReload and not isinstance(lazy_value, Expr):
1083
1083
        """Return a single item from the result set.
1084
1084
 
1085
1085
        @return: An arbitrary object or C{None} if one isn't available.
1086
 
        @seealso: one(), first(), and last().
 
1086
        @see: L{one}, L{first}, and L{last}.
1087
1087
        """
1088
1088
        select = self._get_select()
1089
1089
        select.limit = 1
1112
1112
 
1113
1113
        @raises UnorderedError: Raised if the result set isn't ordered.
1114
1114
        @return: The first object or C{None} if one isn't available.
1115
 
        @seealso: last(), one(), and any().
 
1115
        @see: L{last}, L{one}, and L{any}.
1116
1116
        """
1117
1117
        if self._order_by is Undef:
1118
1118
            raise UnorderedError("Can't use first() on unordered result set")
1124
1124
        @raises FeatureError: Raised if the result set has a C{LIMIT} set.
1125
1125
        @raises UnorderedError: Raised if the result set isn't ordered.
1126
1126
        @return: The last object or C{None} if one isn't available.
1127
 
        @seealso: first(), one(), and any().
 
1127
        @see: L{first}, L{one}, and L{any}.
1128
1128
        """
1129
1129
        if self._order_by is Undef:
1130
1130
            raise UnorderedError("Can't use last() on unordered result set")
1154
1154
        @raises NotOneError: Raised if the result set contains more than one
1155
1155
            item.
1156
1156
        @return: The object or C{None} if one isn't available.
1157
 
        @seealso: first(), one(), and any().
 
1157
        @see: L{first}, L{last}, and L{any}.
1158
1158
        """
1159
1159
        select = self._get_select()
1160
1160
        # limit could be 1 due to slicing, for instance.
1860
1860
 
1861
1861
class block_access(object):
1862
1862
    """
1863
 
    Context manager blocks database access by one or more L{Store}s in the
 
1863
    Context manager blocks database access by one or more L{Store}\ s in the
1864
1864
    managed scope.
1865
1865
    """
1866
1866