RE: How to apply a self defined function in Pandas

2021-10-31 Thread Avi Gross via Python-list
When people post multiple comments and partial answers and the reply every time 
is to ask for more; there may be a disconnect.

Some assume that the person is just stuck but generally can go forward with a 
little hint. But when you keep being asked for more, maybe it means they want 
you to do it for them, as in some asking about HW.

I am not joining this one. 


-Original Message-
From: Python-list  On 
Behalf Of Karsten Hilbert
Sent: Sunday, October 31, 2021 4:00 PM
To: python-list@python.org
Subject: Re: How to apply a self defined function in Pandas

Am Sun, Oct 31, 2021 at 07:52:18PM + schrieb Shaozhong SHI:

> Well, can you expand the the simplicity?

Not sure how expanding is going to help but here's one way to do it:

Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> list('simplicity')
['s', 'i', 'm', 'p', 'l', 'i', 'c', 'i', 't', 'y']
>>>

Best,
Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
--
https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Python C API: how to mark a type as subclass of another type

2021-10-31 Thread Marco Sulla
I have two types declared as

PyTypeObject PyX_Type = {
PyVarObject_HEAD_INIT(_Type, 0)

etc.

How can I mark one of the types as subclass of the other one? I tried
to use tp_base but it didn't work.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45670] New .mapping attribute is broken for some existing uses of dict views

2021-10-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Hmm, I'm looking through the bidict code a bit more.  Rather than saying the 
dict views are being used in an unsupported way, it is more accurate to say 
that your intended meaning for the *mapping* attribute differs from the 
published meaning.

Note, the implementation is already skating on thin ice.  The values() call 
unexpectedly returns an instance of dict_keys().  At first, I was surprised 
that this got past the type checker -- you can do set operations with KeysView 
but not with a ValuesView.

>>> b.values()
dict_keys([1, 2])

One suggestion is to document *mapping* do exactly what it currently does.  The 
mappingproxy means that you aren't promising a specific upstream 
implementation.   

Also consider that bidict could guarantee the meaning of *mapping* and its 
underlying store.  This would allow users to make fast conversions to other 
mapping types:

# This is weird, but useful. 
# It might be nice to guarantee it.
>>> OrderedDict(b.values().mapping)
>>> OrderedDict([(1, 'a'), (2, 'b')])

--

___
Python tracker 

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



[issue45618] Documentation builds fail with Sphinx 3.2.1

2021-10-31 Thread miss-islington


miss-islington  added the comment:


New changeset 14a4fce457033412278ca9a056787db424310dc3 by m-aciek in branch 
'main':
bpo-45618: Update Sphinx version used to build the documentation to 4.2.0 
(GH-29256)
https://github.com/python/cpython/commit/14a4fce457033412278ca9a056787db424310dc3


--

___
Python tracker 

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



Re: How to apply a self defined function in Pandas

2021-10-31 Thread Shaozhong SHI
On Sun, 31 Oct 2021 at 18:42, Shaozhong SHI  wrote:

>
>
> On Sunday, 31 October 2021, Albert-Jan Roskam 
> wrote:
>
>>
>>
>> > df['URL'] = df.apply(lambda x:  connect(df['URL']), axis=1)
>>
>>
>> I think you need axis=0. Or use the Series, df['URL'] =
>> df.URL.apply(connect)
>>
>

> Just experimented with your suggestion, but have not seen any difference.
>

Regards, David
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45682] Nicer default logging format

2021-10-31 Thread Vinay Sajip


Vinay Sajip  added the comment:

> They too could pass a format argument themselves rather then relying on the 
> default format never changing.

Changes to the stdlib shouldn't require changing previously working code 
(sometimes months or years old) to fix breakage caused by new stdlib changes.

--

___
Python tracker 

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



Re: How to apply a self defined function in Pandas

2021-10-31 Thread Karsten Hilbert
Am Sun, Oct 31, 2021 at 07:52:18PM + schrieb Shaozhong SHI:

> Well, can you expand the the simplicity?

Not sure how expanding is going to help but here's one way to
do it:

Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> list('simplicity')
['s', 'i', 'm', 'p', 'l', 'i', 'c', 'i', 't', 'y']
>>>

Best,
Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to apply a self defined function in Pandas

2021-10-31 Thread Shaozhong SHI
On Sun, 31 Oct 2021 at 19:28, MRAB  wrote:

