Giter Site home page Giter Site logo

constructor_generator's Introduction

constructor_generator

An automatic class generator with constructor, getters and setters method for the attributes

An example of input

class name and a list of attribute names

parameter_list = ['fare_class', 'unit_fare_value', 'volume', 'container_type', 'orig', 'dest', 'date_avail', 'date_due', 'cat_customer']
my_code = generator("Demand", parameter_list)
print(my_code)

An example of output

class Demand:
	def __init__(self,fare_class,unit_fare_value,volume,container_type,orig,dest,date_avail,date_due,cat_customer):
		self.fare_class = fare_class
		self.unit_fare_value = unit_fare_value
		self.volume = volume
		self.container_type = container_type
		self.orig = orig
		self.dest = dest
		self.date_avail = date_avail
		self.date_due = date_due
		self.cat_customer = cat_customer

	@property
	def fare_class(self):
		return self.__fare_class

	@fare_class.setter
	def fare_class(self, new_fare_class):
		self.__fare_class = new_fare_class

	@property
	def unit_fare_value(self):
		return self.__unit_fare_value

	@unit_fare_value.setter
	def unit_fare_value(self, new_unit_fare_value):
		self.__unit_fare_value = new_unit_fare_value

	@property
	def volume(self):
		return self.__volume

	@volume.setter
	def volume(self, new_volume):
		self.__volume = new_volume

	@property
	def container_type(self):
		return self.__container_type

	@container_type.setter
	def container_type(self, new_container_type):
		self.__container_type = new_container_type

	@property
	def orig(self):
		return self.__orig

	@orig.setter
	def orig(self, new_orig):
		self.__orig = new_orig

	@property
	def dest(self):
		return self.__dest

	@dest.setter
	def dest(self, new_dest):
		self.__dest = new_dest

	@property
	def date_avail(self):
		return self.__date_avail

	@date_avail.setter
	def date_avail(self, new_date_avail):
		self.__date_avail = new_date_avail

	@property
	def date_due(self):
		return self.__date_due

	@date_due.setter
	def date_due(self, new_date_due):
		self.__date_due = new_date_due

	@property
	def cat_customer(self):
		return self.__cat_customer

	@cat_customer.setter
	def cat_customer(self, new_cat_customer):
		self.__cat_customer = new_cat_customer

constructor_generator's People

Contributors

martinwang2014 avatar

Watchers

James Cloos avatar  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.