Data.FashionShop
index
/home/flempriere/personal_projects/Languages/Python/BeginToCodeWithPython/02_AdvancedProgramming/12_PythonApplications/Examples/10_FashionShopWithDocumentation/Data/FashionShop.py

Example 12.10c FashionShop
 
Contains implementations for handling a collection of inventory items
 
Routine Listings
----------------
FashionShop
    Collection class for handling a collection of `StockItem` classes
 
See Also
--------
Data.StockItem : Module containing implementations of inventory items

 
Modules
       
pickle

 
Classes
       
builtins.object
FashionShop

 
class FashionShop(builtins.object)
    Represents the inventory management system of a Fashion
 
Class Attributes
----------------
show_instrumentation : bool
    indicates if instrumentation should be printed
 
  Methods defined here:
__init__(self)
Create a new `FashionShop` instance
__str__(self)
Return str(self).
find_matching_with_tags(self, search_tags)
Get stock items that match all the specified search tags
 
Parameters
----------
search_tags : str
    set of tags to search against.
    Item's must match all tags
 
Returns
-------
list[StockItem]
    list containing all StockItem's matching the
    specified set of tags. If no matches are found
    the list is empty
find_stock_item(self, stock_ref)
Find the stock item with the corresponding reference id
 
Parameters
----------
stock_ref : str
    stock reference id of the item to find
 
Returns
-------
StockItem | None
    Returns a `StockItem` with a matching `stock_ref` else `None`
save(self, filename)
Save the `FashionShop` to a given file
 
`FashionShop` is saved as a pickled binary file in the file given
by `filename`. The file is created if it doesn't exist. If the file
already exists it is overwritten
 
Parameters
----------
filename : str
    path to the file to save
 
Returns
-------
None
 
Raises
------
Exceptions
    raised if the file fails to save
 
See Also
--------
FashionShop.load : load a `FashionShopobject from a file
store_new_stock_item(self, item)
Store a new item in the reference system
 
The provided `item` can be indexed by it's `stock_ref` parameter
 
Parameters
----------
item : StockItem
    item to add to the inventory system
 
Returns
-------
None
 
Raises
------
KeyError
    Raised if the item's `stock_ref` is already registered as a key

Static methods defined here:
load(filename)
Create a `FashionShop` instance from a pickled binary file
 
Parameters
----------
filename : str
    path to a file containing pickled `FashionShop` data
 
Returns
-------
FashionShop
    the loaded `FashionShop` instance
 
Raises
------
Exceptions
    raised if the file fails to load
 
See Also
--------
FashionShop.save : saves a `FashionShop` instance

Data descriptors defined here:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

Data and other attributes defined here:
show_instrumentation = True