> On 2021-10-31 18:48, Shaozhong SHI wrote:
> >
> > On Sunday, 31 October 2021, MRAB  wrote:
> >
> > On 2021-10-31 17:25, Shaozhong SHI wrote:
> >
> > I defined a function and apply it to a column in Pandas.  But
> > it does not
> > return correct values.
> >
> > I am trying to test which url in a column full of url to see
> > which one can
> > be connected to or not
> >
> > def connect(url):
> >  try:
> >  urllib.request.urlopen(url)
> >  return True
> >  except:
> >  return False
> >
> > df['URL'] = df.apply(lambda x: connect(df['URL']), axis=1)
> >
> > I ran without any error, but did not return any true.
> >
> > I just could not find any error with it.
> >
> > Can anyone try and find out why
> >
> > You're passing a function to '.apply'. That has one argument,' x'.
> >
> > But what is the function doing with that argument?
> >
> > Nothing.
> >
> > The function is just returning the result of connect(df['URL']).
> >
> > df['URL'] is a column, so you're passing a column to '.urlopen',
> > which, of course, it doesn't understand.
> >
> > So 'connect' returns False.
> >
> >
> > Please expand on how.
> >
> It's as simple as passing 'connect' to '.apply' as  the first argument.
>


Well, can you expand the the simplicity?

Regards, David

> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45682] Nicer default logging format

2021-10-31 Thread Olaf van der Spek


Olaf van der Spek  added the comment:

> Except that people may have used the current basic format in, for example, 
> unit tests, and that code could break after a change like the one proposed.

They too could pass a format argument themselves rather then relying on the 
default format never changing.

--

___
Python tracker 

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



[issue45670] New .mapping attribute is broken for some existing uses of dict views

2021-10-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Sorry, but this isn't bug in Python.  The documented and supported API is the 
MappingView ABC where the _mapping attribute is private.

As an optimization, the bidict project has elected to forgo the supported API 
and instead use a concrete implementation designed specifically for actual 
dictionaries.  This is an unsupported use and the constructor is not a public 
API.

We don't even do this internally in the standard library. OrderedDict, for 
example, has its own odict_keys() type for the C version and 
_OrderedDictKeysView() for the pure python version.

It would be possible for us to add a set_mapping() method or make the attribute 
writeable but that would send us down the path for having to support non-dicts 
throughout and would tie our hands with respect to implementation techniques 
that rely on the mapping being an actual dictionary.  That isn't worth it for a 
code optimization and it loses the benefits arising from separate concrete and 
abstract classes.

Likewise, I don't think a documentation update makes sense because we don't 
document a constructor, so there is no documented way for a user to get into 
this position.

For the bidict project, several options come to mind:

1) To continue down the path of using dict_keys, dict_values, and dict_items, 
consider building a subclass that hides the mapping attribute or that raises a 
NotImplementedError. That is what collections.Counter() does with the inherited 
fromkeys() classmethod.

2) Build a C or Cython extension to implement an optimized concrete 
implementation designed specifically for bidict. That is what 
collections.OrderedDict() does for keys, values, and items.

3) Forgo the optimization and use the supported MappingView ABC.  That is what 
collections.ChainMap() does.

4) Just document that *mapping* behaves differently in bidict.

Thank you for the clear bug report with examples. It made it easier to drill 
into what was happening.

--
assignee:  -> rhettinger
resolution:  -> not a bug
stage:  -> 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



[issue45588] cached_method similar to cached_property to cache with classes

2021-10-31 Thread Marten Lienen


Marten Lienen  added the comment:

As suggested, I have extracted the code and tests into a package on PyPI: 
https://pypi.org/project/cached_method/
With this I will close this issue. "third party" sounds about right as the 
Resolution setting.

@eric.araujo This feature is about caching the result of a method call.

--
resolution:  -> third party
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



[issue45516] Add protocol description to the Traversable and TraversableResources documentation

2021-10-31 Thread miss-islington


miss-islington  added the comment:


New changeset b04b307e0ebad0d9c7cc311fe6018b8d31b2ac8d by Miss Islington (bot) 
in branch '3.9':
bpo-45516: add protocol description to the Traversable documentation (GH-29039)
https://github.com/python/cpython/commit/b04b307e0ebad0d9c7cc311fe6018b8d31b2ac8d


--

___
Python tracker 

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



Re: How to apply a self defined function in Pandas

2021-10-31 Thread MRAB

On 2021-10-31 18:48, Shaozhong SHI wrote:


On Sunday, 31 October 2021, MRAB  wrote:

