Re: Renaming an import

2019-09-05 Thread Peter Otten
Rob Gaddi wrote: > I'm trying to figure out how to rename an import globally for an entire > package. > Something like: > > pkg/__init__.py: > import graphing_module_b as graph If you want to go low-level: sys.modules["pkg.graph"] = graph will make > pkg/foobar.py: > from .graph

Re: Renaming an import

2019-09-05 Thread dieter
Rob Gaddi writes: > I'm trying to figure out how to rename an import globally for an > entire package. Something like: > > pkg/__init__.py: > import graphing_module_b as graph > > pkg/foobar.py: > from .graph import plot, axis > > The point being that, if at some point I decide to change f

Re: Renaming an import

2019-09-05 Thread Cameron Simpson
On 05Sep2019 20:31, Michael Speer wrote: pkg/graph.py: from graphing_module_b import plot, axis pkg/foobar.py: from .graph import plot, axis Would it be sufficient to use a file for indirection? Or without a stub file and only slightly less conveniently: pkg/__init__.py import g

Re: Renaming an import

2019-09-05 Thread Michael Speer
pkg/graph.py: from graphing_module_b import plot, axis pkg/foobar.py: from .graph import plot, axis Would it be sufficient to use a file for indirection? On Thu, Sep 5, 2019 at 7:11 PM Rob Gaddi wrote: > I'm trying to figure out how to rename an import globally for an entire > packa

Re: pandas loc on str lower for column comparison

2019-09-05 Thread Sayth Renshaw
That is actually consistent with Excel row, column. Can see why it works that way then. Thanks -- https://mail.python.org/mailman/listinfo/python-list

Renaming an import

2019-09-05 Thread Rob Gaddi
I'm trying to figure out how to rename an import globally for an entire package. Something like: pkg/__init__.py: import graphing_module_b as graph pkg/foobar.py: from .graph import plot, axis The point being that, if at some point I decide to change from graphing_module_b to graphin

Re: pandas loc on str lower for column comparison

2019-09-05 Thread Piet van Oostrum
Piet van Oostrum writes: > That would select ROWS 0,1,5,6,7, not columns. > To select columns 0,1,5,6,7, use two-dimensional indexes > > df1 = df.iloc[:, [0,1,5,6,7]] > > : selects all rows. And that also solves your original problem. This statement: df1['Difference'] = df1.loc['Current Team']

Re: pandas loc on str lower for column comparison

2019-09-05 Thread Piet van Oostrum
Sayth Renshaw writes: > On Sunday, 1 September 2019 10:48:54 UTC+10, Sayth Renshaw wrote: >> I've created a share doc same structure anon data from my google drive. >> >> https://drive.google.com/file/d/0B28JfFTPNr_lckxQRnFTRF9UTEFYRUVqRWxCNVd1VEZhcVNr/view?usp=sharing >> >> Sayth > > I tried

Fwd: Installation Errors

2019-09-05 Thread venu gopal reddy
Hi Python Support Team, I have subscribed now and re-sending my query. Please suggest. I have an Issue installing python 3.7 on my work computer. It says core.msi package not found during installation. Can you please help me with steps to resolve this issue? Thank you, Venu -- https://mail.pyth

Re: How do I give a decorator acces to the class of a decorated function

2019-09-05 Thread Chris Angelico
On Fri, Sep 6, 2019 at 4:33 AM Serhiy Storchaka wrote: > > 04.09.19 17:21, Antoon Pardon пише: > > What I am trying to do is the following. > > > > class MyClass (...) : > > @register > > def MyFunction(...) > > ... > > > > What I would want is for the register decorator to some

EuroPython 2019 - Videos for Wednesday available

2019-09-05 Thread M.-A. Lemburg
We are pleased to announce the first batch of cut videos from EuroPython 2019 in Basel, Switzerland. * EuroPython 2019 YouTube Channel * http://europython.tv/ In this batch, we have included all videos for Wednesday, July 10 2019, the first conference d

Re: How do I give a decorator acces to the class of a decorated function

2019-09-05 Thread Serhiy Storchaka
04.09.19 17:21, Antoon Pardon пише: What I am trying to do is the following. class MyClass (...) : @register def MyFunction(...) ... What I would want is for the register decorator to somehow create/mutate class variable(s) of MyClass. Is that possible or do I have to rethin

Re: CVE-2019-9636 - Can this be exploit over the wire?

2019-09-05 Thread Barry Scott
> On 5 Sep 2019, at 16:18, Random832 wrote: Thanks for taking the time to reply. > > On Wed, Sep 4, 2019, at 13:36, Barry Scott wrote: >> The conclusion I reached is that the CVE only applies to client code >> that allows a URL in unicode to be entered. >> >> Have I missed something import

Re: "How to protect the python code"

2019-09-05 Thread Grant Edwards
On 2019-09-05, Michael Torrie wrote: > I've never understood why companies are so obsessed with preventing > users from modifying their programs. Because they'll change it, the result won't behave correctly, and then the user will waste a lot of tech-support hours or ruin the company's reputatio

Re: "How to protect the python code"

