Grammalecte  Check-in [b41f8c080b]

Overview
Comment:[core][fr] code cleaning
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fr | core
Files: files | file ages | folders
SHA3-256: b41f8c080b24b644eee0e7d8b37dd993dc6a7b49a42da8f3740c070e1280465e
User & Date: olr on 2019-05-11 14:34:59
Other Links: manifest | tags
Context
2019-05-11
15:11
[fr] erreur de paramètre check-in: 51e717f8bc user: olr tags: trunk, fr
14:34
[core][fr] code cleaning check-in: b41f8c080b user: olr tags: trunk, fr, core
14:34
[graphspell] code cleaning (pylint) check-in: 23fcc016ee user: olr tags: trunk, graphspell
Changes

Modified gc_lang/fr/modules/conj.py from [8a23de1404] to [ae150ced95].

304
305
306
307
308
309
310
311

312
313
314
315
316
317
318
304
305
306
307
308
309
310

311
312
313
314
315
316
317
318







-
+







            if self._sRawInfo[5:6] in ["q", "u", "v", "e"]:
                sInfo = sInfo + " (+ usage pronominal)"
            if self._sRawInfo[6:7] == "m":
                sInfo = sInfo + " impersonnel"
            if not sInfo:
                sInfo = "# erreur - code : " + self._sRawInfo
            return sGroup + " · " + sInfo
        except:
        except (IndexError, TypeError):
            traceback.print_exc()
            return "# erreur"

    def infinitif (self, bPro, bNeg, bTpsCo, bInt, bFem):
        "returns string (conjugaison à l’infinitif)"
        try:
            if bTpsCo:
327
328
329
330
331
332
333
334

335
336
337
338
339
340
341
342

343
344
345
346
347
348
349
327
328
329
330
331
332
333

334
335
336
337
338
339
340
341

342
343
344
345
346
347
348
349







-
+







-
+







            if bNeg:
                sInfi = "ne pas " + sInfi
            if bTpsCo:
                sInfi += " " + self._seekPpas(bPro, bFem, self._sRawInfo[5] == "r")
            if bInt:
                sInfi += " … ?"
            return sInfi
        except:
        except (TypeError, IndexError):
            traceback.print_exc()
            return "# erreur"

    def participePasse (self, sWho):
        "returns past participle according to <sWho>"
        try:
            return self.dConj[":Q"][sWho]
        except:
        except KeyError:
            traceback.print_exc()
            return "# erreur"

    def participePresent (self, bPro, bNeg, bTpsCo, bInt, bFem):
        "returns string (conjugaison du participe présent)"
        try:
            if not self.dConj[":P"][":"]:
366
367
368
369
370
371
372
373

374
375
376
377
378
379
380
366
367
368
369
370
371
372

373
374
375
376
377
378
379
380







-
+







                else:
                    sPartPre = "ne " + sPartPre + " pas"
            if bTpsCo:
                sPartPre += " " + self._seekPpas(bPro, bFem, self._sRawInfo[5] == "r")
            if bInt:
                sPartPre += " … ?"
            return sPartPre
        except:
        except (KeyError, TypeError, IndexError):
            traceback.print_exc()
            return "# erreur"

    def conjugue (self, sTemps, sWho, bPro, bNeg, bTpsCo, bInt, bFem):
        "returns string (conjugue le verbe au temps <sTemps> pour <sWho>) "
        try:
            if not self.dConj[sTemps][sWho]:
407
408
409
410
411
412
413
414

415
416
417
418
419
420
421
422
423
424
425
426
427
428

429
430
431
432
433
434
435
407
408
409
410
411
412
413

414
415
416
417
418
419
420
421
422
423
424
425
426
427

428
429
430
431
432
433
434
435







-
+













-
+







            if bNeg:
                sConj += " pas"
            if bTpsCo:
                sConj += " " + self._seekPpas(bPro, bFem, sWho.endswith("p") or self._sRawInfo[5] == "r")
            if bInt:
                sConj += " … ?"
            return sConj
        except:
        except (KeyError, TypeError, IndexError):
            traceback.print_exc()
            return "# erreur"

    def _getPronomSujet (self, sWho, bFem):
        try:
            if sWho == ":3s":
                if self._sRawInfo[5] == "r":
                    return "on"
                if bFem:
                    return "elle"
            if sWho == ":3p" and bFem:
                return "elles"
            return _dProSuj[sWho]
        except:
        except (KeyError, IndexError):
            traceback.print_exc()
            return "# erreur"

    def imperatif (self, sWho, bPro, bNeg, bTpsCo, bFem):
        "returns string (conjugaison à l’impératif)"
        try:
            if not self.dConj[":E"][sWho]:
453
454
455
456
457
458
459
460

461
462
463
464
465
466
467
468
469
470
471
472
473

474
475
476
477
478
479
480
453
454
455
456
457
458
459

460
461
462
463
464
465
466
467
468
469
470
471
472

473
474
475
476
477
478
479
480







-
+












-
+







                else:
                    sImpe = "n’" + sImpe + " pas"  if bEli  else  "ne " + sImpe + " pas"
            elif bPro:
                sImpe = sImpe + _dImpeProEn[sWho]  if self.bProWithEn  else  sImpe + _dImpePro[sWho]
            if bTpsCo:
                return sImpe + " " + self._seekPpas(bPro, bFem, sWho.endswith("p") or self._sRawInfo[5] == "r")
            return sImpe
        except:
        except (KeyError, TypeError, IndexError):
            traceback.print_exc()
            return "# erreur"

    def _seekPpas (self, bPro, bFem, bPlur):
        try:
            if not bPro and self.sVerbAux == "avoir":
                return self.dConj[":Q"][":Q1"]
            if not bFem:
                return self.dConj[":Q"][":Q2"]  if bPlur and self.dConj[":Q"][":Q2"]  else  self.dConj[":Q"][":Q1"]
            if not bPlur:
                return self.dConj[":Q"][":Q3"]  if self.dConj[":Q"][":Q3"]  else  self.dConj[":Q"][":Q1"]
            return self.dConj[":Q"][":Q4"]  if self.dConj[":Q"][":Q4"]  else  self.dConj[":Q"][":Q1"]
        except:
        except KeyError:
            traceback.print_exc()
            return "# erreur"

    def createConjTable (self, bPro=False, bNeg=False, bTpsCo=False, bInt=False, bFem=False):
        "return a dictionary of all conjugations with titles, according to options (used to be displayed as is)"
        dConjTable = {
            "t_infi":   "Infinitif",