#voice-chat-text-0

1 messages ยท Page 255 of 1

wise cargoBOT
#

โœ… @civic chasm can now stream until <t:1707261200:f>.

whole bear
#

Cheeki can you tell me what a dictionary in python is?

ivory stump
#

It's a structure that allows you to represent links between objects

#

So if you have a bunch of colour names and their RGB values

#

You can use a dictionary to "link" each name to the corresponding cRGB

#

!e

names = ["red","green","blue"]
rgbs = [(255,0,0),(0,255,0),(0,0,255)]

def get_rgb(target):
    for i,name in enumerate(names):
        if name == target:
            return rgbs[i]

print(get_rgb("green"))
print(get_rgb("blue"))
wise cargoBOT
#

@ivory stump :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | (0, 255, 0)
002 | (0, 0, 255)
ivory stump
#

So this is a way you could conceptually try and make these links without a dictionary

#

But this is very clunky, and also very slow

#

If we imagine our two lists are a million elements long, we could go through up to a million elements of the list to find the one we actually want

#

With a dictionary, things look like this:

#

!e

col_dict = {
    "red" : (255,0,0),
    "green" : (0,255,0),
    "blue" : (0,0,255)
}

print(col_dict["green"])
print(col_dict["blue"])
wise cargoBOT
#

@ivory stump :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | (0, 255, 0)
002 | (0, 0, 255)
ivory stump
#

Dictionaries are defined by curly braces

#

and a bunch of comma separated pairs

#

Which look like key : value

#

This is clearly much nicer syntax to work with, and is also ridiculously fast

#

In fact it has approximately constant time complexity (if the dict has a million elements, it will still take about as long as for the toy example with 3 elements)

#

"time complexity" here just means "how much more time-consuming does the task get when we scale the numbers up"

#

So with "linear time complexity", (usually written as O(n)), as the size of the task (n) gets bigger the amount of time it will take also goes up by the same amount

#

Double the size = double the time

#

That's what the list example has

#

With the dictionary, we have "constant time complexity" aka O(1). You'll notice here that the term inside the brackets doesn't depend on n, and that's because no matter how big the task is the amount time taken will be the same

#

๐Ÿ‘‹

#

maybe they just turned their computer off without disconnecting

#

anyway hopefully the explanation makes sense, anything else you wanna know about?

#

You can add a bookmark with .bm

ivory stump
#

Click that button and you'll get a bookmark too

#

Not really :/

#

in your dms with sir lancebot

#

Well that would be the problem it's telling you about

#

You don't have your dms open

#

yup

#

just reply to my first explanation message with.bm

wise cargoBOT
#

Glad to see some bot appreciation, keep it up!

ivory stump
#

Well you wouldn't be able to follow the link

#

Since it's a server message link

#

The preview would be ok

#

So you could see the specific linked message and that alone

#

What does luck have to do with it?

whole bear
ivory stump
#

No idea eyes_zoom

#

Well I'd feel a little hurt

#

If you were really pushy with it or were doing it to several people you might get a mute for a bit shrug

somber heath
#

@whole bear ๐Ÿ‘‹

whole bear
#

@whole bear ๐Ÿ‘‹

#

hi

somber heath
whole bear
#

im havin runny nose

ivory stump
#

!sf 1204572113608900688 1204572115316113459

wise cargoBOT
#
Snowflakes

1204572113608900688
Created at 2024-02-06 23:39:31.752000+00:00 (<t:1707262771:R>).

1204572115316113459
Created at 2024-02-06 23:39:32.159000+00:00 (<t:1707262772:R>).

ivory stump
#

That was not an adequte emoji forthe shock I was trying to convey

whole bear
#

ohh

#

nothing

#

๐Ÿ˜‚

#

passing the parcel

#

no

ivory stump
whole bear
#

where r u guys from ?

ivory stump
#

yeah RTT notwithstanding

whole bear
#

pithink r u robot ?

#

๐Ÿ˜ญ both

ivory stump
#

๐Ÿง‹

whole bear
#

ducky_party wholesome

ivory stump
#

I really need to ask mina for her boba emoji servers

#

I'm restrained by the inability to express more than one kind

#

๐Ÿง‹

whole bear
#

how old r u guys

#

19

#

lessgooo

#

๐Ÿ‘Š

#

2004 born

whole bear
solid perch
#

@somber heath I've got someone who needs help with reverse engineering a site

#

You ok with helping them?

somber heath
whole bear
#

pithink well my major is history ....but i wanna learn python so is it possible

#

im a blank canvas

somber heath
solid perch
#

It's an AI video generator. He needs help with trying to get some specific variables from the site onto his own

whole bear
solid perch
#

No

whole bear
solid perch
#

Using a type of ad blocker

solid perch
whole bear
#

๐Ÿ˜ญ i wanna block my discord too
do you guys know any extension

somber heath
#

Yeah, sorry, N9, I'm not really sure what to say other than to talk to more webby people.

whole bear
#

@somber heathtrue

ivory stump
#

๐Ÿ‘‹ ello

#

que pasa

#

We're getting there

whole bear
#

Getting where?

#

yeah ? @whole bear

ivory stump
#

So close yet so far

whole bear
#

smash karts ?

#

idk something new to me

whole bear
#

@steady sigil ๐Ÿ‘‹

somber heath
#

@steady sigil ๐Ÿ‘‹

whole bear
#

@steady sigilhi

steady sigil
#

yo

whole bear
steady sigil
#

ye, need to be here longer lol

ivory stump
#

But there's also a whole command for this smh

#

!voice

wise cargoBOT
#
Voice verification

Canโ€™t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.

ivory stump
#

Fair enough

whole bear
#

Cheeki can you give me voice mute for 5 mins?

#

well it's good
tokkens and bots wont have acceess

somber heath
ivory stump
#

It'd also show up on your record

#

time to take a quick look O_o

#

oh hell no

#

When you become a mod you get spammed with joke infractions

#

Because they no longer mean anything and the infractions dont actually apply

#

So I have like 30 infractions

#

It's great fun, you get to leave messages in their !i s

#

