#-*- coding: utf-8 -*-
# module pyparsing.py
#
# Copyright (c) 2003-2019 Paul T. McGuire
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__doc__ = \
"""
pyparsing module - Classes and methods to define and execute parsing grammars
=============================================================================
The pyparsing module is an alternative approach to creating and
executing simple grammars, vs. the traditional lex/yacc approach, or the
use of regular expressions. With pyparsing, you don't need to learn
a new syntax for defining grammars or matching expressions - the parsing
module provides a library of classes that you use to construct the
grammar directly in Python.
Here is a program to parse "Hello, World!" (or any greeting of the form
``"<salutation>, <addressee>!"``), built up using :class:`Word`,
:class:`Literal`, and :class:`And` elements
(the :class:`'+'<ParserElement.__add__>` operators create :class:`And` expressions,
and the strings are auto-converted to :class:`Literal` expressions)::
from pip._vendor.pyparsing import Word, alphas
# define grammar of a greeting
greet = Word(alphas) + "," + Word(alphas) + "!"
hello = "Hello, World!"
print (hello, "->", greet.parseString(hello))
The program outputs the following::
Hello, World! -> ['Hello', ',', 'World', '!']
The Python representation of the grammar is quite readable, owing to the
self-explanatory class names, and the use of '+', '|' and '^' operators.
The :class:`ParseResults` object returned from
:class:`ParserElement.parseString` can be
accessed as a nested list, a dictionary, or an object with named
attributes.
The pyparsing module handles some of the problems that are typically
vexing when writing text parsers:
- extra or missing whitespace (the above program will also handle
"Hello,World!", "Hello , World !", etc.)
- quoted strings
- embedded comments
Getting Started -
-----------------
Visit the classes :class:`ParserElement` and :class:`ParseResults` to
see the base classes that most other pyparsing
classes inherit from. Use the docstrings for examples of how to:
- construct literal match expressions from :class:`Literal` and
:class:`CaselessLiteral` classes
- construct character word-group expressions using the :class:`Word`
class
- see how to create repetitive expressions using :class:`ZeroOrMore`
and :class:`OneOrMore` classes
- use :class:`'+'<And>`, :class:`'|'<MatchFirst>`, :class:`'^'<Or>`,
and :class:`'&'<Each>` operators to combine simple expressions into
more complex ones
- associate names with your parsed results using
:class:`ParserElement.setResultsName`
- find some helpful expression short-cuts like :class:`delimitedList`
and :class:`oneOf`
- find more useful common expressions in the :class:`pyparsing_common`
namespace class
"""
__version__ = "2.3.1"
__versionTime__ = "09 Jan 2019 23:26 UTC"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
from weakref import ref as wkref
import copy
import sys
import warnings
import re
import sre_constants
import collections
import pprint
import traceback
import types
from datetime import datetime
try:
# Python 3
from itertools import filterfalse
except ImportError:
from itertools import ifilterfalse as filterfalse
try:
from _thread import RLock
except ImportError:
from threading import RLock
try:
# Python 3
from collections.abc import Iterable
from collections.abc import MutableMapping
except ImportError:
# Python 2.7
from collections import Iterable
from collections import MutableMapping
try:
from collections import OrderedDict as _OrderedDict
except ImportError:
try:
from ordereddict import OrderedDict as _OrderedDict
except ImportError:
_OrderedDict = None
try:
from types import SimpleNamespace
except ImportError:
class SimpleNamespace: pass
#~ sys.stderr.write( "testing pyparsing module, version %s, %s\n" % (__version__,__versionTime__ ) )
__all__ = [
'And', 'CaselessKeyword', 'CaselessLiteral', 'CharsNotIn', 'Combine', 'Dict', 'Each', 'Empty',
'FollowedBy', 'Forward', 'GoToColumn', 'Group', 'Keyword', 'LineEnd', 'LineStart', 'Literal',
'PrecededBy', 'MatchFirst', 'NoMatch', 'NotAny', 'OneOrMore', 'OnlyOnce', 'Optional', 'Or',
'ParseBaseException', 'ParseElementEnhance', 'ParseException', 'ParseExpression', 'ParseFatalException',
'ParseResults', 'ParseSyntaxException', 'ParserElement', 'QuotedString', 'RecursiveGrammarException',
'Regex', 'SkipTo', 'StringEnd', 'StringStart', 'Suppress', 'Token', 'TokenConverter',
'White', 'Word', 'WordEnd', 'WordStart', 'ZeroOrMore', 'Char',
'alphanums', 'alphas', 'alphas8bit', 'anyCloseTag', 'anyOpenTag', 'cStyleComment', 'col',
'commaSeparatedList', 'commonHTMLEntity', 'countedArray', 'cppStyleComment', 'dblQuotedString',
'dblSlashComment', 'delimitedList', 'dictOf', 'downcaseTokens', 'empty', 'hexnums',
'htmlComment', 'javaStyleComment', 'line', 'lineEnd', 'lineStart', 'lineno',
'makeHTMLTags', 'makeXMLTags', 'matchOnlyAtCol', 'matchPreviousExpr', 'matchPreviousLiteral',
'nestedExpr', 'nullDebugAction', 'nums', 'oneOf', 'opAssoc', 'operatorPrecedence', 'printables',
'punc8bit', 'pythonStyleComment', 'quotedString', 'removeQuotes', 'replaceHTMLEntity',
'replaceWith', 'restOfLine', 'sglQuotedString', 'srange', 'stringEnd',
'stringStart', 'traceParseAction', 'unicodeString', 'upcaseTokens', 'withAttribute',
'indentedBlock', 'originalTextFor', 'ungroup', 'infixNotation','locatedExpr', 'withClass',
'CloseMatch', 'tokenMap', 'pyparsing_common', 'pyparsing_unicode', 'unicode_set',
]
system_version = tuple(sys.version_info)[:3]
PY_3 = system_version[0] == 3
if PY_3:
_MAX_INT = sys.maxsize
basestring = str
unichr = chr
unicode = str
_ustr = str
# build list of single arg builtins, that can be used as parse actions
singleArgBuiltins = [sum, len, sorted, reversed, list, tuple, set, any, all, min, max]
else:
_MAX_INT = sys.maxint
range = xrange
def _ustr(obj):
"""Drop-in replacement for str(obj) that tries to be Unicode
friendly. It first tries str(obj). If that fails with
a UnicodeEncodeError, then it tries unicode(obj). It then
< returns the unicode object | encodes it with the default
encoding | ... >.
"""
if isinstance(obj,unicode):
return obj
try:
# If this works, then _ustr(obj) has the same behaviour as str(obj), so
# it won't break any existing code.
return str(obj)
except UnicodeEncodeError:
# Else encode it
ret = unicode(obj).encode(sys.getdefaultencoding(), 'xmlcharrefreplace')
xmlcharref = Regex(r'&#\d+;')
xmlcharref.setParseAction(lambda t: '\\u' + hex(int(t[0][2:-1]))[2:])
return xmlcharref.transformString(ret)
# build list of single arg builtins, tolerant of Python ver
没有合适的资源?快使用搜索试试~ 我知道了~
大学实训课程设计基于Django服装仓库管理系统源代码+数据库
共2000个文件
py:1466个
html:155个
mo:107个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 181 浏览量
2024-11-09
17:30:58
上传
评论
收藏 14.26MB ZIP 举报
温馨提示
大学实训课程设计基于Django服装仓库管理系统源代码+数据库
资源推荐
资源详情
资源评论
收起资源包目录
大学实训课程设计基于Django服装仓库管理系统源代码+数据库 (2000个子文件)
bootstrap.css 143KB
bootstrap.min.css 118KB
bootstrap-theme.css 26KB
bootstrap-theme.min.css 23KB
responsive.css 18KB
select2.css 17KB
base.css 16KB
select2.min.css 15KB
widgets.css 10KB
forms.css 8KB
autocomplete.css 8KB
changelists.css 6KB
rtl.css 4KB
responsive_rtl.css 2KB
login.css 1KB
ol3.css 657B
fonts.css 423B
dashboard.css 412B
technical_500.html 17KB
default_urlconf.html 16KB
index.html 5KB
base.html 5KB
base1.html 4KB
tabular.html 4KB
index.html 4KB
index.html 4KB
index.html 4KB
base2.html 4KB
index.html 4KB
base.html 4KB
detail.html 3KB
detail.html 3KB
index.html 3KB
change_form.html 3KB
change_list.html 3KB
edit.html 2KB
technical_404.html 2KB
delete_confirmation.html 2KB
stacked.html 2KB
change_password.html 2KB
delete_selected_confirmation.html 2KB
add.html 2KB
password_change_form.html 2KB
edit.html 2KB
register.html 2KB
openlayers.html 2KB
edit.html 2KB
edit.html 2KB
login.html 2KB
openlayers.html 2KB
edit.html 2KB
index.html 2KB
model_detail.html 2KB
fieldset.html 2KB
template_filter_index.html 2KB
template_tag_index.html 2KB
changepwd.html 2KB
view_index.html 2KB
add.html 2KB
change_list_results.html 2KB
related_widget_wrapper.html 1KB
object_history.html 1KB
add.html 1KB
login.html 1KB
password_reset_confirm.html 1KB
addmore.html 1KB
bookmarklets.html 1KB
model_index.html 1KB
index.html 1KB
editmore.html 1KB
addmore.html 1KB
editmore.html 1KB
actions.html 1KB
submit_line.html 1024B
search_form.html 1020B
template_detail.html 995B
add.html 988B
add.html 983B
password_reset_form.html 966B
view_detail.html 896B
missing_docutils.html 734B
password_change_done.html 671B
password_reset_done.html 669B
password_reset_email.html 582B
clearable_file_input.html 568B
pagination.html 553B
500.html 527B
date_hierarchy.html 518B
password_reset_complete.html 505B
multiple_input.html 462B
clearable_file_input.html 461B
clearable_file_input.html 461B
invalid_setup.html 437B
multiple_input.html 431B
change_form_object_tools.html 395B
app_index.html 385B
select.html 384B
openlayers-osm.html 378B
logged_out.html 374B
change_list_object_tools.html 370B
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
yanglamei1962
- 粉丝: 2604
- 资源: 902
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于区块链的乳制品溯源系统文档+源码+全部资料+高分项目.zip
- 基于区块链技术之可溯源珠宝电商平台文档+源码+全部资料+高分项目.zip
- 基于区块链的药品溯源系统(学习开发中)文档+源码+全部资料+高分项目.zip
- 基于事件驱动+事件溯源+Saga的微服务示例文档+源码+全部资料+高分项目.zip
- 基于使用Axon框架基于DDD领域驱动设计、CQRS读写分离和事件溯源来实现货物运输系统文档+源码+全部资料+高分项目.zip
- 基于若依后台管理系统的代码溯源系统文档+源码+全部资料+高分项目.zip
- 基于以太坊 Solidity 语言开发秒钛坊区块链智能合约致辞供应链金融信贷周期全流程溯源文档+源码+全部资料+高分项目.zip
- 基于事件溯源基于事件回溯的高性能架构,例如:秒杀、抢红包、12306卖票等,实现cqrs最复杂的模型, 通过事件是追加的特性,然后结合事件批量提交的手段,避免在
- Visual Studio Code中的IntelliSense功能详解.pdf
- 基于溯源图的入侵威胁检测相关论文及阅读笔记文档+源码+全部资料+高分项目.zip
- Keil C51 插件 检测所有if语句
- 基于优雅的Laravel框架开发咖啡壶是一个免费、开源、高效且漂亮的资产管理平台。资产管理、归属使用者追溯、盘点以及可靠的服务器状态管理面板文档+源码+全部资料+高分项目.zip
- 基于云链聚合的隐私保护数据共享与溯源平台文档+源码+全部资料+高分项目.zip
- 各种排序算法java实现的源代码.zip
- java考试题目总132
- 用c语言实现各种排序算法
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功