Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(62)  |  Call(56)  |  Derive(0)  |  Import(6)

src/c/o/cogent-1.5.3/cogent/parse/locuslink.py   cogent(Download)
are probably a map and its corresponding link).
"""
from cogent.parse.record import MappedRecord, FieldWrapper, DelimitedSplitter,\
    list_adder, list_extender, int_setter, LineOrientedConstructor
from cogent.parse.record_finder import LabeledRecordFinder
first_colon = DelimitedSplitter(':', 1)
 
accession_wrapper = FieldWrapper(['Accession', 'Gi', 'Strain'], pipes)
def _read_accession(line):
    """Reads accession lines: format is Accession | Gi | Strain."""
    return MappedRecord(accession_wrapper(line))
 
rell_wrapper = FieldWrapper(['Description', 'Id', 'IdType', 'Printable'], pipes)
def _read_rell(line):
    """Reads RELL lines: format is Description|Id|IdType|Printable"""
    return MappedRecord(rell_wrapper(line))
 
accnum_wrapper = FieldWrapper(['Accession','Gi','Strain','Start','End'], pipes)

src/p/y/pycogent-HEAD/cogent/parse/locuslink.py   pycogent(Download)
are probably a map and its corresponding link).
"""
from cogent.parse.record import MappedRecord, FieldWrapper, DelimitedSplitter,\
    list_adder, list_extender, int_setter, LineOrientedConstructor
from cogent.parse.record_finder import LabeledRecordFinder
first_colon = DelimitedSplitter(':', 1)
 
accession_wrapper = FieldWrapper(['Accession', 'Gi', 'Strain'], pipes)
def _read_accession(line):
    """Reads accession lines: format is Accession | Gi | Strain."""
    return MappedRecord(accession_wrapper(line))
 
rell_wrapper = FieldWrapper(['Description', 'Id', 'IdType', 'Printable'], pipes)
def _read_rell(line):
    """Reads RELL lines: format is Description|Id|IdType|Printable"""
    return MappedRecord(rell_wrapper(line))
 
accnum_wrapper = FieldWrapper(['Accession','Gi','Strain','Start','End'], pipes)

src/c/o/cogent-1.5.3/cogent/parse/genbank.py   cogent(Download)
#!/usr/bin/env python
from cogent.parse.record import FieldWrapper
from cogent.parse.record_finder import DelimitedRecordFinder, \
    LabeledRecordFinder
from cogent.core.genetic_code import GeneticCodes
 
locus_fields = [None, 'locus','length', None, 'mol_type','topology','db','date']
_locus_parser = FieldWrapper(locus_fields)
 
#need to turn off line stripping, because whitespace is significant
    even when prior versions omitted it.
    """
    result = _locus_parser(line)
    try:
        result['length'] = int(result['length'])

src/p/y/pycogent-HEAD/cogent/parse/genbank.py   pycogent(Download)
#!/usr/bin/env python
from cogent.parse.record import FieldWrapper
from cogent.parse.record_finder import DelimitedRecordFinder, \
    LabeledRecordFinder
from cogent.core.genetic_code import GeneticCodes
 
locus_fields = [None, 'locus','length', None, 'mol_type','topology','db','date']
_locus_parser = FieldWrapper(locus_fields)
 
#need to turn off line stripping, because whitespace is significant
    even when prior versions omitted it.
    """
    result = _locus_parser(line)
    try:
        result['length'] = int(result['length'])

src/c/o/cogent-1.5.3/tests/test_parse/test_record.py   cogent(Download)
#!/usr/bin/env python
"""Unit tests for parser support libraries dealing with records.
"""
from cogent.parse.record import FieldError, RecordError, Grouper, \
    DelimitedSplitter, GenericRecord, MappedRecord, \
    def test_default(self):
        """Default FieldWrapper should wrap fields and labels"""
        fields = list('abcde')
        f = FieldWrapper(fields)
        self.assertEqual(f(''), {})
    def test_splitter(self):
        """FieldWrapper with splitter should use that splitter"""
        fields = ['label', 'count']
        splitter = DelimitedSplitter(':', -1)
        f = FieldWrapper(fields, splitter)
    def test_constructor(self):
        """FieldWrapper with constructor should use that constructor"""
        fields = list('abc')
        f = FieldWrapper(fields, constructor=fake_dict)
        self.assertEqual(f('x y'), {'a':'x','b':'y'})
        assert isinstance(f('x y'), fake_dict)

src/p/y/pycogent-HEAD/tests/test_parse/test_record.py   pycogent(Download)
#!/usr/bin/env python
"""Unit tests for parser support libraries dealing with records.
"""
from cogent.parse.record import FieldError, RecordError, Grouper, \
    DelimitedSplitter, GenericRecord, MappedRecord, \
    def test_default(self):
        """Default FieldWrapper should wrap fields and labels"""
        fields = list('abcde')
        f = FieldWrapper(fields)
        self.assertEqual(f(''), {})
    def test_splitter(self):
        """FieldWrapper with splitter should use that splitter"""
        fields = ['label', 'count']
        splitter = DelimitedSplitter(':', -1)
        f = FieldWrapper(fields, splitter)
    def test_constructor(self):
        """FieldWrapper with constructor should use that constructor"""
        fields = list('abc')
        f = FieldWrapper(fields, constructor=fake_dict)
        self.assertEqual(f('x y'), {'a':'x','b':'y'})
        assert isinstance(f('x y'), fake_dict)