当前位置: 首页>>代码示例>>Python>>正文


Python Parser.sub方法代码示例

本文整理汇总了Python中utils.Parser.sub方法的典型用法代码示例。如果您正苦于以下问题:Python Parser.sub方法的具体用法?Python Parser.sub怎么用?Python Parser.sub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utils.Parser的用法示例。


在下文中一共展示了Parser.sub方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: parse_week

# 需要导入模块: from utils import Parser [as 别名]
# 或者: from utils.Parser import sub [as 别名]
            allergene[title] = text
    parse_week(url + this_week, canteen, canteentype,
               allergene=allergene, zusatzstoffe=zusatzstoffe)
    if not today and next_week is True:
        parse_week(url + '-kommende-woche', canteen, canteentype,
                   allergene=allergene, zusatzstoffe=zusatzstoffe)
    if not today and type(next_week) is str:
        parse_week(url + next_week, canteen, canteentype,
                   allergene=allergene, zusatzstoffe=zusatzstoffe)
    return canteen.toXMLFeed()


parser = Parser('ostniedersachsen', handler=parse_url,
                shared_prefix='http://www.stw-on.de')

sub = parser.sub('braunschweig',
                 shared_prefix='/braunschweig/essen/menus/')
sub.define('mensa1-mittag', suffix='mensa-1', extra_args={'canteentype': 'Mittagsmensa'})
sub.define('mensa1-abend', suffix='mensa-1', extra_args={'canteentype': 'Abendmensa'})
sub.define('mensa360', suffix='360', extra_args={'canteentype': 'Pizza', 'this_week': '-2', 'next_week': '-nachste-woche'})
sub.define('mensa2', suffix='mensa-2')
sub.define('hbk', suffix='mensa-hbk')

parser.define('clausthal', suffix='/clausthal/essen/menus/mensa-clausthal',
              extra_args={'next_week': '-kommend-woche'})

sub = parser.sub('hildesheim', shared_prefix='/hildesheim/essen/menus/')
sub.define('uni', suffix='mensa-uni')
sub.define('hohnsen', suffix='mensa-hohnsen')
sub.define('luebecker-strasse', suffix='luebecker-strasse', extra_args={'canteentype': 'Mittagsausgabe'})

parser.sub('suderburg').define('campus', suffix='/suderburg/essen/menus/mensa-suderburg')
开发者ID:azrdev,项目名称:openmensa-parsers,代码行数:34,代码来源:ostniedersachsen.py

示例2: nextWeek

# 需要导入模块: from utils import Parser [as 别名]
# 或者: from utils.Parser import sub [as 别名]
    @Source.feed(name="nextWeek", priority=2, hour="9")
    def nextWeek(self, request):
        day = (datetime.datetime.now() + 7 * datetime.date.resolution).isocalendar()
        self.parse_data(week=day[1], year=day[0])
        return self.feed.toXMLFeed()


parser = Parser(name="halle", version=1.0)
Canteen("harzmensa", parser, location=3, needed_title="Harzmensa")
Canteen("weinbergmensa", parser, location=5, needed_title="Weinbergmensa")
# Canteen('cafebar-weinberg', parser, location=, needed_title='')
Canteen("tulpe", parser, location=10, needed_title="Mensa Tulpe")
Canteen("heidemensa", parser, location=17, needed_title="Heidemensa")
Canteen("burg", parser, location=12, needed_title="Mensa Burg")
Canteen("neuwerk", parser, location=9, needed_title="Neuwerk")
Canteen("franckesche-stiftungen", parser, location=14, needed_title="Franckesche Stiftungen")

# merseburg = parser.sub('merseburg')
Canteen("merseburg", parser, location=16, needed_title="Mensa Merseburg", not_halle=True)
# Canteen('cafebar-merseburg', merseburg, location=, needed_title=)

# dessau = parser.sub('dessau')
Canteen("dessau", parser, location=13, needed_title="Mensa Dessau", not_halle=True)

koethen = parser.sub("koethen")
Canteen("fasanerieallee", koethen, location=7, needed_title="Mensa Köthen")
# Canteen('lohmannstrasse', koethen, location=, needed_title=None)