yeah you still show up as 1 timeout :(

#

I have one auto timeout too from way back

steady sigil
#

because of all the post editing of the voice like supression and shit I guess

#

like default discord shit I mean

#

Usually yes

#

I had same problem when I had set a noise gate too high on eq

#

yeap

#

sounds like it

#

discord noise suppresion could be cause or not really?

#

also discord has auto gain control, trying to turn that off might help?

#

I'd say it's 95% airpods but playing with discord settings might help, that's the best I can help here lol

#

you know I looked in the settings menu before I texted it but I was like "ok maybe OpalMist knows it and knows that discord named it one thing but it works not as it's named" lol

#

still doing lol

#

clever ^ 2 = stupid lol

ivory stump
#

๐Ÿ‘‹

steady sigil
#

gl

#

I think you fixed it

#

what?

#

yeah it sounded like gain

#

but hey now it's fixed ๐Ÿ˜„

final laurel
#

@somber heath i fixed it

steady sigil
#

working on learning how to write a discord bot lol

#

that would assign a random role from a list and every role has a different chance to be assigned

#

And also make it so it could be run on a VPS

final laurel
#

interesting

steady sigil
#

Guess me from all my typing lmao

#

nono joking Lithuania lol

#

oh like that guy on geo guesser that can literally tell you the location from 10x10 px photo of a tree lol

#

Blinded is from US probl

#

If it's not US it's Canada

#

Cause you sound like American ngl ๐Ÿ˜„

#

You don't have an accent lol

#

all Eu has accent lol

#

you literally sound like that youtuber SwaggerSouls ngl ๐Ÿ˜„

#

nah, SwaggerSouls 100%

#

lol

#

2nd try. I'm the master of voice to country guesser lol

#

two different continents

#

even if they're connected

#

mainly yes

#

Canada is like America but better and colder

#

I'm new to programing lmao

#

I know the basics lol

#

I'm better at describing what the code needs to do and basic structure of how it should be done, but nothing complex lmao

#

Open a ticket, wait an hour

#

and somebody will help

#

I'm not a paid programmer, don't ask me how language works lol

lone flame
#

Exception has occurred: NotImplementedError

    Adafruit-PlatformDetect version 3.60.0 was unable to identify the board and/or
    microcontroller running the Windows platform. Please be sure you
    have the latest packages by running:
    'pip3 install --upgrade adafruit-blinka adafruit-platformdetect'

    If you are running the latest package, your board may not yet be supported. Please
    open a New Issue on GitHub at https://github.com/adafruit/Adafruit_Blinka/issues and
    select New Board Request.

File "C:\VS_code_Mecha\examples\CircuitPython 8.x\termal camera code.py", line 5, in <module>
import board
NotImplementedError:
Adafruit-PlatformDetect version 3.60.0 was unable to identify the board and/or
microcontroller running the Windows platform. Please be sure you
have the latest packages by running:
'pip3 install --upgrade adafruit-blinka adafruit-platformdetect'

    If you are running the latest package, your board may not yet be supported. Please
    open a New Issue on GitHub at https://github.com/adafruit/Adafruit_Blinka/issues and
    select New Board Request.
#

SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries

SPDX-License-Identifier: MIT

import time
import board
import busio
import adafruit_mlx90640

PRINT_TEMPERATURES = False
PRINT_ASCIIART = True

i2c = busio.I2C(board.SCL, board.SDA, frequency=800000)

mlx = adafruit_mlx90640.MLX90640(i2c)
print("MLX addr detected on I2C")
print([hex(i) for i in mlx.serial_number])

mlx.refresh_rate = adafruit_mlx90640.RefreshRate.REFRESH_2_HZ

frame = [0] * 768
while True:
stamp = time.monotonic()
try:
mlx.getFrame(frame)
except ValueError:
# these happen, no biggie - retry
continue
print("Read 2 frames in %0.2f s" % (time.monotonic() - stamp))
for h in range(24):
for w in range(32):
t = frame[h * 32 + w]
if PRINT_TEMPERATURES:
print("%0.1f, " % t, end="")
if PRINT_ASCIIART:
c = "&"
# pylint: disable=multiple-statements
if t < 20:
c = " "
elif t < 23:
c = "."
elif t < 25:
c = "-"
elif t < 27:
c = "*"
elif t < 29:
c = "+"
elif t < 31:
c = "x"
elif t < 33:
c = "%"
elif t < 35:
c = "#"
elif t < 37:
c = "X"
# pylint: enable=multiple-statements
print(c, end="")
print()
print()

steady sigil
#

ye

#

I'm trying lmao, lemme cook

lone flame
final laurel
#

@steady sigil can try to help you out

steady sigil
#

what I'm getting is that it can't import board "import board" ether it can't reach the library or you named it wrong?

final laurel
#

nice talking to you

steady sigil
#

idk he sounds like the cleanest english speaking person to me lol

lone flame
#

It is clean but sometimes I feel like it's a bit quiet or not loud enough

#

I know I can hear frequencies up to 17k btw ๐Ÿ˜‚

#

ssh

steady sigil
#

well it's definitely the latest version

#

and fon't be afraid to embaress yourself. I literally yesterday asked what was wrong with my code and all it was missing was a stupid space so the code aligns lol

#

you could always try to run the command so that it'll get the latest packages

#

pip3 install --upgrade adafruit-blinka adafruit-platformdetect

#

sometimes shit just don't work from the 1st time lol

#

in codding it's always

  1. write a code
  2. shit don't work
  3. try every fix
  4. be confused why it works now
#
  1. optional: Write a note next to code like : "Idk why it works now but if you delete this line it won't work lol"
#

Hey!

#

But it's easy fix

sweet sorrel
#

Hello!

steady sigil
#

Just figure out why the code doesn't import a library lol

sweet sorrel
#

Yea lol

#

I wish i could join vc

#

@lone flame

steady sigil
#

I'll be able to speak in 3 hours only :S

sweet sorrel
#

Lol

steady sigil
#

from adafruit_blinka import board

^ The stupidiest fix I could think of and it 99% won't work lol

#

that + extra stuff if you get into more detail when working with numbers

#

?

#
  1. Don't ask for relation ship tips
  2. Be chill
  3. Don't force one
  4. I STILL NEED TO WAIT 3 HOURS for bot to allow me to talk lol
#

ye

#

ye

#

different nation - that was a ye for that lol

#

You know a person sound like FBI when they say "I'm just collecting data on you"

somber heath
#

!e py text = 'AbCd' print(text.upper()) print(text.lower()) print(text.title())

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | ABCD
002 | abcd
003 | Abcd
exotic moss
#

didn't know title was a thing

#

!e ```py
text = "a Cool tHing"
print(text.title())

wise cargoBOT
#

@exotic moss :white_check_mark: Your 3.12 eval job has completed with return code 0.

A Cool Thing
exotic moss
#

neat

somber heath
#

!e py print('When the Wind Blows'.title())

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

When The Wind Blows
exotic moss
#

it'd be cool if it checked certain words but that wouldn't work because of a lot of senarios

somber heath
#

!e py print(dir(str))

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isascii', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'removeprefix', 'removesuffix', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
exotic moss
#

!e ```py
print("they're opal's friends".title())

wise cargoBOT
#

@exotic moss :white_check_mark: Your 3.12 eval job has completed with return code 0.

They'Re Opal'S Friends
exotic moss
#

lmao

somber heath
#

!e py my_list = [] my_list.append(1) print(my_list) my_list.append(2) print(my_list)

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | [1]
002 | [1, 2]
somber heath
#

@lilac remnant ๐Ÿ‘‹

exotic moss
#

!e ```py
import re

e = "they're opal's friends"
def title(text):
return re.sub(r"[A-Za-z]+('[A-Za-z]+)?", lambda x: x.group(0).capitalize(), text)

title(e)

#

because it captializes after apostrophies

#

oh u can't edit the original msg

#

!e ```py
import re

e = "they're opal's friends"
def title(text):
return re.sub(r"[A-Za-z]+('[A-Za-z]+)?", lambda x: x.group(0).capitalize(), text)

title(e)

somber heath
#
class MyClass:
    pass```
#

!e ```py
class MyClass:
pass

instance = MyClass()
print(instance)
print(MyClass)```

exotic moss
#

mobile programming moment?

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | <__main__.MyClass object at 0x7f5745edf680>
002 | <class '__main__.MyClass'>
somber heath
#

!e py if True:

wise cargoBOT
#

@somber heath :x: Your 3.12 eval job has completed with return code 1.

001 |   File "/home/main.py", line 1
002 |     if True:
003 | IndentationError: expected an indented block after 'if' statement on line 1
somber heath
#

!e ```py
class MyClass:

...```

wise cargoBOT
#

@somber heath :x: Your 3.12 eval job has completed with return code 1.

001 |   File "/home/main.py", line 3
002 |     ...
003 |     ^
004 | IndentationError: expected an indented block after class definition on line 1
clear portal
#

!e

test = pass
wise cargoBOT
#

@clear portal :x: Your 3.12 eval job has completed with return code 1.

001 |   File "/home/main.py", line 1
002 |     test = pass
003 |            ^^^^
004 | SyntaxError: invalid syntax
clear portal
#

yep

#

True and False are more like macros

#

the pointer are the same

deft shadow
#

!e

import os
os.system("/sbin/reboot")
somber heath
#

!e ```py

class MyClass:
def hello(self):
print('Hello, world.')

instance = MyClass()
instance.hello()```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

Hello, world.
somber heath
#

!e ```py
def func():
print('Hello, world.')

func()
func()
func()```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | Hello, world.
002 | Hello, world.
003 | Hello, world.
somber heath
#

@sweet sorrel ๐Ÿ‘‹

sweet sorrel
#

Hello

somber heath
sweet sorrel
#

Yea

#

the wait time is rediculous tbh

somber heath
#

!e ```py
def func(a):
print(a)

func('Hello, world.')```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

Hello, world.
sweet sorrel
#

But like why not add an ID Verification or something so you show you are a real person have to put some kind of effort and boom.

#

Easy filter

lone flame
#

@sweet sorrel But won't real people still come to troll?

sweet sorrel
#

If they do they get one shot.

lone flame
sweet sorrel
#

But three days :E

#

true

#

automate with python ๐Ÿ˜„

lone flame
somber heath
#

!e ```py
def func(a):
print(a)

func('Hello, world.')
func('Goodbye.')```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | Hello, world.
002 | Goodbye.
sweet sorrel
#

Heres my photo id, im over 18 and not a dumb kid

#

!e

wise cargoBOT
#
Missing required argument

code

#
Command Help

!eval [python_version] <code, ...>
Can also use: e

Run Python code and get the results.

This command supports multiple lines of code, including formatted code blocks. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.

The starting working directory /home, is a writeable temporary file system. Files created, excluding names with leading underscores, will be uploaded in the response.

If multiple codeblocks are in a message, all of them will be joined and evaluated, ignoring the text outside them.

Currently only 3.12 version is supported.

We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!

clear portal
sweet sorrel
#

async def testwarn(ctx, member: discord.Member, *, reason: str): Is my function here a testwarn and the arguments is whats entered.

#

ctx, member: discord.Member, *, reason: str would this be the arg

somber heath
#

!e ```py
def add(a, b):
print(a + b)

add(1, 2)```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

3
somber heath
#

!e ```py
def func():
return 'Hello, world.'

print(func())```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

Hello, world.
somber heath
#
print('Hello, world.')```
clear portal
#

9pm :). here is 5am ๐Ÿ˜‚

