# -*- 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`
- access the parsed data, which is returned as a :class:`ParseResults`
object
- 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.4.7"
__versionTime__ = "30 Mar 2020 00:43 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
from operator import itemgetter
import itertools
from functools import wraps
from contextlib import contextmanager
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, Mapping
except ImportError:
# Python 2.7
from collections import Iterable
from collections import MutableMapping, Mapping
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
# version compatibility configuration
__compat__ = SimpleNamespace()
__compat__.__doc__ = """
A cross-version compatibility configuration for pyparsing features that will be
released in a future version. By setting values in this configuration to True,
those features can be enabled in prior versions for compatibility development
and testing.
- collect_all_And_tokens - flag to enable fix for Issue #63 that fixes erroneous grouping
of results names when an And expression is nested within an Or or MatchFirst; set to
True to enable bugfix released in pyparsing 2.3.0, or False to preserve
pre-2.3.0 handling of named results
"""
__compat__.collect_all_And_tokens = True
__diag__ = SimpleNamespace()
__diag__.__doc__ = """
Diagnostic configuration (all default to False)
- warn_multiple_tokens_in_named_alternation - flag to enable warnings when a results
name is defined on a MatchFirst or Or expression with one or more And subexpressions
(only warns if __compat__.collect_all_And_tokens is False)
- warn_ungrouped_named_tokens_in_collection - flag to enable warnings when a results
name is defined on a containing expression with ungrouped subexpressions that also
have results names
- warn_name_set_on_empty_Forward - flag to enable warnings whan a Forward is defined
with a results name, but has no contents defined
- warn_on_multiple_string_args_to_oneof - flag to enable warnings whan oneOf is
incorrectly called with multiple str arguments
- enable_debug_on_named_expressions - flag to auto-enable debug on all subsequent
calls to ParserElement.setName()
"""
__diag__.warn_multiple_tokens_in_named_alternation = False
__diag__.warn_ungrouped_named_tokens_in_collection = False
__diag__.warn_name_set_on_empty_Forward = False
__diag__.warn_on_multiple_string_args_to_oneof = False
__diag__.enable_debug_on_named_expressions = False
__diag__._all_names = [nm for nm in vars(__diag__) if nm.startswith("enable_") or nm.startswith("warn_")]
def _enable_all_warnings():
__diag__.warn_multiple_tokens_in_named_alternation = True
__diag__.warn_ungrouped_named_tokens_in_collection = True
__diag__.warn_name_set_on_empty_Forward = True
__diag__.warn_on_multiple_string_args_to_oneof = True
__diag__.enable_all_warnings = _enable_all_warnings
__all__ = ['__version__', '__versionTime__', '__author__', '__compat__', '__diag__',
'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', 'Pars
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
内容概要:本项目旨在开发一个学生—教师在线批改作业系统,使用Python的socket库进行网络编程,并结合Tkinter或PyQt库创建图形用户界面。系统分为学生端和教师端,支持学生登录、提交作业、查看成绩,以及教师登录、批改作业和发送评价等功能。通过此项目,参与者将深入理解网络通信、图形界面设计和多线程处理的实际应用。 适合人群:具备基本的Python编程技能和了解简单网络编程的学生或开发者,适合自学者和希望通过实际项目提升软件开发技能的初中级开发人员。 能学到什么: 网络编程:了解如何使用Python的socket库实现基于TCP协议的网络通信。 图形用户界面设计:学习如何使用Tkinter或PyQt库设计直观、美观的用户界面。 多线程处理:掌握如何使用Python的threading模块来处理并发任务,提高程序的响应性和效率。 阅读建议:在学习和开发过程中,建议重点关注网络编程和图形界面的交互逻辑,同时注意多线程的实现方式和其对程序性能的影响。除了编码实践,也应理解每个模块的设计理念和实现细节。可通过逐步构建小型功能模块,逐步集成至完整系统,确保每个功能的实现都符合预期效果。
资源推荐
资源详情
资源评论
收起资源包目录
Python网络编程Socket案例实现教师学生作业批改源代码 (641个子文件)
activate 2KB
activate.bat 991B
deactivate.bat 510B
pydoc.bat 24B
sysconfig.cfg 3KB
pyvenv.cfg 410B
python.exe 260KB
pythonw.exe 249KB
t64-arm.exe 177KB
w64-arm.exe 163KB
gui-arm64.exe 135KB
cli-arm64.exe 134KB
pip3.exe 104KB
pip.exe 104KB
pip-3.10.exe 104KB
pip3.10.exe 104KB
wheel3.exe 104KB
wheel-3.10.exe 104KB
wheel3.10.exe 104KB
wheel.exe 104KB
t64.exe 104KB
w64.exe 98KB
t32.exe 95KB
w32.exe 88KB
gui-64.exe 74KB
cli-64.exe 73KB
cli-32.exe 64KB
cli.exe 64KB
gui-32.exe 64KB
gui.exe 64KB
activate.fish 3KB
.gitignore 190B
.gitignore 42B
pythonProject.iml 361B
INSTALLER 5B
INSTALLER 5B
INSTALLER 5B
18413101_assignment.jpg 9KB
LICENSE 1KB
METADATA 5KB
METADATA 4KB
METADATA 2KB
activate.nu 1KB
deactivate.nu 333B
cacert.pem 253KB
activate.ps1 2KB
distutils-precedence.pth 151B
_virtualenv.pth 18B
pyparsing.py 267KB
pyparsing.py 227KB
pyparsing.py 227KB
uts46data.py 197KB
langrussianmodel.py 128KB
more.py 115KB
html5parser.py 114KB
__init__.py 106KB
__init__.py 106KB
langbulgarianmodel.py 103KB
langthaimodel.py 101KB
langhungarianmodel.py 100KB
langgreekmodel.py 97KB
langhebrewmodel.py 96KB
langturkishmodel.py 94KB
tarfile.py 90KB
easy_install.py 84KB
constants.py 82KB
_tokenizer.py 75KB
util.py 66KB
locators.py 51KB
database.py 50KB
msvc.py 49KB
dist.py 49KB
distro.py 47KB
ccompiler.py 47KB
dist.py 42KB
wheel.py 42KB
idnadata.py 41KB
compat.py 41KB
package_index.py 39KB
metadata.py 38KB
fallback.py 37KB
connectionpool.py 37KB
package_finder.py 35KB
bdist_msi.py 35KB
models.py 34KB
six.py 34KB
six.py 34KB
securetransport.py 34KB
req_install.py 33KB
_inputstream.py 32KB
euctwfreq.py 31KB
build_ext.py 31KB
utils.py 31KB
big5freq.py 31KB
specifiers.py 30KB
specifiers.py 30KB
specifiers.py 30KB
msvc9compiler.py 30KB
sessions.py 29KB
install.py 29KB
共 641 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
Asongsong_6
- 粉丝: 71
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- HTTP协议基础概念解析及其演进过程
- 钢管切割机Creo 7.0全套技术资料100%好用.zip
- MiHealth.apk
- 【深度学习专栏】ch06配套资源
- 机床自动上下料机械手 移载机械手sw14可编辑全套技术资料100%好用.zip
- 小学生出题软件v6.3.3.zip
- MATLAB代码:基于MATLAB的三母线高斯赛德尔潮流分析计算 关键词:潮流计算 电力系统 高斯赛德尔迭代法 MATLAB 参考文献+自制详细实验文档 仿真平台:MATLAB 主要内容:潮流计算是判
- DilateFormer实战:使用DilateFormer实现图像分类任务
- 疫苗预约系统:数据库设计与数据安全性
- 粒子群MPPT多峰值寻优 针对扰动、电导等无法用在局部遮阴下,使用粒子群pso算法克服 附使用说明及解析,包括扰动法PO与粒子群PSO法
- 极片自动制片成型模切机sw16可编辑全套技术资料100%好用.zip
- 基于Python实现的医疗知识图谱的知识问答系统源码毕业设计(高分项目)
- 酒店客房管理系统:集成技术与服务创新
- 5个小游戏源代码和图片、音频等资源
- 知攻善防-应急响应靶机-web2-z05-z07.zip
- Python毕业设计Django+Neo4j基于医疗知识图谱的问答系统项目源码+使用说明
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功