- Sobre o que se trata OOP
- Reuso (objeto pode ser reaproveitado por outros contextos)
- Abstração
- Encapsulamento (esconder implementação)
- Alta Coesão (objeto fazer bem uma única coisa)
- Baixo Acoplamento (objeto pode ser substituído sem afetar outros objetos)
- Elementos OOP
- Interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import re | |
rawwords = { | |
"whitelist": "gbvampnkwxxbgxgxbgxkxbgxfwnkvaatuxgwbxlxdxbgxptkxgatmmxbffxklvahgngmxkzxzxgebxzmlmxamcxmsmlxbxgwbxlxdhffmxbgxlwtuxbwtfbmlxbgxcxmsmgxnxglmtmmctakxaxnmxlmtwmpxkwxxklmxxmptlsnwxfexuxgbagxgobxexwtuxbftvamzxuxgubmmxaxnmxpxzxglibxelbxamobxexlxaxglxbmxlxbgxbakxguxbwxzxaxgxbgxglhztketgzxwnkvalmbxzsxbzmwtmxglmtgwyktzxkheexmaxftteexlzkngwwtfbmikxblbakxgztgsxltzmxzxzxgteexguebxubakxkgbffmlmtkutuxgwyhezxietmsmbmxetikbewknvdlmtkdabeyxphvaxyxaemlxmsmlheexfnlbdubmmxzxkgxlxvalsnwxftdmbxdtfxggxnxkuebvdgtfxgteexfwkhamdxbgxftkdmcxwxkfxbgxptknfwtohgyhezmpxgbzhiyxkltvaxyhmhlkxzxenglxkzxgtncxwxggxnxltnzxgwtaxkbffxkebxuxfbmmxingdmlvahgngmxkcxwxkfxbgxkxvamlmttmtemxgexuxgfxblmteexlexnmxfxmxkmtzxguxlmxznmxgabeymbakxfhyyxgltzxgytakmeblmxmbxkxngbhgwtaxkbagxgpbkdmdkblxftvamgtmnkkxblxlbvamlhglmuxbwxdgtiigxuxgkxbaxlnvaxxgwxmahaxgnglxktemxkdkbxzgtvamlmtgwpxzxgznmxkcngzxexzmxlhkzmuxknyuhwxgwbgzxyxnxkdktymebvamlihkmztuxgabgsnmkbmmutlblbwxxgdtfiygbvamkngwxwbxgmdxggmexlxglbmsmlmx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# : | |
# : | |
youplanny/poetry.lock: pyproject.toml | |
poetry lock | |
requirements.txt: poetry.lock | |
poetry export --without-hashes -f requirements.txt -o requirements.txt | |
deploy: requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def say(animal_name): | |
match animal_name: | |
case 'cow': | |
print('mu!') | |
case 'duck': | |
print('quack!') | |
case _: | |
print(f'Invalid animal type: {animal_name}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- resource: listing | |
- permissions: | |
- profile1: | |
- READ | |
- profile2: | |
- UPDATE | |
- fields: | |
- code: | |
- profile1: | |
- SET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ dig aduniverso.com.br | |
; <<>> DiG 9.10.6 <<>> aduniverso.com.br | |
;; global options: +cmd | |
;; Got answer: | |
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2534 | |
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 5 | |
;; OPT PSEUDOSECTION: | |
; EDNS: version: 0, flags:; udp: 4096 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Lib/os.py b/Lib/os.py | |
index e293ecae7f..4dfa41c712 100644 | |
--- a/Lib/os.py | |
+++ b/Lib/os.py | |
@@ -25,6 +25,7 @@ and opendir), and leave all pathname manipulation to os.path | |
import abc | |
import sys, errno | |
import stat as st | |
+import _thread | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import wikipedia | |
def parse(raw_content): | |
section_title_re = re.compile("^=+\s+.*\s+=+$") | |
content = [] | |
skip = False | |
for l in raw_content.splitlines(): | |
line = l.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Error(Exception): | |
pass | |
class RecoverableError(Error): | |
pass | |
class NonRecoverableError(Error): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Modo sugerido pela documentação do Django | |
def create(request, template_name="my_app/my_form.html"): | |
if request.method == 'POST': | |
form = MyForm(request.POST, request.FILES) | |
if form.is_valid(): | |
instance = form.save(commit=False) | |
do_x() # custom logic here | |
instance.save() | |
return redirect('home') | |
else: |