Skip to main content

A minimalistic yet powerful object proxying utility

Project description

# ObjectProxy #
**A minimalistic yet powerful object proxying utility**

This readme attempts to explain the general use of this library.

### Installation ###
* Install from repository
```
pip install git+https://github.com/aviksama/objectproxy.git
```
### Example ###

Object proxy basically creates a proxy for any python object:

```python
class MyClass(object):

def __init__(self, array=None):
self.array = array or []

def get_array_element(self, index):
try:
return self.array[index]
except IndexError:
return


def create_dictionary_of_objects(*args):
mydict = dict()
for index, arg in enumerate(args):
mydict[index] = arg

```
Now lets create proxies for the objects above in random fashion

```python
>>> from objectproxy import ProxyElement, eval_proxy

>>> class_proxy = ProxyElement(MyClass, args=[[1,2,3],], kwargs={})
>>> function_proxy = ProxyElement(create_dictionary_of_objects, args=[class_proxy], kwargs={})
>>> class_proxy_ref = function_proxy.values()[0]
>>> class_proxy_array_element = class_proxy_ref.get_array_element(0)
>>> eval_proxy(class_proxy_array_element)
1
```
until `eval_proxy` is called on the proxy object, It doesn't call the parent methods. Hence all the parent methods and attributes are lazily evaluated.

### Contribution guidelines ###

We appreciate your effort in contributing to this project. You can contribute in any of the following.
* Writing tests
* Code review
* Other guidelines
* Submit issues

In order to contribute please fork the repository, And make a GitHub pull request to `dev` branch.

### Who do I talk to? ###

* Repo owner or admin
* Other community or team contact





Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

object-proxy-0.1a0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

object_proxy-0.1a0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file object-proxy-0.1a0.tar.gz.

File metadata

  • Download URL: object-proxy-0.1a0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for object-proxy-0.1a0.tar.gz
Algorithm Hash digest
SHA256 6c1547182df508d4bf3ec141506224ffbc98dc3ee875dba3815d0d61ee3743b8
MD5 6c484f8f40ab804d8723f0978bea3d62
BLAKE2b-256 a8dfb78e279ac5b2e7256c368cf771e0c16f802719294eef3c99eb24aa0bb23d

See more details on using hashes here.

File details

Details for the file object_proxy-0.1a0-py3-none-any.whl.

File metadata

  • Download URL: object_proxy-0.1a0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for object_proxy-0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 55f7500b0b02afc17c06852c954b5ee9b43aa4d141402f6ed8cc36ddfc122494
MD5 0229ed5bd431f91776f9117188769002
BLAKE2b-256 d5898141c5b9e693c03fd92fff12eba964c4ee83a04bcf23691a455ca20d94d1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page