This file contains hidden or 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 os | |
from sys import argv | |
import re | |
import subprocess | |
user = None | |
ignore = [ | |
"node_modules", | |
".git", | |
"env", |
This file contains hidden or 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
from unittest.mock import patch | |
import pika | |
def callback_func(channel, method, properties, body): | |
print("Message consumed:", body) | |
@patch("pika.BlockingConnection", spec=pika.BlockingConnection) | |
def mock_publish(mock_conn): | |
def side_effect_publish(exchange, routing_key, body): | |
print(f"Message published to {routing_key}:", body) |
This file contains hidden or 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
from sys import argv | |
from requests import head | |
def url_unshorten(url, verbose=True): | |
full_url = head(url, allow_redirects=True).url | |
verbose and print(full_url) | |
return full_url | |
if __name__ == '__main__': | |
url_unshorten(argv[1]) |
This file contains hidden or 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 sys | |
import requests | |
if len(sys.argv) < 4: | |
print( | |
"""Invalid arguments. | |
Format: python3 latest_github_release.py <repo> [OPTIONS] <keywords>. | |
Type 'help' in options for more.""") | |
exit(1) | |
if sys.argv[2] == "help": |