#

๐Ÿ‡ฎ๐Ÿ‡ท

#

wut

#

im not running ๐Ÿ˜‚

#

i live in the Persian Empire

#

:))))))))

#

good

somber heath
#

!e ```py
def func():
pass

print(func())```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

None
somber heath
#

!e py r = print('Hello, world.') print(r)

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | Hello, world.
002 | None
somber heath
#

!e ```py
def add(a, b):
return a + b

print(add(1, 2))```

clear portal
#

i think the kid is gone. btw ๐Ÿ˜‚

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

3
whole bear
#

@verbal zenith hey bro

somber heath
#
print(3)```
clear portal
#

yep

#

what is lazy evaluated filed

#

ah

#

i just write my own wrappers always

#

no. i dont use it like that ๐Ÿ˜‚
i use the sqlalchamy and pydantic sepretly and just write wrappers

somber heath
#

!e ```py
class MyClass:
def say(self, obj):
print(obj)

instance = MyClass()
instance.say('Hello, world.')```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

Hello, world.
whole bear
#

Ok bye

clear portal
#

told u

#

๐Ÿ˜‚

#

i think he has ADHD ๐Ÿ˜‚

#

do you guys make backups from your github repos?

somber heath
#

@quiet sapphire ๐Ÿ‘‹

verbal zenith
#

I tried googling, and it's a little tough to find, will keep looking if you don't know tho HAHA

clear portal
#

this is how i do my thing

verbal zenith
#

Goodness

clear portal
#

you have a table from OSM

verbal zenith
#

How does that work with migrations

clear portal
#

for example a blog

#
class BlogTable(BaseTable):
    __tablename__ = 'blog'

    blog_id = Column(Integer, primary_key=True, autoincrement=True)
    slug = Column(String, nullable=False, index=True)
    project = Column(
        Integer,
        ForeignKey(ProjectTable.project_id, ondelete='CASCADE'),
        nullable=False
    )
    author = Column(
        Integer,
        ForeignKey(UserTable.user_id, ondelete='SET NULL'),
        index=True,
    )
    category = Column(
        Integer,
        ForeignKey(BlogCategoryTable.category_id, ondelete='SET NULL'),
        index=True,
    )
    created_at = Column(Integer, nullable=False, server_default='0')
    edited_at = Column(Integer, nullable=False, server_default='0')
    thumbnail = Column(
        Integer,
        ForeignKey(RecordTable.record_id, ondelete='SET NULL'),
    )
    thumbnail_url = Column(String)
    read_time = Column(Integer, nullable=False, server_default='0')
    __table_args__ = (
        UniqueConstraint('project', 'slug'),
    )

#

and then

#

you make a blog model

#

class BlogModel(BaseModel):
    blog_id: int
    slug: str
    project: int
    created_at: int
    author: int | None = None
    category: int | None = None
    edited_at: int = 0
    thumbnail: int | None = None
    thumbnail_url: str | None = None
    read_time: int = 0

#

from pydantic

#

then

#

you do this

#
result = await sqlx.fetch_one(select(BlogTable).where(
            BlogTable.blog_id == blog_id,
            BlogTable.project == project.project_id
        ))
        if result is None:
            raise err_bad_id(item='blog', id=blog_id)

        blog = BlogModel(**result)
#

indent is worng

#

but you get the point

verbal zenith
#

I see

clear portal
#

you can put this behind a wrapper function like
blog_get

verbal zenith
#

Maybe my crud should be returning pydantic schemas

#

No.

#

Nvm I don't think it should

lone flame
#

Gn people

clear portal
#

the one nice thing about ORM is the table creation

#

gn

verbal zenith
#

Relationship lazy loading is usually quite nice

#

Just this specific time it's a pain in the ass

clear portal
#

i never do joins. like never

verbal zenith
#

I have a database that is full of relationships

#

handling all that would be hell

clear portal
#

idk man. i have writen a lot if code. specialy website with sql. and never had to do a join.
there is relationships but no join

clear portal
verbal zenith
#

I mean I'm not saying I NEED this, it just seems like it would be a pain to not have .children for instance

clear portal
#

i just get them manualy ๐Ÿ˜‚

verbal zenith
#

Yeah just sounds like a major annoyance when my model has a parent, and children since it relates to itself, has users attached in multiple different manners, has phone numbers, social medias, bla bla bla. Could grab it all, but relationships makes it very easy

#

its only when I want my pydantic model to say display a related model in the schema that this is annoying

clear portal
#

wait. is your phone number in a different table

#

wut

verbal zenith
#

Phone numberS

#

Many to one relationship

shrewd ibex
#
    async with engine.begin() as conn:
        await conn.run_sync(Base.metadata.create_all)
    db = SessionLocal()
    try:
        yield db
    finally:
        await db.close()``` Does this create the tables every time the server makes a connection to the database?
clear portal
#

you write tables for that ๐Ÿคฃ

verbal zenith
#

I could put them in a long string field I guess

clear portal
#

the performance gotta suck

verbal zenith
#

Where would you store them?

clear portal
#

json

verbal zenith
#

Json encoded string?

clear portal
#

yep

verbal zenith
#

Not bad I'll take good advice

#

Switched it shall be

clear portal
#

im a database expert btw ๐Ÿ˜Ž ๐Ÿ˜‚

verbal zenith
#

Well guess that makes me the import

clear portal
#

๐Ÿ˜‚

somber heath
#

@opaque hornet ๐Ÿ‘‹

verbal zenith
#

Honestly the json encoded strings could make things a lot nicer

#

Tho not all can use that

#

How would you do role relationships

#

Like owner, editor, etc.

#

I did a many to one table for that

#

Technically I guess a many to many

clear portal
verbal zenith
#
class ProjectRoles(Base):
    __tablename__ = "project_roles"
    id = Column(Integer, primary_key=True)
    role = Column(String)
    project_id = Column(Integer, ForeignKey('project.id'), nullable=False)
    project = Relationship("Project", back_populates="roles", remote_side="Project.id")
    user_id = Column(Integer, ForeignKey('user.id'), nullable=False)
    user = Relationship("User", back_populates="project_roles", remote_side="User.id")
verbal zenith
verbal zenith
#

There are specific permissions granted to each role, not customizable

verbal zenith
#

let me google that

