IncludeCPP 3.7.26__tar.gz → 3.7.27__tar.gz
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.
- {includecpp-3.7.26 → includecpp-3.7.27}/IncludeCPP.egg-info/PKG-INFO +53 -1
- {includecpp-3.7.26 → includecpp-3.7.27}/PKG-INFO +53 -1
- {includecpp-3.7.26 → includecpp-3.7.27}/README.md +53 -1
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/__init__.py +1 -1
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/cssl/cssl_builtins.py +209 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/vscode/cssl/snippets/cssl.snippets.json +38 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +8 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/pyproject.toml +1 -1
- {includecpp-3.7.26 → includecpp-3.7.27}/IncludeCPP.egg-info/SOURCES.txt +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/IncludeCPP.egg-info/dependency_links.txt +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/IncludeCPP.egg-info/entry_points.txt +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/IncludeCPP.egg-info/requires.txt +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/IncludeCPP.egg-info/top_level.txt +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/LICENSE +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/MANIFEST.in +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/__init__.pyi +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/__main__.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/cli/__init__.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/cli/commands.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/cli/config_parser.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/__init__.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/ai_integration.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/build_manager.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/cpp_api.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/cpp_api.pyi +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/cppy_converter.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/cssl/CSSL_DOCUMENTATION.md +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/cssl/__init__.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/cssl/cssl_builtins.pyi +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/cssl/cssl_events.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/cssl/cssl_modules.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/cssl/cssl_parser.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/cssl/cssl_runtime.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/cssl/cssl_syntax.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/cssl/cssl_types.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/cssl_bridge.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/cssl_bridge.pyi +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/error_catalog.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/error_formatter.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/exceptions.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/path_discovery.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/project_ui.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/core/settings_ui.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/generator/__init__.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/generator/parser.cpp +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/generator/parser.h +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/generator/type_resolver.cpp +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/generator/type_resolver.h +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/py.typed +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/templates/cpp.proj.template +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/vscode/__init__.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/vscode/cssl/__init__.py +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/vscode/cssl/extension.js +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/vscode/cssl/images/cssl.png +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/vscode/cssl/images/cssl_pl.png +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/vscode/cssl/language-configuration.json +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/includecpp/vscode/cssl/package.json +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/requirements.txt +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/setup.cfg +0 -0
- {includecpp-3.7.26 → includecpp-3.7.27}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: IncludeCPP
|
|
3
|
-
Version: 3.7.
|
|
3
|
+
Version: 3.7.27
|
|
4
4
|
Summary: Professional C++ Python bindings with type-generic templates, pystubs and native threading
|
|
5
5
|
Home-page: https://github.com/liliassg/IncludeCPP
|
|
6
6
|
Author: Lilias Hatterscheidt
|
|
@@ -853,3 +853,55 @@ cssl.run('''
|
|
|
853
853
|
printl(@version);
|
|
854
854
|
''')
|
|
855
855
|
```
|
|
856
|
+
|
|
857
|
+
## Return CSSL Classes to Python
|
|
858
|
+
|
|
859
|
+
Use `python::pythonize()` to convert CSSL class instances into Python-usable objects:
|
|
860
|
+
|
|
861
|
+
```python
|
|
862
|
+
from includecpp import CSSL
|
|
863
|
+
|
|
864
|
+
cssl = CSSL.CsslLang()
|
|
865
|
+
|
|
866
|
+
# Create and return a CSSL class as a Python object
|
|
867
|
+
greeter = cssl.run('''
|
|
868
|
+
class Greeter {
|
|
869
|
+
string name;
|
|
870
|
+
|
|
871
|
+
Greeter(string n) {
|
|
872
|
+
this->name = n;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
string sayHello() {
|
|
876
|
+
return "Hello, " + this->name + "!";
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
void setName(string newName) {
|
|
880
|
+
this->name = newName;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
string getName() {
|
|
884
|
+
return this->name;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
instance = new Greeter("World");
|
|
889
|
+
pyclass = python::pythonize(instance);
|
|
890
|
+
parameter.return(pyclass);
|
|
891
|
+
''')
|
|
892
|
+
|
|
893
|
+
# Now use it like a normal Python object!
|
|
894
|
+
print(greeter.name) # "World"
|
|
895
|
+
print(greeter.sayHello()) # "Hello, World!"
|
|
896
|
+
greeter.setName("Python")
|
|
897
|
+
print(greeter.getName()) # "Python"
|
|
898
|
+
print(greeter.name) # "Python"
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
### Aliases
|
|
902
|
+
|
|
903
|
+
- `python::pythonize(instance)` - Main function
|
|
904
|
+
- `python::wrap(instance)` - Alias
|
|
905
|
+
- `python::export(instance)` - Alias
|
|
906
|
+
|
|
907
|
+
All three do the same thing: wrap a CSSL class instance for Python use.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: IncludeCPP
|
|
3
|
-
Version: 3.7.
|
|
3
|
+
Version: 3.7.27
|
|
4
4
|
Summary: Professional C++ Python bindings with type-generic templates, pystubs and native threading
|
|
5
5
|
Home-page: https://github.com/liliassg/IncludeCPP
|
|
6
6
|
Author: Lilias Hatterscheidt
|
|
@@ -853,3 +853,55 @@ cssl.run('''
|
|
|
853
853
|
printl(@version);
|
|
854
854
|
''')
|
|
855
855
|
```
|
|
856
|
+
|
|
857
|
+
## Return CSSL Classes to Python
|
|
858
|
+
|
|
859
|
+
Use `python::pythonize()` to convert CSSL class instances into Python-usable objects:
|
|
860
|
+
|
|
861
|
+
```python
|
|
862
|
+
from includecpp import CSSL
|
|
863
|
+
|
|
864
|
+
cssl = CSSL.CsslLang()
|
|
865
|
+
|
|
866
|
+
# Create and return a CSSL class as a Python object
|
|
867
|
+
greeter = cssl.run('''
|
|
868
|
+
class Greeter {
|
|
869
|
+
string name;
|
|
870
|
+
|
|
871
|
+
Greeter(string n) {
|
|
872
|
+
this->name = n;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
string sayHello() {
|
|
876
|
+
return "Hello, " + this->name + "!";
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
void setName(string newName) {
|
|
880
|
+
this->name = newName;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
string getName() {
|
|
884
|
+
return this->name;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
instance = new Greeter("World");
|
|
889
|
+
pyclass = python::pythonize(instance);
|
|
890
|
+
parameter.return(pyclass);
|
|
891
|
+
''')
|
|
892
|
+
|
|
893
|
+
# Now use it like a normal Python object!
|
|
894
|
+
print(greeter.name) # "World"
|
|
895
|
+
print(greeter.sayHello()) # "Hello, World!"
|
|
896
|
+
greeter.setName("Python")
|
|
897
|
+
print(greeter.getName()) # "Python"
|
|
898
|
+
print(greeter.name) # "Python"
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
### Aliases
|
|
902
|
+
|
|
903
|
+
- `python::pythonize(instance)` - Main function
|
|
904
|
+
- `python::wrap(instance)` - Alias
|
|
905
|
+
- `python::export(instance)` - Alias
|
|
906
|
+
|
|
907
|
+
All three do the same thing: wrap a CSSL class instance for Python use.
|
|
@@ -818,4 +818,56 @@ cssl.run('''
|
|
|
818
818
|
@log("Application started");
|
|
819
819
|
printl(@version);
|
|
820
820
|
''')
|
|
821
|
-
```
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
## Return CSSL Classes to Python
|
|
824
|
+
|
|
825
|
+
Use `python::pythonize()` to convert CSSL class instances into Python-usable objects:
|
|
826
|
+
|
|
827
|
+
```python
|
|
828
|
+
from includecpp import CSSL
|
|
829
|
+
|
|
830
|
+
cssl = CSSL.CsslLang()
|
|
831
|
+
|
|
832
|
+
# Create and return a CSSL class as a Python object
|
|
833
|
+
greeter = cssl.run('''
|
|
834
|
+
class Greeter {
|
|
835
|
+
string name;
|
|
836
|
+
|
|
837
|
+
Greeter(string n) {
|
|
838
|
+
this->name = n;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
string sayHello() {
|
|
842
|
+
return "Hello, " + this->name + "!";
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
void setName(string newName) {
|
|
846
|
+
this->name = newName;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
string getName() {
|
|
850
|
+
return this->name;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
instance = new Greeter("World");
|
|
855
|
+
pyclass = python::pythonize(instance);
|
|
856
|
+
parameter.return(pyclass);
|
|
857
|
+
''')
|
|
858
|
+
|
|
859
|
+
# Now use it like a normal Python object!
|
|
860
|
+
print(greeter.name) # "World"
|
|
861
|
+
print(greeter.sayHello()) # "Hello, World!"
|
|
862
|
+
greeter.setName("Python")
|
|
863
|
+
print(greeter.getName()) # "Python"
|
|
864
|
+
print(greeter.name) # "Python"
|
|
865
|
+
```
|
|
866
|
+
|
|
867
|
+
### Aliases
|
|
868
|
+
|
|
869
|
+
- `python::pythonize(instance)` - Main function
|
|
870
|
+
- `python::wrap(instance)` - Alias
|
|
871
|
+
- `python::export(instance)` - Alias
|
|
872
|
+
|
|
873
|
+
All three do the same thing: wrap a CSSL class instance for Python use.
|
|
@@ -205,6 +205,11 @@ class CSSLBuiltins:
|
|
|
205
205
|
self._functions['isavailable'] = self.builtin_isavailable
|
|
206
206
|
self._functions['instance::exists'] = self.builtin_isavailable # Alias
|
|
207
207
|
|
|
208
|
+
# Python interop functions
|
|
209
|
+
self._functions['python::pythonize'] = self.builtin_python_pythonize
|
|
210
|
+
self._functions['python::wrap'] = self.builtin_python_pythonize # Alias
|
|
211
|
+
self._functions['python::export'] = self.builtin_python_pythonize # Alias
|
|
212
|
+
|
|
208
213
|
# Regex functions
|
|
209
214
|
self._functions['match'] = self.builtin_match
|
|
210
215
|
self._functions['search'] = self.builtin_search
|
|
@@ -2445,6 +2450,210 @@ class CSSLBuiltins:
|
|
|
2445
2450
|
|
|
2446
2451
|
return None
|
|
2447
2452
|
|
|
2453
|
+
# ============= Python Interop Functions =============
|
|
2454
|
+
|
|
2455
|
+
def builtin_python_pythonize(self, cssl_instance: Any) -> Any:
|
|
2456
|
+
"""Convert a CSSL class instance to a Python-usable object.
|
|
2457
|
+
|
|
2458
|
+
This allows CSSL classes to be returned and used in Python code
|
|
2459
|
+
with proper attribute access and method calls.
|
|
2460
|
+
|
|
2461
|
+
Usage in CSSL:
|
|
2462
|
+
class Greeter {
|
|
2463
|
+
string name;
|
|
2464
|
+
|
|
2465
|
+
Greeter(string n) {
|
|
2466
|
+
this->name = n;
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2469
|
+
string sayHello() {
|
|
2470
|
+
return "Hello, " + this->name + "!";
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2473
|
+
void setName(string newName) {
|
|
2474
|
+
this->name = newName;
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
string getName() {
|
|
2478
|
+
return this->name;
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
greeter = new Greeter("World");
|
|
2483
|
+
pyclass = python::pythonize(greeter);
|
|
2484
|
+
parameter.return(pyclass);
|
|
2485
|
+
|
|
2486
|
+
Usage in Python:
|
|
2487
|
+
from includecpp import CSSL
|
|
2488
|
+
|
|
2489
|
+
cssl = CSSL.CsslLang()
|
|
2490
|
+
greeter = cssl.run('''
|
|
2491
|
+
class Greeter { ... }
|
|
2492
|
+
g = new Greeter("World");
|
|
2493
|
+
parameter.return(python::pythonize(g));
|
|
2494
|
+
''')
|
|
2495
|
+
|
|
2496
|
+
# Now use it like a normal Python object:
|
|
2497
|
+
print(greeter.name) # "World"
|
|
2498
|
+
print(greeter.sayHello()) # "Hello, World!"
|
|
2499
|
+
greeter.setName("Python")
|
|
2500
|
+
print(greeter.getName()) # "Python"
|
|
2501
|
+
|
|
2502
|
+
Args:
|
|
2503
|
+
cssl_instance: A CSSLInstance object (created via 'new ClassName()')
|
|
2504
|
+
|
|
2505
|
+
Returns:
|
|
2506
|
+
PythonizedCSSLInstance - A Python-friendly wrapper
|
|
2507
|
+
"""
|
|
2508
|
+
from .cssl_types import CSSLInstance, CSSLClass
|
|
2509
|
+
|
|
2510
|
+
if cssl_instance is None:
|
|
2511
|
+
return None
|
|
2512
|
+
|
|
2513
|
+
# Already pythonized
|
|
2514
|
+
if isinstance(cssl_instance, PythonizedCSSLInstance):
|
|
2515
|
+
return cssl_instance
|
|
2516
|
+
|
|
2517
|
+
# Must be a CSSLInstance
|
|
2518
|
+
if not isinstance(cssl_instance, CSSLInstance):
|
|
2519
|
+
# If it's a dict, wrap it as a simple object
|
|
2520
|
+
if isinstance(cssl_instance, dict):
|
|
2521
|
+
return PythonizedDict(cssl_instance)
|
|
2522
|
+
# Return as-is for primitives
|
|
2523
|
+
return cssl_instance
|
|
2524
|
+
|
|
2525
|
+
return PythonizedCSSLInstance(cssl_instance, self.runtime)
|
|
2526
|
+
|
|
2527
|
+
|
|
2528
|
+
class PythonizedCSSLInstance:
|
|
2529
|
+
"""Python wrapper for CSSL class instances.
|
|
2530
|
+
|
|
2531
|
+
Provides Pythonic attribute access and method calling for CSSL objects.
|
|
2532
|
+
"""
|
|
2533
|
+
|
|
2534
|
+
def __init__(self, instance: Any, runtime: Any = None):
|
|
2535
|
+
# Use object.__setattr__ to avoid triggering our custom __setattr__
|
|
2536
|
+
object.__setattr__(self, '_cssl_instance', instance)
|
|
2537
|
+
object.__setattr__(self, '_cssl_runtime', runtime)
|
|
2538
|
+
object.__setattr__(self, '_cssl_class_name', instance._class.name if hasattr(instance, '_class') else 'Unknown')
|
|
2539
|
+
|
|
2540
|
+
def __getattr__(self, name: str) -> Any:
|
|
2541
|
+
"""Get member or method from CSSL instance."""
|
|
2542
|
+
if name.startswith('_'):
|
|
2543
|
+
raise AttributeError(f"'{self._cssl_class_name}' has no attribute '{name}'")
|
|
2544
|
+
|
|
2545
|
+
instance = object.__getattribute__(self, '_cssl_instance')
|
|
2546
|
+
runtime = object.__getattribute__(self, '_cssl_runtime')
|
|
2547
|
+
|
|
2548
|
+
# Check for member variable first
|
|
2549
|
+
if instance.has_member(name):
|
|
2550
|
+
value = instance.get_member(name)
|
|
2551
|
+
# Recursively pythonize nested CSSL instances
|
|
2552
|
+
from .cssl_types import CSSLInstance
|
|
2553
|
+
if isinstance(value, CSSLInstance):
|
|
2554
|
+
return PythonizedCSSLInstance(value, runtime)
|
|
2555
|
+
return value
|
|
2556
|
+
|
|
2557
|
+
# Check for method
|
|
2558
|
+
method = instance.get_method(name)
|
|
2559
|
+
if method is not None:
|
|
2560
|
+
# Return a callable wrapper for the method
|
|
2561
|
+
return PythonizedMethod(instance, name, method, runtime)
|
|
2562
|
+
|
|
2563
|
+
raise AttributeError(f"'{self._cssl_class_name}' has no attribute '{name}'")
|
|
2564
|
+
|
|
2565
|
+
def __setattr__(self, name: str, value: Any) -> None:
|
|
2566
|
+
"""Set member value on CSSL instance."""
|
|
2567
|
+
if name.startswith('_'):
|
|
2568
|
+
object.__setattr__(self, name, value)
|
|
2569
|
+
return
|
|
2570
|
+
|
|
2571
|
+
instance = object.__getattribute__(self, '_cssl_instance')
|
|
2572
|
+
instance.set_member(name, value)
|
|
2573
|
+
|
|
2574
|
+
def __repr__(self) -> str:
|
|
2575
|
+
class_name = object.__getattribute__(self, '_cssl_class_name')
|
|
2576
|
+
instance = object.__getattribute__(self, '_cssl_instance')
|
|
2577
|
+
members = list(instance._members.keys()) if hasattr(instance, '_members') else []
|
|
2578
|
+
return f"<PythonizedCSSL '{class_name}' members={members}>"
|
|
2579
|
+
|
|
2580
|
+
def __dir__(self) -> list:
|
|
2581
|
+
"""List available attributes."""
|
|
2582
|
+
instance = object.__getattribute__(self, '_cssl_instance')
|
|
2583
|
+
members = list(instance._members.keys()) if hasattr(instance, '_members') else []
|
|
2584
|
+
methods = list(instance._class.methods.keys()) if hasattr(instance._class, 'methods') else []
|
|
2585
|
+
return members + methods
|
|
2586
|
+
|
|
2587
|
+
def _to_dict(self) -> dict:
|
|
2588
|
+
"""Convert to Python dictionary."""
|
|
2589
|
+
instance = object.__getattribute__(self, '_cssl_instance')
|
|
2590
|
+
result = {}
|
|
2591
|
+
for name, value in instance._members.items():
|
|
2592
|
+
from .cssl_types import CSSLInstance
|
|
2593
|
+
if isinstance(value, CSSLInstance):
|
|
2594
|
+
result[name] = PythonizedCSSLInstance(value, None)._to_dict()
|
|
2595
|
+
else:
|
|
2596
|
+
result[name] = value
|
|
2597
|
+
return result
|
|
2598
|
+
|
|
2599
|
+
|
|
2600
|
+
class PythonizedMethod:
|
|
2601
|
+
"""Wrapper that makes CSSL methods callable from Python."""
|
|
2602
|
+
|
|
2603
|
+
def __init__(self, instance: Any, method_name: str, method_ast: Any, runtime: Any):
|
|
2604
|
+
self._instance = instance
|
|
2605
|
+
self._method_name = method_name
|
|
2606
|
+
self._method_ast = method_ast
|
|
2607
|
+
self._runtime = runtime
|
|
2608
|
+
|
|
2609
|
+
def __call__(self, *args, **kwargs) -> Any:
|
|
2610
|
+
"""Call the CSSL method with arguments."""
|
|
2611
|
+
if self._runtime is None:
|
|
2612
|
+
raise RuntimeError(f"Cannot call method '{self._method_name}' - no runtime available")
|
|
2613
|
+
|
|
2614
|
+
# Execute the method through the runtime
|
|
2615
|
+
result = self._runtime._call_method(self._instance, self._method_name, list(args))
|
|
2616
|
+
|
|
2617
|
+
# Pythonize the result if it's a CSSL instance
|
|
2618
|
+
from .cssl_types import CSSLInstance
|
|
2619
|
+
if isinstance(result, CSSLInstance):
|
|
2620
|
+
return PythonizedCSSLInstance(result, self._runtime)
|
|
2621
|
+
|
|
2622
|
+
return result
|
|
2623
|
+
|
|
2624
|
+
def __repr__(self) -> str:
|
|
2625
|
+
return f"<method '{self._method_name}' of '{self._instance._class.name}'>"
|
|
2626
|
+
|
|
2627
|
+
|
|
2628
|
+
class PythonizedDict:
|
|
2629
|
+
"""Simple wrapper for dict objects with attribute access."""
|
|
2630
|
+
|
|
2631
|
+
def __init__(self, data: dict):
|
|
2632
|
+
object.__setattr__(self, '_data', data)
|
|
2633
|
+
|
|
2634
|
+
def __getattr__(self, name: str) -> Any:
|
|
2635
|
+
data = object.__getattribute__(self, '_data')
|
|
2636
|
+
if name in data:
|
|
2637
|
+
value = data[name]
|
|
2638
|
+
if isinstance(value, dict):
|
|
2639
|
+
return PythonizedDict(value)
|
|
2640
|
+
return value
|
|
2641
|
+
raise AttributeError(f"No attribute '{name}'")
|
|
2642
|
+
|
|
2643
|
+
def __setattr__(self, name: str, value: Any) -> None:
|
|
2644
|
+
if name.startswith('_'):
|
|
2645
|
+
object.__setattr__(self, name, value)
|
|
2646
|
+
return
|
|
2647
|
+
data = object.__getattribute__(self, '_data')
|
|
2648
|
+
data[name] = value
|
|
2649
|
+
|
|
2650
|
+
def __repr__(self) -> str:
|
|
2651
|
+
data = object.__getattribute__(self, '_data')
|
|
2652
|
+
return f"<PythonizedDict {data}>"
|
|
2653
|
+
|
|
2654
|
+
def _to_dict(self) -> dict:
|
|
2655
|
+
return object.__getattribute__(self, '_data')
|
|
2656
|
+
|
|
2448
2657
|
|
|
2449
2658
|
# Module-level convenience functions
|
|
2450
2659
|
_default_builtins: Optional[CSSLBuiltins] = None
|
|
@@ -1164,5 +1164,43 @@
|
|
|
1164
1164
|
"}"
|
|
1165
1165
|
],
|
|
1166
1166
|
"description": "Function with selectable modifier combinations"
|
|
1167
|
+
},
|
|
1168
|
+
"Python Pythonize": {
|
|
1169
|
+
"prefix": ["python::pythonize", "pythonize"],
|
|
1170
|
+
"body": "python::pythonize(${1:instance})$0",
|
|
1171
|
+
"description": "Convert CSSL class instance to Python-usable object"
|
|
1172
|
+
},
|
|
1173
|
+
"Return Pythonized Class": {
|
|
1174
|
+
"prefix": "returnpython",
|
|
1175
|
+
"body": [
|
|
1176
|
+
"${1:instance} = new ${2:ClassName}(${3:args});",
|
|
1177
|
+
"pyobj = python::pythonize(${1});",
|
|
1178
|
+
"parameter.return(pyobj);"
|
|
1179
|
+
],
|
|
1180
|
+
"description": "Create class instance and return as Python object"
|
|
1181
|
+
},
|
|
1182
|
+
"Class with Python Export": {
|
|
1183
|
+
"prefix": "pyclass",
|
|
1184
|
+
"body": [
|
|
1185
|
+
"class ${1:ClassName} {",
|
|
1186
|
+
"\t${2:string} ${3:name};",
|
|
1187
|
+
"",
|
|
1188
|
+
"\t${1}(${4:params}) {",
|
|
1189
|
+
"\t\tthis->${3} = ${5:value};",
|
|
1190
|
+
"\t}",
|
|
1191
|
+
"",
|
|
1192
|
+
"\t${6:string} get${3/(.*)/${1:/capitalize}/}() {",
|
|
1193
|
+
"\t\treturn this->${3};",
|
|
1194
|
+
"\t}",
|
|
1195
|
+
"",
|
|
1196
|
+
"\tvoid set${3/(.*)/${1:/capitalize}/}(${2} newValue) {",
|
|
1197
|
+
"\t\tthis->${3} = newValue;",
|
|
1198
|
+
"\t}",
|
|
1199
|
+
"}",
|
|
1200
|
+
"",
|
|
1201
|
+
"${7:obj} = new ${1}(${8:args});",
|
|
1202
|
+
"parameter.return(python::pythonize(${7}));$0"
|
|
1203
|
+
],
|
|
1204
|
+
"description": "Create a class and export as Python object"
|
|
1167
1205
|
}
|
|
1168
1206
|
}
|
{includecpp-3.7.26 → includecpp-3.7.27}/includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json
RENAMED
|
@@ -319,6 +319,14 @@
|
|
|
319
319
|
{
|
|
320
320
|
"name": "support.function.namespace.combo.cssl",
|
|
321
321
|
"match": "\\bcombo::(filterdb|blocked|like)\\b"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"name": "support.function.namespace.python.cssl",
|
|
325
|
+
"match": "\\bpython::(pythonize|wrap|export)\\b"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"name": "support.function.namespace.filter.cssl",
|
|
329
|
+
"match": "\\bfilter::(register|unregister|list|exists)\\b"
|
|
322
330
|
}
|
|
323
331
|
]
|
|
324
332
|
},
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "IncludeCPP"
|
|
7
|
-
version = "3.7.
|
|
7
|
+
version = "3.7.27"
|
|
8
8
|
description = "Professional C++ Python bindings with type-generic templates, pystubs and native threading"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|