# bernburg = parser.sub('bernburg')
Canteen("bernburg", parser, location=8, needed_title="Mensa Bernburg", not_halle=True)
开发者ID:shad0w73,项目名称:openmensa-parsers,代码行数:32,代码来源:halle.py

示例3: parse_week

# 需要导入模块: from utils import Parser [as 别名]
# 或者: from utils.Parser import sub [as 别名]
        if title.isdigit():
            zusatzstoffe[title] = text
        else:
            allergene[title] = text
    parse_week(url + this_week, canteen, canteentype, allergene=allergene, zusatzstoffe=zusatzstoffe)
    if not today and next_week is True:
        parse_week(url + "-kommende-woche", canteen, canteentype, allergene=allergene, zusatzstoffe=zusatzstoffe)
    if not today and type(next_week) is str:
        parse_week(url + next_week, canteen, canteentype, allergene=allergene, zusatzstoffe=zusatzstoffe)
    print(canteen.toXMLFeed())
    return canteen.toXMLFeed()


parser = Parser("ostniedersachsen", handler=parse_url, shared_prefix="http://www.stw-on.de")

sub = parser.sub("braunschweig", shared_prefix="/braunschweig/essen/menus/")
sub.define("mensa1-mittag", suffix="mensa-1", extra_args={"canteentype": "Mittagsmensa"})
sub.define("mensa1-abend", suffix="mensa-1", extra_args={"canteentype": "Abendmensa"})
sub.define(
    "mensa360", suffix="360", extra_args={"canteentype": "Pizza", "this_week": "-2", "next_week": "-nachste-woche"}
)
sub.define("mensa2", suffix="mensa-2")
sub.define("hbk", suffix="mensa-hbk")

parser.define("clausthal", suffix="/clausthal/essen/menus/mensa-clausthal", extra_args={"next_week": "-kommend-woche"})

sub = parser.sub("hildesheim", shared_prefix="/hildesheim/essen/menus/")
sub.define("uni", suffix="mensa-uni")
sub.define("hohnsen", suffix="mensa-hohnsen")
sub.define("luebecker-strasse", suffix="luebecker-strasse", extra_args={"canteentype": "Mittagsausgabe"})
开发者ID:mswart,项目名称:openmensa-parsers,代码行数:32,代码来源:ostniedersachsen.py

示例4: nextWeek

# 需要导入模块: from utils import Parser [as 别名]
# 或者: from utils.Parser import sub [as 别名]
    @Source.feed(name='nextWeek', priority=2, hour='9')
    def nextWeek(self, request):
        day = (datetime.datetime.now() + 7 * datetime.date.resolution).isocalendar()
        self.parse_data(week=day[1], year=day[0])
        return self.feed.toXMLFeed()


parser = Parser(name='halle', version=1.0)
Canteen('harzmensa', parser, location=3, needed_title='Harzmensa')
Canteen('weinbergmensa', parser, location=5, needed_title='Weinbergmensa')
#Canteen('cafebar-weinberg', parser, location=, needed_title='')
Canteen('tulpe', parser, location=10, needed_title='Mensa Tulpe')
Canteen('heidemensa', parser, location=17, needed_title='Heidemensa')
Canteen('burg', parser, location=12, needed_title='Mensa Burg')
Canteen('neuwerk', parser, location=9, needed_title='Neuwerk')
Canteen('franckesche-stiftungen', parser, location=14, needed_title='Franckesche Stiftungen')

#merseburg = parser.sub('merseburg')
Canteen('merseburg', parser, location=16, needed_title='Mensa Merseburg', not_halle=True)
#Canteen('cafebar-merseburg', merseburg, location=, needed_title=)

#dessau = parser.sub('dessau')
Canteen('dessau', parser, location=13, needed_title='Mensa Dessau', not_halle=True)

koethen = parser.sub('koethen')
Canteen('fasanerieallee', koethen, location=7, needed_title='Mensa Köthen')
#Canteen('lohmannstrasse', koethen, location=, needed_title=None)

#bernburg = parser.sub('bernburg')
Canteen('bernburg', parser, location=8, needed_title='Mensa Bernburg', not_halle=True)
开发者ID:azrdev,项目名称:openmensa-parsers,代码行数:32,代码来源:halle.py


注:本文中的utils.Parser.sub方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。