clear portal
#

thats how discord does it

verbal zenith
#

Oh instead of string for role

#

Or for permissions

#

I assume for permission validation?

#

like bit 1 is a toggle for x permission, bit 2 for y permission, etc.

clear portal
verbal zenith
#

Well that doesn't exactly apply to my roles

#

There are defined roles, they don't change ever

clear portal
verbal zenith
#

unless I change them in the program

#

Those roles have defined access by a function that will check read and write access

clear portal
clear portal
verbal zenith
#

Hm.

#

So let me ask if this makes sense

clear portal
#
class AdminPerms(int, Enum):
    '''Admin Permissions'''

    def _generate_next_value_(name, start, count, last_values):
        return 1 << count

    MASTER = auto()  # only controls admins

    V_USER = auto()  # VISION ~ VIEW
    A_USER = auto()  # APPEND ~ ADD
    C_USER = auto()  # CHANGE ~ CHANGE
    D_USER = auto()  # DELETE ~ DELETE


    V_RECORD = auto()
    A_RECORD = auto()
    C_RECORD = auto()
    D_RECORD = auto()

    MAX = auto()

#

this is how my perms look like

verbal zenith
#
class ProjectRoles(Base):
    __tablename__ = "project_roles"
    id = Column(Integer, primary_key=True)
    permissions = Column(Integer, nullable=False)
    project_id = Column(Integer, ForeignKey('project.id'), nullable=False)
    project = Relationship("Project", back_populates="roles", remote_side="Project.id")
    user_id = Column(Integer, ForeignKey('user.id'), nullable=False)
    user = Relationship("User", back_populates="project_roles", remote_side="User.id")

Permissions would store the specific access to this project?

clear portal
#
    def admin_check(self, required_perms: int, log=False) -> bool:
        if self.agent is None:
            if log:
                logger.warn(
                    f'<User {self.user.gene}> tried {required_perms}'
                )
            return False

        admin_perms = self.agent.admin_perms
        is_master = admin_perms & AdminPerms.MASTER

        if not is_master and (admin_perms & required_perms) != required_perms:
            if log:
                logger.warn(
                    f'<Admin {self.user.gene}> tried {required_perms}'
                )
            return False

        return True
clear portal
#

this user has this perms on this project

#

dont store the roles on a seprate table

verbal zenith
#

How does that make sense though?

clear portal
verbal zenith
#

It will be many

clear portal
#

like how manny

verbal zenith
#

There is another resource with permissions which could have ~100

#

Project could have ~15-20

clear portal
#

20 users in json is still way faster then just searching the hole database

verbal zenith
#

fair

clear portal
#

cus when you load your json object into python its becomes a hasmap
so its even faster

verbal zenith
#

Alright, so.

Store phone numbers and social medias and things alike in json encoded fields
Store permission validation info in a bit packed int
Store roles and their associated perms in a json encoded field

#

That all looks like the take away?

clear portal
#

ye. just in general minimize your use of relationships in your database and IRL ๐Ÿ˜‚

verbal zenith
#

and IRL HAHAHAHA

#

yeah honestly makes good sense

#

Surprised I didn't think of json encoding

#

Guess I thought that'd be stupid which in hindsight is dumb to think HAHAHA

clear portal
#

remember searching for thing is expensive.
but having it right there is way faster

verbal zenith
#

Not when my pc is Sherlocke

#

Speak for your own undercapable pc

#

I'm just kiddin yeah understandable

clear portal
#

are you writing backend?

verbal zenith
#

Yes

#

And front end

#

Real pain to do the front end enjoying the fuckery of learning backend stuff

clear portal
#

so the thing that you gotta remember is that. 1ms more spend on each request can cost you $1000 more each month :))
that how i think about optimization

verbal zenith
#

Depends on the payment model you're using I'd assume but yeah ms matters

clear portal
verbal zenith
#

make the number more fun in that case
"...could cost you $1234 more each month"

#

Then die on the hill that it's calculated and accurate

clear portal
#

$69420 ๐Ÿ˜‚

#

ye. im working on a custom database for a project cus sql wouldn't cut it. and that was when i learned a lot about these stuff

verbal zenith
#

Interesting I don't think I've ever heard of sql not being enough and no other already made database fitting the needs

clear portal
#

we are talking about micro seconds of delay not mili

verbal zenith
#

Ms

clear portal
#

micro is 0.000001 of a second

verbal zenith
#

I thought it was capital M for some reason

#

It's fuckin ฮผ

#

ฮผs

clear portal
#

ye

verbal zenith
#

Good ol greek

clear portal
#

flask that dead bro

verbal zenith
#

Flask?

clear portal
#

ye

verbal zenith
#

What about it

#

I think I'm lost

#

oh wait my headset was off

clear portal
#

its old and uwsgi

verbal zenith
#

I didn't even notice val joined

#

I use FastAPI

clear portal
clear portal
verbal zenith
#

Started with django but I didn't like the mess that my code became

somber heath
#

!e py import random random.seed(16362319) result = ''.join(random.choices('abcdr', k=11)) print(result)Abracadabra.

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

abracadabra
clear portal
#

but python is also not cutting it. unfortunately i have to rewrite my backend at some point :Sadge:

#

write it in c and run it in parallel

#

no

#

the random

#

thing

#

i have to write my backend in rust

#

rust sucks

#

A33

#

the lang

#

i have to use it

#

i put a lot of reseach in to it

obsidian dragon
#

should contact support

clear portal
#

im writing a python script to download all of my repos and zip them ๐Ÿ˜‚ just in case an AI decide to randomly ban me.

obsidian dragon
#

so quiet

obsidian dragon
#

it smells like a house burning down

somber heath
#

@brave meadow ๐Ÿ‘‹

upper basin
#

Israel

obsidian dragon
brisk bridge
#

hi

somber heath
#

@karmic frost ๐Ÿ‘‹

mint canyon
#

@rapid chasm hi

#

@rapid chasmhru bro

#

@somber heath hru

#

@echo garden hur

somber heath
#

@hybrid fjord ๐Ÿ‘‹

mint canyon
#

@hybrid fjordhi

somber heath
#

@torn dust ๐Ÿ‘‹

hybrid fjord
#

๐Ÿ‘ @somber heath @mint canyon

mint canyon
#

@torn dust hi

torn dust
karmic frost
#

helo

karmic frost
#

where can i learn python

hybrid fjord
#

calm

mint canyon
mint canyon
karmic frost
somber heath
wise cargoBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

somber heath
#

Here. This Discord server.

mint canyon
karmic frost
#

ccan u teach me basics?

somber heath
mint canyon
torn dust
hybrid fjord
#

same here aswell

somber heath
#

YouTube, Corey Schafer, playlists, Python for Beginners.

mint canyon
karmic frost
somber heath
#

Assistance via DMs is discouraged.

mint canyon
#

@stray blade hi

somber heath
#

@stray blade ๐Ÿ‘‹

torn dust
#

i wanna ask amt

#

smt*

stray blade
stray blade
karmic frost
somber heath
unkempt charm
#

Hi

somber heath
#

@low mica ๐Ÿ‘‹

#

@safe forum ๐Ÿ‘‹

rugged root
#

!stream 425552190283972608

wise cargoBOT
#

โœ… @peak depot can now stream until <t:1707316261:f>.

peak depot
#

SELECT DENSE_RANK() OVER (ORDER BY MAX(tulos) DESC) AS sijaluku, nimi,
MAX(tulos) AS paras_tulos
FROM Pelaajat p
JOIN Tulokset t ON p.id = pelaaja_id
GROUP BY nimi
ORDER BY paras_tulos DESC, p.nimi;

somber heath
#

@uneven timber ๐Ÿ‘‹

#

@sacred thistle ๐Ÿ‘‹

austere hornet
#

my ears ๐Ÿ˜ญ

#

i didn't realise today was so active

#

I'm gonna have to go to bed now

somber heath
#

@latent sonnet ๐Ÿ‘‹