On 2021-10-31 17:25, Shaozhong SHI wrote:

I defined a function and apply it to a column in Pandas.  But
it does not
return correct values.

I am trying to test which url in a column full of url to see
which one can
be connected to or not

def connect(url):
     try:
         urllib.request.urlopen(url)
         return True
     except:
         return False

df['URL'] = df.apply(lambda x: connect(df['URL']), axis=1)

I ran without any error, but did not return any true.

I just could not find any error with it.

Can anyone try and find out why

You're passing a function to '.apply'. That has one argument,' x'.

But what is the function doing with that argument?

Nothing.

The function is just returning the result of connect(df['URL']).

df['URL'] is a column, so you're passing a column to '.urlopen',
which, of course, it doesn't understand.

So 'connect' returns False.


Please expand on how.


It's as simple as passing 'connect' to '.apply' as  the first argument.
--
https://mail.python.org/mailman/listinfo/python-list


[issue45516] Add protocol description to the Traversable and TraversableResources documentation

2021-10-31 Thread miss-islington


miss-islington  added the comment:


New changeset 89b1237ffbd2df2721dc4959e3ccb1106f3555b5 by Miss Islington (bot) 
in branch '3.10':
bpo-45516: add protocol description to the Traversable documentation (GH-29039)
https://github.com/python/cpython/commit/89b1237ffbd2df2721dc4959e3ccb1106f3555b5


--

___
Python tracker 

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



Re: How to apply a self defined function in Pandas

2021-10-31 Thread Shaozhong SHI
On Sunday, 31 October 2021, MRAB  wrote:

> On 2021-10-31 17:25, Shaozhong SHI wrote:
>
>> I defined a function and apply it to a column in Pandas.  But it does not
>> return correct values.
>>
>> I am trying to test which url in a column full of url to see which one can
>> be connected to or not
>>
>> def connect(url):
>>  try:
>>  urllib.request.urlopen(url)
>>  return True
>>  except:
>>  return False
>>
>> df['URL'] = df.apply(lambda x: connect(df['URL']), axis=1)
>>
>> I ran without any error, but did not return any true.
>>
>> I just could not find any error with it.
>>
>> Can anyone try and find out why
>>
>> You're passing a function to '.apply'. That has one argument,' x'.
>
> But what is the function doing with that argument?
>
> Nothing.
>
> The function is just returning the result of connect(df['URL']).
>
> df['URL'] is a column, so you're passing a column to '.urlopen', which, of
> course, it doesn't understand.
>
> So 'connect' returns False.
>
>
Please expand on how.

David

> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to apply a self defined function in Pandas

2021-10-31 Thread Shaozhong SHI
On Sunday, 31 October 2021, Albert-Jan Roskam 
wrote:

>
>
> > df['URL'] = df.apply(lambda x:  connect(df['URL']), axis=1)
>
>
> I think you need axis=0. Or use the Series, df['URL'] =
> df.URL.apply(connect)
>
Any details?
I will try and let you know.  Regards, David
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to apply a self defined function in Pandas

2021-10-31 Thread Albert-Jan Roskam
 > df['URL'] = df.apply(lambda x:  connect(df['URL']), axis=1)

   I think you need axis=0. Or use the Series, df['URL'] =
   df.URL.apply(connect)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to apply a self defined function in Pandas

2021-10-31 Thread MRAB

On 2021-10-31 17:25, Shaozhong SHI wrote:

I defined a function and apply it to a column in Pandas.  But it does not
return correct values.

I am trying to test which url in a column full of url to see which one can
be connected to or not

def connect(url):
 try:
 urllib.request.urlopen(url)
 return True
 except:
 return False

df['URL'] = df.apply(lambda x: connect(df['URL']), axis=1)

I ran without any error, but did not return any true.

I just could not find any error with it.

Can anyone try and find out why


You're passing a function to '.apply'. That has one argument,' x'.

But what is the function doing with that argument?

Nothing.

The function is just returning the result of connect(df['URL']).

df['URL'] is a column, so you're passing a column to '.urlopen', which, 
of course, it doesn't understand.


So 'connect' returns False.
--
https://mail.python.org/mailman/listinfo/python-list


[issue10483] http.server - what is executable on Windows

2021-10-31 Thread Éric Araujo

Éric Araujo  added the comment:

I don’t know if CGI on windows servers is very relevant nowadays.

--
nosy: +eric.araujo
versions:  -Python 3.2

