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

Can't pass ExpandType to StyleConfigMap.insert #10

Open
mwildehahn opened this issue Feb 23, 2025 · 0 comments
Open

Can't pass ExpandType to StyleConfigMap.insert #10

mwildehahn opened this issue Feb 23, 2025 · 0 comments

Comments

@mwildehahn
Copy link
Contributor

Trying to do something like:

rich_text_config = StyleConfigMap.default_rich_text_config()
rich_text_config.insert("mention", ExpandType.Null())
doc.config_text_style(rich_text_config)

results in TypeError: 'builtins.ExpandType' object is not callable.

it looks like this is because these are defined:

#[pyclass(eq, eq_int)]
#[derive(Clone, Copy, Eq, PartialEq, Debug, Hash)]
pub enum ExpandType {
    Before,
    After,
    Both,
    Null,
}

as singleton instances so you need to pass:

rich_text_config = StyleConfigMap.default_rich_text_config()
rich_text_config.insert("mention", ExpandType.Null)
doc.config_text_style(rich_text_config)

but that currently returns a type error:

Argument of type "type[Null]" cannot be assigned to parameter "value" of type "ExpandType" in function "insert"
  "type[type]" is incompatible with "type[ExpandType]"
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

No branches or pull requests

1 participant