#ot1-perplexing-regexing

1 messages Β· Page 560 of 1

dreamy wharf
#

mhm

inland wolf
#

ye

hasty musk
#

soup infact is my wife, but im not old enough to have a wife in the law books

#

who is that? sorry if he iconic, Me nEw to python community

inland wolf
#

hes the creator of python

lunar crescent
inland wolf
#

damn

solemn leaf
#

guido van rossum

hasty musk
#

has kosayoda always been typing btw?

acoustic moss
#

yes

scarlet wind
#

yea

lunar crescent
#

yes

tribal aurora
#

yep

inland wolf
#

yep

hasty musk
#

Just everyone says a form of yes

lunar crescent
#

yup

inland wolf
#

ye

edgy crest
#

Oui

inland wolf
#

ja

lunar crescent
#

Π΄Π°

inland wolf
#

hanji

acoustic moss
#

hyan

last mantle
#

tf is hanji

inland wolf
#

bro

#

pls

#

i am not hindi

last mantle
#

lol

inland wolf
#

speaker

last mantle
#

same

#

studied hindi for 10 years, cant even speak properly

inland wolf
#

sameee

#

which state u from

last mantle
#

k'taka

inland wolf
inland wolf
hasty musk
#

tf?

proud rock
#

Ik fluent hindi

#

But thts not my mother tongue

twin charm
acoustic moss
#

I basically learnt hindi from cartoons lol

inland wolf
#

same

twin charm
#

shinchan?

inland wolf
#

i know most of my hindi from doremon

#

lmao

#

and shinchan

#

lol

twin charm
#

lmao.

#

that kid has an interesting face.

#

and an annoying voice.

#

.topi

#

.topic

median domeBOT
#
**What is better: Milk, Dark or White chocolate?**

Suggest more topics here!

twin charm
#

the normal one.

brazen ingot
#

pink chocolate

twin charm
#

whatever its called.

brazen ingot
#

i like cookie 11

twin charm
brazen ingot
#

nah, i like the brown one

#

the snake eating in my pfp

twin charm
#

haha

brazen ingot
#

next scaleios

twin charm
#

what a coincidence.

brazen ingot
#

lul

twin charm
#

ok byebyebee

brazen ingot
#

wanna typerace?

#

@twin charm

twin charm
brazen ingot
#

how's the weather?

#

fine

twin charm
#

hm

#

still rainy tho.

brazen ingot
#

ooof

twin charm
#

too dark too

brazen ingot
#

electricity gone ?

twin charm
#

Naw.

brazen ingot
#

fine

lunar crescent
brazen ingot
#

flutter chocolate

toxic pebble
#

hey guys

zealous hull
#

.love @polar knoll @median dome

median domeBOT
#
❀ So when will you two go on a date? ❀

Python Discord ModMail#6914 ❀ Sir Lancebot#9543 scored 63%!
​

A letter from Dr. Love:

Your relationship will most likely work out. It won't be perfect and you two need to spend a lot of time together, but if you keep on having contact, the good times in your relationship will outweigh the bad ones.

zealous hull
#

.love @median dome @royal lake

median domeBOT
#
πŸ’• Aww look you two fit so well together πŸ’•

Sir Lancebot#9543 ❀ Python#4329 scored 86%!
​

A letter from Dr. Love:

Your relationship will most likely work out well. Don't hesitate on making contact with each other though, as your relationship might suffer from a lack of time spent together. Talking with each other and spending time together is key.

zealous hull
#

.love @wide verge @royal lake

median domeBOT
#
πŸ’˜ You two are really close aren't you? πŸ’˜

David Bartholomew IIII#1448 ❀ Python#4329 scored 59%!
​

A letter from Dr. Love:

Your relationship has a reasonable amount of working out. But do not overestimate yourself there. Your relationship will suffer good and bad times. Make sure to not let the bad times destroy your relationship, so do not hesitate to talk to each other, figure problems out together etc.

acoustic moss
zealous hull
#

.love @median dome @royal lake#4329

median domeBOT
#
❀ So when will you two go on a date? ❀

Sir Lancebot#9543 ❀ @deleted-user#43777 scored 61%!
​

A letter from Dr. Love:

Your relationship will most likely work out. It won't be perfect and you two need to spend a lot of time together, but if you keep on having contact, the good times in your relationship will outweigh the bad ones.

zealous hull
#

oh its random

#

ok

royal lakeBOT
#
Bad argument

Unable to convert 'love not really, i read the code' to valid command, tag, or Cog.

lunar crescent
#

.src love

median domeBOT
#
Command: love

Tells you how much the two love each other.

Source Code
ornate nymph
#

does anyone here using windows have a second to test something for me?

acoustic moss
#

sure

inland wolf
#

what do u need to test?

ornate nymph
#
def windows_memory_percent():
    import ctypes
    from ctypes import wintypes

    class MemoryStatus(ctypes.Structure):
        _fields_ = [
            ('ullTotalPageFile', ctypes.c_uint64),
            ('ullAvailPageFile', ctypes.c_uint64),
            ('ullTotalVirtual', ctypes.c_uint64),
            ('ullTotalPhys', ctypes.c_uint64),
            ('ullAvailVirtual', ctypes.c_uint64),
            ('ullAvailPhys', ctypes.c_uint64),
            ('ullAvailExtendedVirtual', ctypes.c_uint64),
            ('dwLength', wintypes.DWORD),
            ('dwMemoryLoad', wintypes.DWORD)
        ]

    memStatStruct = MemoryStatus()
    memStatStruct.dwLength = ctypes.sizeof(memStatStruct)
    ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(memStatStruct))
    return memStatStruct.dwMemoryLoad

# import psutil
x = [1,1] * int(1e8)
print(windows_memory_percent())
#

Just let me know if that returns a number or throws an error

acoustic moss
#

gives me 0

ornate nymph
#

