Giter Site home page Giter Site logo

gettersandsettersforpython's Introduction

Setup

  1. Clone this repository to your local machine.
  2. Delete all lines in the input file.
  3. Place all the attributes of your class in the input file.
  4. Run the following command, and the script will generate a Constructor, Getters, and Setters for your class.
python3 create_Constructor_Getters_Setters.py

P.S. Example usage can be found in the input and output files. Also, this python script do not require to import or install any additional packages / applications.

Output Styles

Running the script will generate output in two different styles.

  1. The first style of output provides getters and setters for all attributes, regardless of whether they are public, protected, or private. NB Setters are really only required for non-public (i.e. protected or private) attributes. There is thus an option (found in the main() function) to change behaviour of this first style so that the script only outputs getters and setters for those non-public attributes. (Public attributes may be addressed directly from outside the class.)

  2. The second style of output provides getters and setters only for those non-public attributes, and it provides them using property decorators. This style may not be used to provide setters and getters for public attributes, so that option is not available for the second style.

Valid Input Formats

You may provide your list of attributes in any of the following styles.

  • attribute = value
  • attribute=value
  • attribute =
  • _attribute
  • __attribute = value

How to Contribute?

  1. If you need an additional feature that you want to add, please create a pull request.
  2. If you want to request a feature, create an issue instead.

P.S. While sending a pull request, please be as clear as possible (i.e. comment your code, explain what you have done.). Also, send multiple pull requests if the change you will make is complicated and long.

gettersandsettersforpython's People

Contributors

kaanturkmen avatar

Stargazers

 avatar  avatar MEHMET HAKAN ÖZAYAN avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.