Toots for ptmcg@fosstodon.org account

Written by Paul McGuire on 2025-02-01 at 17:47

Here are some emojidentifiers for your next Python code:

import math

乁_ツ_ㄏ = None

乁_益_ㄏ = math.nan

def minnums(values: list | 乁_ツ_ㄏ = 乁_ツ_ㄏ):

if (

    values is 乁_ツ_ㄏ 

    or not all(isinstance(n, (float, int))

               for n in values)

):

    return 乁_益_ㄏ

return min(values)

[#]python #unicode #emoji

=> More informations about this toot | View the thread

Written by Paul McGuire on 2025-01-29 at 06:04

Pyparsing sightings - recent posts/pages using pyparsing (2/2):

https://pypi.org/project/ciscoconfparse2/

https://github.com/getmoto/moto

https://docs.saaspegasus.com/

https://github.com/jwdj/EasyABC

[#]pyparsing #python

=> More informations about this toot | View the thread

Written by Paul McGuire on 2025-01-29 at 06:03

Pyparsing sightings - some recent posts/pages using pyparsing (1/2):

https://www.juniper.net/documentation/us/en/software/junos-pyez/junos-pyez-developer/junos-pyez-developer.pdf

https://packaging.python.org/en/latest/guides/licensing-examples-and-user-scenarios/

https://github.com/sucv/paperCrawler

[#]pyparsing #python #parsing

=> More informations about this toot | View the thread

Written by Paul McGuire on 2025-01-27 at 15:08

That little personal thrill when you get exactly 7 pills from your pill bottle - IYKYK

=> More informations about this toot | View the thread

Written by Paul McGuire on 2025-01-18 at 16:42

Some things I'm especially proud of in plusminus (my Python package for parsing and evaluating infix notation arithmetic):

Try it at https://ptmcg.pythonanywhere.com/plusminus

[#]python #parsing #infix

=> More informations about this toot | View the thread

Written by Paul McGuire on 2025-01-17 at 20:18

Remember when we were young, and we thought the "U" in "USB" stood for "universal"? #usb #standards

=> More informations about this toot | View the thread

Written by Paul McGuire on 2025-01-06 at 06:02

I fed a sample page to Chad (my nickname for ChatGPT) and asked if any of them were profound. It found 8 out of 36 worth mentioning.

I think Chad's bar for profoundness is pretty low (it is definitely a sucker for lines using templated opposites).

=> More informations about this toot | View the thread

Written by Paul McGuire on 2025-01-06 at 05:44

Some templates are cliche-makers around pre-defined opposites:

Illusion is really just Reality in disguise.

Illusion is really just Reality having a bad day.

Over time, Abstinence is really just Indulgence in disguise.

Every Abstinence hides a cautiously tender Indulgence.

These are really just cheating, since the template already sets up any kind of structure to these aphorisms (though the random injection of adverb-adjective pairs makes for at least some variety).

=> More informations about this toot | View the thread

Written by Paul McGuire on 2025-01-06 at 05:38

pyrac has about 120 templates, an additional 300 intro and prepositional phrases, and several hundred available nouns, verbs, adjectives, and adverbs to randomly fill in the template blanks. Visiting that site will produce 3 12-line sentence groups. Most are nonsense like:

For a single season, a temporarily respected arrow should not be unimpressed!

But every so often a profound-sounding nugget drops out:

Behind every illusion is a word for Hate.

Ideas are bullets.

Truth will feed nothing.

=> More informations about this toot | View the thread

Written by Paul McGuire on 2025-01-06 at 05:19

pyrac (https://ptmcg.pythonanywhere.com/pyrac) is my own #Python version of Racter, which was a crude prose generator from the early 80s (https://en.wikipedia.org/wiki/Racter). Racter composed this fragment as part of a larger story, "The Policeman's Beard is Half Constructed":

More than iron, more than lead, more than gold I need electricity.

I need it more than I need lamb or pork or lettuce or cucumber.

I need it for my dreams.

Originally offered as an AI, it is actually just a compositor with a rich set of templates.

=> More informations about this toot | View the thread

Written by Paul McGuire on 2025-01-06 at 05:14

Earlier today I posted about a spoof site of mine on #pythonanywhere, 𝐹º𝑛t 𝘔ⅸᵉ𝐫, which converts identifiers in ASCII #Python to equivalent identifiers by randomly selecting Unicode points that normalize back to the original ASCII, and are therefore directly runnable, even though they look like a ransom note. Remember, builtins and all stdlib names can be denormalized this way.

I went to check the web logs, and found that someone found another PA site of mine, https://ptmcg.pythonanywhere.com/pyrac...

=> More informations about this toot | View the thread

Written by Paul McGuire on 2025-01-04 at 10:34

With the latest 3.2.1 release of pyparsing, I also cleaned up the README for the examples directory. Much improved over the hand-coded HTML from 20+ years ago!

https://github.com/pyparsing/pyparsing/blob/master/examples/README.md

[#]python #pyparsing

=> View attached media

=> More informations about this toot | View the thread

Written by Paul McGuire on 2025-01-01 at 15:49

At first I assumed these were jokes, but let's just say this parser were added to an email-scraper that auto-creates calendar entries for embedded tasks. We could detect common ambiguous deadlines like this, and then generate a random future timestamp, of the quality that such phrases deserve.

Additional submissions invited.

(During my college summer working in the blueprint room at an engineering company, one of our project managers routinely marked print requests with "ASAP or sooner".)

=> More informations about this toot | View the thread

Written by Paul McGuire on 2025-01-01 at 03:01

Here is the Github repo for pyparsing - this parser is the delta_time.py script in the examples directory. https://github.com/pyparsing/pyparsing

=> More informations about this toot | View the thread

Written by Paul McGuire on 2025-01-01 at 02:58

Here are some of the test cases for that parser:

10 seconds ago

1000 seconds ago

10000 seconds ago

10 minutes ago

10 minutes from now

in 10 minutes

in a couple of minutes

20 seconds ago

in 30 seconds

in an hour

3 days from now

a couple of days from now

a week from today

in a couple of days

a couple of days from today

8am the day after tomorrow

6am tomorrow

0800 yesterday

1700 tomorrow

12:15 AM today

twenty-four hours from now

in just 10 seconds

in just a couple of hours

in exactly 1 hour

=> More informations about this toot | View the thread

Written by Paul McGuire on 2025-01-01 at 02:48

I just released pyparsing 3.2.1 with a very cool addition to the railroad diagrams that pyparsing generates for its parsers - non-terminal diagram elements now link to their definitions elsewhere in the diagram! This is pretty handy when the diagram is for a complex parser, as in this demo of a parser/evaluator for time references like "3 weeks from today" or "0800 two days from now" or "in exactly twenty-four hours". #pyparsing #python #parser #railroaddiagram

=> View attached media

=> More informations about this toot | View the thread

Written by Paul McGuire on 2024-11-19 at 05:54

Well I have this Medium account and never posted anything on it, so I decided to write up my littletable project. littletable was an experiment in ORMs that I started about 15 years ago, but it has really come in handy in dealing with small data sets and CSVs (up to a few thousand items). https://medium.com/@ptmcg/data-in-the-small-python-package-littletable-combines-in-memory-nosql-orm-with-schemaless-setup-54ea0b24ac6a #python #orm #database #littletable

=> More informations about this toot | View the thread

Written by Paul McGuire on 2024-10-15 at 15:12

I'm seeing a number of responses from pyparsing users (or matplotlib users) that they are getting a version of pyparsing that is not compatible with their version of Python (they are running Python 3.8 or older, but the new pyparsing release requires Python 3.9 or later). After some experimenting, I found this requirements.txt to help in selecting the right pyparsing version:

matplotlib

pyparsing>=3.2;python_version>="3.9"

pyparsing>=3.1;python_version<"3.9"

[#]pyparsing #python #matplotlib

=> More informations about this toot | View the thread

Written by Paul McGuire on 2024-10-13 at 23:02

Pyparsing 3.2.0 pushed to pypi! See the docs at https://pyparsing-docs.readthedocs.io/en/3.2.0_docs/ , including "What's New" sections going back to 3.0. Note: this version drops support for Python < 3.9, so give it a look if your project uses it! #python #parsing #pyparsing

=> More informations about this toot | View the thread

Written by Paul McGuire on 2024-10-05 at 11:28

Pyparsing 3.2.0rc1 is now out. There are a lot of nice things and bugfixes in this release - please check it out (and see if any of the breaking changes affect your code): https://github.com/pyparsing/pyparsing/releases/tag/3.2.0rc1 #python #pyparsing

=> More informations about this toot | View the thread

=> This profile with reblog | Go to ptmcg@fosstodon.org account

Proxy Information
Original URL
gemini://mastogem.picasoft.net/profile/108306951026992715
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
362.049948 milliseconds
Gemini-to-HTML Time
5.807764 milliseconds

This content has been proxied by September (3851b).