well i guess I have some more work to do

wraith hound
#

Maybe I screwed something up since this wasn't a proper python file, but

ornate nymph
#

interesting

wraith hound
#

Lemme see what IDLE says

ornate nymph
#

Maybe I need to use a pointer 😐

wraith hound
#

I got 0 in IDLE

acoustic moss
#

at x = [1,1] * int(1e8)

wraith hound
#

Probably

#

Since that used the Piston CLI for the Piston API

dusty cobalt
#

Anyone familiar with sockets / winsock and python + cpp that could help me figure out what is wrong with my setup?

I have a cpp server running that sends an image as bytes, first the amount of images, then it loops through a vector and sends the image size and then the bytes. I have a python client that receives the messages. First iteration is fine but on second iteration the image size that should be an independant message is suddenly in the beginning of the image bytes

https://pastebin.com/5HcH8YR3
https://pastebin.com/1k0Ngxqt

vapid nymph
#

@wraith hound u know regex?

wraith hound
#

Not really

vapid nymph
#

why would anyone do this http[s]? ???

acoustic moss
#

optional s

wraith hound
#

Why not ask in pygen though?

inland wolf
#

ye

acoustic moss
#

accepts http or https

inland wolf
#

ye

vapid nymph
#

but

inland wolf
#

? makes it zero or more

vapid nymph
#

the ? does that itself

inland wolf
#

what

acoustic moss
#

he means that the [] are redundant

inland wolf
#

oh ok

#

hmm thats true right

acoustic moss
#

ye pretty sure they are

vapid nymph
#

this regex is