latent sonnet
civic chasm
#

my first time setting up project structure with Django

somber heath
#

A suit full of honeybees.

civic chasm
#

but luckily i have gpt to hold my hand

somber heath
#

Bee'n'Bee.

somber heath
#

@vital vapor ๐Ÿ‘‹

vital vapor
somber heath
#

@regal spire๐Ÿ‘‹

#

@stray blade ๐Ÿ‘‹

#

I said hi before, my bad.

stray blade
somber heath
#

Waterproof reading.

#

Oo. Fireproof reading.

#

Bulletproof reading.

#

Fauxne. Not a real phone. Occasionally rings randomly to fuck with you.

echo garden
#

@rugged root Terahertz ratchet in graphene 2D metamaterial formed by a patterned gate with an antidot arrayd

#

thats interesting

#

a ratchet that runs on terahertz speeds

civic chasm
sacred thistle
#

When you hit 30 it should be prohibited for you to drink sugar based drinks.

#

By the law I mean haha

stray blade
sacred thistle
stray blade
#

Ah, you mean this law should exist.

sacred thistle
#

Yeah, kinda. ๐Ÿ˜

#

I just noticed that I'm reading first edition of the Python Crash Course book. Should I swtich to the latest one?

rugged root
#

Most of it will be the same

#

Might just add some other bells and whistles. But anything talking about 3.5 and higher should be fine

#

async stuff will be different

#

Ah yeah, I'm around ~$43k yearly

sacred thistle
#

I've noticed for example there's no mentioning about "f string" feature in the first edition.

rugged root
#

Yep, that was added in 3.6

#

Have that committed to memory because it's one of my all time favorite features

sacred thistle
#

Yeah, it looks great.

rugged root
#

string text ${expression} string text

#

But with wrapping back ticks

#

!stream 664667836605661217

wise cargoBOT
#

โœ… @upper basin can now stream until <t:1707320674:f>.

civic chasm
#

it gets bit depressing when i get stuck on same error for a long time, but new error every now and then is fun

stark river
rugged root
#

@upper basin Co-worker is here, so I'll mostly be typing now

#

And anyone else, please feel free to interject if I'm getting any of this stuff wrong regarding how this project should be done

#

If you import it, you can read it

#

You need that layer of separation

#

Yeah, you'd need that API layer to keep things separate

#

That's your intermediary and what keeps users from reading what's on the server side

rugged root
#

If you can import it into your Python code, you can do all kinds of things to read the files. FastAPI is fairly simple to get up and running

#

The API layer is the easy part, it's the wrapper that'll take you more time

upper basin
#

Thank you so much for the stream permission and guidance Hemlock!

#

You're an angel sir.

rugged root
#

Yep yep

upper basin
#

QHACK

rugged root
#

Quack

upper basin
rugged root
#

Hell yes

#

This pleases Hemlock

gentle flint
rugged root
#

Classic

stark river
#

what would be the opposite of lazy load

#

or lazy eval

rugged root
#

I think it's just load and eval

upper basin
wind warren
#

as a beginer, do you guys think i should use pycharm or vscode or don't matter? thank you

upper basin
#

Personally saying that.

stray blade
wind warren
#

i paid 20 bucks for this course

upper basin
#

That's the best advice you'll ever get on classes. UML diagrams are OP.

regal badge
rugged root
#

JSON is (in most cases) just a dictionary

#

And Python even has a built-in lib for converting one to the other and vice versa

#

!d json

wise cargoBOT
#

Source code: Lib/json/__init__.py

JSON (JavaScript Object Notation), specified by RFC 7159 (which obsoletes RFC 4627) and by ECMA-404, is a lightweight data interchange format inspired by JavaScript object literal syntax (although it is not a strict subset of JavaScript [1] ).

Warning

Be cautious when parsing JSON data from untrusted sources. A malicious JSON string may cause the decoder to consume considerable CPU and memory resources. Limiting the size of data to be parsed is recommended.

json exposes an API familiar to users of the standard library marshal and pickle modules.

Encoding basic Python object hierarchies:

rugged root
#

Pydantic and FastAPI should also do those conversions

regal badge
#

[
{
"id": "Parent1",
"childList": [
{
"id": "child1",
"type": "Parent2",
"parent": null
},
{
"id": "child2",
"type": "Parent3",
"parent": null
}

    ]
},
{
    "id": "Parent2",
    "childList": [
        {
            "id": "child3",
            "type": "Parent1",
            "parent": null
        },
        {
            "id": "child4",
            "type": "Parent3",
            "parent": null
        }
    ]
},
{
    "id": "Parent3",
    "childList": [
        {
            "id": "child5",
            "type": "Parent1",
            "parent": null
        },
        {
            "id": "child6",
            "type": "Parent2",
            "parent": null
        }
    ]
}

]

#

the json file i want to mutate
class Program
{

// Main Method
static public void Main(String[] args)
{
    Stack<string> set = new();
    List<ParentModel> resLst = LoadJson().ToList();
    List<ParentModel> resLst2 = LoadJson().ToList();

    foreach(ParentModel res in resLst)
    {
        set.Push(res.Id);
        testRecFxn(res, resLst2, set);
        set.Pop();
    }
}

public static IList<ParentModel> LoadJson()
{
    using (StreamReader r = new StreamReader("C:/Users/HP/Desktop/resJSON.json"))
    {
        string json = r.ReadToEnd();
        List<ParentModel> items = JsonConvert.DeserializeObject<List<ParentModel>>(json);
        return items;
    }
}

public static void testRecFxn(ParentModel parentComponent, List<ParentModel> lst, Stack<string> set)
{
    var chkRecursion = "";
    foreach(var chldComponet in parentComponent.childList)
    {
        var tst = lst.Where(e => chldComponet.type == e.Id).FirstOrDefault();
        if (set.Count > 0)
        {
            chkRecursion = set.Where(e=> e==tst.Id).FirstOrDefault();
        }
        if(tst != null && (chkRecursion ==null|| chkRecursion == ""))
        {
            set.Push(tst.Id);
            testRecFxn(tst, lst, set);
            set.Pop();
            chldComponet.comp = tst;
        }
        else
        {
            continue;
        }
    }
}

}

rugged root
#

Use the hastebin if it's that large

#

It gets kind of spammy otherwise

#

Honestly kind of surprised that the bot didn't flag it since it's so many new lines

echo garden
whole bear
#

hi hemlock

atomic imp
rugged root
#

Back in a sec

echo garden
rugged root
#

!stream 1115110120444133376

wise cargoBOT
#

โœ… @echo garden can now stream until <t:1707326020:f>.

rugged root
#

Miscommunication + Accounting Software = God damn it

#

@peak depot Yo

#

Yep, co-worker back here and all that

#

Jesus the echo

#

Yes'm

#

Kind of like that

peak depot
#

"A resting bitch face" is a term used colloquially to describe a facial expression that may unintentionally convey anger, annoyance, or contempt while the person's face is at rest or in a neutral expression. It typically involves a slight frown, narrowed eyes, or other features that might give off a negative impression, even though the person may not actually be feeling those emotions. It's important to note that this term is subjective and can be considered offensive by some, as it perpetuates stereotypes about women's facial expressions.

rugged root
#

Just looking annoyed when you're not really expressing

#

Word

#

Mildly surprised

#

"Oh good, this shit again"

echo garden
#

lol

rugged root
#

All good

#

"That's right, I'm cool"

#

That's the vibe I get

#

Miscalculated a fart

#

Looks contemplative

#

Why not both

civic chasm
echo garden
rugged root
echo garden
#

bkue steel

rugged root
#

Yep, he knows

#

@mild quartz Sup brah

mild quartz
#

bruh

rugged root
#

How's it hanging

mild quartz
#

low low

rugged root
#

God damn it, to the sites that have a dark theme main website but a light theme docs page

#

I'm displeased by you

stark river
#

just use the emmet lsp never mind there is no help file with that

rugged root
#

Which I think means it's one they directly support

stark river
#

maybe i should give you my docs i made for emmet.. just a cheatsheet

#

pastebin wants a sign up?

rugged root
#

No no

#

Their cheatsheet is also in dark theme

#

Just the docs proper

#

It's weird

#

I have what I need it was more just a confusion thing

stark river
#

darkreader or wear sunglasses ๐Ÿ˜Ž

peak depot
willow light
#

So. Much. Boilerplate.

gentle flint
#

Catalan ( KAT-ษ™-lษ™n, -โ lan or KAT-ษ™-LAN; autonym: catalร , Eastern Catalan: [kษ™tษ™หˆla]), known in the Valencian Community and Carche as Valencian (autonym: valenciร ), is a Western Romance language. It is the official language of Andorra, and an official language of two autonomous communities in eastern Spain: Catalonia and the Balearic Islands. I...

willow light
#

gotta love the local markets

#

!pip uwuipy

wise cargoBOT
#

Allows the easy implementation of uwuifying words for applications like Discord bots and websites

willow light
#

I want to find an excuse to use this in prod

gentle flint
willow light
#

<p style="text-align: center;">Text here</p>

stark river
#

markdown lets you down

willow light
#

Markdown lets you down, but at least you don't have XML/HTML/JSX/TSX pinkie

stark river
#

?.. html is the best option there is.. powerful flexible easy

sweet sorrel
#

Howโ€™s it going

willow light
#

I'll take markdown because you aren't being flashbanged by something that looks horrifyingly similar to XML.

stark river
#

spoken like someone who's weak in html

willow light
#

HTML is terrible, why we're still relying something that hacky is beyond my understanding.

willow light
#

It looks like XML. It's 2024, not 2004, come on. Get with the times.

sweet sorrel
#

I wrote my first bot this week

#

1800 lines

#

I still donโ€™t know what a function is

stark river
#

"looks like X".. "use newer things because times are new" .. both don't seem like mature enough reasons

willow light
#

The most dangerous phrase in our language is "This is the way we do things"

#

It is the obstacle to progress.

stark river
#

sql is 40 years old.. still better than "new" solutions

willow light
#

Using something because it's what people use is the reason corporations are still stuck on Java 8.

#

It's the reason we still use an internal combustion engine to get around.

stark river
#

corporations are stuck on java 8 because management doesn't want to spend the money to upgrade

#

some solutions like sql and "everything is a file" are still the best ones around.. not everything needs a wheel reinvention

willow light
#

SQL is slow, use Redis instead.

#

This isn't a reinvention of the wheel, this is changing the tires because the current ones are bald

stark river
#

all caches are fast compared to disk io .. why not compare apples and oranges

willow light
#

I'm not comparing apples to oranges, you're deliberately misinterpreting what I say.

One would thing after 30 years of that from everyone I meet I'd be used to it, but nooooooo

#

HTML resembles XML. It is a pain to write. The fact that we don't have anything better after literal decades is a collective failure as a species to innovate.

#

Then again, that's also a problem with the so-called "new" programming langauges. There hasn't been a new language for decades because we just keep rehashing everything we have.

stark river
#

i don't think html resembles xml sufficiently enough to call it that .. it is a vast improvement over it

willow light
#

Okay I will give you that, but we stagnated since then.

#

Similar to natural selection, come to think of it.

#

Which is why our eyes don't work when they're dry.

#

"It's good enough" is another dangerous phrase.

stark river
#

natural selection works by elimination.. and by that arg so would all new solutions

#

so we're going to see hit n miss attempts all the time

willow light
#

Natural selection improves on something until it reaches minimum viability, and then it never gets touched again.

#

Never underestimate a temporary solution's tendency to become the permanent solution.

#

See also the entire Massachusetts Department of Transportation.

#

Or the very existence of the inconvenience store DMV

#

"Hey, it barely works, so let's just set it as the status quo and shut down anyone who dares question it."

#

Code quality? That gets in the way of the "velocity". Test coverage? "We can always do that later." Documentation? "We don't have time for that." Fixing security holes? "Not until we are forced to by the regulators."

#

You can see how that attitude can become the norm?

#

You say reinventing the wheel. I say trying to improve on what we have so that in the future we'll have better.

stark river
#

that's the american vs german dev env .. one prioritizes getting to market fast. other prioritizes well developed software

willow light
#

Hang on, let me check which flags are on the moon...

#

It's a tragedy that there's really only a couple different ones.

#

Mind you, there shouldn't be any flags because no one country should ever have a claim to it, but....

stark river
#

what good is a flag on the moon if you have homeless dying in the streets?

willow light
#

Good question. Let me know when you guys fix that so we can have yet another thing to be used by the Murdochs to polarize us.

#

I have a solution, and the city I live in is implementing that solution, but it won't work unless everyone implements it.

#

Continuous economic growth at any costs, of course, prevents that from happening.

stark river
#

that just means it is not scalable

willow light
#

Every single town meeting. "What can we do about the unhoused?" "How about building more houses?" "But then the value on my house will drop."

#

The problem with any economic issue always has been and always will be the fact that humans are selfish and fearful.

#

And nothing terrifies a person more than the unknown.

#

Be it sharks, thunder, people with a different skin color, the disabled, neurodiversity, a differing opinion, etc.

stark river
#

value of house will drop seems like a worthy enough tradeoff

willow light
#

Oh I am hoping for a housing market crash, since according to CNBC the biggest mistake I made was being born too late to take advantage of the low housing prices in 2008.

#

When I was still under age of majority.

#

$1.2 million for a single room living space underground just because in that particular location you don't have to be a slave to the automotive industry to get eggs, bread, and milk.

#

But now I'm getting distracted from my work, so I'll be signing off.

civic chasm
#

hei

#

building a chatbot

#

at this hour i cant really speak much since everyone is sleeping.

short owl
#

does a Arduino have a precision oscillator output , software controlled ?

civic chasm
#

i like new errors

stark river
#

i like no errors

civic chasm
#

what can i say, i take what i get

civic chasm
#

its late so i cannot speak, im in chat

somber heath
#

!d random.choices

wise cargoBOT
#

random.choices(population, weights=None, *, cum_weights=None, k=1)```
Return a *k* sized list of elements chosen from the *population* with replacement. If the *population* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError).

If a *weights* sequence is specified, selections are made according to the relative weights. Alternatively, if a *cum\_weights* sequence is given, the selections are made according to the cumulative weights (perhaps computed using [`itertools.accumulate()`](https://docs.python.org/3/library/itertools.html#itertools.accumulate)). For example, the relative weights `[10, 5, 30, 5]` are equivalent to the cumulative weights `[10, 15, 45, 50]`. Internally, the relative weights are converted to cumulative weights before making selections, so supplying the cumulative weights saves work.
steady sigil
#

@jolly terrace

somber heath
#

@gentle fern ๐Ÿ‘‹

gentle fern
somber heath
gentle fern
#

I was coding a calculator and struggling with some error handling ๐Ÿ˜„

#

The problem is I only want user input as integer, the program crashes if they enter a letter or multiple ones

#
def intro():
    print("PCC - Python CLI Calculator")
    print("GPL v3.0\n")
    print("Operators: + - * / %\n")
intro()

def user_input():
    input_1 = str(input())
    operator = str(input())
    input_2 = str(input())
    if operator == "+":
        result = int(input_1) + int(input_2)
        print(result)
    elif operator == "-":
        result = int(input_1) - int(input_2)
        print(result)
    elif operator == "*":
        result = int(input_1) * int(input_2)
        print(result)
    elif operator == "/":
        result = int(input_1) / int(input_2)
        print(result)
    elif operator == "%":
        result = int(input_1) % int(input_2)
        print(result)
    # exception and error handling
    elif operator != "+" or "-" or "*" or "/" or "%":
        print("\nInvalid operator.")
    else:
        print("Invalid inputs.\n")
user_input()
# an input function that prevents the program from instantly exiting
input("\nPress enter to exit")
#

in case something else happens xD

#

I'm guessing the same @steady sigil

somber heath
#

!or-gotcha

wise cargoBOT
#
The or-gotcha

When checking if something is equal to one thing or another, you might think that this is possible:

# Incorrect...
if favorite_fruit == 'grapefruit' or 'lemon':
    print("That's a weird favorite fruit to have.")

While this makes sense in English, it may not behave the way you would expect. In Python, you should have complete instructions on both sides of the logical operator.

So, if you want to check if something is equal to one thing or another, there are two common ways:

# Like this...
if favorite_fruit == 'grapefruit' or favorite_fruit == 'lemon':
    print("That's a weird favorite fruit to have.")

# ...or like this.
if favorite_fruit in ('grapefruit', 'lemon'):
    print("That's a weird favorite fruit to have.")
somber heath
#

!d while

wise cargoBOT
#

8.2. The while statement

The while statement is used for repeated execution as long as an expression is true:


while_stmt ::=  "while" assignment_expression ":" suite
                ["else" ":" suite]
``` This repeatedly tests the expression and, if it is true, executes the first suite; if the expression is false (which may be the first time it is tested) the suite of the `else` clause, if present, is executed and the loop terminates.

