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

Load task definition inclusion #24

Merged
merged 7 commits into from
Jul 2, 2024
Merged

Conversation

yoavkt
Copy link
Collaborator

@yoavkt yoavkt commented Jun 30, 2024

In this PR we added the ability to include a list of symbols for the tasks.

Copy link
Collaborator

@edenjenzohar edenjenzohar left a comment

Choose a reason for hiding this comment

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

One small comment

entities, outcomes = filter_exclusion(entities, outcomes, exclude_symbols)
if not include_symbols is None:
entities, outcomes = filter_inclusion(entities, outcomes, include_symbols)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This very hard to understand with the double negative logic. lets do:

if exclude_symbols: 
if include_symbols:

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The issue that include_symbols could be a series:

import pandas as pd
a = None 
b = [1,2,3]
c = pd.Series(b)
if a:
    print("None is False")
if b:
    print("b is a list ")
if c:
    print("series is error ")

will yield

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/var/folders/xb/f1xjztvd437bvj2g25bkbq3h0000gn/T/ipykernel_19828/782548513.py in ?()
      5 if a:
      6     print("None is False")
      7 if b:
      8     print("b is a list ")
----> 9 if c:
     10     print("series is error ")

/opt/miniconda3/envs/bmfm/lib/python3.10/site-packages/pandas/core/generic.py in ?(self)
   1574     @final
   1575     def __nonzero__(self) -> NoReturn:
-> 1576         raise ValueError(
   1577             f"The truth value of a {type(self).__name__} is ambiguous. "
   1578             "Use a.empty, a.bool(), a.item(), a.any() or a.all()."
   1579         )

ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

We can check it with is instance do you think it will be better?

Something like

from collections.abc import Iterable
if isinstance(the_element, Iterable):

@yoavkt yoavkt merged commit a96f8e8 into main Jul 2, 2024
6 checks passed
@yoavkt yoavkt deleted the load_task_definition_inclusion branch July 2, 2024 12:04
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.

2 participants