Data Ethics (Virtual) Meeting

2024-04-10 Thread dn via Python-list

Virtual meeting, Wed 17 April, 1800 for 1830 (NZST, ie 0630 UTC)


Data Ethics

Emma McDonald is the Director of the Interim Centre for Data Ethics and 
Innovation at Stats NZ (New Zealand Government Department of Statistics)


Emma will talk about why Stats NZ is establishing a Centre for Data 
Ethics and Innovation, and why it needs to be set up as a network that 
draws on and leverages knowledge and expertise across relevant work 
programmes and people across agencies. As an initiative, the Centre is 
there to help agencies develop and maintain secure and trusted data 
environments. A large part of this is drawing on a diverse network of 
people who can support the with sharing the importance of data ethics 
being a critical component of data driven technologies.


Will be of-interest to Quants, Data Science, and Machine Learning folk; 
as well as those of us with wider interest in what should/not happen 
with personal, public, and corporate data...


She will be wanting to hear what folk have to say, and is interested to 
recruit competent individuals for hui*, consultations, and the like.


WebRef: 
https://data.govt.nz/leadership/the-interim-centre-for-data-ethics-and-innovation/ 
from which you can access their Work Programme and Guidance developed 
to-date.



Please RSVP at https://www.meetup.com/nzpug-auckland/events/299764076/


* hui is the Te Reo Maori word for meeting or conference
(Te Reo is one of New Zealand's official languages)

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: How to Add ANSI Color to User Response

2024-04-10 Thread Grant Edwards via Python-list
On 2024-04-10, Alan Gauld via Python-list  wrote:
> On 10/04/2024 19:50, WordWeaver Evangelist via Python-list wrote:
>
>> I have a simple question. I use the following textPrompt in some of my 
>> Jython modules:
>>  '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, 
>> forceUppercase=True)
>> Is there a way to add an ANSI color code to the end
>
> Normally, for any kind of fancy terminal work, I'd say use curses.

If you want to use the terminal escape sequences provided by terminfo
and ncurses, but don't want to use the ncurses windowing functions,
here are some notes on how to do that:

https://github.com/GrantEdwards/Python-curses-and-terminfo

That too is C-Python oriented, and I don't really know how to do the
same things using Jython.

--
Grant

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


Re: How to Add ANSI Color to User Response

2024-04-10 Thread David via Python-list
On Wed, 10 Apr 2024 at 18:51, WordWeaver Evangelist via Python-list
 wrote:

> I have a simple question. I use the following textPrompt in some of my
> Jython modules:

>  '\n [1;33mYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, 
> forceUppercase=True)

> Is there a way to add an ANSI color code to the end where the conditions
> are, so that the color of the user’s input is of a color of my choosing,
> instead of just white?

Hi Bill,

Here's a tutorial:
  https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html
Note the sentence: "once you print out the special code enabling a color,
the color persists forever until someone else prints out the code for
a different color, or prints out the Reset code to disable it."

Here's a more detailed specification:
  https://en.wikipedia.org/wiki/ANSI_escape_code

And here's a conversation:
  http://mywiki.wooledge.org/BashFAQ/037
(see the first sentence, and then under the heading "Discussion")
that might help you decide whether this approach will satisy your need in
your particular circumstances of operating system, Python version, and
terminal settings.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to Add ANSI Color to User Response

2024-04-10 Thread Pierre Fortin via Python-list
On Thu, 11 Apr 2024 04:50:49 +1000 WordWeaver Evangelist via Python-list
wrote:

>Hello List,
>
>I have a simple question. I use the following textPrompt in some of my Jython 
>modules:
> '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, 
> forceUppercase=True)
>Is there a way to add an ANSI color code to the end where the conditions are, 
>so that the color of the user’s input is of a color of my choosing, instead of 
>just white?
>Thank you very much in advance.
>Kind regards,
>Bill Kochman

Over the years, I've tried different mechanisms for applying colors until
I got my hands on f-stings; then I created a tiny module with all the
colors (cR, cG, etc) which made my life so much simpler (attached). The
module includes background colors (bX); but I very rarely use those.

Then, I just use the module like this:

# place the module in a directory where your script is
# e.g., $ mkdir mymods (rename as desired) 
from mymods.colors import *  
# or just include the contents inline

# this simply switches from one color to the next
print( f"{cR}red, {cB}blue, {cG}green {cO}are colors." )

# color just the response
ans = input( f"Answer?: {cG}" ) # turn off color on next line
print( f"{cO}You entered: {cY}{ans}{cO}" )
# 

# to turn off each color (white commas), change the above to:
print( f"{cR}red{cO}, {cB}blue{cO}, {cG}green {cO}are colors." )

On Windows, you'll need to add this *before* using the colors:
import os
if os.name == 'nt': # Only if we are running on Windows
from ctypes import windll
w = windll.kernel32
# enable ANSI VT100 colors on Windows.
w.SetConsoleMode(w.GetStdHandle(-11), 7)

HTH,
Pierre
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to Add ANSI Color to User Response

2024-04-10 Thread Alan Gauld via Python-list
On 10/04/2024 19:50, WordWeaver Evangelist via Python-list wrote:

> I have a simple question. I use the following textPrompt in some of my Jython 
> modules:
>  '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, 
> forceUppercase=True)
> Is there a way to add an ANSI color code to the end

Normally, for any kind of fancy terminal work, I'd say use curses.
But I suspect Jython may not support curses?

On the offchance it does do curses it would look like:

import curses