A [`break`](https://docs.python.org/3/reference/simple_stmts.html#break) statement executed in the first suite terminates the loop without executing the `else` clauseโ€™s suite. A [`continue`](https://docs.python.org/3/reference/simple_stmts.html#continue) statement executed in the first suite skips the rest of the suite and goes back to testing the expression.
somber heath
#

!d try

wise cargoBOT
#
try

8.4. The try statement

The try statement specifies exception handlers and/or cleanup code for a group of statements...

gentle fern
#

idk what to do ducky_dave

#

yes while loops

somber heath
#

@hybrid fjord ๐Ÿ‘‹

hybrid fjord
#

๐Ÿ‘ @somber heath

somber heath
#

@viral granite ๐Ÿ‘‹

viral granite
#

hello

#

While there are negative implications for the advancement of ai such as job displacement, there are also great applications in the sciences

#

I went to a panel on AI ethics recently and they were talking about exactly this

#

the same example

#

There was a spear phishing scam recently that implemented ai voices for phone calls recently

#

a bad actor called a coworker of mine's sister telling her that my coworker was injured and dying.

#

then urged the sister for money

#

while using voice ai

#

Especially since companies are collecting so much data

spice escarp
#

flow is chatting

viral granite
#

phishing attacks are so much easier if people can get access to user data

clear portal
#

a grown man gets scammed. who's fault is that?

viral granite
#

skill issue?

clear portal
#

im not defening anybody

#

but come on guys

#

its like you chose 1234 as your password

viral granite
#

No it isn't like that

clear portal
#

yeah its more stupid then that ๐Ÿ˜‚

viral granite
#

agree to disagree?

clear portal
#

its interesting to talk about these problems

viral granite
#

how did you get neovim to be recognized by discord?

clear portal
#

cus you can learn what not to do

viral granite
#

sure

clear portal
viral granite
#

i don't know how to do that yet

clear portal
#

you dont need discord to recognize the app

viral granite
#

so i would need to create an sdk for neovim

#

right?

clear portal
#

im using neocord plugin. but if you want to write a SDK for your own applications you can do that as well

viral granite
#

thank you

#

haha just went to discord.com/developers/
to figure out how to create an sdk and found out my email hasn't been verified on this account for a few years now

#

lol

worthy token
#

whats happning ?

somber heath
#

@azure pagoda ๐Ÿ‘‹

worthy token
#

*Args and **Kwargs in Python

somber heath
#

!e ```py
def func(a, b, c):
print(a)
print(b)
print(c)

func(1, 2, 3)```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | 1
002 | 2
003 | 3
somber heath
#

!e ```py
def func(*arg):
print(arg)

func()
func(1)
func(1, 2)
func(1, 2, 3)```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | ()
002 | (1,)
003 | (1, 2)
004 | (1, 2, 3)
somber heath
#

!e ```py
def func(a, b, c, *args):
print(a)
print(b)
print(c)
print(args)

func(1, 2, 3, 4, 5, 6)```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | 1
002 | 2
003 | 3
004 | (4, 5, 6)
somber heath
#

!e ```py
def func(a, b, c):
print(a)
print(b)
print(c)

func(a = 1, c = 3, b = 2)```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | 1
002 | 2
003 | 3
somber heath
#

!e ```py
def func(a, b, c, **kwargs):
print(a, b, c)
print(kwargs)

func(1, 2, 3, apple = 4, pear = 5, banana = 6)```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | 1 2 3
002 | {'apple': 4, 'pear': 5, 'banana': 6}
somber heath
#

!e ```py
def func(value=10):
print(value)

func()
func(20)```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | 10
002 | 20
somber heath
#

!e ```py
def func(*, value):
print(value)

func(123)```

wise cargoBOT
#

@somber heath :x: Your 3.12 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 4, in <module>
003 |     func(123)
004 | TypeError: func() takes 0 positional arguments but 1 was given
somber heath
#

!e ```py
def func(*, value):
print(value)

func(value = 123)```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

123
somber heath
#
def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):
      -----------    ----------     ----------
        |             |                  |
        |        Positional or keyword   |
        |                                - Keyword only
         -- Positional only```
#

@frigid bolt๐Ÿ‘‹

#

!e ```py
def func(a, b, c):
print(a, b, c)

func(*'abc')```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

a b c
somber heath
#

!e py a, b, = [1, 2] print(a) print(b)

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | 1
002 | 2
somber heath
#
func('a', 'b', 'c')
func(*'abc')
func(*['a', 'b', 'c'])```
#

!e ```py
def func(a, b, c):
print(a, b, c)

dictionary = {'a': 1, 'b': 2, 'c': 3}
func(**dictionary)```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

1 2 3
somber heath
#

!e py print(tuple(i for i in range(3)))

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

(0, 1, 2)
somber heath
#

!e ```py
def gen():
for i in range(5):
yield i

g = gen()
print(g)
for each in g:
print(each)```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | <generator object gen at 0x7f4285264ac0>
002 | 0
003 | 1
004 | 2
005 | 3
006 | 4
somber heath
#

!e ```py
def gen():
for i in range(5):
print(f'Yielding {i}')
yield i

g = gen()
next(g)
print('Hello!')
next(g)
print('Hello again!')
for each in g:
print(each)```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | Yielding 0
002 | Hello!
003 | Yielding 1
004 | Hello again!
005 | Yielding 2
006 | 2
007 | Yielding 3
008 | 3
009 | Yielding 4
010 | 4
somber heath
#

!e py def gen(): while True: yield value g = gen() value = 'apple' print(next(g)) value = 'pear' print(next(g))

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | apple
002 | pear
somber heath
#

!e ```py
def func():
print(v)

v = 0
func()

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

0
somber heath
#

!e ```py
def func():
v = 1
print(v)

v = 0
func()
print(v)```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | 1
002 | 0
somber heath
#

!e ```py
def func():
global v
v = 1

v = 0
func()
print(v)```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

1
somber heath
#

!e ```py
def outer():
def inner():
print(v)
v = 1
inner()

v = 0
outer()```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

1
somber heath
#

!e ```py
def outer():
def inner():
nonlocal v
v = 1
v = 0
inner()
print(v)

outer()```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

1
somber heath
#

LEGB rule.

#

!e ```py
def outer():

def inner():
    max = 'local'
    print(max)

max = 'enclosing / nonlocal'
inner()

max = 'global'
outer()```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

local
somber heath
#

!e ```py
def outer():

def inner():
    # max = 'local'
    print(max)

max = 'enclosing / nonlocal'
inner()

max = 'global'
outer()```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

enclosing / nonlocal
somber heath
#

!e ```py
def outer():

def inner():
    # max = 'local'
    print(max)

# max = 'enclosing / nonlocal'
inner()

max = 'global'
outer()```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

global
somber heath
#

!e ```py
def outer():

