Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should TimezoneComponent.prettyPrint() have default arguments? #67

Open
da4089 opened this issue Oct 8, 2024 · 1 comment
Open

Should TimezoneComponent.prettyPrint() have default arguments? #67

da4089 opened this issue Oct 8, 2024 · 1 comment
Labels
bug Something isn't working debian Imported from Debian package bugs

Comments

@da4089
Copy link

da4089 commented Oct 8, 2024

Import from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=849882

Should the TimezoneComponent.prettyPrint() function use the same default
values as the equivalent function in other classes? I discovered that
The method in TimezoneComponent have this prototype:

def prettyPrint(self, level, tabwidth):

While the base class Component have this prototype:

def prettyPrint(self, level = 0, tabwidth=3):

This made my code fail with this message:

<VTIMEZONE | <TZID{}Europe/Stockholm>>
Traceback (most recent call last):
  File "/home/pere/bin/ical-split", line 119, in <module>
    print c.prettyPrint()
TypeError: prettyPrint() takes exactly 3 arguments (1 given)

This code demonstrates the problem:

import vobject
icalstream = open(file)
components = vobject.readComponents(icalstream, validate=True)
cal = components.next()
for c in cal.getChildren():
    print c.prettyPrint()
@da4089 da4089 added bug Something isn't working debian Imported from Debian package bugs labels Oct 8, 2024
@rsb-23
Copy link

rsb-23 commented Oct 12, 2024

This is a method signature mismatch issue, and it can be fixed/avoided by using linters.
There can be other methods with this issue and similar issues.
So, I think all can be addressed when linters are added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working debian Imported from Debian package bugs
Projects
None yet
Development

No branches or pull requests

2 participants