Skip to content

05 How does cp work

Austin edited this page Dec 16, 2017 · 3 revisions

How does cp work?

Contents

  1. Introduction
  2. utils.py
  3. parse.py
  4. class Base
  5. class Logpath
  6. class Clock
  7. class Command
  8. class Call
  9. class Parser
  10. main.py
  11. Summary

Introduction

If you haven't already, you may want to take a look at the Overview, Getting Started, and What is cp? sections before getting started with this page.

They explain, in a tutorial like fashion, how to get started and may answer any other basic questions you may have. They also set the foundation for the rest of the API descriptions.

Please note that this API is always subject to change if and when a better solution is committed. Think of the code as a guideline rather than a rule of thumb.

This documentation may or may not reflect the current state of the repository. However, the general ideas should remain alive.

I do dive in to weeds on this one and this is all pretty basic stuff as it is. If you haven't learned this stuff already, or failed to have a solid grasp on what was going, this should clear things up for you.

Now, off to the weeds.

-> goto index

utils.py

This is a simple module. It contains any utility based functions or classes. For example, this module simply holds a single function called clear.

Parameters

  • n/a

Module utils.py

from sys import platform
from os import system

def clear():
    if 'win32' == platform:
        system('cls')
    else:
        system('clear')

Usage

We can load up the module in python like so.

$ pwd
/home/th3ros/Documents/github/atom-python-run/cp
$ python
Python 3.6.3 (default, Oct 24 2017, 14:48:20) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cp.utils import clear
>>> clear()
> clears the screen <

Summary

That's really all this module does. It just clears the screen.

-> goto index

Clone this wiki locally