___
Python tracker 

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



[issue45682] Nicer default logging format

2021-10-31 Thread Vinay Sajip


Vinay Sajip  added the comment:

> However in the case of logging, an argument could be made that changing the 
> default would have less impact.

Except that people may have used the current basic format in, for example, unit 
tests, and that code could break after a change like the one proposed. The 
default has been intentionally kept minimal for the very simplest of needs and 
it is easy to override this default using e.g. basicConfig() for simple needs 
or e.g. dictConfig() for more elaborate needs.

For those reasons, I don't think this default should be changed.

--
resolution:  -> rejected
stage:  -> 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



[issue45625] Add support for top-level await

2021-10-31 Thread Éric Araujo

Éric Araujo  added the comment:

I don’t think that’s possible; it wouldn’t fit with the design of python to 
have an implicit async loop like that.  But I’m no expert here, so you could 
bring this idea to https://discuss.python.org/c/ideas/6 to see what people 
think.

--

___
Python tracker 

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



[issue44365] Bad dataclass post-init example

2021-10-31 Thread da2ce7


da2ce7  added the comment:

Amazingly, the original example needs a very small change to make it work as 
expected:

@dataclass
class Rectangle:
height: float
width: float

@dataclass
class Square(Rectangle):
side: float
height: float = field(init=False)
width: float = field(init=False)

def __post_init__(self) -> None:
super().__init__(self.side, self.side)

I discover this now, after playing around for a while.
Attached is the simplified version of my expanded example testcase.

--
Added file: https://bugs.python.org/file50416/dataclass_inheritance_v3_test.py

___
Python tracker 

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



How to apply a self defined function in Pandas

2021-10-31 Thread Shaozhong SHI
I defined a function and apply it to a column in Pandas.  But it does not
return correct values.

I am trying to test which url in a column full of url to see which one can
be connected to or not

def connect(url):
try:
urllib.request.urlopen(url)
return True
except:
return False

df['URL'] = df.apply(lambda x: connect(df['URL']), axis=1)

I ran without any error, but did not return any true.

I just could not find any error with it.

Can anyone try and find out why


Regards,

David
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45642] Unable to save

2021-10-31 Thread Ned Deily


Change by Ned Deily :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> tkinter.filedialog linked with Tk 8.6.11 crashes on macOS 12 
Monterey, breaking IDLE saves

___
Python tracker 

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



[issue45516] Add protocol description to the Traversable and TraversableResources documentation

2021-10-31 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27611
pull_request: https://github.com/python/cpython/pull/29348

___
Python tracker 

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



[issue45516] Add protocol description to the Traversable and TraversableResources documentation

2021-10-31 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27612
pull_request: https://github.com/python/cpython/pull/29349

___
Python tracker 

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



[issue45634] [sqlite3] don't combine error checks when adding integer constants

2021-10-31 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Thanks for reviewing, Dong-hee!

--
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



[issue45682] Nicer default logging format

2021-10-31 Thread Ned Deily


Change by Ned Deily :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue44365] Bad dataclass post-init example

2021-10-31 Thread da2ce7


da2ce7  added the comment:

Upon Self Review, I think that this slightly updated version is a bit more 
illustrative.

--
Added file: https://bugs.python.org/file50415/dataclass_inheritance_v2_test.py

___
Python tracker 

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



[issue2628] ftplib Persistent data connection

2021-10-31 Thread Jonathan Bell


Jonathan Bell  added the comment:

This issue is 13 years old. The original 2008 patch was used in a production 
environment against an OpenVMS server identifying itself as MadGoat. That use 
case involved downloading documents only, and no write permission was 
available. Therefore the patch only supports RETR. See the debug.log file 
attached to this issue for the server interaction. 

I no longer have a need for BLOCK mode, and don't know what modern servers 
would support it. mikecmcleod revived this issue so perhaps they can provide 
some ability for testing, or perspective on the current needs.

The PR updates the patch to Python 3, and includes a test written against the 
minimal changes required for that 2.7->3.x update.

--

___
Python tracker 

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



[issue44365] Bad dataclass post-init example

2021-10-31 Thread da2ce7


da2ce7  added the comment:

I have made a slightly more comprehensive example. See file attached.

Please consider for the updated documentation.

--
nosy: +da2ce7
Added file: https://bugs.python.org/file50414/dataclass_inheritance_test.py

___
Python tracker 

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



[issue43633] Improve the textual representation of IPv4-mapped IPv6 addresses

