implica 0.3.2__py3-none-any.whl → 0.3.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of implica might be problematic. Click here for more details.

implica/__init__.py CHANGED
@@ -41,4 +41,4 @@ __all__ = [
41
41
  "mutations",
42
42
  ]
43
43
 
44
- __version__ = "0.3.2"
44
+ __version__ = "0.3.3"
implica/core/types.py CHANGED
@@ -10,6 +10,7 @@ This module defines the type hierarchy for the implicational logic graph:
10
10
  import hashlib
11
11
  from abc import ABC, abstractmethod
12
12
  from functools import cached_property
13
+ from typing import List
13
14
 
14
15
  from pydantic import BaseModel, ConfigDict, Field, field_validator
15
16
 
@@ -33,6 +34,20 @@ class BaseType(BaseModel, ABC):
33
34
  """
34
35
  pass
35
36
 
37
+ @property
38
+ @abstractmethod
39
+ def variables(self) -> List["Variable"]:
40
+ """
41
+ Return the list of all variables in this type.
42
+
43
+ This property is computed recursively on each access.
44
+ The list may contain duplicate variables if they appear multiple times.
45
+
46
+ Returns:
47
+ List[Variable]: A list of all Variable instances in this type
48
+ """
49
+ pass
50
+
36
51
  @abstractmethod
37
52
  def __str__(self) -> str:
38
53
  """String representation of the type."""
@@ -62,6 +77,18 @@ class Variable(BaseType):
62
77
  content = f"Var({self.name})"
63
78
  return hashlib.sha256(content.encode("utf-8")).hexdigest()
64
79
 
80
+ @property
81
+ def variables(self) -> List["Variable"]:
82
+ """
83
+ Return the list of variables in this type.
84
+
85
+ For a Variable, this returns a list containing only itself.
86
+
87
+ Returns:
88
+ List[Variable]: A list containing only this variable
89
+ """
90
+ return [self]
91
+
65
92
  def __str__(self) -> str:
66
93
  """Return the variable name."""
67
94
  return self.name
@@ -93,6 +120,19 @@ class Application(BaseType):
93
120
  content = f"App({self.input_type.uid},{self.output_type.uid})"
94
121
  return hashlib.sha256(content.encode("utf-8")).hexdigest()
95
122
 
123
+ @property
124
+ def variables(self) -> List[Variable]:
125
+ """
126
+ Return the list of variables in this type.
127
+
128
+ For an Application, this recursively collects all variables from
129
+ both the input_type and output_type.
130
+
131
+ Returns:
132
+ List[Variable]: A list of all variables in this application type
133
+ """
134
+ return self.input_type.variables + self.output_type.variables
135
+
96
136
  def __str__(self) -> str:
97
137
  """
98
138
  Return a human-readable string representation.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: implica
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: A package for working with graphs representing minimal implicational logic models
5
5
  Author: Carlos Fernandez
6
6
  Author-email: carlos.ferlo@outlook.com
@@ -1,7 +1,7 @@
1
- implica/__init__.py,sha256=hYegXgHbaTtUgy58UKZD8xs_zMOuk6K6dUKcMjRY_JI,886
1
+ implica/__init__.py,sha256=0mZ2GjzddOh36dHFon3fW8RIykgyO5KNwYQ5_9RR-Yc,886
2
2
  implica/core/__init__.py,sha256=opdPtga0OU0d8CEf5DL4Xl4AriBaOHdVW4mbwdD2A0Y,191
3
3
  implica/core/combinator.py,sha256=VOeIj_FRMI7fmuMjjbgRBP-FvExnQ6vOjCD-egt96lI,4324
4
- implica/core/types.py,sha256=c8mNq9oztOqJ2QhSdUdVQYwGMisPF0HHsPkgjalsr54,4073
4
+ implica/core/types.py,sha256=AtzQAY9rJ4lIcjqdVZHLDOO-YXSudez4NOzaw6EPjRc,5230
5
5
  implica/graph/__init__.py,sha256=Lj2bUdPZVgMoIYXF7DeMNuFBl3ftqrkAxhGq-Oj0MoQ,172
6
6
  implica/graph/connection.py,sha256=IpyvA_J_BQqhecxN3XoQ00Io7zjwok5PGz2TKia35ZQ,13746
7
7
  implica/graph/elements.py,sha256=ag5Gdr-5djGnKOEhoEAm3NpWTmw3gnucq1IEv2xxTB4,6015
@@ -24,7 +24,7 @@ implica/mutations/try_remove_edge.py,sha256=2aeg6f6nR49MViyZk15-ys7I5Xt0a2wXycBI
24
24
  implica/mutations/try_remove_many_edges.py,sha256=pgZdqFltMaycNBfdjejYVXQZw3i2K1AJYYcsaKk7n74,1596
25
25
  implica/mutations/try_remove_many_nodes.py,sha256=DK_BtKuEh_7zm5bzryOi1BVfmuCiQ-SVA9yIdgN-imE,1817
26
26
  implica/mutations/try_remove_node.py,sha256=igTEnGUCd0U2_3Rr5SIOSIs4FZmYi2Y6bLk0Ae64Bsg,1837
27
- implica-0.3.2.dist-info/LICENSE,sha256=jDn9mmsCvjx_av9marP7DBqjfmK1gsQmgycgBRC2Eck,1073
28
- implica-0.3.2.dist-info/METADATA,sha256=0KsXUyMePnr8SuabFUbJf2QIT5ofrOJfFjk1FrKOl24,25200
29
- implica-0.3.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
30
- implica-0.3.2.dist-info/RECORD,,
27
+ implica-0.3.3.dist-info/LICENSE,sha256=jDn9mmsCvjx_av9marP7DBqjfmK1gsQmgycgBRC2Eck,1073
28
+ implica-0.3.3.dist-info/METADATA,sha256=d6yVeAJq0yVrKVdMcBxgEu8-SUkcpH0f2GnePDPE4sU,25200
29
+ implica-0.3.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
30
+ implica-0.3.3.dist-info/RECORD,,