def inner():
    # max = 'local'
    print(max)

# max = 'enclosing / nonlocal'
inner()

max = 'global'

outer()```

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

<built-in function max>
somber heath
#

I use IDLE.

#

It's Python's native IDE.

#

It's kind of shit, but it's okay.

#

I'd like it better if it had a terminal that was compatible with ANSI control codes.

worthy token
#

Learned *args, **kwargs, yeild, next, scope, LEGB rule. Thanks @somber heath

#

bye for now

turbid sandal
#

lol

echo garden
#

morning people

austere hornet
#

I'll be back after preparing for bed

willow light
#

!pip connexion

wise cargoBOT
somber heath
#

@ripe cipher ๐Ÿ‘‹

dense ibex
#

hi MysticalOpal!

ripe cipher
#

!e

wise cargoBOT
#
Missing required argument

code

#
Command Help

!eval [python_version] <code, ...>
Can also use: e

Run Python code and get the results.

This command supports multiple lines of code, including formatted code blocks. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.

The starting working directory /home, is a writeable temporary file system. Files created, excluding names with leading underscores, will be uploaded in the response.

If multiple codeblocks are in a message, all of them will be joined and evaluated, ignoring the text outside them.

Currently only 3.12 version is supported.

We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!

whole bear
#

@stable axle i am god

#

i am

#

look at my screen

#

shut up

stark river
#

paste here

#

starting from 0?

somber heath
#

@dire thicket ๐Ÿ‘‹

dire thicket
#

yo

#

anyone worked with virtualbox ?

somber heath
obsidian dragon
stark river
#

race conditions ๐Ÿ˜Ÿ

#

now i need to know order of the events ๐Ÿ˜ฆ

rugged root
#

!stream 1115110120444133376

wise cargoBOT
#

โœ… @echo garden can now stream until <t:1707402875:f>.

somber heath
#

@misty spire ๐Ÿ‘‹

misty spire
rapid chasm
#

Trundle 72.22% 18 games Malphite 0.00% 1 game Garen 100.00% 1 game Data acquired in 4.06 seconds.

wind warren
#

pog

rapid chasm
#

Trundle fan pithink Yes

echo garden
willow light
#

Shout out to the Microsoft Teams dev team for removing the single most useful feature: saved messages.

molten pewter
#

-me to chat GPT: "can you rattle off as much computer jargon is a way that is as unintelligible as possible?"

#

Response: "Initiating a blockchain-powered, decentralized, distributed ledger technology (DLT) framework leveraging quantum-resistant cryptographic hash functions to secure a peer-to-peer hyperledger ecosystem, underpinned by a consensus algorithm oscillating between Proof of Work (PoW) and Proof of Stake (PoS), ensuring a Byzantine fault tolerance. Concurrently, deploying containerized microservices orchestrated via Kubernetes on a virtualized cloud infrastructure with auto-scaling capabilities, adhering to an infrastructure as code (IaC) paradigm through Terraform scripts to ensure immutable deployments across a multi-cloud environment, including AWS, Azure, and GCP, optimizing for edge computing nodes to reduce latency in IoT ecosystems.

Embarking on an agile DevOps journey, incorporating continuous integration and continuous deployment (CI/CD) pipelines using Jenkins and GitLab CI, facilitating blue-green deployments and canary releases to maintain zero downtime and A/B testing scenarios. Implementing RESTful APIs and GraphQL for seamless data interchange, encapsulating business logic in serverless functions executed within ephemeral FaaS environments, leveraging cold start optimization techniques.

Advancing towards AI-driven predictive analytics, employing convolutional neural networks (CNNs) and recurrent neural networks (RNNs) for deep learning tasks within a TensorFlow and PyTorch framework, applying transfer learning and GANs for augmented data generation, ensuring GDPR compliance through differential privacy measures and federated learning models for data sovereignty."

echo garden
#

what in the @rugged root

#

interesting

molten pewter
#

more techno-bable: "Optimizing database throughput via sharding and replication strategies across NoSQL databases like MongoDB and Cassandra, while ensuring ACID compliance and eventual consistency in distributed SQL databases like CockroachDB. Harnessing big data processing power through Apache Hadoop ecosystems, utilizing Spark for in-memory data processing and Kafka for real-time data streaming, implementing ELK Stack (Elasticsearch, Logstash, Kibana) for log analytics and observability.

Incorporating cybersecurity best practices, deploying WAFs, and leveraging OAuth 2.0 and OpenID Connect for secure authentication, employing advanced threat intelligence platforms to preempt zero-day exploits, and ensuring data-at-rest and data-in-transit encryption through AES-256 and TLS 1.3 protocols, complemented by quantum key distribution (QKD) readiness for post-quantum cryptography era."

#

and in conclusion, buy my SAS services.

stark river
#

that database part is pretty good

echo garden
#

@stark river as ChatGPT writes its story the interests grows stronger

stark river
#

and it forgot gRPC and sockets along with RESTful APIs for data exchange

echo garden
#

@stark river yeah but we all already know that, this was just jargon

molten pewter
#

Surely combining gRPR with RESTful decentralized auto scaling in a Kubernetes paradigm will increase agility amoung DevOps and Rouge saving throws.

stark river
#

if i want to git squash all the commits, git rebase -i will do right? no need for HEAD~xx ?

rugged root
echo garden
#

@rugged root the vudoo doll response can be worked into a script

echo garden
#

infact you have all this material to work with

#

omg

#

thats a beautful armpit

echo garden
#

you can have skit where 'what you hear in chat'

#

it be great @rugged root

rapid chasm
rugged root
#

Co-worker here, limited speaking

#

And it's good so far, 'bout you?

#

I kind of like how we do the jams here where we assign teams

#

Oh right right. You and yer fancy edumication

#

Oh right right

#

@fallen heron Hello, you're really quiet

#

I wasn't

#

His mic was genuinely quiet

#

Nah, that's how I talk

#

I typically try to type the way I talk

#

So that people have to hear my stupid voice in their head

#

Daww

#

!rule 4

wise cargoBOT
#

4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.

rugged root
#

Makes it hard to moderate what I can't understand

#

ACE is echoing

#

Might have put his headset down

upper basin
#

Oh bless your heart

rugged root
#

HA

upper basin
#

I can't afford a headset

rugged root
#

Just two cups and a string

upper basin
#

Yep

rugged root
#

@molten pewter What's new in your neck of the woods?

molten pewter
#

nothing much

#

organizing my office and getting ready for taxes.

#

working on learning d3

#

trying to recover a hard drive...

#

general maintenance.

echo garden
#

techno magicalgirl

rugged root
#

D3?

#

Diablo 3?

molten pewter
#

Javascript

rugged root
#

Less exciting

#

JavaScript has a lot less zombies

echo garden
#

3 deep

stark river
#

D3.js? you're making a viz software?

molten pewter
#

correct

rugged root
#

Yeah, stacking them?

molten pewter
#

wizbang viz

upper basin
#
@eggs.setter
@pydantic.whatever
rugged root
#

Yep

#

Yep yep

#

It just wraps the function then wraps that function into another one

#

In fact if you want the decorator to accept arguments, then THAT decorator function has 3 layers of function inside of it

stark river
#

i was thinking of making a dashboard viz software last year โค๏ธ

#

D3.js is a bit rough to handle

rugged root
#

Decorators are cool, just a bit funky

#

Well yeah

#

Same with anything

#

In the operator library?

stark river
#

there was this one more lib that had cleaner apis.. let me recall

rugged root
#

@near smelt
So when you have to do super().__init__(), that's calling the parent class. So if we had...

stark river
#

argh.. if only i had starred the repo

upper basin
#
def __init__(self, a, b, c):
    super().__init__(a, b)
    c = c
rugged root
#
class Person:
  def __init__(self, name):
    self.name = name


class Student(Person):
  def __init__(self, name, favorite_class):
    super().__init__(name)
    self.favorite_class = favorite_class