mswp

Decorator that automatically clears temporary local variables upon function execution, effectively preventing clutter and mitigating memory leaks.

https://github.com/louisbrulenaudet/mswp

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.6%) to scientific vocabulary
Last synced: 10 months ago · JSON representation ·

Repository

Decorator that automatically clears temporary local variables upon function execution, effectively preventing clutter and mitigating memory leaks.

Basic Info
  • Host: GitHub
  • Owner: louisbrulenaudet
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Size: 18.6 KB
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Created over 2 years ago · Last pushed over 2 years ago
Metadata Files
Readme Funding License Citation Security

README.md

mswp, a decorator that clears temporary local variables upon function execution, preventing clutter and mitigating memory leaks

Python License Maintainer

mswp is a Python decorator designed to enhance code cleanliness and mitigate potential memory leaks by automatically clearing temporary local variables after function execution.

Overview

Python functions often create temporary variables for intermediate computations, which can clutter the local namespace and potentially lead to memory leaks if not properly managed. mswp addresses this issue by providing a simple yet powerful decorator that automatically cleans up temporary local variables, ensuring an efficient execution environment.

Installation

You can install mswp via pip:

bash pip3 install mswp

Usage

To use mswp, simply decorate your functions with @mswp. This ensures that any temporary local variables used within the function are cleared upon completion, promoting code cleanliness and efficient memory usage.

```python from mswp import clear

@clear def myfunction(): tempvar = 10 # Your code here return result ``` In this example, my_function is decorated with @clear, ensuring that any temporary local variables used within it are cleared upon completion.

Parameters

func: The function to be decorated.

Returns

function: The decorated function.

Features

  • Automatic Cleanup: mswp automatically clears temporary local variables after function execution, preventing clutter and potential memory leaks.

  • Simplified Syntax: With a simple decorator, mswp streamlines code maintenance and promotes readability.

  • Error Handling: mswp provides robust error handling to ensure reliable execution even in the presence of exceptions.

Citing this project

If you use this code in your research, please use the following BibTeX entry.

BibTeX @misc{louisbrulenaudet2023, author = {Louis Brulé Naudet}, title = {mswp, a decorator that automatically clears temporary local variables upon function execution, effectively preventing clutter and mitigating memory leaks}, howpublished = {\url{https://github.com/louisbrulenaudet/mswp}}, year = {2024} }

Feedback

If you have any feedback, please reach out at louisbrulenaudet@icloud.com.

Owner

  • Name: Louis Brulé Naudet
  • Login: louisbrulenaudet
  • Kind: user
  • Location: Paris
  • Company: Université Paris-Dauphine (Paris Sciences et Lettres - PSL)

Research in business taxation and development (NLP, LLM, Computer vision...), University Dauphine-PSL 📖 | Backed by the Microsoft for Startups Hub program

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Brulé Naudet"
  given-names: "Louis"
  orcid: "https://orcid.org/0000-0001-9111-4879"
title: "mswp, a decorator that automatically clears temporary local variables upon function execution, effectively preventing clutter and mitigating memory leaks"
version: 1.0.0
date-released: 2024-02-21

GitHub Events

Total
Last Year

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 15 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
pypi.org: mswp

A decorator that automatically clears temporary local variables upon function execution, effectively preventing clutter and mitigating memory leaks.

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 15 Last month
Rankings
Dependent packages count: 9.8%
Average: 37.3%
Dependent repos count: 64.8%
Maintainers (1)
Last synced: 10 months ago

Dependencies

pyproject.toml pypi