Skip to content

Validate functions#15

Merged
shaharyarn merged 4 commits intomasterfrom
validate_functions
Apr 2, 2020
Merged

Validate functions#15
shaharyarn merged 4 commits intomasterfrom
validate_functions

Conversation

@shaharyarn
Copy link
Copy Markdown
Collaborator

No description provided.

marine/marine.py Outdated

def validate_bpf(self, bpf: str) -> bool:
bpf = bpf.encode("utf-8")
if self._marine.validate_bpf(bpf) < 0:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

< or !=? What's more likely to remain correct?
(Not rehtorical, actually asking)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doesn't it return a boolean? I see no applications for error codes here.

marine/marine.py Outdated

def validate_bpf(self, bpf: str) -> bool:
bpf = bpf.encode("utf-8")
if self._marine.validate_bpf(bpf) < 0:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of:

if cond:
    return False
return True

use:

return not cond

marine/marine.py Outdated

def validate_bpf(self, bpf: str) -> bool:
bpf = bpf.encode("utf-8")
if self._marine.validate_bpf(bpf) < 0:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doesn't it return a boolean? I see no applications for error codes here.

Copy link
Copy Markdown
Owner

@tomlegkov tomlegkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't merge until the C part is done :)

@shaharyarn shaharyarn merged commit e635cd8 into master Apr 2, 2020
@shaharyarn shaharyarn deleted the validate_functions branch April 2, 2020 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants