profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/smithdc1/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.

django-crispy-forms/crispy-tailwind 98

A Tailwind template pack for django-crispy-forms

django-crispy-forms/crispy-bootstrap5 69

Bootstrap5 template pack for django-crispy-forms

smithdc1/django-asv 1

Benchmarks for Django using asv

django-crispy-forms/crispy-forms-bootstrap2 0

Bootstrap2 templates for django-crispy-forms

smithdc1/channels 0

Developer-friendly asynchrony for Django

smithdc1/crispy-forms-bootstrap2 0

Bootstrap2 templates for django-crispy-forms

smithdc1/crispy-tailwind 0

A Tailwind template pack for django-crispy-forms

smithdc1/crispy-test-project 0

Simple Django project for testing https://github.com/maraujop/django-crispy-forms based on https://gist.github.com/maraujop/1838193

smithdc1/csvs-to-sqlite 0

Convert CSV files into a SQLite database

smithdc1/datasette 0

An open source multi-tool for exploring and publishing data

pull request commentdjango/django

Fixed #24121 - Added BoundField __repr__() method

@alex hai

Edald123

comment created time in an hour

pull request commentdjango/django

Fixed #18468 Support migrate with db comment

thank you for your feedback , yes I already reflected every piece of feedback. I'll think about testcase for this new feature without modifying DatabaseWrapper.introspection.get_table_description()

and I will do rollback 1 commit and force push which contained failed testcase

KimSoungRyoul

comment created time in 4 hours

pull request commentdjango/django

Remove unnecessary call to `type` function

@abresas as shown by failed tests that call to type is needed as pointed out by the comments right above:

Construct a new model with the new fields to allow self referential primary key to resolve to. This model won't ever be materialized as a table and solely exists for foreign key reference resolution purposes. This wouldn't be required if the schema editor was operating on model states instead of rendered models.

when a new subclass of Model is created ModelBase metaclass logic is ran, so the call to type triggers ModelBase logic which handles also foreign keys resolution.

I believe mentioning this in a comment would be nice.

abresas

comment created time in 5 hours

pull request commentdjango/django

[WIP] Refs #32508 -- Raise proper exceptions instead of using 'assert' in django.db

This is great--thanks for taking this on. I see you've marked this WIP, so I hope this is a helpful set of notes for when you decide to return to this (rather than just being an annoyance!) Best, Jacob

Hey @jacobtylerwalls ! My pleasure! I'm sorry for being inactive. Giving my time to #14437. But I'd like to finish this up too! I'll add a set of notes in the description.

abbasidaniyal

comment created time in 5 hours

issue openedwillmcgugan/textual

[Windows] ModuleNotFoundError: No module named '_curses'

Trying to run the textual.app example on Windows 10 with Python 3.9.5:

โžœ python -m textual.app
Traceback (most recent call last):
 File "C:\Program Files\Python39\lib\runpy.py", line 197, in _run_module_as_main
   return _run_code(code, main_globals, None,
 File "C:\Program Files\Python39\lib\runpy.py", line 87, in _run_code
   exec(code, run_globals)
 File "C:\CodeProjects\Python\Manim\manimvenv\lib\site-packages\textual\app.py", line 19, in <module>
   from .driver import Driver
 File "C:\CodeProjects\Python\Manim\manimvenv\lib\site-packages\textual\driver.py", line 8, in <module>
   import curses
 File "C:\Program Files\Python39\lib\curses\__init__.py", line 13, in <module>
   from _curses import *
ModuleNotFoundError: No module named '_curses'

created time in 6 hours

Pull request review commentencode/django-rest-framework

Re-prefetch related objects after updating

 def update(self, request, *args, **kwargs):          if getattr(instance, '_prefetched_objects_cache', None):             # If 'prefetch_related' has been applied to a queryset, we need to-            # forcibly invalidate the prefetch cache on the instance.+            # forcibly invalidate the prefetch cache on the instance,+            # and then re-prefetch related objects             instance._prefetched_objects_cache = {}+            prefetch_related_objects([instance], *self.get_prefetch_related())

Given that we are already relying on a private attribute for _prefetched_objects_cache, we may want to also rely on QuerySet._prefetch_related_lookups for getting the prefetch_related() set on the queryset.

This would allow this to be implemented in a way that also fixes the issue for existing queries without requiring the prefetch_related to be defined multiple times for a queryset. The downside would be that it would require the query to be statically defined on the view which might not be compatible many of the more advanced use cases that tend to require prefetching.

yuekui

comment created time in 8 hours

Pull request review commentencode/django-rest-framework

Re-prefetch related objects after updating

 class Meta:   class UserUpdate(generics.UpdateAPIView):-    queryset = User.objects.exclude(username='exclude').prefetch_related('groups')+    queryset = User.objects.exclude(username='exclude')     serializer_class = UserSerializer+    prefetch_related = ['groups']

Useful to mention that these are the only meaningful changes in this file. The actual changes within the tests were reducing duplication but otherwise appear to perform the same as previously.

yuekui

comment created time in 8 hours

issue commentencode/django-rest-framework

null=True is not respected by AutoSchema when the field is on read_only_fields

In theory, this should produce both readOnly = True and nullable = True, which is allowed per the OpenAPI spec.

This is not happening because null=True on the model is translated to allow_null=True on the serializer field which is stripped out when read_only=True is specified.

https://github.com/encode/django-rest-framework/blob/24a938abaadd98b5482bec33defd285625842342/rest_framework/serializers.py#L1327-L1333

It's not entirely clear at first glance why allow_null is removed since there doesn't appear to be any assertions explaining why these two wouldn't be allowed at the same time. My only guess is because normally this only applies to handling null in input data, but we do have code which also uses this for null coercion in outgoing data as well.

canassa

comment created time in 9 hours

pull request commentdjango/django

Fixed #24121 - Added BoundField __repr__() method

Hello @Edald123! Thank you for your contribution ๐Ÿ’ช

As it's your first contribution be sure to check out the patch review checklist.

If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!

If you have any design or process questions then you can ask in the Django forum.

Welcome aboard โ›ต๏ธ!

Edald123

comment created time in 9 hours

pull request commentdjango/django

Remove unnecessary call to `type` function

@abresas as shown by failed tests that call to type is needed as pointed out by the comments right above:

Construct a new model with the new fields to allow self referential primary key to resolve to. This model won't ever be materialized as a table and solely exists for foreign key reference resolution purposes. This wouldn't be required if the schema editor was operating on model states instead of rendered models.

when a new subclass of Model is created ModelBase metaclass logic is ran, so the call to type triggers ModelBase logic which handles also foreign keys resolution.

abresas

comment created time in 9 hours

PR opened django/django

Removed options parameter from djangoAdminSelect2.

It seems this parameter has never been used internally, so to avoid exposing a large surface area in the admin, remove it. As discussed in this mailing list thread: https://groups.google.com/g/django-developers/c/G-fDkNxhxsE/m/--RtGwmtAQAJ .

+14 -19

0 comment

1 changed file

pr created time in 10 hours

pull request commentdjango/django

[WIP] Add a backend for Redis

Hey @carltongibson! So I was going trying to work on the coverages of each backend. However, one tests keeps failing. cache.tests.CreateCacheTableForDBCacheTests.test_createcachetable_observes_database_router

======================================================================
FAIL: test_createcachetable_observes_database_router (cache.tests.CreateCacheTableForDBCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/daniyal/Desktop/django/django/test/utils.py", line 430, in inner
    return func(*args, **kwargs)
  File "/home/daniyal/Desktop/django/tests/cache/tests.py", line 1238, in test_createcachetable_observes_database_router
    management.call_command('createcachetable', database='other', verbosity=0)
  File "/home/daniyal/Desktop/django/django/test/testcases.py", line 86, in __exit__
    self.test_case.assertEqual(
AssertionError: 1 != 5 : 1 queries executed, 5 expected
Captured queries were:
1. 
            SELECT c.relname,
            CASE WHEN c.relispartition THEN 'p' WHEN c.relkind IN ('m', 'v') THEN 'v' ELSE 't' END
            FROM pg_catalog.pg_class c
            LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
            WHERE c.relkind IN ('f', 'm', 'p', 'r', 'v')
                AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
                AND pg_catalog.pg_table_is_visible(c.oid)
        

----------------------------------------------------------------------

I did not completely understand the reason for this. My test settings were

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'mydb_default',
        'USER': 'myuser',
        'PASSWORD': 'password',
        'HOST': 'localhost',
        'PORT': '5432',
    },
    'other': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'mydb_other',
        'USER': 'myuser',
        'PASSWORD': 'password',
        'HOST': 'localhost',
        'PORT': '5432',
    }
}

CACHES = {
    "default": {
        "BACKEND": "django.core.cache.backends.db.DatabaseCache",
        "LOCATION": "my_cache_table",
    },
}

Tried and tested with SQLite as well, and got the same results. Error with SQLite

======================================================================
FAIL: test_createcachetable_observes_database_router (cache.tests.CreateCacheTableForDBCacheTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/daniyal/Desktop/django/django/test/utils.py", line 430, in inner
    return func(*args, **kwargs)
  File "/home/daniyal/Desktop/django/tests/cache/tests.py", line 1238, in test_createcachetable_observes_database_router
    management.call_command('createcachetable', database='other', verbosity=0)
  File "/home/daniyal/Desktop/django/django/test/testcases.py", line 86, in __exit__
    self.test_case.assertEqual(
AssertionError: 1 != 5 : 1 queries executed, 5 expected
Captured queries were:
1. 
            SELECT name, type FROM sqlite_master
            WHERE type in ('table', 'view') AND NOT name='sqlite_sequence'
            ORDER BY name

----------------------------------------------------------------------

However, when I comment out this line, which call createcachetable, the test passes. https://github.com/django/django/blob/d270dd584e0af12fe6229fb712d0704c232dc7e5/django/db/backends/base/creation.py#L92

@carltongibson I was able to figure this one out. I was following the documentation to setup the DatabaseCache.

CACHES = {
    "default": {
        "BACKEND": "django.core.cache.backends.db.DatabaseCache",
        "LOCATION": "my_cache_table",
    },
}

However, I believe my_cache_table was conflicting with this https://github.com/django/django/blob/225d96533a8e05debd402a2bfe566487cc27d95f/tests/cache/tests.py#L1213-L1220

Setting the "LOCATION" to some other table name leads to the test passing.

Maybe we could mention it in the docs somewhere or update the test to check if duplicate table names exists? This is a little off-topic from this PR. Should I create a separate ticket for this? Or should we let it be for now?

abbasidaniyal

comment created time in 12 hours

issue commentwillmcgugan/textual

Scrolling and hitting Q at the same time in textual.app hung the script entirely

I recorded it with QuickTime Player, but the screen overlays are https://github.com/keycastr/keycastr (just found it today)

simonw

comment created time in 12 hours

issue commentwillmcgugan/textual

Scrolling and hitting Q at the same time in textual.app hung the script entirely

Thanks for doing the investigation! It seems to occur when there are lots of queued messages, but frustratingly there are no exceptions logged.

One of the pain points of this is that I can't just let exceptions propagate, because it can leave the terminal in an unusable stage.

BTW what screen capture app do you use? I like the key press overlays.

simonw

comment created time in 14 hours

issue commentwillmcgugan/textual

Scrolling and hitting Q at the same time in textual.app hung the script entirely

Here's the richtui.log from one of my successful attempts to get this to happen. Note that the clock keeps on ticking, but everything else is unresponsive. https://gist.github.com/simonw/49f10e10ec0f2fc6261a48d8a4ff68d4

simonw

comment created time in 14 hours

issue commentwillmcgugan/textual

Scrolling and hitting Q at the same time in textual.app hung the script entirely

(This is very much a stress-test-induced bug, but I thought you may find it interesting)

simonw

comment created time in 15 hours

issue openedwillmcgugan/textual

Scrolling and hitting Q at the same time in textual.app hung the script entirely

See attached video - if I hit Q while scrolling up and down with the trackpad I've occasionally managed to cause the terminal app to hang - such that it no longer responds to keyboard commands or scrolling, plus hitting Ctrl+C or even Ctrl+Z fails to exit it.

I recorded a video here with software that shows the keys I'm pressing:

https://user-images.githubusercontent.com/9599/122653493-bfe7b680-d0f9-11eb-9b71-c76fe32d10a8.mov

created time in 15 hours

issue closedwillmcgugan/textual

DivideByZero error in the `python -m textual.app` demo

While playing with the demo I tried scrolling up and down and then I think I hit "B" and got this crash (not sure what the pure steps to reproduce are I'm afraid):

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Traceback (most recent call last) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ /Users/simon/.local/share/virtualenvs/t-nAAsrU6W/lib/python3.8/site-packages/textual/app.py:93   โ”‚
โ”‚ in process_messages                                                                              โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    90 โ”‚                                                                                          โ”‚
โ”‚    91 โ”‚   async def process_messages(self) -> None:                                              โ”‚
โ”‚    92 โ”‚   โ”‚   try:                                                                               โ”‚
โ”‚ โฑ  93 โ”‚   โ”‚   โ”‚   await self._process_messages()                                                 โ”‚
โ”‚    94 โ”‚   โ”‚   except Exception:                                                                  โ”‚
โ”‚    95 โ”‚   โ”‚   โ”‚   self.console.print_exception(show_locals=True)                                 โ”‚
โ”‚    96                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ                                                   โ”‚
โ”‚ โ”‚ self = MyApp(title='Megasoma Application') โ”‚                                                   โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ                                                   โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /Users/simon/.local/share/virtualenvs/t-nAAsrU6W/lib/python3.8/site-packages/textual/app.py:116  โ”‚
โ”‚ in _process_messages                                                                             โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   113 โ”‚   โ”‚   โ”‚   log.exception("error starting application mode")                               โ”‚
โ”‚   114 โ”‚   โ”‚   โ”‚   raise                                                                          โ”‚
โ”‚   115 โ”‚   โ”‚   try:                                                                               โ”‚
โ”‚ โฑ 116 โ”‚   โ”‚   โ”‚   await super().process_messages()                                               โ”‚
โ”‚   117 โ”‚   โ”‚   finally:                                                                           โ”‚
โ”‚   118 โ”‚   โ”‚   โ”‚   try:                                                                           โ”‚
โ”‚   119 โ”‚   โ”‚   โ”‚   โ”‚   if self.children:                                                          โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ               โ”‚
โ”‚ โ”‚ __class__ = <class '__main__.App'>                                             โ”‚               โ”‚
โ”‚ โ”‚ close_all = <function App._process_messages.<locals>.close_all at 0x106df0430> โ”‚               โ”‚
โ”‚ โ”‚    driver = <textual._linux_driver.LinuxDriver object at 0x106897cd0>          โ”‚               โ”‚
โ”‚ โ”‚      loop = <_UnixSelectorEventLoop running=True closed=False debug=False>     โ”‚               โ”‚
โ”‚ โ”‚      self = MyApp(title='Megasoma Application')                                โ”‚               โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ               โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /Users/simon/.local/share/virtualenvs/t-nAAsrU6W/lib/python3.8/site-packages/textual/message_pum โ”‚
โ”‚ p.py:172 in process_messages                                                                     โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   169 โ”‚   โ”‚   โ”‚   โ”‚   priority, message = await self.get_message()                               โ”‚
โ”‚   170 โ”‚   โ”‚   โ”‚                                                                                  โ”‚
โ”‚   171 โ”‚   โ”‚   โ”‚   try:                                                                           โ”‚
โ”‚ โฑ 172 โ”‚   โ”‚   โ”‚   โ”‚   await self.dispatch_message(message, priority)                             โ”‚
โ”‚   173 โ”‚   โ”‚   โ”‚   except Exception as error:                                                     โ”‚
โ”‚   174 โ”‚   โ”‚   โ”‚   โ”‚   raise                                                                      โ”‚
โ”‚   175                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ             โ”‚
โ”‚ โ”‚ idle_handler = <bound method App.on_idle of MyApp(title='Megasoma Application')> โ”‚             โ”‚
โ”‚ โ”‚      message = Key(key='x')                                                      โ”‚             โ”‚
โ”‚ โ”‚      pending = None                                                              โ”‚             โ”‚
โ”‚ โ”‚     priority = 0                                                                 โ”‚             โ”‚
โ”‚ โ”‚         self = MyApp(title='Megasoma Application')                               โ”‚             โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ             โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /Users/simon/.local/share/virtualenvs/t-nAAsrU6W/lib/python3.8/site-packages/textual/message_pum โ”‚
โ”‚ p.py:186 in dispatch_message                                                                     โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   183 โ”‚   โ”‚   self, message: Message, priority: int = 0                                          โ”‚
โ”‚   184 โ”‚   ) -> bool | None:                                                                      โ”‚
โ”‚   185 โ”‚   โ”‚   if isinstance(message, events.Event):                                              โ”‚
โ”‚ โฑ 186 โ”‚   โ”‚   โ”‚   await self.on_event(message, priority)                                         โ”‚
โ”‚   187 โ”‚   โ”‚   else:                                                                              โ”‚
โ”‚   188 โ”‚   โ”‚   โ”‚   return await self.on_message(message)                                          โ”‚
โ”‚   189 โ”‚   โ”‚   return False                                                                       โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ                                               โ”‚
โ”‚ โ”‚  message = Key(key='x')                        โ”‚                                               โ”‚
โ”‚ โ”‚ priority = 0                                   โ”‚                                               โ”‚
โ”‚ โ”‚     self = MyApp(title='Megasoma Application') โ”‚                                               โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ                                               โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /Users/simon/.local/share/virtualenvs/t-nAAsrU6W/lib/python3.8/site-packages/textual/app.py:157  โ”‚
โ”‚ in on_event                                                                                      โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   154 โ”‚   โ”‚   if isinstance(event, events.Key):                                                  โ”‚
โ”‚   155 โ”‚   โ”‚   โ”‚   key_action = self.KEYS.get(event.key, None)                                    โ”‚
โ”‚   156 โ”‚   โ”‚   โ”‚   if key_action is not None:                                                     โ”‚
โ”‚ โฑ 157 โ”‚   โ”‚   โ”‚   โ”‚   await self.action(key_action)                                              โ”‚
โ”‚   158 โ”‚   โ”‚   โ”‚   โ”‚   return                                                                     โ”‚
โ”‚   159 โ”‚   โ”‚                                                                                      โ”‚
โ”‚   160 โ”‚   โ”‚   if isinstance(event, events.InputEvent):                                           โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ                                             โ”‚
โ”‚ โ”‚  __class__ = <class '__main__.App'>              โ”‚                                             โ”‚
โ”‚ โ”‚      event = Key(key='x')                        โ”‚                                             โ”‚
โ”‚ โ”‚ key_action = 'bang'                              โ”‚                                             โ”‚
โ”‚ โ”‚   priority = 0                                   โ”‚                                             โ”‚
โ”‚ โ”‚       self = MyApp(title='Megasoma Application') โ”‚                                             โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ                                             โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /Users/simon/.local/share/virtualenvs/t-nAAsrU6W/lib/python3.8/site-packages/textual/app.py:183  โ”‚
โ”‚ in action                                                                                        โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   180 โ”‚   โ”‚   โ”‚   action_name = action                                                           โ”‚
โ”‚   181 โ”‚   โ”‚                                                                                      โ”‚
โ”‚   182 โ”‚   โ”‚   log.debug("ACTION %r %r", destination, action_name)                                โ”‚
โ”‚ โฑ 183 โ”‚   โ”‚   await self.dispatch_action(destination, action_name, params)                       โ”‚
โ”‚   184 โ”‚                                                                                          โ”‚
โ”‚   185 โ”‚   async def dispatch_action(                                                             โ”‚
โ”‚   186 โ”‚   โ”‚   self, destination: str, action_name: str, params: Any                              โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ                                            โ”‚
โ”‚ โ”‚      action = 'bang'                              โ”‚                                            โ”‚
โ”‚ โ”‚ action_name = 'bang'                              โ”‚                                            โ”‚
โ”‚ โ”‚ destination = 'app'                               โ”‚                                            โ”‚
โ”‚ โ”‚      params = ()                                  โ”‚                                            โ”‚
โ”‚ โ”‚        self = MyApp(title='Megasoma Application') โ”‚                                            โ”‚
โ”‚ โ”‚      target = 'bang'                              โ”‚                                            โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /Users/simon/.local/share/virtualenvs/t-nAAsrU6W/lib/python3.8/site-packages/textual/app.py:193  โ”‚
โ”‚ in dispatch_action                                                                               โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   190 โ”‚   โ”‚   โ”‚   method_name = f"action_{action_name}"                                          โ”‚
โ”‚   191 โ”‚   โ”‚   โ”‚   method = getattr(action_target, method_name, None)                             โ”‚
โ”‚   192 โ”‚   โ”‚   โ”‚   if method is not None:                                                         โ”‚
โ”‚ โฑ 193 โ”‚   โ”‚   โ”‚   โ”‚   await method(*params)                                                      โ”‚
โ”‚   194 โ”‚                                                                                          โ”‚
โ”‚   195 โ”‚   async def on_shutdown_request(self, event: events.ShutdownRequest) -> None:            โ”‚
โ”‚   196 โ”‚   โ”‚   log.debug("shutdown request")                                                      โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ        โ”‚
โ”‚ โ”‚   action_name = 'bang'                                                                โ”‚        โ”‚
โ”‚ โ”‚ action_target = MyApp(title='Megasoma Application')                                   โ”‚        โ”‚
โ”‚ โ”‚   destination = 'app'                                                                 โ”‚        โ”‚
โ”‚ โ”‚        method = <bound method App.action_bang of MyApp(title='Megasoma Application')> โ”‚        โ”‚
โ”‚ โ”‚   method_name = 'action_bang'                                                         โ”‚        โ”‚
โ”‚ โ”‚        params = ()                                                                    โ”‚        โ”‚
โ”‚ โ”‚          self = MyApp(title='Megasoma Application')                                   โ”‚        โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ        โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /Users/simon/.local/share/virtualenvs/t-nAAsrU6W/lib/python3.8/site-packages/textual/app.py:221  โ”‚
โ”‚ in action_bang                                                                                   โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   218 โ”‚   โ”‚   await self.close_messages()                                                        โ”‚
โ”‚   219 โ”‚                                                                                          โ”‚
โ”‚   220 โ”‚   async def action_bang(self) -> None:                                                   โ”‚
โ”‚ โฑ 221 โ”‚   โ”‚   1 / 0                                                                              โ”‚
โ”‚   222                                                                                            โ”‚
โ”‚   223                                                                                            โ”‚
โ”‚   224 if __name__ == "__main__":                                                                 โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ                                                   โ”‚
โ”‚ โ”‚ self = MyApp(title='Megasoma Application') โ”‚                                                   โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ                                                   โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
ZeroDivisionError: division by zero

closed time in 15 hours

simonw

issue commentwillmcgugan/textual

DivideByZero error in the `python -m textual.app` demo

Aha! Yes I must have hit X - just tried that now and it had the same result.

simonw

comment created time in 15 hours

issue commentwillmcgugan/textual

DivideByZero error in the `python -m textual.app` demo

I think that one is intentional. :-) Could you have hit X ? It's a test to see if it exits application mode when there is an exception in an event.

There is also a genuine zero division error when the scrollbar gets too compressed. It's on my list...

simonw

comment created time in 15 hours

issue openedwillmcgugan/textual

DivideByZero error in the `python -m textual.app` demo

While playing with the demo I tried scrolling up and down and then I think I hit "B" and got this crash (not sure what the pure steps to reproduce are I'm afraid):

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Traceback (most recent call last) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ /Users/simon/.local/share/virtualenvs/t-nAAsrU6W/lib/python3.8/site-packages/textual/app.py:93   โ”‚
โ”‚ in process_messages                                                                              โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    90 โ”‚                                                                                          โ”‚
โ”‚    91 โ”‚   async def process_messages(self) -> None:                                              โ”‚
โ”‚    92 โ”‚   โ”‚   try:                                                                               โ”‚
โ”‚ โฑ  93 โ”‚   โ”‚   โ”‚   await self._process_messages()                                                 โ”‚
โ”‚    94 โ”‚   โ”‚   except Exception:                                                                  โ”‚
โ”‚    95 โ”‚   โ”‚   โ”‚   self.console.print_exception(show_locals=True)                                 โ”‚
โ”‚    96                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ                                                   โ”‚
โ”‚ โ”‚ self = MyApp(title='Megasoma Application') โ”‚                                                   โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ                                                   โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /Users/simon/.local/share/virtualenvs/t-nAAsrU6W/lib/python3.8/site-packages/textual/app.py:116  โ”‚
โ”‚ in _process_messages                                                                             โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   113 โ”‚   โ”‚   โ”‚   log.exception("error starting application mode")                               โ”‚
โ”‚   114 โ”‚   โ”‚   โ”‚   raise                                                                          โ”‚
โ”‚   115 โ”‚   โ”‚   try:                                                                               โ”‚
โ”‚ โฑ 116 โ”‚   โ”‚   โ”‚   await super().process_messages()                                               โ”‚
โ”‚   117 โ”‚   โ”‚   finally:                                                                           โ”‚
โ”‚   118 โ”‚   โ”‚   โ”‚   try:                                                                           โ”‚
โ”‚   119 โ”‚   โ”‚   โ”‚   โ”‚   if self.children:                                                          โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ               โ”‚
โ”‚ โ”‚ __class__ = <class '__main__.App'>                                             โ”‚               โ”‚
โ”‚ โ”‚ close_all = <function App._process_messages.<locals>.close_all at 0x106df0430> โ”‚               โ”‚
โ”‚ โ”‚    driver = <textual._linux_driver.LinuxDriver object at 0x106897cd0>          โ”‚               โ”‚
โ”‚ โ”‚      loop = <_UnixSelectorEventLoop running=True closed=False debug=False>     โ”‚               โ”‚
โ”‚ โ”‚      self = MyApp(title='Megasoma Application')                                โ”‚               โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ               โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /Users/simon/.local/share/virtualenvs/t-nAAsrU6W/lib/python3.8/site-packages/textual/message_pum โ”‚
โ”‚ p.py:172 in process_messages                                                                     โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   169 โ”‚   โ”‚   โ”‚   โ”‚   priority, message = await self.get_message()                               โ”‚
โ”‚   170 โ”‚   โ”‚   โ”‚                                                                                  โ”‚
โ”‚   171 โ”‚   โ”‚   โ”‚   try:                                                                           โ”‚
โ”‚ โฑ 172 โ”‚   โ”‚   โ”‚   โ”‚   await self.dispatch_message(message, priority)                             โ”‚
โ”‚   173 โ”‚   โ”‚   โ”‚   except Exception as error:                                                     โ”‚
โ”‚   174 โ”‚   โ”‚   โ”‚   โ”‚   raise                                                                      โ”‚
โ”‚   175                                                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ             โ”‚
โ”‚ โ”‚ idle_handler = <bound method App.on_idle of MyApp(title='Megasoma Application')> โ”‚             โ”‚
โ”‚ โ”‚      message = Key(key='x')                                                      โ”‚             โ”‚
โ”‚ โ”‚      pending = None                                                              โ”‚             โ”‚
โ”‚ โ”‚     priority = 0                                                                 โ”‚             โ”‚
โ”‚ โ”‚         self = MyApp(title='Megasoma Application')                               โ”‚             โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ             โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /Users/simon/.local/share/virtualenvs/t-nAAsrU6W/lib/python3.8/site-packages/textual/message_pum โ”‚
โ”‚ p.py:186 in dispatch_message                                                                     โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   183 โ”‚   โ”‚   self, message: Message, priority: int = 0                                          โ”‚
โ”‚   184 โ”‚   ) -> bool | None:                                                                      โ”‚
โ”‚   185 โ”‚   โ”‚   if isinstance(message, events.Event):                                              โ”‚
โ”‚ โฑ 186 โ”‚   โ”‚   โ”‚   await self.on_event(message, priority)                                         โ”‚
โ”‚   187 โ”‚   โ”‚   else:                                                                              โ”‚
โ”‚   188 โ”‚   โ”‚   โ”‚   return await self.on_message(message)                                          โ”‚
โ”‚   189 โ”‚   โ”‚   return False                                                                       โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ                                               โ”‚
โ”‚ โ”‚  message = Key(key='x')                        โ”‚                                               โ”‚
โ”‚ โ”‚ priority = 0                                   โ”‚                                               โ”‚
โ”‚ โ”‚     self = MyApp(title='Megasoma Application') โ”‚                                               โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ                                               โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /Users/simon/.local/share/virtualenvs/t-nAAsrU6W/lib/python3.8/site-packages/textual/app.py:157  โ”‚
โ”‚ in on_event                                                                                      โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   154 โ”‚   โ”‚   if isinstance(event, events.Key):                                                  โ”‚
โ”‚   155 โ”‚   โ”‚   โ”‚   key_action = self.KEYS.get(event.key, None)                                    โ”‚
โ”‚   156 โ”‚   โ”‚   โ”‚   if key_action is not None:                                                     โ”‚
โ”‚ โฑ 157 โ”‚   โ”‚   โ”‚   โ”‚   await self.action(key_action)                                              โ”‚
โ”‚   158 โ”‚   โ”‚   โ”‚   โ”‚   return                                                                     โ”‚
โ”‚   159 โ”‚   โ”‚                                                                                      โ”‚
โ”‚   160 โ”‚   โ”‚   if isinstance(event, events.InputEvent):                                           โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ                                             โ”‚
โ”‚ โ”‚  __class__ = <class '__main__.App'>              โ”‚                                             โ”‚
โ”‚ โ”‚      event = Key(key='x')                        โ”‚                                             โ”‚
โ”‚ โ”‚ key_action = 'bang'                              โ”‚                                             โ”‚
โ”‚ โ”‚   priority = 0                                   โ”‚                                             โ”‚
โ”‚ โ”‚       self = MyApp(title='Megasoma Application') โ”‚                                             โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ                                             โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /Users/simon/.local/share/virtualenvs/t-nAAsrU6W/lib/python3.8/site-packages/textual/app.py:183  โ”‚
โ”‚ in action                                                                                        โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   180 โ”‚   โ”‚   โ”‚   action_name = action                                                           โ”‚
โ”‚   181 โ”‚   โ”‚                                                                                      โ”‚
โ”‚   182 โ”‚   โ”‚   log.debug("ACTION %r %r", destination, action_name)                                โ”‚
โ”‚ โฑ 183 โ”‚   โ”‚   await self.dispatch_action(destination, action_name, params)                       โ”‚
โ”‚   184 โ”‚                                                                                          โ”‚
โ”‚   185 โ”‚   async def dispatch_action(                                                             โ”‚
โ”‚   186 โ”‚   โ”‚   self, destination: str, action_name: str, params: Any                              โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ                                            โ”‚
โ”‚ โ”‚      action = 'bang'                              โ”‚                                            โ”‚
โ”‚ โ”‚ action_name = 'bang'                              โ”‚                                            โ”‚
โ”‚ โ”‚ destination = 'app'                               โ”‚                                            โ”‚
โ”‚ โ”‚      params = ()                                  โ”‚                                            โ”‚
โ”‚ โ”‚        self = MyApp(title='Megasoma Application') โ”‚                                            โ”‚
โ”‚ โ”‚      target = 'bang'                              โ”‚                                            โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /Users/simon/.local/share/virtualenvs/t-nAAsrU6W/lib/python3.8/site-packages/textual/app.py:193  โ”‚
โ”‚ in dispatch_action                                                                               โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   190 โ”‚   โ”‚   โ”‚   method_name = f"action_{action_name}"                                          โ”‚
โ”‚   191 โ”‚   โ”‚   โ”‚   method = getattr(action_target, method_name, None)                             โ”‚
โ”‚   192 โ”‚   โ”‚   โ”‚   if method is not None:                                                         โ”‚
โ”‚ โฑ 193 โ”‚   โ”‚   โ”‚   โ”‚   await method(*params)                                                      โ”‚
โ”‚   194 โ”‚                                                                                          โ”‚
โ”‚   195 โ”‚   async def on_shutdown_request(self, event: events.ShutdownRequest) -> None:            โ”‚
โ”‚   196 โ”‚   โ”‚   log.debug("shutdown request")                                                      โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ        โ”‚
โ”‚ โ”‚   action_name = 'bang'                                                                โ”‚        โ”‚
โ”‚ โ”‚ action_target = MyApp(title='Megasoma Application')                                   โ”‚        โ”‚
โ”‚ โ”‚   destination = 'app'                                                                 โ”‚        โ”‚
โ”‚ โ”‚        method = <bound method App.action_bang of MyApp(title='Megasoma Application')> โ”‚        โ”‚
โ”‚ โ”‚   method_name = 'action_bang'                                                         โ”‚        โ”‚
โ”‚ โ”‚        params = ()                                                                    โ”‚        โ”‚
โ”‚ โ”‚          self = MyApp(title='Megasoma Application')                                   โ”‚        โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ        โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /Users/simon/.local/share/virtualenvs/t-nAAsrU6W/lib/python3.8/site-packages/textual/app.py:221  โ”‚
โ”‚ in action_bang                                                                                   โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   218 โ”‚   โ”‚   await self.close_messages()                                                        โ”‚
โ”‚   219 โ”‚                                                                                          โ”‚
โ”‚   220 โ”‚   async def action_bang(self) -> None:                                                   โ”‚
โ”‚ โฑ 221 โ”‚   โ”‚   1 / 0                                                                              โ”‚
โ”‚   222                                                                                            โ”‚
โ”‚   223                                                                                            โ”‚
โ”‚   224 if __name__ == "__main__":                                                                 โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ locals โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ                                                   โ”‚
โ”‚ โ”‚ self = MyApp(title='Megasoma Application') โ”‚                                                   โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ                                                   โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
ZeroDivisionError: division by zero

created time in 15 hours

push eventwillmcgugan/textual

Will McGugan

commit sha ab14b766d3b6b5b786090bea6b6a158ff92fc10c

add footer

view details

push time in 17 hours

pull request commentdjango/django

Remove unnecessary call to `type` function

Hello @abresas! Thank you for your contribution ๐Ÿ’ช

As it's your first contribution be sure to check out the patch review checklist.

If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!

If you have any design or process questions then you can ask in the Django forum.

Welcome aboard โ›ต๏ธ!

abresas

comment created time in 18 hours

PR opened django/django

protect against mutual edit of object in admin

PR https://code.djangoproject.com/ticket/32867

+19 -5

0 comment

3 changed files

pr created time in 18 hours

PR opened django/django

Remove unnecessary call to `type` function

The function output is ignored and type function has no side effects, so it should be safe to be removed.

+1 -2

0 comment

1 changed file

pr created time in 18 hours

issue commentwillmcgugan/textual

esda

Who are you?

19 Haz 2021 Cmt 15:43 tarihinde Will McGugan ***@***.***> ลŸunu yazdฤฑ:

Yep

โ€” You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/willmcgugan/textual/issues/11#issuecomment-864408173, or unsubscribe https://github.com/notifications/unsubscribe-auth/AURBUE7XRIPPQ5OSAEQFFFDTTSNHHANCNFSM466LTORQ .

mayatocg

comment created time in 21 hours

issue commentwillmcgugan/textual

esda

Yep

mayatocg

comment created time in 21 hours

issue closedwillmcgugan/textual

esda

#include<stdio.h> #include<stdlib.h> #include<string.h>

struct disciplina{ char nome[20]; };

struct Estudante{ char nome[20]; char apelido[20]; }; struct pautaNo{ disciplina d; int ano; double nota; Estudante est; pautaNo* proximo; };

pautaNo * ps=(pautaNo*)malloc(sizeof(pautaNo)*5);

int tamanho=0;

void colocarProduto(pautaNo p){ ps[tamanho]=p; tamanho=tamanho+1; }

void listar(){ for(int i=0; i<tamanho; i++){ printf("Dados do estudante:\n"); printf("Nome: %s \n",ps[i].est.nome); printf("Apelido: %s \n",ps[i].d.nome); printf("Disciplina: %s \n",ps[i].est.nome);

	printf("Ano: %f \n",ps[i].ano);
	printf("Nota: %f \n",ps[i].nota); 
	
	printf("\n");
}

} void pesquisar(char n[]){ for(int i=0; i<tamanho; i++){ if(ps[i].est.nome==n){ printf("Encontrado o nome: %s \n",ps[i].est.nome); }

}

}

void organizar(){

printf("\n lista organiza da ");
for(int i=0; i<tamanho; i++){
	
	for(int j=0; j<tamanho; j++){
		
	 if(ps[j].nota>ps[j+1].nota){
	 	pautaNo temp=ps[j+1];
	 	ps[j+1]=ps[j];
	 	ps[j]=temp;
	 }
} 
}

}

int main(){

disciplina d;
strcpy(d.nome,"ESDA");

Estudante e1;
strcpy(e1.nome,"Dias");
strcpy(e1.apelido,"Mayato");
pautaNo p1;
p1.ano=2021;
p1.nota=15;
p1.est=e1;
p1.d=d;


Estudante e2;
strcpy(e2.nome,"Dias 2");
strcpy(e2.apelido,"Mayato 1");
pautaNo p2;
p2.ano=2021;
p2.nota=15;
p2.est=e2;
p2.d=d;

Estudante e3;
strcpy(e3.nome,"Mudengue");
strcpy(e3.apelido,"Mayatoo");
pautaNo p3;
p3.ano=2021;
p3.nota=13;
p3.est=e3;
p3.d=d;

Estudante e4;
strcpy(e4.nome,"Mudengue 2");
strcpy(e4.apelido,"Mayato 1");
pautaNo p4;
p4.ano=2021;
p4.nota=10;
p4.est=e4;
p4.d=d;


colocarProduto(p1);
colocarProduto(p2);
colocarProduto(p3);
colocarProduto(p4);

listar();
pesquisar("Dias");
organizar();
listar();

return 0;

}

closed time in 21 hours

mayatocg

issue commentwillmcgugan/textual

esda

I believe this issue was created in error.

mayatocg

comment created time in 21 hours