Here are some suggestions for documentation that will hopefully help avoid confusion and unnecessary downtime.
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
# Create a boto3 session by assuming a role | |
import boto3 | |
import uuid | |
def create_session(role_arn): | |
client = boto3.client('sts') | |
response = client.assume_role( | |
RoleArn=role_arn, |
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
val length = 10 | |
val breadth = 10 | |
type Loc = (Int, Int) | |
type Grid = Map[Loc, Cell] | |
case class Cell(i: Loc) | |
class World(xlim: Int, ylim: Int)(grid: Grid = Map.empty) { |
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
trait Reader[T] { | |
def read(t: T): String | |
} | |
sealed trait MakesSound { | |
val doesTalk: Boolean | |
} | |
case class Dog(doesTalk: Boolean) extends MakesSound | |
case class Frog(doesTalk: Boolean) extends MakesSound |
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
# Based on https://www.ncbi.nlm.nih.gov/pubmed/30850328 | |
import datetime | |
from random import choices | |
withdrawal_percentage_per_week = 5 | |
starting_dosage_in_milligrams = 200 | |
minimum_reduction_in_milligrams = 25 | |
dosage_reduction_population = [minimum_reduction_in_milligrams, 0] |
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 java.time.Instant | |
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB | |
import com.amazonaws.services.dynamodbv2.model.ConditionalCheckFailedException | |
import com.gu.scanamo.error.{ConditionNotMet, ScanamoError} | |
import com.gu.scanamo.ops.ScanamoOps | |
import com.gu.scanamo.query.{KeyEquals, UniqueKey} | |
import com.gu.scanamo.syntax.{attributeExists, not} | |
import com.gu.scanamo.{DynamoFormat, Scanamo, Table} | |
import grizzled.slf4j.Logging |
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
Service Modes | |
- Operational | |
- Transient | |
- Catastrophic |
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
trait LockingService[IdentF[_], OutT[_], Ident, Out] { | |
import cats.implicits._ | |
sealed trait LockProcess | |
case class FailedLock(id: Ident, e: Throwable) extends LockProcess | |
case class FailedUnlock(id: Ident, e: Throwable) extends LockProcess | |
type Lock = Validated[FailedLock, Unit] | |
type Unlock = Validated[FailedLock, Unit] |
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 uk.ac.wellcome.platform.archive.common.bagit.models.{BagDigestFile, BagItemPath} | |
import uk.ac.wellcome.platform.archive.common.storage.models.ChecksumAlgorithm | |
case class FileManifest( | |
algorithm: ChecksumAlgorithm, | |
files: List[BagDigestFile] | |
) | |
object FileManifestUpdate { |
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 scala.concurrent.Future | |
sealed trait Result[Id] { | |
val id: Id | |
} | |
trait Completed[Id] extends Result[Id] | |
trait Retry[Id] extends Result[Id] |