#
http[s]?:\/\/(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+
acoustic moss
#

?: within () would make it a non-capturing group

vapid nymph
#

supposed to match urls

acoustic moss
#

not sure what it means when its not in ()

vapid nymph
#

πŸ€”

#

regex is hard

wraith hound
#

aaaaAAAA

vapid nymph
#

!src

royal lakeBOT
vapid nymph
#

There's gotta be a url regex in there somewhere I can look at

#

(https?://[^\s]+)

#

Okay then.

#

the problem with that regex

young shoal
#

@low chasm wtf

lunar crescent
#

taim trahvel

low chasm
young shoal
#

how

low chasm
#

I'm just too good at this

wraith hound
#

Aboo can see the future

low chasm
#

Indeed

inland wolf
#

lol

lunar crescent
#

lol

last mantle
#

Hmm

#

How do I call a flutter route from a function that does not have build context

lunar crescent
last mantle
#

O

inland wolf
#

ye

acoustic moss
latent scaffold
#

oh my

acoustic moss
#

I'm a bad, bad person

misty dew
acoustic moss
#

i know

#

lol

inland wolf
#

sussy

vapid nymph
narrow pasture
inland wolf
#

agreed

acoustic moss
#

ah shit, I the cat

inland wolf
#

πŸ˜”

vapid nymph
#

my guy lol

inland wolf
#

wait

#

the bot does thsat?

tardy rain
#

Ye

inland wolf
#

bruh nice

royal lakeBOT
#

Pipfile lines 1 to 9

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true```
wraith hound
#

Ya, it's kinda new

vapid nymph
#

bad code tho

wraith hound
#

4/27

vapid nymph
#

deletes redundant pipfile statement

wraith hound
wraith hound
#

oh

vapid nymph
#

the literal code it shows

#

smh

#

guess i need to parse a poetry.lock and convert it to a poppyfile.lock

#

ugh

last mantle
#

poppy

latent scaffold
#

bruh I'm never going to figure this out haha

#

I can no longer python3 -m robbie... how sad

inland wolf
#

goodbye robbie πŸ˜”

latent scaffold
#

idk why it just refuses to work

#

and I can never find any good resources

#

._. it's installing the package with the name src

tardy rain
#

I would take a look at how flask handles setup and package structure tbh

#

It has a similar structure to yours, with scripts and a src dir

latent scaffold
#

hmm

last mantle
#

there is a package to do it now

inland wolf
#

is it called getx

last mantle
#

FYI

#

no

inland wolf
#

Getx.to(Page())

last mantle
#

o

#

that looks ez

inland wolf
#

its in the state management link i sent

#

getx is like

#

second last

last mantle
#

hmm

inland wolf
#

it can do more than state management

last mantle
#

i will try it for future apps πŸ‘

latent scaffold
last mantle
#

yes

latent scaffold
#

it should be src/robbie/<all of robbie's code>, not src/<all of robbie's code>

#

so now.. I can do

#!/usr/bin/env python3
from robbie.__main__ import main
from robbie.utils import entrypoint


@entrypoint
def _entry():
    main()

and it works

inland wolf
#

nice

last mantle
#

tf is robbie

latent scaffold
#

robbie

last mantle
#

what does it do

inland wolf
#

robbie

latent scaffold
#

on second thought

last mantle
#

...

latent scaffold
tardy rain
#

Does it work now?

latent scaffold
#

yes

vapid nymph
#
          +-------------+           +-----------+
 input -> |             |---------->|           | >----------+
          |  HTTP POST  |           |  SNEKBOX  |  execution |
result <- |             |<----------|           | <----------+
          +-------------+           +-----------+
             ^                         ^
             |                         |- Executes python code
             |                         |- Returns result
             |                         +-----------------------
             |
             |- HTTP POST Endpoint receives request and returns result
             +---------------------------------------------------------

#

yert

last mantle
#

k

vapid nymph
#

i broke my snekbox lol

last mantle
#

good

latent scaffold
#

Is there such a way to clean unused site packages in pip

inland wolf
#

i think theres a pip pacjage for that

round rose
#

Does it clean itself

inland wolf
#

lol

#

probably not

#

!pip autoremove

#

πŸ˜”

last mantle
#

there is no null safety on that package

#

:/

vapid nymph
#

what was that

latent scaffold
#

oh nothing

vapid nymph
#

lmao

#

since there's both a pyproject.toml and a pipfile

#

I uh

#

did the unspeakable.

#

i created two virtual enviroments

low chasm
#

omg

#

impossible

pearl sail
#

soup

rich moon
#

u know a language is old when it supports goto label statements

vapid nymph
#

!pypi toml

royal lakeBOT
vernal oasis
#

Hello I'm Brazilian and I would like to know what you think of Brazil (I don't know how to speak English)

hasty musk
#

Henlo

vapid nymph
#

POETRY IS GREAT

latent scaffold
#

is it

vapid nymph
#

yes

hasty musk
vapid nymph
latent scaffold
hasty musk
#

?

#

because I said football first? lmao

latent scaffold
#

because I can't tell what the difference is

#

what is football and what is soccer

#

do you mean football or soccer

#

by "football" do you mean football or soccer \😩

#

my brain hurts

hasty musk
#

When I say football I mean Soccer, because I don't like saying soccer

latent scaffold
#

... but what is soccer to you

hasty musk
#

Thats Why when I refer to Footbal in America, I say "American Football"

hasty musk
latent scaffold
#

:faint:

misty dew
#

why does chocolate dipped lemons sound good

last mantle
#

No

misty dew
#

it does tho

last mantle
#

No

misty dew
#

mkay

last mantle
#

K

pearl sail
#

chocolate dipped lemons

#

sounds nice

low chasm
#

I sure do love my chocolate dipped lemons

low chasm
wraith hound
misty dew
#

i need to try this

low chasm
#

indeed

#

now to convince my mother

misty dew
#

if I do I'll send a picture

tardy rain
#

Chocolate oranges are a thing, cant imagine why lemons wouldnt be

misty dew
#

mhm

low chasm
#

pics

wraith hound
cyan dragon
#

i don't imagine chocolate lemons being bad at all, with sugar from the chocolate tbh

low chasm
#

mhm

#

lemons on their own taste good as well

latent scaffold
#

chocolate lemon sounds kinda good

low chasm
#

indeed

#

tasty

cyan dragon
#

lemons are less acidic than limes so...yeah. better than chocolate covered limes

vapid nymph
#

wat

#

!pypi flake9

royal lakeBOT
vapid nymph
#

😳

#

!pypi flake8

royal lakeBOT
vapid nymph
#

:sus:

latent scaffold
#

flake9

rich moon
#

isnt it supposed to be flake8

#

or maybe flake9 is for the cool kids

latent scaffold
#

lol

acoustic moss
#

interesting

rich moon
#

dont they all have to be on at the same time

hushed olive
#

Hello, I need some help linking up pycharm accounts using github, rq, where can I access the sign in page on pycharm?

#

wait nvm, got it

rich moon
#

havent used pycharm is a super long time but i think when u do a push it prompts u for an account

acoustic moss
#

yeah it does

hushed olive
#

yeah

#

I was just trying to sync my chromebook account with my desktop

#

now all I need to do is learn how to use linux right, and see if I can sync projects then I'll be in the clear

versed saffron
#

I'm trying to figure out the best way to do because 100% there's no way this is efficient. I'm making chess and I'm now realizing my method of checking if a move will put the player in check, won't actually work, The way I have it now is by iterating over the board (dict), if the piece belongs to the opponent, check all possible legal moves, append them and return that list. Then make the move and check if that new position is in the list.

This works great if the king is the one moving but doesn't if it's not as it only checks the moves up to a piece - not past it. I've realized now that I need at least 2 layers of depth for any other piece (opponent moves -> player responses -> opponent moves to response). That means I have to find all possible opponent moves + for each one of those moves, find all possible responses + for each of those, find all possible opponent moves and return that.

I've had the thought of running this on a separate thread and running it right after a player makes a move in the game loop (with the exception of maybe running it at start of game (with a depth of 1), and causing the main thread to block until it gets that list. The issues is it will have to run:

for opponent_pieces:
  for opponent_pieces.legal_moves():
    for player_piece.legal_moves(`board):
      for opponent_pieces.legal_moves(``board):```
and I'm a bit concerned about the complexity/time it'll take. I had some idea of caching a piece's possible moves - hashing them based on their current position - letting the loops use the cache if the piece hasn't moved but is there a better way to approach this?
young shoal
#

you can cache the "in-check" positions from the previous move

#

would probably just be a set of coordinates or something

versed saffron
#

but wouldn't that be invalid after the opponent moves?

young shoal
#

then you can calculate it again

versed saffron
#

doesn't that negate the purpose of caching it

young shoal
#

you don't run into your quarduply nested for loops

#

it's just move_target in in_check_squares

acoustic roost
#

Hi

#

@vapid nymph

vapid nymph
#

Here

acoustic roost
#

i ama show u the github

#

of my bot

vapid nymph
#

Ok

inland wolf
#

sad

versed saffron
young shoal
#

i c

#

so why can't you just calculate again after moving?

versed saffron
#

That’s a good question

acoustic roost
misty dew
#

choco lemons ftw

#

and now the os debate begins

low chasm
#

Lmao

opaque bronze
#

hello Bois

low chasm
#

Hi

#

@thick dawn

#

We can discuss OS here

opaque bronze
#

bruh why did they call it memoization, coulda called it caching

#

simple and effective

thick dawn
low chasm
#

So, you say that windows is the best, but beside better app support, why is that?

#

What benefits does it have

thick dawn
#

I think windows i the most common and hence is supported by all applications

low chasm
#

It's slower than Linux, heavier, and is limited in customization

opaque bronze
#

many dev tools are better in linux

low chasm
#

^

opaque bronze
#

you get gcc chan builtin

low chasm
#

Hence why a lot of devs use linux

opaque bronze
#

and i have to use mingw like a n00b

thick dawn
low chasm
#

Lmao

last mantle
#

in what way is it slower?
it just uses more resources

low chasm
#

And more and more apps are being ported to Linux

low chasm
last mantle
#

no

#

not necessarily

low chasm
#

Why not

misty dew
#

mAcOs iS bEsT ok goodbye

low chasm
last mantle
#

not in my pc

low chasm
misty dew
#

πŸƒβ€β™‚οΈ

low chasm
#

On low end machines, people use linux over windows

thick dawn
#

ah! to be frank I am using windows from past 10 years. so i am used to it and don't want to change. that's all πŸ˜†

low chasm
#

Sure on a decent pc it won't make a difference

low chasm
#

But the fact is there that Linux uses less resources

opaque bronze
#

people are resistant to change

low chasm
#

Windows shoves updates down your throat

opaque bronze
#

exactly when you need to do something important

low chasm
#

Yep

thick dawn
low chasm
#

But for most users, windows is fine

latent scaffold
low chasm
#

Lmao

#

Also how the fuck do you rice windows

vapid nymph
#

Guys how can you write a schema for a toml?

latent scaffold
#

I think so, anyways... that people are reluctant to change simply because it's not what they're used to

opaque bronze
#

yeah

low chasm
#

I've done what I can

#

I centered the Taskbar

opaque bronze
#

atleast they can experiment with stuff

low chasm
#

Changed the theme

#

But that's it

opaque bronze
#

they wont even TRY other things

low chasm
#

I don't think you can truly bash Linux without using a modern Linux distro thoroughly

latent scaffold
#

bash Linux? is that an awful pun?

low chasm
#

I'm so good at puns I don't even know when I'm making em

thick dawn
#

have you seen garuda linux. i like its design. fluid tabs

opaque bronze
low chasm
#

Haha

#

Fuck

#

It's 1:10

#

Am

last mantle
#

but its limited

thick dawn
#

its 10:40 am here

low chasm
#

Yeah

#

Which is the problem

#

With Linux I can do whatever the fuck I want

latent scaffold
low chasm
#

Haha

vapid nymph
last mantle
#

worth trying

low chasm
latent scaffold
#

no

low chasm
#

Just use arch

latent scaffold
#

Arch-derivatives will never be good

low chasm
#

Some are half decebt

last mantle
#

it has built in BTRFS and ZRAM

low chasm
#

Though we can all agree, fuck manjaro

latent scaffold
#

If you don't want Arch, you don't want an Arch derivative

last mantle
#

does arch have that?

#

ootb

low chasm
#

You can get it

latent scaffold
last mantle
#

ootb...

low chasm
#

Oh wait

thick dawn
#

give a mac to a windows user and he will ask how the hell should i copy. there's no ctrl button. (and vice-versa)\

low chasm
#

Ha yeah

last mantle
#

well the point is for a newbie, garuda is a nice distro

latent scaffold
#

Arch's DIY... there's almost nothing ootb

low chasm
#

If your a new user

last mantle
#

yes

latent scaffold
low chasm
#

Do not at all use arch or a deritive

latent scaffold
#

or what zram even is

last mantle
#

zram is automatic

opaque bronze
last mantle
#

no one needs to know anything

low chasm
#

For newbies, just go with lubuntu, kubuntu, or xubuntu

last mantle
#

ah kubuntu

#

i had driver issues

low chasm
thick dawn
#

i heard of a chromeOS too. never saw it tho

low chasm
#

Ah no

opaque bronze
low chasm
#

Chrome OS is shit

#

I am ashamed to call it Linux

latent scaffold
low chasm
#

My school uses chromebook

opaque bronze
#

sudo die

last mantle
#

i installed proprietary drivers

latent scaffold
#

hmm

last mantle
#

a lot of screen tear

low chasm
#

Open source?

latent scaffold
#

Did you use bumblebee or something

last mantle
#

garuda did not have that B)

#

idk

latent scaffold
#

I can only assume you did something wrong

thick dawn
#

i dont understand why the fuck do schools give students the worst OSes to work on. also some shitty IDEs too like code:blocks

latent scaffold
#

because the drivers are exactly the same

#

they're... proprietary

last mantle
#

yes

low chasm
latent scaffold
low chasm
#

Hm

#

It can be decent

latent scaffold
#

It's good at what it does

opaque bronze
#

this is funny as shit

low chasm
#

But school ruined it for me

latent scaffold
#

but I'd never personally use it willingly

low chasm
thick dawn
#

my school still used windows 7. lmao

last mantle
#

anyways i tried linux and stuff, and until windows breaks, i wont switch

low chasm
#

That's fair

latent scaffold
#

tbh I don't really ever trust the word of "tried linux"

low chasm
#

I balance both of em

last mantle
#

tbh you dont trust anything

latent scaffold
#

I mean it's just one of those things

inland wolf
#

tbh i trust windows

thick dawn
#

which linux will you suggest me to use. i have 4 gigs of ram. and i want a nice design too

latent scaffold
#

If you found it that bad, you must be doing something wrong

last mantle
inland wolf
#

nice design can be achieved by any distro right?

last mantle
#

ye

low chasm
#

So is Xubuntu

latent scaffold
thick dawn
#

k .thanks

low chasm
#

Kubuntu is just very easy to customize out of the box

inland wolf
#

epic

thick dawn
#

will be back later

low chasm
#

And it's beginner friendly

vapid nymph
#

Guys is there a way to define schemas for toml?

latent scaffold
#

Kubuntu is nice, but might take too much RAM

vapid nymph
#

So the IDE can suggest stuff

last mantle
low chasm
#

Anyways, it's 1:16 am, and I should sleep, gn yall

vapid nymph
#

Like json config schemas

last mantle
latent scaffold
#

There is

#

but I don't think there's a way to tell the IDE what to look for

#

that wouldn't make much sense

vapid nymph
#

Yeah, but the schema for a custom definition

latent scaffold
#

The IDEs themselves add stuff like that

vapid nymph
latent scaffold
#

It depends on the JSON, doesn't it?

vapid nymph
#

Yeah but you can basically put a link at the top of the file and it suggests stuff based off of that

inland wolf
#

ye

#

vscode settings.json has a schema

vapid nymph
#

Ik vscode does that, not sure of pycharm and others

vapid nymph
inland wolf
#

yea

#

just give it a schema lolroflmao

vapid nymph
#

I'm curious if such a thing exists for toml or yaml

inland wolf
#

hmm

latent scaffold
#

YAML I think

#

but not TOML

vapid nymph
#

Also what would you use for config

#

Toml or yaml or json

latent scaffold
#

not JSON

#

YAML or TOML

#

JSON's not for configs

vapid nymph
#

Why not json

latent scaffold
#

it's intended for storing data

#

not for being edited by users

vapid nymph
#

Oh

#

Lemme clarify slightly.

latent scaffold
#

you can't have comments in JSON

mellow spire
inland wolf
#

u can have comments

vapid nymph
#

Joe yes imma out him would use toml

inland wolf
#

i edited a tsconfig.json and it was filled with comments

latent scaffold
#

You can't have comments in JSON

mellow spire
#

yaml is a superset of json

inland wolf
#

bruh

last mantle
#

toml, for ease of use

vapid nymph
#

Toml because in toml you can have sections

last mantle
#

tables ftw

mellow spire
#

your choice, i had go wtih yaml

vapid nymph
#

Actually, thinking about this. Toml sections make the most sense for the different things these configuration are for

last mantle
#

yea

inland wolf
#

toml does makes more sense for config

vapid nymph
#

Ye

latent scaffold
#
In [1]: import json

In [2]: json.loads("""{\n    "owo": "uwu" # this is a comment\n}""")
---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
last mantle
#

?

vapid nymph
#

If anyone wants to devils advocate against toml please do so

last mantle
#

bruh

latent scaffold
#
In [3]: json.loads("""{\n    "owo": "uwu"\n}""")
Out[3]: {'owo': 'uwu'}
last mantle
#

is not a comment in json

inland wolf
#

sad

latent scaffold
#

// doesn't work either

#

There are not comments in JSON

inland wolf
#

ig some parsers just ignore //

vapid nymph
#

^

last mantle
#

JSON has comments

inland wolf
#

can have*

latent scaffold
#

JSON doesn't have comments

inland wolf
#

it can if u wish

#

and ur wish is the parsers command

last mantle
#

its not recommended

vapid nymph
#

Iirc vscode literally calls it json with comments

inland wolf
#

ye

last mantle
#

ye

vapid nymph
#

ye

latent scaffold
#

It depends entirely on the implementation

#

but JSON itself does not have comments

vapid nymph
#

ye

latent scaffold
#

and ini/toml/yaml are better suited for configuration

vapid nymph
#

Ini looks just like toml ngl

inland wolf
#

πŸ˜”

latent scaffold
#

they're the exact same syntax wise, I think

vapid nymph
#

Well

#

Ini is

inland wolf
#

wait

#

this doesnt have a schema

vapid nymph
#

Toml has extra stuff that ini doesn't I think

#

What does toml mean anyhow

latent scaffold
#

but... what?

vapid nymph
#

!pypi toml

royal lakeBOT
latent scaffold
#

Tom's Obv- yes

vapid nymph
#

While we're at it

latent scaffold
#

it's configparser

vapid nymph
#

!pypi ini

royal lakeBOT
#

Simple json/pickle like ini-file parsing.

latent scaffold
#

!pypi configparser

royal lakeBOT
inland wolf
#

ye

latent scaffold
#

oh. it's std

#

!d configparser

royal lakeBOT
#

Source code: Lib/configparser.py

This module provides the ConfigParser class which implements a basic configuration language which provides a structure similar to what’s found in Microsoft Windows INI files. You can use this to write Python programs which can be customized by end users easily.

Note

This library does not interpret or write the value-type prefixes used in the Windows Registry extended version of INI syntax.

inland wolf
#

why are the colors different

#

the embed colours*

latent scaffold
#
"TOML is somewhat similar to the INI format, but unlike INI, it has a standard specification and well-defined syntax for nested structures."
inland wolf
#

yes

latent scaffold
#

interesting

vapid nymph
#

Cool so the next step for me is to abstract away the settings to a toml

inland wolf
#

precisely

vapid nymph
#

Yes all of the default settings are literally coded into the bot ;-;

latent scaffold
#

that or use a Python file

vapid nymph
#

Eh

latent scaffold
#

like how setuptools has setup()

vapid nymph
#

Nah

latent scaffold
#

that way you can more easily govern what's put in

vapid nymph
#

Wdym

latent scaffold
#

with type-hints

#

and like.. mypy apir or something for checking

#

and whatever else... baked right in

vapid nymph
#

toml + pydantic/dataclasses/metaclassess

latent scaffold
#

no parsing and what-not

thick dawn
#

can i keep kubunto os along with windows 8.1 without losing my data

vapid nymph
latent scaffold
#

hm

#

What even is pydantic

vapid nymph
#

!pypi pydantic

royal lakeBOT
#

Data validation and settings management using python 3.6 type hinting

latent scaffold
#

that doesn't really.. help

#

what's the difference between that and mypy

vapid nymph
#

Whats mypy

latent scaffold
#

!pypy mypy

last mantle
#

i already use TOML for all my GUI's

latent scaffold
#

well.. yes

#

!pypi mypy

royal lakeBOT
latent scaffold
#

you can use the API in your code to enforce static typing

vapid nymph
#

Pydantic can take user input and changes it to a model

latent scaffold
#

I don't know what that means

vapid nymph
#

Validates its all the correct type

#

The example

#
from datetime import datetime
from typing import List, Optional
from pydantic import BaseModel

class User(BaseModel):
    id: int
    name = 'John Doe'
    signup_ts: Optional[datetime] = None
    friends: List[int] = []

external_data = {'id': '123', 'signup_ts': '2017-06-01 12:22', 'friends': [1, '2', b'3']}
user = User(**external_data)
print(user)
#> User id=123 name='John Doe' signup_ts=datetime.datetime(2017, 6, 1, 12, 22) friends=[1, 2, 3]
print(user.id)
#> 123
latent scaffold
#

so this is like... serde?

#

like from Rust, I guess

vapid nymph
#

!pypi serde

royal lakeBOT
#

Define, serialize, deserialize, and validate Python data structures.

vapid nymph
#

Yeah I guess

latent scaffold
#

or... in general

#

basically you make a struct statically typed with attribute names as the keys

#

and like JSON, for example (with serde_json)... it'll map it to the struct

vapid nymph
#

I'm confused lol

latent scaffold
#
#[derive(Serialize, Deserialize, Debug)]
struct MyJSON {
    name: &str,
    age: i32
}

let my_object: MyJSON = serde_json.from_str(r#"{"name": "John Doe", "age": 42}"#).unwrap();
#

My Rust is... Rusty, but that's it, basically

inland wolf
#

whats r#

vapid nymph
#

OK yea same thing I think

latent scaffold
#

r#""#

inland wolf
#

i thought that was just r

latent scaffold
#

not in Rust

#

Rust raw strings are nice

vapid nymph
#

So gonna use toml and pydantic

latent scaffold
#

because you could say r#"""#

#

which is " as a string literal

vapid nymph
#

Damn this seems easy enough to redo the config

latent scaffold
#

in Python, you have to say like "\""

vapid nymph
#

The hard part is actually gonna be going through the entire bot and replacing the old config variables lol

inland wolf
latent scaffold
#

It's such a good library

#

I love strongly typed things

#

Like things don't have to be typed with JSON, but it's faster and much safer

fallen knot
#

hi

latent scaffold
#

because you don't need to have an attribute for every single key-value field... you can leave out what you don't need

fallen knot
#

im a freshe

latent scaffold
#

so

struct MyJSON {
    name: &str
}

for

{
    "name": "Mr. Oooga-Booga",
    "age": 42.0
}

is still valid... but age just goes poof

inland wolf
#

yes

#

age is bye

inland wolf
#

@last mantle yo

#

if one of my ram modules is 2400mhz can i have another ram module with a higher clock

#

or should they both stay the same

#

hm

#

so they will both run at then slowest clock

#

if they are differnet clock speeds

#

interesting

last mantle
#

idk if they will be compatible

#

but if they are it makes sense to run at the common clock

inland wolf
#

yes

alpine edge
lunar crescent
#

ok

rough sapphire
#

@alpine edge Your past few messages haven't been meaningful, please don't post such messages

buoyant gust
#

Hi

brittle mica
#

So I have been working on a reminder app made entirely in kivy and kivymd and I needed some help in testing it out. If anyone wants to help in testing please fill out the following form. You must have an android device and a telegram account for bug reporting. Here are some screen shots of the app https://forms.gle/SyD48QX1aJkEPLi89

lunar crescent
#

cool, but python is not really recommended for mobile app dev, but its ok

#

the ui is nice

brittle mica
brittle mica
young shoal
#

that... is a bit sus

lunar crescent
rough sapphire
#

It's fun but you're right but there was no need to πŸ˜†

rough sapphire
#

Let's refrain from posting such links even in jest

#

Alright

#

Thanks!

alpine edge
#

waited 17 hours to connect to 2b2t to be "Timed out" after 4 minutes

#

i am not

lunar crescent
#

buy priority queue then, ik its $20 per month, if don't want to then you just have to face the normal queue, orjust play on another server lol

rough sapphire
#

Oh just, you know, play on another server

acoustic moss
#

@halcyon cosmos answering you here since it was a js question:
removing the ) after 'ready' on line 6 should fix the problem

halcyon cosmos
#

ok wait

acoustic moss
#

I probably won't be able to answer if you have any follow up questions because I have 0 experience with discord.js

halcyon cosmos
#

so like this

acoustic moss
#

not the ()

#

('ready', () =>

halcyon cosmos
#

oh ok

acoustic moss
#

the () => {...} is (yet another) syntax for making an anonymous function
the bot.on takes this function as one of its arguments

wraith hound
#

Node.js is very event oriented, so a lot of things use arrow functions to respond to events

acoustic moss
#

also console.Log should be console.log

halcyon cosmos
#

ok

halcyon cosmos
acoustic moss
halcyon cosmos
#

but its still not starding

#

hmm

#

can i get in a Voice with you

#

and you help me tehr

#

ther

acoustic moss
#

nah, like I said I have no experience with discord.js

wraith hound
#

I've used d.js before

last mantle
#

also are there commands in d.js

wraith hound
last mantle
#

as in?

wraith hound
last mantle
#

o ok

wraith hound
last mantle
#

like how are they more powerful

wraith hound
#

For one, they support multiple lines

#

Which is the main thing

halcyon cosmos
#

const Discord = require('discord.js')
const bot = new Discord.Client();

bot.on('ready', () => {
console.log('Bot online')
}

#

this is the Code

#

to become the bot Online

last mantle
wraith hound
halcyon cosmos
#

oh ok

wraith hound
#

You need bot.login(token)

#

Also, don't use bot in js

#

Use client

halcyon cosmos
#

ok

wraith hound
halcyon cosmos
#

So wherever the bot is written, should I write the client?

last mantle
#

oh alright

wraith hound
#

Yes, replace bot with client

inland wolf
#

ye

halcyon cosmos
#

wait

inland wolf
#

waiting

halcyon cosmos
#

xd

#

i think i got the Problem

inland wolf
#

yes

#

it likes to tell u how to fix syntax errors

halcyon cosmos
#

ok

#

wait can we go in the vc

inland wolf
#

no

wraith hound
#

Unless you add client.login(token)

inland wolf
#

ye

#

u cant just run

#

u need to login

#

to discord

#

via client.login

halcyon cosmos
inland wolf
#

after everything

halcyon cosmos
#

ok

inland wolf
#

just put it in the end

wraith hound
#

At the end of your index.js

inland wolf
#

ye

wraith hound
#

It's a really good way to learn discord.js

halcyon cosmos
wraith hound
#

I've watched that, it isn't that great

#

At least, not as good as the guide

halcyon cosmos
#

ok

inland wolf
#

the actual guide is better

inland wolf
wraith hound
#

Assuming that's the video I'm thinking of

inland wolf
#

Alright, making a bot is cool and all, but there are some prerequisites to it. To create a bot with discord.js, you should have a fairly decent grasp of JavaScript itself.

#

from the guide ^^

halcyon cosmos
#

okay

wraith hound
#

Alright, making a bot is cool and all, but there are some prerequisites to it. To create a bot with discord.py, you should have a fairly decent grasp of Python itself. While you can make a bot with very little Python and programming knowledge, trying to do so without understanding the language first will only hinder you. You may get stuck on many uncomplicated issues, struggle with solutions to incredibly easy problems, and all-in-all end up frustrated. Sounds pretty annoying.

inland wolf
#

yes

#

lol

#

so true

wraith hound
#

That part is so well written

halcyon cosmos
#

I don't check the guide

inland wolf
#

Sounds pretty annoying.

#

it is

inland wolf
wraith hound
#

You should

#

It's the best way to learn d.js

inland wolf
#

ye

wraith hound
#

And it actually explains what everything does

#

Assuming you understand js

gritty zinc
#

To create a bot with discord.py, you should have a fairly decent grasp of Python itself.
#discord-bots: This sign can't stop me because I can't read

inland wolf
#

lol

wraith hound
#

Lol

halcyon cosmos
#

haha

inland wolf
#

ye

last mantle
#

do you prefer d.py or d.js

#

k

inland wolf
#

ive never really tried d.js

last mantle
#

the onmessage triggers me

inland wolf
#

why

last mantle
#

idk

inland wolf
#

bruh

last mantle
#

i like commands more

inland wolf
#

well

last mantle
#

the way dpy handles it

inland wolf
#

there is a commands extension i think

#

for d.js

last mantle
#

hmm

inland wolf
#

i forget its name

gritty zinc
#

commandeer or something

wraith hound
gritty zinc
#

not having command handling in the library itself is a weird choice

wraith hound
#

It's not a d.js thing

last mantle
#

hmm

wraith hound
#

It's just that a lot of people prefer to implement it themselves

#

Which is something they teach you how to do in the guide

halcyon cosmos
#

hey do you have a video which is better?

last mantle
#

docs are usually good

halcyon cosmos
#

ok

wraith hound
#

d.js docs are also surprisingly nice

acoustic moss
last mantle
#

well

acoustic moss
#

chad

last mantle
#

thats nice and stufff

#

but slash commands when

acoustic moss
#

hmm

last mantle
#

im tempted to go over to d.js

#

due to lack of features

acoustic moss
#

bruh

inland wolf
#

moment

twilit shore
#

python is suprerior

#

oops

#

superior

inland wolf
#

no

twilit shore
#

!otn a python-is-suprerior

#

:(

halcyon cosmos
modern haven
last mantle
#

hmm

#

im into GUI now

#

heh

modern haven
#

try C# then πŸ˜‚ so many languages

last mantle
#

nah

#

flutter

modern haven
#

whats that?

twilit shore
#

reject d.js return d.py

gritty zinc
#

making guis in C# is pretty nice

wraith hound
#

Flutter is a UI toolkit that works with Dart

last mantle
gritty zinc
#

Evorage, did you get to see my C# app? πŸ™‚

last mantle
#

show

#

it

modern haven
gritty zinc
#

This is a C# WPF app calling to Rust code via FFI

modern haven
#

ooo nice

last mantle
#

well

#

it is GUi

#

but

modern haven
#

ive always know WPF is powerful but i struggled with it

#

OHHH your fractal thing, that was WPF? nice

gritty zinc
#

every time I zoom in, the image is recalculated pixel-by-pixel in the Rust code

#

yup

halcyon cosmos
#

haha

wraith hound
#

So that's how you maintained good quality?

gritty zinc
#

by the way, do you know any visual GUI editors that aren't Visual Studio/Blend?

modern haven
#

how long have you been learning C# @gritty zinc ?
not long if i remember right, doing great tho lol

gritty zinc
#

I just don't want to install the gigabytes-big C# workload for VS 😩

gritty zinc
modern haven
gritty zinc
#

yikes

twilit shore
gritty zinc
#

I think I'd sooner use Electron than start using a gameengine for a simple GUI πŸ˜…

modern haven
gritty zinc
#

and I don't plan to use electron

modern haven
#

good πŸ˜‚

wraith hound
acoustic moss
#

concattmed reptile pro

twilit shore
#

?

#

oh

#

con-cat-ed reptile

#

oh to

#

tm

#

so concatted

gritty zinc
#

some things were annoying to do, I spent like an hour of two just figuring out how to make an image from bytes

modern haven
#

how did you do that in the end?

gritty zinc
#

the answer turned out to be

        private static BitmapSource ArrToGrayscale(byte[] array, uint w, uint h) {
            var format = PixelFormats.Gray8;
            var wbm = new WriteableBitmap((int) w, (int) h, 96, 96, format,
                null); //TODO: use the other override to work with the pointer to array directly
            wbm.WritePixels(new Int32Rect(0, 0, (int) w, (int) h), array, (int) w, 0);
            return wbm;
        }
#

how to do it with just BitmapImage like you can (supposedly) with rgb images? hell if I know 😩

modern haven
#

looks complicated πŸ˜‚

gritty zinc
#

passing a Vec<uint8> comparatively wasn't too horrible

#
        // ReSharper disable once InconsistentNaming
        public struct FFIVec
        {
            public unsafe byte* Ptr;
            public ulong Len;
            public ulong Cap;
        }
        [DllImport("fractal_calculator.dll")]
        private static extern FFIVec calculate_mandelbrot_vec(
            F xMin,
            F xMax,
            F yMin,
            F yMax,
            uint width,
            uint height,
            uint maxIters,
            F horizon
        );

        // ReSharper disable once InconsistentNaming
        private static byte[] FFIVecToArr(FFIVec vec) {
            var totLen = vec.Len;
            var temp = new byte[totLen];
            unsafe {
                Marshal.Copy(new IntPtr(vec.Ptr), temp, 0, (int) vec.Len);
            }

            return temp;
        }
acoustic moss
#

what does extern do

#

external..?

gritty zinc
#

specify it's an external function, yeah, loaded from a dll

acoustic moss
#

hmm

inland wolf
#

WAIT

#

U CAN JUST LOAD DLLS LIKE THAT?

#

what did u do on the rust end?

gritty zinc
#

and the Rust side looks like

#[no_mangle]
pub extern "C" fn calculate_mandelbrot_vec(
    x_min: F,
    x_max: F,
    y_min: F,
    y_max: F,
    width: u32,
    height: u32,
    max_iters: u32,
    horison: F,
) -> FFIVec<u8> {
    let arr = calculate_mandelbrot(
        x_min, x_max, y_min, y_max, width, height, max_iters, horison,
    );
    arr.into_raw_vec().into()
}

plus I had to make my own FFIVec struct

modern haven
#

you made a dll from a rust script?

inland wolf
#

ah no mangle

#

hot damn

#

C works for csharp too?

gritty zinc
inland wolf
#

interesting

gritty zinc
inland wolf
#

asm is assembly?

gritty zinc
#

and I'm okay with it not being callable from assembly πŸ˜…

inland wolf
#

lol

gritty zinc
modern haven
gritty zinc
#

(I'm also specifying rlib is so that the binary crate I use for testing doesn't break)

#

(dunno why)

modern haven
#

is it possible to make a dll from python scripts then?

#

to be fair you can just import them

gritty zinc
#

no?

inland wolf
#

lol

gritty zinc
#

but there are libraries to call python functions from compiled langs

#

for, say, scripting purposes

modern haven
#

i dont really get how dll's work 😒 i just know you can import them and they run their code

#

ooo nice

gritty zinc
#

as far as I'm aware, DLLs are basically exes but without an entry point

#

you can't run them directly, but besides that they can be full-fledged programs

modern haven
#

ah yeah that makes sense, just a bunch of functions you can call with no main()

gritty zinc
#

oh, and here's the struct:

#[repr(C)]
pub struct FFIVec<T> {
    pub ptr: *mut T,
    pub len: u64,
    pub cap: u64,
}
impl<T> From<Vec<T>> for FFIVec<T> {
    fn from(vec: Vec<T>) -> Self {
        Self::new(vec)
    }
}
impl<T> FFIVec<T> {
    pub fn new(mut x: Vec<T>) -> Self {
        let s = Self {
            ptr: x.as_mut_ptr(),
            len: x.len() as u64,
            cap: x.capacity() as u64,
        };
        mem::forget(x);
        s
    }
}
#

normal Rust Vecs don't have a #[repr(C)]

#

so they aren't FFI-safe

#

so I needed this tiny struct (three fields and a method to make it from a normal Vec)

#

it's exactly like a Vec works, but it's guaranteed πŸ˜…

#

whereas Vecs, I guess, can potentially not be in the right memory layout

#

I'm actually surprised I didn't need any unsafe code on the Rust side.

#

one would think forget would be unsafe, but no:

forget is not marked as unsafe, because Rust’s safety guarantees do not include a guarantee that destructors will always run. For example, a program can create a reference cycle using Rc, or call process::exit to exit without running destructors. Thus, allowing mem::forget from safe code does not fundamentally change Rust’s safety guarantees.

That said, leaking resources such as memory or I/O objects is usually undesirable. The need comes up in some specialized use cases for FFI or unsafe code, but even then, ManuallyDrop is typically preferred.

Because forgetting a value is allowed, any unsafe code you write must allow for this possibility. You cannot return a value and expect that the caller will necessarily run the value’s destructor.

#

The need comes up in some specialized use cases for FFI
As always, Rust docs don't fail to be relatable πŸ˜…

vapid nymph
#

[[howdoes.thiswork]]

#

toml

wraith hound
#

That's a heading

#

Right?

last mantle
#

mmm

#

table ig

#

i forgot

vapid nymph
#

yeah but the dual [[]]

last mantle
#

see the docs

vapid nymph
#

can't find any search results on it

last mantle
#

its a 10 min read

wraith hound
#

The Notion API seems useful

#

Maybe I'll write something on there and publish it on my website

gritty zinc
#

not just a single option

vapid nymph
#

yeah

vapid nymph
#

😳

#

how can i include a file with a package?

gritty zinc
inland wolf
#

thats like typing recieve a lot in ur code

#

and then realizing its receive

vapid nymph
#

shit

acoustic moss
#

very true freind

vapid nymph
#

include = ["default-config.toml"]
in my pyproject.toml for poetry

#

but how do i actually make it include the file with the wheel

#

or is that not possible?

#

wait nvm

#

it doesn't bundle with the file in that case lemon_angrysad

thick dawn
#

need to learn responsive website building. html, css and javascript for free. any suggestion from where to learn. (video lectures)

wraith hound
last mantle