[Python-announce] PyCA cryptography 41.0.7 released

2023-11-27 Thread Alex Gaynor
PyCA cryptography 41.0.7 has been released to PyPI. cryptography includes both high level recipes and low level interfaces to common cryptographic algorithms such as symmetric ciphers, asymmetric algorithms, message digests, X509, key derivation functions, and much more. We support Python 3.7+,

Re: argparse argument post-processing

2023-11-27 Thread Dom Grigonis via Python-list
Yeah, I have been hearing that people are having troubles converting, but I have only used argparse - got lucky there I guess. I am thinking just making the function which spits the class out. Maybe not very optimised solution, but simple. Argument parsing in my case is very far from being a

Re: argparse argument post-processing

2023-11-27 Thread Mats Wichmann via Python-list
On 11/27/23 13:21, Dom Grigonis wrote: Thank you, exactly what I was looking for! One more question following this. Is there a way to have a customisable action? I.e. What if I want to join with space in one case and with coma in another. Is there a way to reuse the same action class? I've

[Python-announce] PyCA cryptography 41.0.6 released

2023-11-27 Thread Paul Kehrer
PyCA cryptography 41.0.6 has been released to PyPI. cryptography includes both high level recipes and low level interfaces to common cryptographic algorithms such as symmetric ciphers, asymmetric algorithms, message digests, X509, key derivation functions, and much more. We support Python 3.7+,

Re: argparse argument post-processing

2023-11-27 Thread Dom Grigonis via Python-list
Thank you, exactly what I was looking for! One more question following this. Is there a way to have a customisable action? I.e. What if I want to join with space in one case and with coma in another. Is there a way to reuse the same action class? Regards, DG > On 27 Nov 2023, at 21:55, Mats

Re: argparse argument post-processing

2023-11-27 Thread Mats Wichmann via Python-list
On 11/27/23 04:29, Dom Grigonis via Python-list wrote: Hi all, I have a situation, maybe someone can give some insight. Say I want to have input which is comma separated array (e.g. paths='path1,path2,path3') and convert it to the desired output - list: import argparse parser =

RE: Context without manager

2023-11-27 Thread David Raymond via Python-list
> I *must* do: > > with device_open() as device: >device.do_something() > > Nevertheless, I _need_ to have a class > where the device is opened in the __init__() > and used in some methods. > > Any ideas? Perhaps take a look at contextlib.ExitStack and see if you can do something with it.

Context without manager

2023-11-27 Thread Richard Damon via Python-list
Read the Fine context manager documentation. What “with with_expression as var” does is effectively: ob = with_expression var = ob.__enter__() And then at the end of the with, does a ob.__exit__() (With some parameters to __exit__, that could just be None, None, None for the simplest case).

Re: Context without manager

2023-11-27 Thread Richard Damon via Python-list
Read the Fine context manager documentation. What “with with_expression as var” does is effectively: ob = with_expression var = ob.__enter__() And then at the end of the with, does a ob.__exit__() (With some parameters to __exit__, that could just be None, None, None for the simplest case).

how to connect linux aws ec2 instance to windows local machine at my home using paramiko

2023-11-27 Thread Kashish Naqvi via Python-list
I have a north viriginia ec2 linux instance and a windows machine at my home, how do I connec tthem? import paramiko import time def run_scripts(): # Set your local machine's SSH details local_machine_ip = ' ' username = 'justk' private_key_path = 'C:/Users/justk/.ssh/kashish'

Re: Context without manager

2023-11-27 Thread Piergiorgio Sartor via Python-list
On 26/11/2023 18.50, Dieter Maurer wrote: Piergiorgio Sartor wrote at 2023-11-25 22:15 +0100: ... Apparently, the "with" context manager is not usable in classes, at least not with __init__() & co. You can use `with` in classes -- with any context manager. However, you would usually not use

RE: Newline (NuBe Question)

2023-11-27 Thread AVI GROSS via Python-list
Dave, I gave an example, again, and make no deep claims so your comments may be valid, without any argument. I mentioned CSV and a related family such as TSV as they were a common and simple data format that has long been used. There are oodles of others and yes, these days many people can

Re: argparse argument post-processing

2023-11-27 Thread Chris Angelico via Python-list
On Mon, 27 Nov 2023 at 22:31, Dom Grigonis via Python-list wrote: > > Hi all, > > I have a situation, maybe someone can give some insight. > > Say I want to have input which is comma separated array (e.g. > paths='path1,path2,path3') and convert it to the desired output - list: This is a single

argparse argument post-processing

2023-11-27 Thread Dom Grigonis via Python-list
Hi all, I have a situation, maybe someone can give some insight. Say I want to have input which is comma separated array (e.g. paths='path1,path2,path3') and convert it to the desired output - list: import argparse parser = argparse.ArgumentParser() parser.add_argument('paths', type=lambda x: