[issue22949] fnmatch.translate doesn't add ^ at the beginning

2016-10-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a1aef5f84142 by Serhiy Storchaka in branch '3.5':
Issue #22949: Documented that fnmatch.translate() is for use with re.match().
https://hg.python.org/cpython/rev/a1aef5f84142

New changeset 8a564ab1d208 by Serhiy Storchaka in branch '2.7':
Issue #22949: Documented that fnmatch.translate() is for use with re.match().
https://hg.python.org/cpython/rev/8a564ab1d208

New changeset dfda2f33fd08 by Serhiy Storchaka in branch '3.6':
Issue #22949: Documented that fnmatch.translate() is for use with re.match().
https://hg.python.org/cpython/rev/dfda2f33fd08

New changeset d103ee917342 by Serhiy Storchaka in branch 'default':
Issue #22949: Documented that fnmatch.translate() is for use with re.match().
https://hg.python.org/cpython/rev/d103ee917342

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22949] fnmatch.translate doesn't add ^ at the beginning

2016-10-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22949] fnmatch.translate doesn't add ^ at the beginning

2016-10-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
keywords: +patch
Added file: http://bugs.python.org/file45116/doc_fnmatch_translate.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22949] fnmatch.translate doesn't add ^ at the beginning

2016-10-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Since issue22493 fnmatch.translate() uses scoped modifiers: r'(?s:%s)\Z' % res.

Here is a patch that updates the documentation for fnmatch.translate().

--
stage: needs patch -> patch review
versions: +Python 3.6, Python 3.7 -Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22949] fnmatch.translate doesn't add ^ at the beginning

2014-11-26 Thread mstol

New submission from mstol:

I'm not sure if this is real bug, but the documentation of fnmatch.translate 
states:

fnmatch.translate(pattern)

Return the shell-style pattern converted to a regular expression.



My intuition about shell-style pattern is that for example, pattern:t3
should match only t3, and not ost3 or xt3, but what I receive from fnmatch 
is:
In [2]: fnmatch.translate(t3)
Out[2]: 't3\\Z(?ms)'

so using for example re.search will match not only on t3, but also on xxxt3 (in 
shell-like pattern is *t3). So... I  believe it should be changed or at least 
the documentation should be more specific about what shell-style pattern mean.

--
components: Regular Expressions
messages: 231712
nosy: ezio.melotti, mrabarnett, mstol
priority: normal
severity: normal
status: open
title: fnmatch.translate doesn't add ^ at the beginning
type: behavior
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22949
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22949] fnmatch.translate doesn't add ^ at the beginning

2014-11-26 Thread mstol

mstol added the comment:

it can be changed easyly with changing the return statement in 
fnmatch.py function translate 

from:
return res + '\Z(?ms)'

to:
return '^' + res + '\Z(?ms)'

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22949
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22949] fnmatch.translate doesn't add ^ at the beginning

2014-11-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The result of fnmatch.translate() is used with re.match(). It could be even 
simplified if use it with re.fullmatch(), but I afraid such change can break 
user code.

--
nosy: +serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22949
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22949] fnmatch.translate doesn't add ^ at the beginning

2014-11-26 Thread mstol

mstol added the comment:

So you suggest that this output should not be used with re.search ? Why?

I think it should be documented, or maybe it is?

I know that this is not possible to introduce such a change to the currently 
used versions.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22949
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22949] fnmatch.translate doesn't add ^ at the beginning

2014-11-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think it should be documented.

--
assignee:  - docs@python
components: +Documentation
keywords: +easy
nosy: +docs@python
priority: normal - low
stage:  - needs patch
versions: +Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22949
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22949] fnmatch.translate doesn't add ^ at the beginning

2014-11-26 Thread Matthew Barnett

Matthew Barnett added the comment:

I notice that it puts the inline flags at the end. It would be better to put 
them at the start.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22949
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com