Code Duplication    Length = 28-28 lines in 3 locations

mandos/entry/entry_commands.py 3 locations

@@ 556-583 (lines=28) @@
553
        return super().run(**{a: locs[a] for a in args if a != "cls"})
554
555
556
class EntryPubchemChemicalCoOccurrence(_EntryPubchemCoOccurrence[ChemicalCoOccurrenceSearch]):
557
    @classmethod
558
    @entry()
559
    def run(
560
        cls,
561
        path: Path = CommonArgs.in_compound_table,
562
        key: str = EntryArgs.key(f"lit.pubchem:{CoOccurrenceType.chemical.name.lower()}"),
563
        to: Optional[Path] = CommonArgs.out_annotations_file,
564
        min_score: float = EntryArgs.min_cooccurrence_score,
565
        min_articles: int = EntryArgs.min_cooccurring_articles,
566
        as_of: Optional[str] = CommonArgs.as_of,
567
        replace: bool = CommonArgs.replace,
568
        proceed: bool = CommonArgs.proceed,
569
        check: bool = EntryArgs.check,
570
        log: Optional[Path] = CommonArgs.log,
571
        stderr: str = CommonArgs.stderr,
572
    ) -> Searcher:
573
        """
574
        Co-occurrences of chemicals from PubMed articles.
575
576
        https://mandos-chem.readthedocs.io/en/latest/co-occurrences.html
577
578
        OBJECT: The name of the chemical (e.g. "cocaine")
579
580
        WEIGHT: The co-occurrence score (refer to the docs)
581
        """
582
        args, _, _, locs = inspect.getargvalues(inspect.currentframe())
583
        return super().run(**{a: locs[a] for a in args if a != "cls"})
584
585
586
class EntryPubchemDgi(Entry[DgiSearch]):
@@ 526-553 (lines=28) @@
523
        return super().run(**{a: locs[a] for a in args if a != "cls"})
524
525
526
class EntryPubchemDiseaseCoOccurrence(_EntryPubchemCoOccurrence[DiseaseCoOccurrenceSearch]):
527
    @classmethod
528
    @entry()
529
    def run(
530
        cls,
531
        path: Path = CommonArgs.in_compound_table,
532
        key: str = EntryArgs.key(f"lit.pubchem:{CoOccurrenceType.disease.name.lower()}"),
533
        to: Optional[Path] = CommonArgs.out_annotations_file,
534
        min_score: float = EntryArgs.min_cooccurrence_score,
535
        min_articles: int = EntryArgs.min_cooccurring_articles,
536
        as_of: Optional[str] = CommonArgs.as_of,
537
        replace: bool = CommonArgs.replace,
538
        proceed: bool = CommonArgs.proceed,
539
        check: bool = EntryArgs.check,
540
        log: Optional[Path] = CommonArgs.log,
541
        stderr: str = CommonArgs.stderr,
542
    ) -> Searcher:
543
        """
544
        Co-occurrences of diseases from PubMed articles.
545
546
        https://mandos-chem.readthedocs.io/en/latest/co-occurrences.html
547
548
        OBJECT: The name of the disease
549
550
        WEIGHT: The co-occurrence score (refer to the docs)
551
        """
552
        args, _, _, locs = inspect.getargvalues(inspect.currentframe())
553
        return super().run(**{a: locs[a] for a in args if a != "cls"})
554
555
556
class EntryPubchemChemicalCoOccurrence(_EntryPubchemCoOccurrence[ChemicalCoOccurrenceSearch]):
@@ 496-523 (lines=28) @@
493
        return cls._run(built, path, to, replace, proceed, check, log, stderr)
494
495
496
class EntryPubchemGeneCoOccurrence(_EntryPubchemCoOccurrence[GeneCoOccurrenceSearch]):
497
    @classmethod
498
    @entry()
499
    def run(
500
        cls,
501
        path: Path = CommonArgs.in_compound_table,
502
        key: str = EntryArgs.key(f"lit.pubchem:{CoOccurrenceType.gene.name.lower()}"),
503
        to: Optional[Path] = CommonArgs.out_annotations_file,
504
        min_score: float = EntryArgs.min_cooccurrence_score,
505
        min_articles: int = EntryArgs.min_cooccurring_articles,
506
        as_of: Optional[str] = CommonArgs.as_of,
507
        replace: bool = CommonArgs.replace,
508
        proceed: bool = CommonArgs.proceed,
509
        check: bool = EntryArgs.check,
510
        log: Optional[Path] = CommonArgs.log,
511
        stderr: str = CommonArgs.stderr,
512
    ) -> Searcher:
513
        """
514
        Co-occurrences of genes from PubMed articles.
515
516
        https://mandos-chem.readthedocs.io/en/latest/co-occurrences.html
517
518
        OBJECT: The name of the gene
519
520
        WEIGHT: The co-occurrence score (refer to the docs)
521
        """
522
        args, _, _, locs = inspect.getargvalues(inspect.currentframe())
523
        return super().run(**{a: locs[a] for a in args if a != "cls"})
524
525
526
class EntryPubchemDiseaseCoOccurrence(_EntryPubchemCoOccurrence[DiseaseCoOccurrenceSearch]):