2019-09-05 Thread Michael Torrie
On 9/5/19 2:48 AM, Saba Kauser wrote: > I am looking for ways available to protect the python source code > from being available to users for write/modify. Is it a good idea to > think that python source code can be protected? In general, no, not with an interpreted language. Intellectual property

RE: "How to protect the python code"

2019-09-05 Thread Saba Kauser
Thanks Chris. Makes sense! -Original Message- From: Chris Angelico Sent: Thursday, September 5, 2019 2:34 PM To: python-list@python.org Subject: Re: "How to protect the python code" On Thu, Sep 5, 2019 at 6:50 PM Saba Kauser wrote: > > Hello Experts, > > I am looking for ways available

Re: Wind Rose Plotting in Python

2019-09-05 Thread Ross Wilson
On Thu, 5 Sep 2562 at 22:00 Madhavan Bomidi wrote: > Hi, > > Can someone help me on how to make the wind rose plotting (similar to the > figure 2 in the paper: > https://agupubs.onlinelibrary.wiley.com/doi/epdf/10.1029/2011JD016386) in > Python? > > The input file contains the data in 4 columns:

Re: CVE-2019-9636 - Can this be exploit over the wire?

2019-09-05 Thread Random832
On Wed, Sep 4, 2019, at 13:36, Barry Scott wrote: > The conclusion I reached is that the CVE only applies to client code > that allows a URL in unicode to be entered. > > Have I missed something important in the analysis? While as I mentioned in my other post I'm not sure if the CVE's analysis o

Re: CVE-2019-9636 - Can this be exploit over the wire?

2019-09-05 Thread Random832
On Wed, Sep 4, 2019, at 13:36, Barry Scott wrote: > I have been looking into CVE-2019-9636 and I'm not sure that > python code that works in bytes is vulnerable to this. I'm not convinced that the CVE (or, at least, the description in the bug report... it's also unclear to me whether this is an a

Wind Rose Plotting in Python

2019-09-05 Thread Madhavan Bomidi
Hi, Can someone help me on how to make the wind rose plotting (similar to the figure 2 in the paper: https://agupubs.onlinelibrary.wiley.com/doi/epdf/10.1029/2011JD016386) in Python? The input file contains the data in 4 columns: [date, time, wind_speed, wind_direction] Look forward to your

Re: How do I give a decorator acces to the class of a decorated function

2019-09-05 Thread Peter Otten
Antoon Pardon wrote: > On 5/09/19 15:30, Peter Otten wrote: >> Can you provide some context? > > Sure I am researching the possibility of writing an easy to use > lexing/parsing tool. The idea is to write your lexer/parser as > follows: > > class Calculator(metaclass = ...): > def __init__(

Re: How do I give a decorator acces to the class of a decorated function

2019-09-05 Thread Antoon Pardon
On 5/09/19 15:30, Peter Otten wrote: >> 2) Is it possible to make MyClass automatically a subclass of an other >> class >>through the metaclass? >> > While you can modify `bases` before passing it on to `type` this starts to > get a bit messy. Maybe you need a real metaclass which unlike the r

Re: How do I give a decorator acces to the class of a decorated function

2019-09-05 Thread Peter Otten
Antoon Pardon wrote: > On 4/09/19 17:46, Peter Otten wrote: >> Antoon Pardon wrote: >> >>> What I am trying to do is the following. >>> >>> class MyClass (...) : >>> @register >>> def MyFunction(...) >>> ... >>> >>> What I would want is for the register decorator to somehow create/

Re: How to only read words within brackets/ parentheses (in .txt file) using Python

2019-09-05 Thread pankaj . jangid
A S writes: > I understand that reading lines in .txt files would look something like this > in Python: > > > with open('filename','r') as fd: >lines = fd.readlines() > > > However, how do I run my code to only read the words in my .txt files that > are within each balanced parenthesis? > >

Re: How do I give a decorator acces to the class of a decorated function

2019-09-05 Thread Antoon Pardon
On 4/09/19 17:46, Peter Otten wrote: > Antoon Pardon wrote: > >> What I am trying to do is the following. >> >> class MyClass (...) : >> @register >> def MyFunction(...) >> ... >> >> What I would want is for the register decorator to somehow create/mutate >> class variable(s) of MyC

Re: "How to protect the python code"

2019-09-05 Thread Chris Angelico
On Thu, Sep 5, 2019 at 6:50 PM Saba Kauser wrote: > > Hello Experts, > > I am looking for ways available to protect the python source code from being > available to users for write/modify. Run it on a server and don't let them see the source code. > Is it a good idea to think that python source

"How to protect the python code"

2019-09-05 Thread Saba Kauser
Hello Experts, I am looking for ways available to protect the python source code from being available to users for write/modify. Is it a good idea to think that python source code can be protected? I am aware that there are ways available to generate extensions like in C(.pyd files) and module

Re: How do I give a decorator acces to the class of a decorated function

2019-09-05 Thread Antoon Pardon
On 4/09/19 17:46, Peter Otten wrote: > Antoon Pardon wrote: > >> What I am trying to do is the following. >> >> class MyClass (...) : >> @register >> def MyFunction(...) >> ... >> >> What I would want is for the register decorator to somehow create/mutate >> class variable(s) of MyC