Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ae7c79a

Browse files
committed
X6, more doc string nitpicks
1 parent 249c918 commit ae7c79a

1 file changed

Lines changed: 30 additions & 8 deletions

File tree

bidi/algorithm.py

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def is_valid_level_and_counters(self, level):
181181
and self.overflow_embedding_count == 0)
182182

183183
def X1(self):
184-
"""Applies X1_:
184+
"""X1_:
185185
186186
* Set the stack to empty.
187187
* Push onto the stack an entry consisting of the paragraph embedding
@@ -201,7 +201,7 @@ def X1(self):
201201
self.valid_isolate_count = 0
202202

203203
def X2(self, idx):
204-
"""X2_: With each RLE, perform the following steps:
204+
"""X2_, With each RLE, perform the following steps:
205205
206206
* Compute the least odd embedding level greater than the embedding
207207
level of the last entry on the directional status stack.
@@ -225,7 +225,7 @@ def X2(self, idx):
225225
self.overflow_embedding_count += 1
226226

227227
def X3(self, idx):
228-
"""X3_: With each LRE, perform the following steps:
228+
"""X3_, With each LRE, perform the following steps:
229229
230230
* Compute the least even embedding level greater than the embedding
231231
level of the last entry on the directional status stack.
@@ -249,7 +249,7 @@ def X3(self, idx):
249249
self.overflow_embedding_count += 1
250250

251251
def X4(self, idx):
252-
"""X4_: With each RLO, perform the following steps:
252+
"""X4_, With each RLO, perform the following steps:
253253
254254
* Compute the least odd embedding level greater than the embedding
255255
level of the last entry on the directional status stack.
@@ -273,7 +273,7 @@ def X4(self, idx):
273273
self.overflow_embedding_count += 1
274274

275275
def X5(self, idx):
276-
"""X5_: With each LRO, perform the following steps:
276+
"""X5_, With each LRO, perform the following steps:
277277
278278
* Compute the least even embedding level greater than the embedding
279279
level of the last entry on the directional status stack.
@@ -296,7 +296,7 @@ def X5(self, idx):
296296
self.overflow_embedding_count += 1
297297

298298
def X5a(self, idx):
299-
"""X5a_: With each RLI, perform the following steps:
299+
"""X5a_, With each RLI, perform the following steps:
300300
301301
* Set the RLI’s embedding level to the embedding level of the last
302302
entry on the directional status stack.
@@ -324,7 +324,7 @@ def X5a(self, idx):
324324
self.overflow_isolate_count += 1
325325

326326
def X5b(self, idx):
327-
"""X5b_: With each LRI, perform the following steps:
327+
"""X5b_, With each LRI, perform the following steps:
328328
329329
* Set the LRI’s embedding level to the embedding level of the last
330330
entry on the directional status stack.
@@ -352,7 +352,7 @@ def X5b(self, idx):
352352
self.overflow_isolate_count += 1
353353

354354
def X5c(self, idx):
355-
"""X5c_: With each FSI:
355+
"""X5c_, With each FSI:
356356
357357
Apply rules P2 and P3 to the sequence of characters between the FSI and
358358
its matching PDI, or if there is no matching PDI, the end of the
@@ -369,6 +369,28 @@ def X5c(self, idx):
369369
else:
370370
self.X5b(idx)
371371

372+
def X6(self, idx):
373+
"""X6_, For all types besides B, BN, RLE, LRE, RLO, LRO, PDF, RLI, LRI,
374+
FSI, and PDI:
375+
376+
* Set the current character’s embedding level to the embedding level of
377+
the last entry on the directional status stack.
378+
* Whenever the directional override status of the last entry on the
379+
directional status stack is not neutral, reset the current character
380+
type according to the directional override status of the last entry
381+
on the directional status stack.
382+
383+
.. _X6: http://www.unicode.org/reports/tr9/#X6
384+
"""
385+
386+
last_entry = self.last_level_entry
387+
ch = self.chars[idx]
388+
389+
ch['level'] = last_entry.embedding_level
390+
391+
if last_entry.directional_override != 'N':
392+
ch['type'] = last_entry.directional_override
393+
372394
def explicit_levels_and_directions(self):
373395

374396
MAPPINGS = {

0 commit comments

Comments
 (0)