codeandrew / python-templates

A collection of python functions, classes made to be copy pasted in the future

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python Function Templates

Here are some of the bootsrapped functions that I regularly use

You aren’t meant to master a Programming Language in the beginning. You’re meant to go build them

You don’t master a programming concept, you apply them in numerous project. then you continuously improve on them

Contents

  • algorithms - python functions that uses algorithms
  • file - python functions that deals in file systems
  • rest - python functions that deals with rest apis
  • sql - python functions that interacts with sql
  • util - python functions as generalized utility

Coding Philosophies

Keep it DRY

"Don't Repeat Your Self"

S.O.L.I.D. Principles

S – Single Responsibility Principle
O – Open-Closed Principle
L – Liskov Substitution Principle
I – Interface Segregation Principle
D – Dependency Inversion Principle

Clean Coding

use name revealing variables and functions.

bad example

import { sub } from './yt';

function run(unit){
  const p = unit.partList[42]
  p.sub.lsn((w) => {
    if (w === 'banana' ){
      sub(unit)
    }
  })
}

Good Example

import { forceToSubscribe } from './youtube';

const BRAIN_INDEX = 42;
const TRIGGER_WORD = 'banana';

function brainwashToSubscribeOnTriggerWord(viewer){
  const brain = viewer.organs[TRIGGER_WORD];

  brain.subconscious.listenForWord((word) => {
    if (word === TRIGGER_WORD) {
      forceToSubscribe(viewer)
    }
  })
}

Python Style Guides

Rush

go to ./freelance.md

scan image text https://github.com/tesseract-ocr/tesseract

TO DO

Cool Projects

Voice Assistant

https://www.geeksforgeeks.org/junk-file-organizer-python/?ref=lbp https://www.geeksforgeeks.org/python-create-a-simple-assistant-using-wolfram-alpha-api/?ref=lbp https://www.geeksforgeeks.org/build-a-virtual-assistant-using-python/ https://www.geeksforgeeks.org/voice-assistant-using-python/?ref=lbp https://www.geeksforgeeks.org/personal-voice-assistant-in-python/?ref=lbp

Reference:

https://www.geeksforgeeks.org/optimization-tips-python-code/?ref=rp

About

A collection of python functions, classes made to be copy pasted in the future


Languages

Language:Python 100.0%