Code Monkey home page Code Monkey logo

prrvchr / pyrdfa3 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rdflib/pyrdfa3

0.0 0.0 1.0 4.03 MB

RDFa 1.1 distiller/parser library: can extract RDFa 1.1 (and RDFa 1.0, if properly set via a @version attribute) from (X)HTML, SVG, or XML in general. The module can be used to produce serialized versions of the extracted graph, or simply an RDFLib Graph.

Home Page: http://www.w3.org/2012/pyRdfa/

License: Other

Shell 0.11% Python 99.89%

pyrdfa3's People

Watchers

 avatar

Forkers

openculinary

pyrdfa3's Issues

Deprecation of invalid escape chars: utils._unquotedChars

The following code began emitting a SyntaxWarning in Python 3.12, and should likely be updated to use a raw-string format as described in the introductory section of the re docs:

_unquotedChars = ':/\?=#~'

Context / History

Python strings such as '\w' that contain invalid escape sequences have become frequently-used in regular expression code, because regex syntax includes some character-classes that are indicated by a backslash followed by a single character.

The absence of any output warning/error when using standard Python string notation to represent those -- as opposed to a raw string notation) -- has allowed these invalid-escape strings to appear organically in many codebases.

Python 3.6 added a (silent-by-default) DeprecationWarning for strings that contain invalid escape sequences, as part of an intention to gradually increase the severity the warning, and eventually for it to become a syntax error (rejected by the interpreter). The deprecation warning occurs when the relevant Python warnings are enabled:

# $ python -Walways
Python 3.11.8 (main, Feb  7 2024, 21:52:08) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> ':/\?=#~'
<stdin>:1: DeprecationWarning: invalid escape sequence '\?'
':/\\?=#~'

From Python 3.12 onwards, the visibility of these syntax problems has been increased, and they begin emitting a SyntaxWarning message to the output by default:

# $ python
Python 3.12.3 (main, Apr 10 2024, 03:39:08) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> ':/\?=#~'
<stdin>:1: SyntaxWarning: invalid escape sequence '\?'
':/\\?=#~'

A fix should be relatively straightforward and is essentially source-only; it affects the way that we represent the set of unquoted characters in the source code as written, and the runtime behaviour of the program (apart from warning/error output) should not change.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.