2021-10-31 Thread Oleksandr Pavliuk


Change by Oleksandr Pavliuk :


--
keywords: +patch
nosy: +opavlyuk
nosy_count: 1.0 -> 2.0
pull_requests: +27610
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29345

___
Python tracker 

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



[issue45516] Add protocol description to the Traversable and TraversableResources documentation

2021-10-31 Thread miss-islington

miss-islington  added the comment:


New changeset bc8fd7c9c24eb71217ebdb8a12cf38e9dc4215b2 by Filipe Laíns in 
branch 'main':
bpo-45516: fix Traversable.name documentation (GH-29194)
https://github.com/python/cpython/commit/bc8fd7c9c24eb71217ebdb8a12cf38e9dc4215b2


--
nosy: +miss-islington

___
Python tracker 

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



[issue45677] [doc] improve sqlite3 docs

2021-10-31 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood

___
Python tracker 

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



[issue45682] Nicer default logging format

2021-10-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Generally, we can't change defaults after an API has been published because it 
immediately affects the output for people who use that default.  However in the 
case of logging, an argument could be made that changing the default would have 
less impact.

--
nosy: +rhettinger

___
Python tracker 

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



[issue45682] Nicer default logging format

2021-10-31 Thread Olaf van der Spek


New submission from Olaf van der Spek :

The default logging format will print something like: 
WARNING:root:Hello Python!

Could it default to something like this instead?

2021-10-31 14:52:36,490 WARNING: Hello Python!

logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s')
logging.warning('Hello Python!')

--
components: Library (Lib)
messages: 405403
nosy: olafvdspek
priority: normal
severity: normal
status: open
title: Nicer default logging format
type: enhancement

___
Python tracker 

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



[issue2628] ftplib Persistent data connection

2021-10-31 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

Hello.
I added some initial comments to the PR, but I'm sort of skeptical about this. 
It must be noted that:

1) very few FTP servers probably support this feature 
(https://en.wikipedia.org/wiki/File_Transfer_Protocol#Data_transfer_modes)

2) the specs are very old (RFC-959 is from 1985), and I doubt they've been 
upgraded in later RFCs. The fact that a header is sent *before every data 
block* seems inefficient (why not just send the  file size once?), probably 
more inefficient that opening a new connection each time (unless files are 
small, I suppose).

Was this tested against an actual FTP server(s)? If yes, which one(s)? IMO, it 
would be good if some actual research/testing is done first, to see how actual 
FTP server products implement this feature.

Another thing to note is that the PR supports RETR (download) only, and not 
STOR (upload). Is this on purpose or does the original RFC/spec limits this 
functionality to RETR?

--

___
Python tracker 

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



Ansible, pip and virtualenv

2021-10-31 Thread Albert-Jan Roskam
   Hi
   I wrote an Ansible .yml to deploy a Flask webapp. I use python 3.6 for the
   ansible-playbook executable. The yml starts with some yum installs,
   amongst which python-pip. That installs an ancient pip version (v9). Then
   I create a virtualenv where I use a requirements.txt for pip install -r.
   Should I precede that step with a separate --upgrade pip step? Or should
   pip just be in my requirements.txt?
   Separate question: what locations do I need to specify in my pip
   --trusted-host list? Could it be that this has recently changed? I
   suddenly got SSL errors.
   Thanks in advance!
   Albert-Jan
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45681] tkinter breaks on high resolution screen after ctypes SetProcessDPIAware()

2021-10-31 Thread Gabe


New submission from Gabe :

In the following code: 
```py
import tkinter as tk
from tkinter import ttk

import ctypes
ctypes.windll.user32.SetProcessDPIAware()

w = tk.Tk()
ttk.Checkbutton(w, text = "Checkbox").grid()
w.mainloop()
```

The checkbox begins as normal size, but after hovering over it, it becomes 
small. See attached gif.

The issue does not occur without the SetProcessDPIAware call. 

I am running Windows 11, and my screen resolution is 2560x1440. My 
Settings>System>Display>Custom Scaling is set to 150%. I believe that this is 
relevant because SetProcessDPIAware() directly affects the dpi awareness (aka 
'custom scaling') of the program, according to Microsoft documentation.

--
components: Tkinter
files: KwUqCTWl58.gif
messages: 405401
nosy: GabeMillikan
priority: normal
severity: normal
status: open
title: tkinter breaks on high resolution screen after ctypes 
SetProcessDPIAware()
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file50413/KwUqCTWl58.gif

