How to annotate an IntEnum value

2019-09-03 Thread Eko palypse
Suppose the following from enum import IntEnum class ENDOFLINE(IntEnum): CRLF = 0 CR = 1 LF = 2 def get_eol() -> ??: return ENDOFLINE.CRLF def set_eol(eol_value) -> None: pass How should the return value from get_eol be annotated? As ENDOFLINE? The same question for set_

Re: Append some stuff into a file with only the last appended line reserved.

2019-09-03 Thread Hongyi Zhao
On Tue, 03 Sep 2019 08:29:31 +1000, Cameron Simpson wrote: > Please describe this in more detail. Present a little pycurl output and > then explain what portion of it should land in the log file. See the following code from here: http://pycurl.io/docs/latest/callbacks.html#xferinfofunction

Re: Proper way to pass Queue to process when using multiprocessing.imap()?

2019-09-03 Thread Israel Brewster
> > On Sep 3, 2019, at 9:27 AM, Rob Gaddi > wrote: > > On 9/3/19 10:17 AM, Israel Brewster wrote: >> When using pool.imap to apply a function over a list of values, what is the >> proper way to pass additional arguments to the function, specifically in my >> case a Queue that the process can

Re: Proper way to pass Queue to process when using multiprocessing.imap()?

2019-09-03 Thread Israel Brewster
> > On Sep 3, 2019, at 10:49 AM, Peter Otten <__pete...@web.de> wrote: > > Israel Brewster wrote: > >> When using pool.imap to apply a function over a list of values, what is >> the proper way to pass additional arguments to the function, specifically >> in my case a Queue that the process can u

Re: Proper way to pass Queue to process when using multiprocessing.imap()?

