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
//> using platform "jvm" | |
//> using scala "2.13.8" | |
//> using lib "dev.zio::zio:1.0.14" | |
//> using lib "com.monovore::decline:2.2.0" | |
//> using mainClass "DeclinedApp" | |
// Runnable using `scala-cli run Declined.scala -- --user Ralph --alpha 3.14` | |
import zio.{ExitCode, ZEnv, ZIO, Task, RIO, IO, UIO, URIO} | |
import zio.console._ |
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 sys | |
import json | |
import logging | |
from typing import List, Tuple, Dict, Any | |
from selenium import webdriver | |
from bs4 import BeautifulSoup | |
import pandas as pd | |
log = logging.getLogger(__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
""" | |
Example of Using a Subparser | |
Demonstration of using two Pydantic data models to | |
build a subparser and sharing options. | |
The major friction point and limitation is the order in which the options appear in --help. | |
For example, |
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
"""PyBites Amazon book affiliation link generator. | |
Uses the link pasted to clipboard and puts the generated link back onto the | |
clipboard. https://pybit.es/pyperclip.html | |
Set the AMAZON_AFFILIATE_CODE variable to your own Amazon affiliate code. | |
From https://twitter.com/pybites/status/1277141497117323266 | |
Separate concerns and enable other AF codes to be registered and |
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 $ivy.`com.zaxxer:nuprocess:2.0.0`, com.zaxxer.nuprocess._ | |
import scala.collection.JavaConverters._ | |
import java.nio.ByteBuffer | |
import scala.concurrent.{Future, Promise} | |
class ProcessHandler extends NuAbstractProcessHandler { | |
private var nuProcess: NuProcess = null | |
override def onStart(nuProcess: NuProcess): Unit = { |
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 python3 | |
""" | |
Example of a functional-ish centric design and encoding logic in rules. | |
This uses determination of a leap year as an simple example. | |
This approach could be used in more involved cases to encode business logic. | |
""" | |
import operator as op |
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
# Common core utils are too small that don't warrant creating a package | |
from argparse import ArgumentParser, Namespace, ArgumentDefaultsHelpFormatter | |
import csv | |
import functools | |
import logging | |
import sys | |
from typing import Callable as F | |
from typing import List, TypeVar, Type, Iterator | |
from pydantic import BaseModel |
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 python3 | |
from collections import deque | |
def to_tail(it, max_items): | |
""" | |
https://twitter.com/Wildvasa/status/1207383049387810816 | |
Get the last N elements from an iterable |
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 python3 | |
import sys | |
from collections import Counter | |
# https://docs.python.org/3.8/library/collections.html?highlight=counter#collections.Counter | |
# Example of using collections.Counter to count item | |
# https://twitter.com/DavidMezzetti/status/1204493772274438151 | |
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
metaflow/package.py:24:4: W0102: Dangerous default value DEFAULT_SUFFIXES (builtins.list) as argument (dangerous-default-value) | |
metaflow/runtime.py:431:4: W0102: Dangerous default value [] as argument (dangerous-default-value) | |
metaflow/flowspec.py:130:4: W0102: Dangerous default value {} as argument (dangerous-default-value) | |
metaflow/flowspec.py:130:4: W0102: Dangerous default value [] as argument (dangerous-default-value) | |
metaflow/flowspec.py:256:4: W0102: Dangerous default value [] as argument (dangerous-default-value) | |
metaflow/pylint_wrapper.py:26:4: W0102: Dangerous default value [] as argument (dangerous-default-value) | |
metaflow/plugins/aws/batch/batch.py:96:4: W0102: Dangerous default value {} as argument (dangerous-default-value) | |
metaflow/plugins/aws/batch/batch.py:96:4: W0102: Dangerous default value {} as argument (dangerous-default-value) | |
metaflow/metadata/service.py:40:4: W0102: Dangerous default value [] as argument (dangerous-default-value) | |
metaflow/metadata/service.py:40:4: W0102: Dangerous defau |
NewerOlder