___
Python tracker 

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



[issue45634] [sqlite3] don't combine error checks when adding integer constants

2021-10-31 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset ed91f959b032951620f32bcd93ff27223699a86a by Erlend Egeberg 
Aasland in branch '3.10':
[3.10] bpo-45634: Don't combine error checks when adding `sqlite3` int 
constants (GH-29251). (GH-29343)
https://github.com/python/cpython/commit/ed91f959b032951620f32bcd93ff27223699a86a


--

___
Python tracker 

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



[issue10483] http.server - what is executable on Windows

2021-10-31 Thread mike mcleod


mike mcleod  added the comment:

Hi,
I would like to help on this issue.
Let me know what can be done?

--
nosy: +mikecmcleod

___
Python tracker 

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



[issue45677] [doc] improve sqlite3 docs

2021-10-31 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

(Nosying Mariatta and Carol from the CPython DWG)

--
nosy: +Mariatta, willingc

___
Python tracker 

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



[issue45677] [doc] improve sqlite3 docs

2021-10-31 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> What is wrong with addressing the reader as "you"?

I remember this was discussed on python-dev last year (?). IIRC, the majority 
was in favour of changing the documentation to avoid addressing the reader 
personally. Let us ask the Documentation Workgroup over at Discourse. I'll 
create a topic.

> Avoiding an affirmative tone goes directly against the style-guide you linked 
> to, which recommends an affirmative (positive) tone:

Sorry, that was a language glitch; I'm not a native english speaker :) _Use_ an 
affirmative tone is of course correct.

--

___
Python tracker 

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



[issue45634] [sqlite3] don't combine error checks when adding integer constants

2021-10-31 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
pull_requests: +27609
pull_request: https://github.com/python/cpython/pull/29343

___
Python tracker 

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



[issue45634] [sqlite3] don't combine error checks when adding integer constants

2021-10-31 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 39b4d5938ce781af41f8c9da72dee46095a78642 by Erlend Egeberg 
Aasland in branch 'main':
bpo-45634: Don't combine error checks when adding `sqlite3` int constants 
(GH-29251)
https://github.com/python/cpython/commit/39b4d5938ce781af41f8c9da72dee46095a78642


--
nosy: +corona10

___
Python tracker 

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



[issue45666] Warning: "'swprintf' : format string '%s' requires an argument of type 'unsigned short *', but variadic argument 1 has type 'const char *'"

2021-10-31 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
pull_requests: +27608
pull_request: https://github.com/python/cpython/pull/29341

___
Python tracker 

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



[issue45679] typing.Literal[True] is implicitly converted to typing.Literal[1]

2021-10-31 Thread miss-islington


miss-islington  added the comment:


New changeset 3997f3ce8ab15269fc800062f75411865dbc0d55 by Miss Islington (bot) 
in branch '3.10':
bpo-45679: Fix caching of multi-value typing.Literal (GH-29334)
https://github.com/python/cpython/commit/3997f3ce8ab15269fc800062f75411865dbc0d55


--

___
Python tracker 

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



[issue45679] typing.Literal[True] is implicitly converted to typing.Literal[1]

2021-10-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +27607
pull_request: https://github.com/python/cpython/pull/29342

___
Python tracker 

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



[issue45679] typing.Literal[True] is implicitly converted to typing.Literal[1]

2021-10-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 634984d7dbdd91e0a51a793eed4d870e139ae1e0 by Serhiy Storchaka in 
branch 'main':
bpo-45679: Fix caching of multi-value typing.Literal (GH-29334)
https://github.com/python/cpython/commit/634984d7dbdd91e0a51a793eed4d870e139ae1e0


--

___
Python tracker 

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



[issue45679] typing.Literal[True] is implicitly converted to typing.Literal[1]

2021-10-31 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +27606
pull_request: https://github.com/python/cpython/pull/29340

___
Python tracker 

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



[issue45666] Warning: "'swprintf' : format string '%s' requires an argument of type 'unsigned short *', but variadic argument 1 has type 'const char *'"

2021-10-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

>From the man page:

   S  (Not in C99 or C11, but in SUSv2, SUSv3, and SUSv4.)  Synonym for 
ls.  Don't use.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue45679] typing.Literal[True] is implicitly converted to typing.Literal[1]

2021-10-31 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
pull_requests: +27605
pull_request: https://github.com/python/cpython/pull/29339

___
Python tracker 

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