2019-09-03 Thread Peter Otten
Israel Brewster wrote: > When using pool.imap to apply a function over a list of values, what is > the proper way to pass additional arguments to the function, specifically > in my case a Queue that the process can use to communicate back to the > main thread (for the purpose of reporting progress

Re: Help needed urgently for running some code!!!!

2019-09-03 Thread Joel Goldstick
On Tue, Sep 3, 2019 at 1:38 PM Dennis Lee Bieber wrote: > > On Mon, 2 Sep 2019 08:05:14 -0700 (PDT), Spencer Du > declaimed the following: > > >Hi > > > >I want to execute > > > >"from devicesEmbedded import *": in GUI.py after all code in GUI.py is run. > >Also how do I make the devicesEmbedded

Re: Proper way to pass Queue to process when using multiprocessing.imap()?

2019-09-03 Thread Rob Gaddi
On 9/3/19 10:17 AM, Israel Brewster wrote: When using pool.imap to apply a function over a list of values, what is the proper way to pass additional arguments to the function, specifically in my case a Queue that the process can use to communicate back to the main thread (for the purpose of re

Proper way to pass Queue to process when using multiprocessing.imap()?

2019-09-03 Thread Israel Brewster
When using pool.imap to apply a function over a list of values, what is the proper way to pass additional arguments to the function, specifically in my case a Queue that the process can use to communicate back to the main thread (for the purpose of reporting progress)? I have seen suggestions of

Re: TypeError: loadtxt() got an unexpected keyword argument 'max_rows'

2019-09-03 Thread MRAB
On 2019-09-03 17:29, Terry Reedy wrote: On 9/3/2019 12:02 PM, alberto wrote: Hi, I produce a script to elaborate data but command line $ python3.4 PlotnhvsvdBTP1.py I have this error Traceback (most recent call last): File "PlotnhvsvdBTP1.py", line 31, in UCvol = np.loadtxt(outputtransfile,s

Re: TypeError: loadtxt() got an unexpected keyword argument 'max_rows'

2019-09-03 Thread MRAB
On 2019-09-03 17:02, alberto wrote: Hi, I produce a script to elaborate data but command line $ python3.4 PlotnhvsvdBTP1.py I have this error Traceback (most recent call last): File "PlotnhvsvdBTP1.py", line 31, in UCvol = np.loadtxt(outputtransfile,skiprows=26,max_rows=1,usecols=[1]) TypeErr

Re: TypeError: loadtxt() got an unexpected keyword argument 'max_rows'

2019-09-03 Thread Terry Reedy
On 9/3/2019 12:02 PM, alberto wrote: Hi, I produce a script to elaborate data but command line $ python3.4 PlotnhvsvdBTP1.py I have this error Traceback (most recent call last): File "PlotnhvsvdBTP1.py", line 31, in UCvol = np.loadtxt(outputtransfile,skiprows=26,max_rows=1,usecols=[1]) TypeEr

Re: TypeError: loadtxt() got an unexpected keyword argument 'max_rows'

2019-09-03 Thread Rhodri James
On 03/09/2019 17:02, alberto wrote: I have this error Traceback (most recent call last): File "PlotnhvsvdBTP1.py", line 31, in UCvol = np.loadtxt(outputtransfile,skiprows=26,max_rows=1,usecols=[1]) TypeError: loadtxt() got an unexpected keyword argument 'max_rows' How could fix it? A quick g

Re: TypeError: loadtxt() got an unexpected keyword argument 'max_rows'

2019-09-03 Thread Joel Goldstick
On Tue, Sep 3, 2019 at 12:06 PM alberto wrote: > > Hi, > I produce a script to elaborate data > > but command line $ python3.4 PlotnhvsvdBTP1.py > > I have this error > > Traceback (most recent call last): > File "PlotnhvsvdBTP1.py", line 31, in > UCvol = np.loadtxt(outputtransfile,skiprows=26,ma

TypeError: loadtxt() got an unexpected keyword argument 'max_rows'

2019-09-03 Thread alberto
Hi, I produce a script to elaborate data but command line $ python3.4 PlotnhvsvdBTP1.py I have this error Traceback (most recent call last): File "PlotnhvsvdBTP1.py", line 31, in UCvol = np.loadtxt(outputtransfile,skiprows=26,max_rows=1,usecols=[1]) TypeError: loadtxt() got an unexpected ke

Re: Execute complex shell commands within python and obtain the output.

2019-09-03 Thread Hongyi Zhao
On Tue, 03 Sep 2019 17:27:59 +1000, Cameron Simpson wrote: > It was merely that it is hardwired in your code (and you need to wire in > something). Just keep in mind that _if_ this script runs in a non-utf8 > environment the decoding may be wrong. Unlikely to actually happen > though. Thanks, fix

Re: problem occurring in operating python , after typing only 5-6 programs only is causing problem it has stoped working

2019-09-03 Thread Calvin Spealman
You will need to provide more information: What version of Python are running? What sort of error message you receiving (paste the entire error)? What code are you attempting to run which causes this problem (paste the failing code)? On Sun, Sep 1, 2019 at 3:01 PM best web site wrote: > > > S

Re: Help needed to run some code!!!!

2019-09-03 Thread Calvin Spealman
It sounds like you have module-level behavior you don't want to happen during normal import-time. If that is the case, move that behavior into a class or function you can invoke at the correct time, rather than trying to do your imports at strange times. On Mon, Sep 2, 2019 at 11:50 AM Spencer Du

Re: if STREAM.isatty():

2019-09-03 Thread Rhodri James
On 30/08/2019 12:05, Hongyi Zhao wrote: On Fri, 30 Aug 2019 18:42:51 +1000, Chris Angelico wrote: There is no magic here. It is simply asking a question, and then making a decision based on the answer. What's your mean by saying this? Sorry for my poor English. "No 'magic'" (魔法 if Google i

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-03 Thread Serhiy Storchaka
03.09.19 11:02, Chris Angelico пише: On Tue, Sep 3, 2019 at 5:53 PM Serhiy Storchaka wrote: 02.09.19 12:24, Chris Angelico пише: But the curious difference happens in 3.7. I don't know what changed to cause this, but from there on, the list gets built and then unpacked. This was a side effe

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-03 Thread Chris Angelico
On Tue, Sep 3, 2019 at 5:53 PM Serhiy Storchaka wrote: > > 02.09.19 12:24, Chris Angelico пише: > > But the curious difference happens in 3.7. I don't know what changed > > to cause this, but from there on, the list gets built and then > > unpacked. > > This was a side effect of moving the optimiz

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-03 Thread Serhiy Storchaka
02.09.19 12:24, Chris Angelico пише: But the curious difference happens in 3.7. I don't know what changed to cause this, but from there on, the list gets built and then unpacked. This was a side effect of moving the optimization for `x in [a, b]` from the peepholer to the AST optimizer. -- h

Re: Execute complex shell commands within python and obtain the output.

2019-09-03 Thread Cameron Simpson
On 03Sep2019 03:59, Hongyi Zhao wrote: On Tue, 03 Sep 2019 08:24:17 +1000, Cameron Simpson wrote: Finally, the .decode('utf8') assumes your locale is UTF8 based. It probably is, but if it isn't then you may get mojibake. Nowadays, most of the os use utf8 as the default locale. Am I wrong?