def main(scr):
   if curses.has_colors():  # check the terminal supports color
  curses.start_color().  # init the color system
  curses.init_pair(1,curses.COLOR_YELLOW,curses.COLOR_BLUE)

  # Now start adding text coloring as desired...
  scr.addstr(0,0,"This string is yellow and blue",
 curses.color_pair(1))

  scr.refresh().  # make it visible
   else: scr.addstr("Sorry, no colors available")

curses.wrapper(main)

HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


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


Re: How to Add ANSI Color to User Response

2024-04-10 Thread dn via Python-list

On 11/04/24 06:50, WordWeaver Evangelist via Python-list wrote:

I have a simple question. I use the following textPrompt in some of my Jython 
modules:
  '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, 
forceUppercase=True)
Is there a way to add an ANSI color code to the end where the conditions are, 
so that the color of the user’s input is of a color of my choosing, instead of 
just white?
Thank you very much in advance.
Kind regards,
Bill Kochman


Haven't tried using any of theses techniques, but may define input() 
color, as well as print():-


How to print colored terminal text in Python
MAR 06, 2024
...
https://byby.dev/py-print-colored-terminal-text

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: How to Add ANSI Color to User Response

2024-04-10 Thread Grant Edwards via Python-list
On 2024-04-10, WordWeaver Evangelist via Python-list  
wrote:

> I have a simple question. I use the following textPrompt in some of my Jython 
> modules:
>  '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, 
> forceUppercase=True)

> Is there a way to add an ANSI color code to the end where the
> conditions are, so that the color of the user’s input is of a color
> of my choosing, instead of just white?

I'm not sure what is meant by "the end where the conditions are", nor
do I know what "textPrompt" refers to.

Are you asking how to put a second escape sequence at the end of the
string literal after the colon?

--
Grant




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


How to Add ANSI Color to User Response

2024-04-10 Thread WordWeaver Evangelist via Python-list

Hello List,

I have a simple question. I use the following textPrompt in some of my Jython 
modules:
 '\nYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, 
forceUppercase=True)
Is there a way to add an ANSI color code to the end where the conditions are, 
so that the color of the user’s input is of a color of my choosing, instead of 
just white?
Thank you very much in advance.
Kind regards,
Bill Kochman
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [RELEASE] Python 3.12.3 and 3.13.0a6 released

2024-04-10 Thread Abdur-Rahmaan Janhangeer via Python-list
I have to comment on this one: "Docstrings now have their leading
indentation stripped"

Incredibly useful!

Kind Regards,

Abdur-Rahmaan Janhangeer
about  | blog

github 
Mauritius


On Tue, Apr 9, 2024 at 11:18 PM Thomas Wouters via Python-list <
python-list@python.org> wrote:

> *It’s time to eclipse the Python 3.11.9 release with two releases*, one of
> which is the *very last alpha release of Python 3.13*:
> <
> https://discuss.python.org/t/python-3-12-3-and-3-13-0a6-released/50601#python-3123-1
> >Python
> 3.12.3
>
> 300+ of the finest commits went into this latest maintenance release of the
> latest Python version, the most stablest, securest, bugfreeest we could
> make it.
> https://www.python.org/downloads/release/python-3123/
> <
> https://discuss.python.org/t/python-3-12-3-and-3-13-0a6-released/50601#python-3130a6-2
> >Python
> 3.13.0a6
>
> What’s that? The last alpha release? Just one more month until feature
> freeze! Get your features done, get your bugs fixed, let’s get 3.13.0 ready
> for people to actually use! Until then, let’s test with alpha 6. The
> highlights of 3.13 you ask? Well:
>
>- In the interactive interpreter, exception tracebacks are now colorized
>by default
> >.
>- A preliminary, *experimental* JIT was added
><
> https://docs.python.org/dev/whatsnew/3.13.html#experimental-jit-compiler>,
>providing the ground work for significant performance improvements.
>- The (cyclic) garbage collector is now incremental
><
> https://docs.python.org/dev/whatsnew/3.13.html#incremental-garbage-collection
> >,
>which should mean shorter pauses for collection in programs with a lot
> of
>objects.
>- Docstrings now have their leading indentation stripped
> >,
>reducing memory use and the size of .pyc files. (Most tools handling
>docstrings already strip leading indentation.)
>- The dbm module  has a
>new dbm.sqlite3 backend
> that is used by
>default when creating new files.
>- PEP 594 (Removing dead batteries from the standard library)
> scheduled removals of many
>deprecated modules: aifc, audioop, chunk, cgi, cgitb, crypt, imghdr,
>mailcap, msilib, nis, nntplib, ossaudiodev, pipes, sndhdr, spwd, sunau,
>telnetlib, uu, xdrlib, lib2to3.
>- Many other removals
> of deprecated
>classes, functions and methods in various standard library modules.
>- New deprecations
>, most of
>which are scheduled for removal from Python 3.15 or 3.16.
>- C API removals 
>and deprecations .
>(Some removals present in alpha 1 were reverted in alpha 2, as the
> removals
>were deemed too disruptive at this time.)
>
> (Hey, *fellow core developer,* if a feature you find important is missing
> from this list, let Thomas know . It’s getting to be
> really important now!)
> https://www.python.org/downloads/release/python-3130a6/
> <
> https://discuss.python.org/t/python-3-12-3-and-3-13-0a6-released/50601#we-hope-you-enjoy-the-new-releases-3
> >We
> hope you enjoy the new releases!
>
> Thanks to all of the many volunteers who help make Python Development and
> these releases possible! Please consider supporting our efforts by
> volunteering yourself, or through contributions to the Python Software
> Foundation  or CPython itself
> .
>
> Thomas “can you tell I haven’t had coffee today” Wouters
> on behalf of your release team,
>
> Ned Deily
> Steve Dower
> Pablo Galindo Salgado
> Łukasz Langa
> --
> Thomas Wouters 
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list