text:
# MIT license
# Copyright (c) Microsoft Corporation. All rights reserved.
# See LICENSE in the project root for full license information.

module BoundingBoxes

using FromFile: @from
using StaticArrays: SVector, SMatrix

@from "Transforms.jl" import Transforms: Transform
@from "Rays.jl" import Rays: AbstractRay, origin, direction

# export BoundingBox, doesintersect

"""
    BoundingBox{T<:Real}

Axis-aligned three-dimensional bounding box.

```julia
BoundingBox(xmin::T, xmax::T, ymin::T, ymax::T, zmin::T, zmax::T)
BoundingBox(s::Surface{T})
BoundingBox(s::ParametricSurface{T,3}, transform::Transform{T} = identitytransform(T))
BoundingBox(c::CSGTree{T})
BoundingBox(tri::Triangle{T})
BoundingBox(triangles::AbstractVector{Triangle{T}})
BoundingBox(points::AbstractArray{SVector{3,T}})
BoundingBox(la::LensAssembly{T})
```
"""
struct BoundingBox{T <: Real}
    xmin::T
    ymin::T
    zmin::T
    xmax::T
    ymax::T
    zmax::T

    function BoundingBox(
        xmin::T,
        xmax::T,
        ymin::T,
        ymax::T,
        zmin::T,
        zmax::T,
    ) where {T <: Real}
        # if anything is NaN then we want to fall back to the infinite bounding box
        # if the input bounds are infinite then we also want to fall back to the infinite bounding box - this is necessary because the signs of the Infinity can sometimes get messed up
        # isinf(-Inf) == true so this works for any infinity
        xmin = isnan(xmin) || isinf(xmin) ? typemin(T) : xmin
        ymin = isnan(ymin) || isinf(ymin) ? typemin(T) : ymin
        zmin = isnan(zmin) || isinf(zmin) ? typemin(T) : zmin
        xmax = isnan(xmax) || isinf(xmax) ? typemax(T) : xmax
        ymax = isnan(ymax) || isinf(ymax) ? typemax(T) : ymax
        zmax = isnan(zmax) || isinf(zmax) ? typemax(T) : zmax
        if xmin <= xmax && ymin <= ymax && zmin <= zmax
            return new{T}(xmin, ymin, zmin, xmax, ymax, zmax)
        else
            throw(ErrorException("Invalid bounding box"))
        end
    end
end

function BoundingBox(points::AbstractArray{SVector{3, T}}) where {T <: Real}
    xmax = maximum((x) -> x[1], points)
    ymax = maximum((x) -> x[2], points)
    zmax = maximum((x) -> x[3], points)
    xmin = minimum((x) -> x[1], points)
    ymin = minimum((x) -> x[2], points)
    zmin = minimum((x) -> x[3], points)
    return BoundingBox(xmin, xmax, ymin, ymax, zmin, zmax)
end

function area(a::BoundingBox{T}) where {T <: Real}
    dx = a.xmax - a.xmin
    dy = a.ymax - a.ymin
    dz = a.zmax - a.zmin
    return 2 * (dx * dy + dy * dz + dz * dx)
end

# Sam changed these to 'Base.union' on 2022-02-26
Base.union(::Nothing, b::BoundingBox{T}) where {T <: Real} = b
Base.union(a::BoundingBox{T}, ::Nothing) where {T <: Real} = a

function Base.union(a::BoundingBox{T}, b::BoundingBox{T}) where {T <: Real}
    return BoundingBox(
        min(a.xmin, b.xmin),
        max(a.xmax, b.xmax),
        min(a.ymin, b.ymin),
        max(a.ymax, b.ymax),
        min(a.zmin, b.zmin),
        max(a.zmax, b.zmax),
    )
end

function intersection(a::BoundingBox{T}, b::BoundingBox{T}) where {T <: Real}
    if a.xmax < b.xmin ||
       a.ymax < b.ymin ||
       a.zmax < b.zmin ||
       b.xmax < a.xmin ||
       b.ymax < a.ymin ||
       b.zmax < b.zmin
        @info a, b
        return nothing
    else
        return BoundingBox(
            max(a.xmin, b.xmin),
            min(a.xmax, b.xmax),
            max(a.ymin, b.ymin),
            min(a.ymax, b.ymax),
            max(a.zmin, b.zmin),
            min(a.zmax, b.zmax),
        )
    end
end

"""
    doesintersect(bbox::BoundingBox{T}, r::AbstractRay{T,3}) -> Bool

Tests whether `r` intersects an axis-aligned [`BoundingBox`](@ref), `bbox`.
"""
function doesintersect(
    a::BoundingBox{T},
    r::AbstractRay{T, 3},
) where {T <: Real}
    if inside(a, origin(r)) || onsurface(a, origin(r))
        return true
    end

    d = direction(r)
    o = origin(r)

    # Infs and zeros get us into all kinds of problems with AutoDiff here..
    # work arounds are possible in all cases, the code just gets messy :(
    # really we are doing this:
    #     dfx = one(T) / d[1]
    #     dfy = one(T) / d[2]
    #     dfz = one(T) / d[3]
    #     t1 = (a.xmin - o[1]) * dfx
    #     t2 = (a.xmax - o[1]) * dfx
    #     t3 = (a.ymin - o[2]) * dfy
    #     t4 = (a.ymax - o[2]) * dfy
    #     t5 = (a.zmin - o[3]) * dfz
    #     t6 = (a.zmax - o[3]) * dfz
    # tmin = max(max(min(t1, t2), min(t3, t4)), min(t5, t6))
    # tmax = min(min(max(t1, t2), max(t3, t4)), max(t5, t6))

    tmin = typemin(T)
    tmax = typemax(T)

    if d[1] != zero(T)
        # don't really understand why the gradient fails here is xmin or xmax is Inf, but this fixes it
        tx1 = isinf(a.xmin) ? sign(d[1]) * a.xmin : (a.xmin - o[1]) / d[1]
        tx2 = isinf(a.xmax) ? sign(d[1]) * a.xmax : (a.xmax - o[1]) / d[1]
    else
        # avoiding divide by zero (when d[1] == 0) to preserve gradients
        tx1 = sign(a.xmin - o[1]) * typemax(T)
        tx2 = sign(a.xmax - o[1]) * typemax(T)
    end
    # avoid min/max on Infs to preserve gradients
    if tx1 > tx2
        if tmin < tx2
            tmin = tx2
        end
        if tmax > tx1
            tmax = tx1
        end
    else
        if tmin < tx1
            tmin = tx1
        end
        if tmax > tx2
            tmax = tx2
        end
    end

    # below uses the same NaN avoidance techniques...
    if d[2] != zero(T)
        ty1 = isinf(a.ymin) ? sign(d[2]) * a.ymin : (a.ymin - o[2]) / d[2]
        ty2 = isinf(a.ymax) ? sign(d[2]) * a.ymax : (a.ymax - o[2]) / d[2]
    else
        ty1 = sign(a.ymin - o[2]) * typemax(T)
        ty2 = sign(a.ymax - o[2]) * typemax(T)
    end
    if ty1 > ty2
        if tmin < ty2
            tmin = ty2
        end
        if tmax > ty1
            tmax = ty1
        end
    else
        if tmin < ty1
            tmin = ty1
        end
        if tmax > ty2
            tmax = ty2
        end
    end

    if d[3] != zero(T)
        tz1 = isinf(a.zmin) ? sign(d[3]) * a.zmin : (a.zmin - o[3]) / d[3]
        tz2 = isinf(a.zmax) ? sign(d[3]) * a.zmax : (a.zmax - o[3]) / d[3]
    else
        tz1 = sign(a.zmin - o[3]) * typemax(T)
        tz2 = sign(a.zmax - o[3]) * typemax(T)
    end
    if tz1 > tz2
        if tmin < tz2
            tmin = tz2
        end
        if tmax > tz1
            tmax = tz1
        end
    else
        if tmin < tz1
            tmin = tz1
        end
        if tmax > tz2
            tmax = tz2
        end
    end

    return tmax >= tmin && tmax > zero(T)
end

function inside(a::BoundingBox{T}, p::SVector{3, T}) where {T <: Real}
    return a.xmin < p[1] < a.xmax &&
           a.ymin < p[2] < a.ymax &&
           a.zmin < p[3] < a.zmax
end

function onsurface(a::BoundingBox{T}, p::SVector{3, T}) where {T <: Real}
    return (
               (p[1] === a.xmin || p[1] === a.xmax) &&
               a.ymin < p[2] < a.ymax &&
               a.zmin < p[3] < a.zmax
           ) ||
           (
               a.xmin < p[1] < a.xmax &&
               (p[2] === a.ymin || p[2] === a.ymax) &&
               a.zmin < p[3] < a.zmax
           ) ||
           (
               a.xmin < p[1] < a.xmax &&
               a.ymin < p[2] < a.ymax &&
               (p[3] === a.zmin || p[3] === a.zmax)
           )
end

"""
    surfaceintersection(bbox::BoundingBox{T}, r::AbstractRay{T,3}) -> Union{EmptyInterval{T},Interval{T}}

Calculates the intersection of `r` with an axis-aligned [`BoundingBox`](@ref), `bbox`.

Returns an [`EmptyInterval`](@ref) if there is no intersection or an [`Interval`](@ref) if there is one or two intersections.
Note that the uv of the returned intersection is always **0**.
"""
function surfaceintersection(
    a::BoundingBox{T},
    r::AbstractRay{T, 3},
) where {T <: Real}
    d = direction(r)
    o = origin(r)

    # Infs and zeros get us into all kinds of problems with AutoDiff here..
    # work arounds are possible in all cases, the code just gets messy :(
    # really we are doing this:
    #     dfx = one(T) / d[1]
    #     dfy = one(T) / d[2]
    #     dfz = one(T) / d[3]
    #     t1 = (a.xmin - o[1]) * dfx
    #     t2 = (a.xmax - o[1]) * dfx
    #     t3 = (a.ymin - o[2]) * dfy
    #     t4 = (a.ymax - o[2]) * dfy
    #     t5 = (a.zmin - o[3]) * dfz
    #     t6 = (a.zmax - o[3]) * dfz
    # tmin = max(max(min(t1, t2), min(t3, t4)), min(t5, t6))
    # tmax = min(min(max(t1, t2), max(t3, t4)), max(t5, t6))

    tmin = typemin(T)
    tmax = typemax(T)
    upper_normal = nothing
    lower_normal = nothing

    if d[1] != zero(T)
        # don't really understand why the gradient fails here is xmin or xmax is Inf, but this fixes it
        tx1 = isinf(a.xmin) ? sign(d[1]) * a.xmin : (a.xmin - o[1]) / d[1]
        tx2 = isinf(a.xmax) ? sign(d[1]) * a.xmax : (a.xmax - o[1]) / d[1]
    else
        # avoiding divide by zero (when d[1] == 0) to preserve gradients
        tx1 = sign(a.xmin - o[1]) * typemax(T)
        tx2 = sign(a.xmax - o[1]) * typemax(T)
    end
    # avoid min/max on Infs to preserve gradients
    if tx1 > tx2
        if tmin < tx2
            lower_normal = SVector{3, T}(1, 0, 0)
            tmin = tx2
        end
        if tmax > tx1
            upper_normal = SVector{3, T}(-1, 0, 0)
            tmax = tx1
        end
    else
        if tmin < tx1
            lower_normal = SVector{3, T}(-1, 0, 0)
            tmin = tx1
        end
        if tmax > tx2
            upper_normal = SVector{3, T}(1, 0, 0)
            tmax = tx2
        end
    end

    # below uses the same NaN avoidance techniques...
    if d[2] != zero(T)
        ty1 = isinf(a.ymin) ? sign(d[2]) * a.ymin : (a.ymin - o[2]) / d[2]
        ty2 = isinf(a.ymax) ? sign(d[2]) * a.ymax : (a.ymax - o[2]) / d[2]
    else
        ty1 = sign(a.ymin - o[2]) * typemax(T)
        ty2 = sign(a.ymax - o[2]) * typemax(T)
    end
    if ty1 > ty2
        if tmin < ty2
            lower_normal = SVector{3, T}(0, 1, 0)
            tmin = ty2
        end
        if tmax > ty1
            upper_normal = SVector{3, T}(0, -1, 0)
            tmax = ty1
        end
    else
        if tmin < ty1
            lower_normal = SVector{3, T}(0, -1, 0)
            tmin = ty1
        end
        if tmax > ty2
            upper_normal = SVector{3, T}(0, 1, 0)
            tmax = ty2
        end
    end

    if d[3] != zero(T)
        tz1 = isinf(a.zmin) ? sign(d[3]) * a.zmin : (a.zmin - o[3]) / d[3]
        tz2 = isinf(a.zmax) ? sign(d[3]) * a.zmax : (a.zmax - o[3]) / d[3]
    else
        tz1 = sign(a.zmin - o[3]) * typemax(T)
        tz2 = sign(a.zmax - o[3]) * typemax(T)
    end
    if tz1 > tz2
        if tmin < tz2
            lower_normal = SVector{3, T}(0, 0, 1)
            tmin = tz2
        end
        if tmax > tz1
            upper_normal = SVector{3, T}(0, 0, -1)
            tmax = tz1
        end
    else
        if tmin < tz1
            lower_normal = SVector{3, T}(0, 0, -1)
            tmin = tz1
        end
        if tmax > tz2
            upper_normal = SVector{3, T}(0, 0, 1)
            tmax = tz2
        end
    end

    if !(tmax >= tmin && tmax > zero(T))
        return EmptyInterval(T)
    else
        if tmin <= zero(T)
            if tmax == typemax(T)
                return rayorigininterval(Infinity(T))
            else
                return rayorigininterval(
                    Intersection(
                        tmax,
                        point(r, tmax),
                        upper_normal,
                        zero(T),
                        zero(T),
                        NullInterface(T),
                    ),
                )
            end
        else
            lower = Intersection(
                tmin,
                point(r, tmin),
                lower_normal,
                zero(T),
                zero(T),
                NullInterface(T),
            )
            if tmax == typemax(T)
                return positivehalfspace(lower)
            else
                return Interval(
                    lower,
                    Intersection(
                        tmax,
                        point(r, tmax),
                        upper_normal,
                        zero(T),
                        zero(T),
                        NullInterface(T),
                    ),
                )
            end
        end
    end
end

end # module


text:
using DifferentialEquations
using PyCall
using PyPlot

function plottimeseries(sol, siay, titlelabel)
    t1 = [x / siay for x in sol.t]
    θ1 = [x[1] for x in sol.u]
    v1 = [x[2] for x in sol.u]
    σ1 = [x[3] for x in sol.u]
    τ1 = [x[4] for x in sol.u]
    h1 = [x[5] for x in sol.u]

    figure(figsize = (12, 18))
    subplot(5, 2, 1)
    plot(t1, θ1, "-b", linewidth = 0.5)
    yscale("log")
    ylabel(L"\theta")
    subplot(5, 2, 2)
    plot(1:1:length(t1), θ1, "-b", linewidth = 0.5)
    yscale("log")
    ylabel(L"\theta")

    subplot(5, 2, 3)
    plot(t1, v1, "-b", linewidth = 0.5)
    yscale("log")
    xlabel("time (years)")
    ylabel("v (m/s)")
    subplot(5, 2, 4)
    plot(1:1:length(t1), v1, "-b", linewidth = 0.5)
    yscale("log")
    xlabel("time (step)")
    ylabel("v (m/s)")
    suptitle(titlelabel)

    subplot(5, 2, 5)
    plot(t1, σ1, "-b", linewidth = 0.5)
    yscale("log")
    xlabel("time (years)")
    ylabel("normal stress (Pa)")
    subplot(5, 2, 6)
    plot(1:1:length(t1), σ1, "-b", linewidth = 0.5)
    yscale("log")
    xlabel("time (step)")
    ylabel("normal stress (Pa)")

    subplot(5, 2, 7)
    plot(t1, τ1, "-b", linewidth = 0.5)
    yscale("log")
    xlabel("time (years)")
    ylabel("shear stress (Pa)")
    subplot(5, 2, 8)
    plot(1:1:length(t1), τ1, "-b", linewidth = 0.5)
    yscale("log")
    xlabel("time (step)")
    ylabel("shear stress (Pa)")

    subplot(5, 2, 9)
    plot(t1, h1, "-b", linewidth = 0.5)
    # yscale("log")
    xlabel("time (years)")
    ylabel("height (m)")
    subplot(5, 2, 10)
    plot(1:1:length(t1), h1, "-b", linewidth = 0.5)
    # yscale("log")
    xlabel("time (step)")
    ylabel("height (m)")

    suptitle(titlelabel)
    return nothing
end

function aginglaw(v, theta, dc)
    return 1 - theta * v / dc
end

function sliplaw(v, theta, dc)
    return -v * theta / dc * log(v * theta / dc)
end

# function derivs!(du, u, p, t)
#     dc, η, σn, a, b, μ, Vp, L, ρ, statelaw = p
#     θ = u[1]
#     v = u[2]
#     du[1] = statelaw(v, θ, dc)
#     du[2] = 1 / (η / σn + a / v) * (μ * (Vp - v) / (L * σn) - b * du[1] / θ)
#     return nothing
# end

function derivs!(dudt, u, p, t)
    dc, η, a, b, μ, Vp, L, ρ, statelaw, α, β, g = p
    θ = u[1]
    v = u[2]
    σ = u[3]
    τ = u[4]
    h = u[5]
    dτdt = μ*(Vp-v)/L # + 0.1*dudt[3]
    # dτdt = μ*(Vp-0)/L # + 0.1*dudt[3]

    dudt[1] = statelaw(v, θ, dc)
    dudt[2] = 1/(η/σ + a/v) * (dτdt/σ - b*dudt[1]/θ + (η*v-τ)*dudt[3]/σ^2)
    dudt[3] = ρ*g*dudt[5]
    dudt[4] = dτdt
    dudt[5] = α*v - β*h^2
    return nothing
end

function rstopo()
    #! Model parameters
    siay = 365.25 * 24 * 60 * 60
    tspan = (0.0, siay * 5000.0)
    μ = 3e10
    ν = 0.25
    ρ = 2700.0
    η = μ / (2.0 * sqrt(μ/ρ))
    L = 60 * 1e3
    a = 0.015
    b = 0.02
    α = sind(45) # Should be given by trig function based on dip of fault
    # β = 1e-8 # Check Whipple and Meade (2006)...should be small  THIS WORKED!!!
    # β = 1e-17 # Check Whipple and Meade (2006)...should be small
    β = 1e-9 # Check Whipple and Meade (2006)...should be small

    vp = 1e-9
    σn = 30e6
    g = 9.81
    h = σn / (ρ*g)
    dc = 0.1
    abstol = 1e-4
    reltol = 1e-4

    #! Time integrate
    icsclassic = [1e8; vp / 1000; σn; 0; h]
    # pclassic = (dc, η, a, b, μ, vp, L, ρ, aginglaw, α, β, g)
    pclassic = (dc, η, a, b, μ, vp, L, ρ, aginglaw, α, β, g)

    probclassic = ODEProblem(derivs!, icsclassic, tspan, pclassic)
    # solclassic = solve(probclassic, RK4(), abstol=abstol, reltol=reltol)
    solclassic = solve(probclassic, DP8(), abstol=abstol, reltol=reltol)

    #! Plot results
    close("all")
    plottimeseries(solclassic, siay, "RSF (classic)")

    return nothing
end
rstopo()

ext: jl


text:
# predefined adaptors for working with types from the Julia standard library

## Base

adapt_structure(to, xs::Union{Tuple,NamedTuple}) = map(x->adapt(to,x), xs)

## Array wrappers

using LinearAlgebra

# database of array wrappers, for use throughout the package
#
# LHS entries are a symbolic type with AT for the array type
#
# RHS entries consist of a closure to reconstruct the wrapper, with as arguments
# a wrapper instance and mutator function to apply to the inner array
const wrappers = (
  :(SubArray{<:Any,<:Any,AT})                     => (A,mut)->SubArray(mut(parent(A)), mut(parentindices(A))),
  :(PermutedDimsArray{<:Any,<:Any,<:Any,<:Any,AT})=> (A,mut)->PermutedDimsArray(mut(parent(A)), permutation(A)),
  :(Base.ReshapedArray{<:Any,<:Any,AT,<:Any})     => (A,mut)->Base.reshape(mut(parent(A)), size(A)),
  :(LinearAlgebra.Adjoint{<:Any,AT})              => (A,mut)->LinearAlgebra.adjoint(mut(parent(A))),
  :(LinearAlgebra.Transpose{<:Any,AT})            => (A,mut)->LinearAlgebra.transpose(mut(parent(A))),
  :(LinearAlgebra.LowerTriangular{<:Any,AT})      => (A,mut)->LinearAlgebra.LowerTriangular(mut(parent(A))),
  :(LinearAlgebra.UnitLowerTriangular{<:Any,AT})  => (A,mut)->LinearAlgebra.UnitLowerTriangular(mut(parent(A))),
  :(LinearAlgebra.UpperTriangular{<:Any,AT})      => (A,mut)->LinearAlgebra.UpperTriangular(mut(parent(A))),
  :(LinearAlgebra.UnitUpperTriangular{<:Any,AT})  => (A,mut)->LinearAlgebra.UnitUpperTriangular(mut(parent(A))),
  :(LinearAlgebra.Diagonal{<:Any,AT})             => (A,mut)->LinearAlgebra.Diagonal(mut(parent(A))),
  :(LinearAlgebra.Tridiagonal{<:Any,AT})          => (A,mut)->LinearAlgebra.Tridiagonal(mut(A.dl), mut(A.d), mut(A.du)),
)

permutation(::PermutedDimsArray{T,N,perm}) where {T,N,perm} = perm

for (W, ctor) in wrappers
    mut = :(A -> adapt(to, A))
    @eval adapt_structure(to, wrapper::$W where {AT <: Any}) = $ctor(wrapper, $mut)
end

## Broadcast

import Base.Broadcast: Broadcasted, Extruded

adapt_structure(to, bc::Broadcasted{Style}) where Style =
  Broadcasted{Style}(bc.f, map(arg->adapt(to, arg), bc.args), bc.axes)

adapt_structure(to, ex::Extruded) =
    Extruded(adapt(to, ex.x), ex.keeps, ex.defaults)


text:
using Gadfly, RDatasets

set_default_plot_size(6inch, 4inch)

births = dataset("HistData", "Arbuthnot")

plot(births, x=:Year, y=Col.value(:Males, :Females),
     color=Col.index(:Males, :Females), Geom.line)


text:
using Documenter, RadiiPolynomial

makedocs(;
    modules = [RadiiPolynomial],
    authors = "Olivier Hénot",
    sitename = "RadiiPolynomial.jl",
    format = Documenter.HTML(;
        prettyurls = get(ENV, "CI", "false") == "true",
        canonical = "https://OlivierHnt.github.io/RadiiPolynomial.jl"
    ),
    pages = [
        "Home" => "index.md",
        "Radii Polynomial Theorem" => "radii_polynomial_theorem.md",
        "Sequence spaces" => [
            "sequence_spaces/vector_spaces.md",
            "sequence_spaces/sequences.md",
            "sequence_spaces/linear_operators.md",
            "sequence_spaces/norms.md",
            "sequence_spaces/special_operators.md"
        ],
        "Examples" => [
            "Finite-dimensional proofs" => [
                "examples/finite_dimensional_proofs/spiderweb.md",
                "examples/finite_dimensional_proofs/pseudo_arclength.md"
            ],
            "Infinite-dimensional proofs" => [
                "examples/infinite_dimensional_proofs/ivp.md"
            ]
        ]
    ]
)

deploydocs(;
    repo = "github.com/OlivierHnt/RadiiPolynomial.jl",
    devbranch = "main"
)


text:
# Copyright 2014 Mitchell Kember. Subject to the MIT License.
# Google Code Jam Qualification Round 2014
# Problem C: Minesweeper Master

# Computes a minesweeper grid with, r rows, c columns, and m mines that can be
# won win a single click on the cell labelled 'c'.
function oneclickgrid(r, c, m)
	if m == 0
		grid = fill('.', r, c)
		grid[1,1] = 'c'
		return grid
	end
	if r <= 2 && c <= 2
		return nothing
	end
	ns = r*c - m
	grid = fill('*', r, c)
	grid[1,1] = '.'
	if solve!(grid, ns)
		grid[1,1] = 'c'
		return grid
	end
	if r != 1 && c != 1
		fill!(grid, '*')
		grid[2,2] = '.'
		if solve!(grid, ns)
			grid[2,2] = 'c'
			return grid
		end
	end
	if r >= 3 && c >= 3
		fill!(grid, '*')
		grid[3,3] = '.'
		if solve!(grid, ns)
			grid[3,3] = 'c'
			return grid
		end
	end
	nothing
end

# Attempts to solve the grid so that there are ns safe cells which will all be
# revealed with a one click on the 'c' cell. Returns true if sucessful.
function solve!(g, ns)
	sz = size(g)
	nsc = 1
	while nsc < ns
		ind = (0,0)
		smallest = 9
		for i = 1:sz[1], j = 1:sz[2]
			if g[i,j] == '.'
				n = nmines(g, i, j)
				if nsc + n == ns
					demine_neighbours!(g, i, j)
					return true
				end
				if n > 0 && n < smallest
					ind = (i,j)
					smallest = n
				end
			end
		end
		if smallest == 9
			return false
		end
		demine_neighbours!(g, ind[1], ind[2])
		nsc += smallest
	end
	false
end

# Returns the number of mines neibouring the cell at (i,j).
function nmines(g, i, j)
	sz = size(g)
	f(x,y) = (x >= 1 && y >= 1 && x <= sz[1] && y <= sz[2] && g[x,y] == '*')?1:0
	+(f(i-1,j-1),f(i-1,j),f(i-1,j+1),f(i,j-1),f(i,j+1),f(i+1,j-1),f(i+1,j),f(i+1,j+1))
end

# Removes mines from cells neighbouring (i,j).
function demine_neighbours!(g, i, j)
	sz = size(g)
	f(x,y) = (x >= 1 && y >= 1 && x <= sz[1] && y <= sz[2])?g[x,y]='.':nothing
	f(i-1,j-1);f(i-1,j);f(i-1,j+1);f(i,j-1);f(i,j+1);f(i+1,j-1);f(i+1,j);f(i+1,j+1)
end

# Converts a grid, or nothing, to a string.
function message(grid)
	if grid === nothing
		"Impossible"
	else
		join(map(i -> join(grid[i,:]), 1:size(grid, 1)), '\n')
	end
end

function main()
	n = int(readline())
	for i = 1:n
		r, c, m = int(split(readline()))
		grid = oneclickgrid(r, c, m)
		println("Case #$i:")
		println(message(grid))
	end
end

main()


text:
# ---
# title: 1591. Strange Printer II
# id: problem1591
# author: Tian Jun
# date: 2020-10-31
# difficulty: Hard
# categories: Greedy
# link: <https://leetcode.com/problems/strange-printer-ii/description/>
# hidden: true
# ---
#
# There is a strange printer with the following two special requirements:
#
#   * On each turn, the printer will print a solid rectangular pattern of a single color on the grid. This will cover up the existing colors in the rectangle.
#   * Once the printer has used a color for the above operation, **the same color cannot be used again**.
#
# You are given a `m x n` matrix `targetGrid`, where `targetGrid[row][col]` is
# the color in the position `(row, col)` of the grid.
#
# Return `true` _if it is possible to print the matrix_`targetGrid` _,_
# _otherwise, return_`false`.
#
#
#
# **Example 1:**
#
# ![](https://assets.leetcode.com/uploads/2020/08/15/sample_1_1929.png)
#
#
#
#     Input: targetGrid = [[1,1,1,1],[1,2,2,1],[1,2,2,1],[1,1,1,1]]
#     Output: true
#
#
# **Example 2:**
#
# ![](https://assets.leetcode.com/uploads/2020/08/15/sample_2_1929.png)
#
#
#
#     Input: targetGrid = [[1,1,1,1],[1,1,3,3],[1,1,3,4],[5,5,1,4]]
#     Output: true
#
#
# **Example 3:**
#
#
#
#     Input: targetGrid = [[1,2,1],[2,1,2],[1,2,1]]
#     Output: false
#     Explanation: It is impossible to form targetGrid because it is not allowed to print the same color in different turns.
#
# **Example 4:**
#
#
#
#     Input: targetGrid = [[1,1,1],[3,1,3]]
#     Output: false
#
#
#
#
# **Constraints:**
#
#   * `m == targetGrid.length`
#   * `n == targetGrid[i].length`
#   * `1 <= m, n <= 60`
#   * `1 <= targetGrid[row][col] <= 60`
#
#
## @lc code=start
using LeetCode

## add your code here:
## @lc code=end


text:
struct IfElseCovariate{S<:AbstractFloat, T<:AbstractFloat, U<:AbstractFloat} <: AbstractCovariate{U}
    name::String
    ifboolvar::AbstractBoolVariate
    truecovariate::AbstractCovariate{S}
    falsecovariate::AbstractCovariate{T}
end

Base.length(var::IfElseCovariate) = length(var.ifboolvar)

function IfElseCovariate(name::String, ifboolvar::AbstractBoolVariate, truecovariate::AbstractCovariate{S}, falsecovariate::AbstractCovariate{T}) where {S<:AbstractFloat} where {T<:AbstractFloat}
    U = promote_type(S, T)
    IfElseCovariate{S, T, U}(name, ifboolvar, truecovariate, falsecovariate)
end

function IfElseCovariate(ifboolvar::AbstractBoolVariate, truecovariate::AbstractCovariate{S}, falsecovariate::AbstractCovariate{T}) where {S<:AbstractFloat} where {T<:AbstractFloat}
    IfElseCovariate("", ifboolvar, truecovariate, falsecovariate)
end

function slice(cov::IfElseCovariate{S, T, U}, fromobs::Integer, toobs::Integer, slicelength::Integer) where {S<:AbstractFloat} where {T<:AbstractFloat} where {U<:AbstractFloat}
    ifboolvar = cov.ifboolvar
    truecov = cov.truecovariate
    falsecov = cov.falsecovariate
    f = ((x, y, z) -> x ? y : z)
    slicelength = verifyslicelength(fromobs, toobs, slicelength)
    slices = zip3(slice(ifboolvar, fromobs, toobs, slicelength), slice(truecov, fromobs, toobs, slicelength),
                  slice(falsecov, fromobs, toobs, slicelength))
    mapslice3(f, slices, slicelength, U)
end

max_stars_repo_name: vikashdwd/JuML

max_issues_repo_name: vikashdwd/JuML

max_forks_repo_name: vikashdwd/JuML


text:
using KernelAbstractions
using StaticArrays
using Test

const TILE_DIM = 32

@kernel function coalesced_matmul_kernel!(output, @Const(input1), @Const(input2), N, R, M,
                                             ::Val{BANK}=Val(1)) where BANK
     gi, gj = @index(Group, NTuple)
     i, j   = @index(Local, NTuple)

     TILE_DIM = @uniform groupsize()[1]

     # +1 to avoid bank conflicts on shared memory
     tile1 = @localmem eltype(output) (TILE_DIM+BANK, TILE_DIM)
     tile2 = @localmem eltype(output) (TILE_DIM+BANK, TILE_DIM)

     # private variable for tile output
     outval = @private eltype(output) 1
     @inbounds outval[1] = -zero(eltype(output))

     @uniform N = size(output, 1)
     # number of tiles depends on inner dimension
     @uniform NUM_TILES = div(R + TILE_DIM - 1, TILE_DIM)

     # loop over all tiles needed for this calculation
     for t in 0:NUM_TILES-1
         # Can't use @index(Global), because we use a smaller ndrange
         I = (gi-1) * TILE_DIM + i
         J = (gj-1) * TILE_DIM + j

         # load inputs into tiles, with bounds checking for non-square matrices
         if I <= N && t*TILE_DIM + j <= R
             @inbounds tile1[i, j] = input1[I, t*TILE_DIM + j]
         else
             @inbounds tile1[i, j] = 0.0
         end
         if t*TILE_DIM + i <= R && J <= M
             @inbounds tile2[i, j] = input2[t*TILE_DIM + i, J]
         else
             @inbounds tile2[i, j] = 0.0
         end

         # wait for all tiles to be loaded
         @synchronize

         # get global values again
         I = (gi-1) * TILE_DIM + i
         J = (gj-1) * TILE_DIM + j

         # calculate value of spot in output, use temporary value to allow for vectorization
         out = zero(eltype(output))
         @simd for k in 1:TILE_DIM
             @inbounds out += tile1[i, k] * tile2[k, j]
         end
         outval[1] += out

         @synchronize
     end

     # get global indices again
     I = (gi-1) * TILE_DIM + i
     J = (gj-1) * TILE_DIM + j

     # save if inbounds
     if I <= N && J <= M
         @inbounds output[I, J] = outval[1]
     end
end

N = 1024
R = 512
M = 2048
A = rand(N, R)
B = rand(R, M)
C = zeros(N, M)

kern = coalesced_matmul_kernel!(CPU(), (TILE_DIM, TILE_DIM))

wait(kern(C, A, B, N, R, M, ndrange=size(C)))
@test isapprox(A*B, C)


text:
function initialize()
    Random.seed!(267)
    model = ABM(
        Agent3,
        GridSpace((10, 10));
        properties = Dict(:year => 0, :tick => 0, :flag => false),
    )
    add_agent!((4, 3), model, rand())
    add_agent!((7, 5), model, rand())
    add_agent!((2, 9), model, rand())
    return model
end

function agent_step!(agent, model)
    if rand() < 0.1
        agent.weight += 0.05
    end
    if model.tick % 365 == 0
        agent.weight *= 2
    end
end
function model_step!(model)
    model.tick += 1
    model.flag = rand(Bool)
    if model.tick % 365 == 0
        model.year += 1
    end
end

x_position(agent) = first(agent.pos)
model = initialize()

@testset "DataFrame init" begin
    props = [:weight]
    @test sprint(show, "text/csv", describe(init_agent_dataframe(model, props), :eltype)) == "\"variable\",\"eltype\"\n\"step\",\"Int64\"\n\"id\",\"Int64\"\n\"weight\",\"Float64\"\n"
    props = [:year]
    @test sprint(show, "text/csv", describe(init_model_dataframe(model, props), :eltype)) == "\"variable\",\"eltype\"\n\"step\",\"Int64\"\n\"year\",\"Int64\"\n"
end

@testset "aggname" begin
    @test aggname(:weight, mean) == Symbol("mean(weight)")
    @test aggname(x_position, length) == Symbol("length(x_position)")
end

@testset "Aggregate Collections" begin
    props = [:weight]
    df = init_agent_dataframe(model, props)
    collect_agent_data!(df, model, props, 1)
    # Expecting weight values of all three agents. ID and step included.
    @test size(df) == (3, 3)
    @test names(df) == [:step, :id, :weight]
    @test mean(df[!, :weight]) ≈ 0.3917615139

    props = [(:weight, mean)]
    df = init_agent_dataframe(model, props)
    collect_agent_data!(df, model, props, 1)
    # Activate aggregation. Weight column is expected to be one value for this step,
    # renamed mean(weight). ID is meaningless and will therefore be dropped.
    @test size(df) == (1, 2)
    @test names(df) == [:step, Symbol("mean(weight)")]
    @test df[1, Symbol("mean(weight)")] ≈ 0.3917615139

    # Add a function as a property
    props = [:weight, x_position]
    df = init_agent_dataframe(model, props)
    collect_agent_data!(df, model, props, 1)
    @test size(df) == (3, 4)
    @test names(df) == [:step, :id, :weight, :x_position]
    @test mean(df[!, :x_position]) ≈ 4.3333333

    props = [(:weight, mean), (x_position, mean)]
    df = init_agent_dataframe(model, props)
    collect_agent_data!(df, model, props, 1)
    @test size(df) == (1, 3)
    @test names(df) == [:step, Symbol("mean(weight)"), Symbol("mean(x_position)")]
    @test df[1, Symbol("mean(x_position)")] ≈ 4.3333333
end

@testset "High-level API for Collections" begin
    # Extract data from the model every year for five years,
    # with the average `weight` of all agents every six months.
    each_year(model, step) = step % 365 == 0
    six_months(model, step) = step % 182 == 0
    agent_data, model_data = run!(
        model,
        agent_step!,
        model_step!,
        365 * 5;
        when_model = each_year,
        when = six_months,
        mdata = [:flag, :year],
        adata = [(:weight, mean)],
    )

    @test size(agent_data) == (11, 2)
    @test names(agent_data) == [:step, Symbol("mean(weight)")]
    @test maximum(agent_data[!, :step]) == 1820

    @test size(model_data) == (6, 3)
    @test names(model_data) == [:step, :flag, :year]
    @test maximum(model_data[!, :step]) == 1825
end

@testset "Low-level API for Collections" begin
    # Generate three separate dataframes using the low level API.
    # User controls the evolution, as well as the identity of each `step`.
    # Note in this example daily data are labelled with a daily `step`,
    # and yearly data with a yearly `step`.
    model = initialize()
    model_props = [:flag, :year]
    agent_agg = [(:weight, mean)]
    agent_props = [:weight]
    daily_model_data = init_model_dataframe(model, model_props)
    daily_agent_aggregate = init_agent_dataframe(model, agent_agg)
    yearly_agent_data = init_agent_dataframe(model, agent_props)

    for year in 1:5
        for day in 1:365
            step!(model, agent_step!, model_step!, 1)
            collect_model_data!(daily_model_data, model, model_props, day * year)
            collect_agent_data!(daily_agent_aggregate, model, agent_agg, day * year)
        end
        collect_agent_data!(yearly_agent_data, model, agent_props, year)
    end

    @test size(daily_model_data) == (1825, 3)
    @test names(daily_model_data) == [:step, :flag, :year]
    @test maximum(daily_model_data[!, :step]) == 1825

    @test size(daily_agent_aggregate) == (1825, 2)
    @test names(daily_agent_aggregate) == [:step, Symbol("mean(weight)")]
    @test maximum(daily_agent_aggregate[!, :step]) == 1825

    @test size(yearly_agent_data) == (15, 3)
    @test names(yearly_agent_data) == [:step, :id, :weight]
    @test maximum(yearly_agent_data[!, :step]) == 5
end

n = 10
parameters = Dict(
    :f => [0.05, 0.07],
    :d => [0.6, 0.7, 0.8],
    :p => 0.01,
    :griddims => (20, 20),
    :seed => 2,
)
@testset "Parameter Scan" begin
    adata = [(:status, length), (:status, count)]
    data, _ = paramscan(
        parameters,
        forest_initiation;
        n = n,
        agent_step! = dummystep,
        model_step! = forest_step!,
        adata = adata,
        progress = false,
    )
    # 6 is the number of combinations of changing params
    @test size(data) == ((n+1) * 6, 5)
    data, _ = paramscan(
        parameters,
        forest_initiation;
        n = n,
        agent_step! = dummystep,
        model_step! = forest_step!,
        include_constants = true,
        adata = adata,
        progress = false,
    )
    # 6 is the number of combinations of changing params,
    # 8 is 5+3, where 3 is the number of constant parameters
    @test size(data) == ((n+1) * 6, 8)

    adata = [:status]
    data, _ = paramscan(
        parameters,
        forest_initiation;
        n = n,
        agent_step! = dummystep,
        model_step! = forest_step!,
        adata = adata,
        progress = false,
    )
    @test unique(data.step) == 0:10
    @test unique(data.f) == [0.05, 0.07]
    @test unique(data.d) == [0.6, 0.7, 0.8]
end

@testset "Parameter Scan with replicates" begin
    adata = [(:status, length), (:status, count)]
    data, _ = paramscan(
        parameters,
        forest_initiation;
        n = n,
        agent_step! = dummystep,
        model_step! = forest_step!,
        replicates = 3,
        adata = adata,
        progress = false,
    )
    # the first 6 is the number of combinations of changing params
    @test size(data) == (((n+1) * 6) * 3, 6)
end

@testset "Issue 179 fix" begin
    # only ids sorted, not properties
    model = ABM(Agent2)
    for i = 1:5
        add_agent!(model, i * 0.2)
    end
    data, _ = run!(model, dummystep, 2; adata = [:weight])
    @test data[1, :id] == 1 && data[1, :weight] ≈ 0.2
    @test data[3, :id] == 3 && data[3, :weight] ≈ 0.6
    @test data[6, :id] == 1 && data[6, :weight] ≈ 0.2
end


text:
using Test

using QuantumControlBase
using QuantumControlBase.TestUtils

@testset "dry-run" begin

    problem = dummy_control_problem()
    file_expected = joinpath(tempdir(), "dry-run.jld2")
    result, file =
        @test_logs (:info, "Would optimize and store in $file_expected") @optimize_or_load(
            tempdir(),
            problem;
            method=:dummymethod,
            filename="dry-run.jld2",
            dry_run=true,
            verbose=true
        )
    @test isnothing(result)
    @test file == file_expected

end

@testset "metadata" begin

    problem = dummy_control_problem()
    outdir = mktempdir()
    println("")
    result, file = @optimize_or_load(
        outdir,
        problem;
        method=:dummymethod,
        filename="optimization_with_metadata.jld2",
        metadata=Dict("testset" => "metadata", "method" => :dummymethod,)
    )
    @test result.converged
    @test basename(file) == "optimization_with_metadata.jld2"
    @test isfile(file)
    result_load, metadata = load_optimization(file; return_metadata=true)
    @test result_load isa QuantumControlBase.TestUtils.DummyOptimizationResult
    @test result_load.message == "Reached maximum number of iterations"
    @test metadata["testset"] == "metadata"
    @test metadata["method"] == :dummymethod

end

@testset "continue_from" begin
    problem = dummy_control_problem()
    outdir = mktempdir()
    println("")
    result, file = @optimize_or_load(
        outdir,
        problem;
        iter_stop=5,
        method=:dummymethod,
        filename="optimization_stage1.jld2"
    )
    @test result.converged
    result1 = load_optimization(file)
    result2 = optimize(problem; method=:dummymethod, iter_stop=15, continue_from=result1)
    @test result2.iter == 15
end


text:
using CDMrdata
using Test

@testset "CDMrdata.jl" begin
    for data in readdir("data")
        data = chop(data,tail=4)
        dataset = load_data(data)
        @info data
        @info typeof(dataset)
        println(" ")
    end
end

# cdm01 checked
    # - Vector of 3, data, q.matrix, group, best way to acces data["group"]

# cdm02,cdm03,cdm08,cdm09,cdm10,dcm - checked
    # Vector of 2, data, q.matrix

#cdm04
    # Vector of 3, q.matrix1, q.matrix2, data

# cdm05, cdm06
    # data, q.matrix, skills
# cdm07
    # items, data, q.matrix

# dtmr
 # skills.distribution, sim_data, data, itempars, q.matrix


text:
# This file is a part of Julia. License is MIT: https://julialang.org/license

## promote()

@test promote_type(Some{Int}, Some{Float64}) == Some
@test promote_type(Some{Int}, Some{Real}) == Some{Real}
@test promote_type(Some{Int}, Nothing) == Union{Some{Int},Nothing}

## convert()

# These conversions must fail to prevent ambiguities
# when a value to wrap is already a Some or a Nothing
@test_throws MethodError convert(Some, 1)
@test_throws MethodError convert(Union{Some, Nothing}, 1)
@test_throws MethodError convert(Some{Int}, 1)
@test_throws MethodError convert(Union{Some{Int}, Nothing}, 1)

@test convert(Some, Some(1)) === convert(Union{Some, Nothing}, Some(1)) === Some(1)
@test convert(Some{Int}, Some(1)) === convert(Union{Some{Int}, Nothing}, Some(1)) === Some(1)
@test convert(Some{Int}, Some(1.0)) === Some(1)
@test convert(Union{Some{Int}, Nothing}, Some(1.0)) === Some(1)

@test_throws MethodError convert(Some, nothing)
@test_throws MethodError convert(Some{Int}, nothing)

@test convert(Some, Some(nothing)) === Some(nothing)
@test convert(Some{Nothing}, Some(nothing)) === Some(nothing)

@test convert(Union{Some, Nothing}, nothing) === nothing
@test convert(Union{Some{Int}, Nothing}, nothing) === nothing

@test convert(Union{Int, Nothing}, nothing) === nothing
@test convert(Union{Int, Nothing}, 1) === 1
@test convert(Union{Int, Nothing}, 1.0) === 1
@test convert(Nothing, nothing) === nothing
@test_throws MethodError convert(Nothing, 1)

## show()

@test sprint(show, Some(1)) == "Some(1)"
@test sprint(show, Some(Some(1))) == "Some(Some(1))"
@test repr([Some(1)]) == "Some{$Int}[1]"
@test repr([Some(Some(1))]) == "Some{Some{$Int}}[Some(1)]"

##  == and isequal nothing

@test Some(1) != nothing
@test Some(nothing) != nothing
@test !isequal(Some(1), nothing)
@test !isequal(Some(nothing), nothing)

# coalesce()

for v in (nothing, missing)
    @test coalesce(1) === 1
    @test coalesce(v) === v
    @test coalesce(v, 1) === 1
    @test coalesce(1, v) === 1
    @test coalesce(v, v) === v
    @test coalesce(v, 1, 2) === 1
    @test coalesce(1, v, 2) === 1
    @test coalesce(v, v, 2) === 2
    @test coalesce(v, v, v) === v

    @test coalesce(Some(1)) === 1
    @test coalesce(Some(v)) === v
    @test coalesce(Some(1), 0) === 1
    @test coalesce(Some(v), 0) === v
    @test coalesce(v, Some(v)) === v
    @test coalesce(Some(1), v) === 1
    @test coalesce(v, Some(1)) === 1
    @test coalesce(v, Some(1), v) === 1
    @test coalesce(v, Some(1), Some(2)) === 1
    @test coalesce(Some(1), v, Some(2)) === 1

    @test coalesce(v, missing) === missing
    @test coalesce(v, nothing) === nothing
    @test coalesce(v, missing, v) === v
    @test coalesce(v, nothing, v) === v

    # issue #26927
    a = [missing, nothing, Some(nothing), Some(missing)]
    @test a isa Vector{Union{Missing, Nothing, Some}}
    @test a[1] === missing && a[2] === nothing && a[3] === Some(nothing) && a[4] === Some(missing)
    b = [ "replacement", "replacement", nothing, missing ]
    @test b isa Vector{Union{Missing, Nothing, String}}
    # the original operation from the issue, though it was not the source of the problem
    @test all(coalesce.(a, "replacement") .=== b)
end

# notnothing()

using Base: notnothing
@test notnothing(1) === 1
@test_throws ArgumentError notnothing(nothing)

max_stars_repo_name: ninjin/julia

max_issues_repo_name: ninjin/julia

max_forks_repo_name: ninjin/julia


text:
using Documenter, DemoCards, JSON

# 1. generate demo files
quickstart, postprocess_cb, quickstart_assets = makedemos("quickstart")
themeless_demopage, themeless_cb, themeless_assets = makedemos(joinpath("theme_gallery", "themeless"))
grid_demopage, grid_cb, grid_assets = makedemos(joinpath("theme_gallery", "grid"))
list_demopage, list_cb, list_assets = makedemos(joinpath("theme_gallery", "list"))
bulmagrid_demopage, bulmagrid_cb, bulmagrid_assets = makedemos(joinpath("theme_gallery", "bulmagrid"))

assets = collect(filter(x->!isnothing(x), Set([quickstart_assets, themeless_assets, grid_assets, list_assets, bulmagrid_assets])))

# 2. normal Documenter usage
format = Documenter.HTML(edit_link = "master",
                         prettyurls = get(ENV, "CI", nothing) == "true",
                         assets = assets)

makedocs(format = format,
         pages = [
            "Home" => "index.md",
            quickstart,
            "Concepts" => "concepts.md",
            "Partial build" => "preview.md",
            "Structure manipulation" => "structure.md",
            "Theme Gallery" => [
               themeless_demopage,
               grid_demopage,
               bulmagrid_demopage,
               list_demopage,
            ],
            "Package References" => "references.md"
         ],
         sitename = "DemoCards.jl")

# 3. postprocess after makedocs
postprocess_cb()
themeless_cb()
bulmagrid_cb()
grid_cb()
list_cb()

# a workdaround to github action that only push preview when PR has "push_preview" labels
# issue: https://github.com/JuliaDocs/Documenter.jl/issues/1225
function should_push_preview(event_path = get(ENV, "GITHUB_EVENT_PATH", nothing))
   event_path === nothing && return false
   event = JSON.parsefile(event_path)
   haskey(event, "pull_request") || return false
   labels = [x["name"] for x in event["pull_request"]["labels"]]
   return "push_preview" in labels
end

# 4. deployment
deploydocs(repo = "github.com/johnnychen94/DemoCards.jl.git",
            push_preview = should_push_preview())


text:
# This file is a part of UnsafeArrays.jl, licensed under the MIT License (MIT).

__precompile__(true)

module UnsafeArrays

include("util.jl")
include("unsafe_array.jl")
include("uview.jl")

end # module


text:
module Assignment07

export normalizeDNA,
       composition

# # uncomment the following line if you intend to use BioSequences types
# using BioSequences

"""
    normalizeDNA(::AbstractString)

Ensures that a sequence only contains valid bases
(or `'N'` for unknown bases).
Returns a String.
"""
function normalizeDNA(seq)
    seq = uppercase(string(seq))
    for base in seq
        # note: `N` indicates an unknown base
        occursin(base, "AGCTN") || error("invalid base $base")
    end
    return seq # change to `return LongDNASeq(seq)` if you want to try to use BioSequences types
end

# Your code here.
# Don't forget to export your functions!
function composition(seq)
    sequence = normalizeDNA(seq) # make uppercase string, check invalid bases
    a = c = g = t = n = 0 # sets all 4 variables to `0`

    for base in sequence
        ## add 1 to each base as it occurs
        if occursin(base, "A")
            a = a + 1
        elseif occursin(base, "C")
            c = c + 1
        elseif occursin(base, "G")
            g = g + 1
        elseif occursin(base, "T")
            t = t + 1
        elseif occursin(base, "N")
            n = n + 1
        end
    end

    return composition_dict = Dict('A'=>a, 'C'=>c, 'G'=>g, 'T'=>t,'N'=>n)
end

function gc_content(seq)
    seqlength = length(seq)

    sequence = composition(seq)
    cs = sequence['C']
    gs = sequence['G']

    return (cs + gs) / seqlength
end

function complement(base::Char)
    comp = Dict('A'=>'T',
                'T'=>'A',
                'G'=>'C',
                'C'=>'G',
                'N'=>'N')
    return comp[base]
 end

function complement(seq::AbstractString)
    seq = uppercase(seq)
    base_comp = Dict("A" => "T",
                    "T" => "A",
                    "G" => "C",
                    "C" => "G",
                    "N" => "N")
    return base_comp[sequence]
end

function complement(base)
    base = uppercase(base)

    if base == "A" || base == 'A'
        return 'T'
    elseif base == "T" || base == 'T'
        return 'A'
    elseif base == "C" || base == 'C'
        return 'G'
    elseif base == "G" || base == 'G'
        return 'C'
    else
        error("Base $base not supported.")
    end
end

    if occursin(base, "A")
        return "T"
    elseif occursin(base, "T")
        return "A"
    elseif occursin(base, "C")
        return "G"
    elseif occursin(base,"G")
        return "C"
    elseif occursin(base, "N")
        return "N"
    else
        error("Base $base not supported.")
    end

end # module Assignment07


text:
# Smearing functions

# Ref for the equations:
#    - M. Methfessel, A. T. Paxton 1989
#       "High-precision sampling for Brillouin-zone integration in metals"
#     - E. Cancès, V. Ehrlacher, D. Gontier, A. Levitt, D. Lombardi
#       "Numerical quadrature in the brillouin zone for periodic schrodinger operators"
# See also https://www.vasp.at/vasp-workshop/k-points.pdf
module Smearing

using SpecialFunctions: erf, factorial
using ForwardDiff

abstract type SmearingFunction end

"""
Occupation at `x`, where in practice x = (ε - εF) / T.
"""
occupation(S::SmearingFunction, x) = error()

"""
Derivative of the occupation function, approximation to minus the delta function.
"""
occupation_derivative(S::SmearingFunction, x) = ForwardDiff.derivative(x -> occupation(S, x), x)

"""
(f(x) - f(y))/(x - y), computed stably in the case where x and y are close
"""
function occupation_divided_difference(S::SmearingFunction, x, y, εF, temperature)
    if temperature == 0
        if x == y
            zero(x)
        else
            fx = x < εF ? 1 : 0
            fy = y < εF ? 1 : 0
            (fx-fy)/(x-y)
        end
    else
        f(z) = occupation(S, (z-εF) / temperature)
        fder(z) = occupation_derivative(S, (z-εF)/temperature) / temperature
        divided_difference_(f, fder, x, y)
    end
end
function divided_difference_(f, fder, x, y)
    # (f(x) - f(y))/(x - y) is accurate to ε/|x-y|
    # so for x ~= y we use the approximation (f'(x)+f'(y))/2,
    # which is accurate to |x-y|^2, and therefore better when |x-y| ≤ cbrt(ε)
    # The resulting method is accurate to ε^2/3
    abs(x-y) < cbrt(eps(typeof(x))) && return (fder(x) + fder(y))/2
    (f(x)-f(y)) / (x-y)
end

"""
Entropy. Note that this is a function of the energy `x`, not of `occupation(x)`.
This function satisfies s' = x f' (see https://www.vasp.at/vasp-workshop/k-points.pdf
p. 12 and https://arxiv.org/pdf/1805.07144.pdf p. 18.
"""
entropy(S::SmearingFunction, x) = error()

struct None <: SmearingFunction end
occupation(S::None, x) = x > 0 ? zero(x) : one(x)
entropy(S::None, x) = zero(x)

function xlogx(x)
    iszero(x) ? zero(x) : x * log(x)
end

struct FermiDirac <: SmearingFunction end
occupation(S::FermiDirac, x) = 1 / (1 + exp(x))
function occupation_derivative(S::FermiDirac, x)
    # ForwardDiff gets NaNs for large arguments so we help it along
    if exp(x) > floatmax(typeof(x)) / 1e3
        zero(x)
    else
        -exp(x) / (1+exp(x))^2
    end
end

# entropy(f) = -(f log f + (1-f)log(1-f)), where f = 1/(1+exp(x))
# this "simplifies" to -(x*exp(x)/(1+exp(x)) - log(1+exp(x)))
# although that is not especially useful...
function entropy(S::FermiDirac, x)
    f = occupation(S, x)
    - (xlogx(f) + xlogx(1 - f))
end

struct Gaussian <: SmearingFunction end
occupation(S::Gaussian, x) = (1 - erf(x)) / 2
entropy(S::Gaussian, x) = 1 / (2sqrt(typeof(x)(pi))) * exp(-x^2)

H1(x) = 2x
H2(x) = 4x^2 - 2
H3(x) = 8x^3 - 12x
H4(x) = 16x^4 - 48x^2 + 12
A(n, T=Float64) = (-1)^n / (factorial(n) * 4^n * sqrt(T(π)))

struct MethfesselPaxton1 <: SmearingFunction end
function occupation(S::MethfesselPaxton1, x)
    x == Inf && return zero(x)
    x == -Inf && return one(x)
    occupation(Gaussian(), x) + A(1, typeof(x))*H1(x)*exp(-x^2)
end
entropy(S::MethfesselPaxton1, x) = 1/2 * A(1, typeof(x)) * H2(x) * exp(-x^2)

struct MethfesselPaxton2 <: SmearingFunction end
function occupation(S::MethfesselPaxton2, x)
    x == Inf && return zero(x)
    x == -Inf && return one(x)
    occupation(MethfesselPaxton1(), x) + A(2, typeof(x))*H3(x)*exp(-x^2)
end
entropy(S::MethfesselPaxton2, x) = 1/2 * A(2, typeof(x)) * H4(x) * exp(-x^2)

function MethfesselPaxton(order::Integer)
    if order == 0
        Gaussian()
    elseif order == 1
        MethfesselPaxton1()
    elseif order == 2
        MethfesselPaxton2()
    else
        error("Not implemented")
    end
end

# TODO: Marzari-Vanderbilt "cold smearing"

# List of available smearing functions
smearing_methods = (None, FermiDirac, Gaussian, MethfesselPaxton1, MethfesselPaxton2)

# these are not broadcastable
import Base.Broadcast.broadcastable
Base.Broadcast.broadcastable(S::SmearingFunction) = Ref(S)
end


text:
create(c::Client, ::Type{Member}, g::AbstractGuild, u::User; kwargs...) = add_guild_member(c, g.id, u.id; kwargs...)

retrieve(c::Client, ::Type{Member}, g::AbstractGuild, u::User) = get_guild_member(c, g.id, u.id)
retrieve(c::Client, ::Type{Member}, g::AbstractGuild) = list_guild_members(c, g.id)

update(c::Client, m::Member, g::AbstractGuild; kwargs...) = modify_guild_member(c, g.id, m.user.id; kwargs...)
update(c::Client, m::Member, r::Role, g::AbstractGuild) = add_guild_member_role(c, g.id, m.user.id, r.id)

delete(c::Client, m::Member, g::AbstractGuild) = remove_guild_member(c, g.id, m.user.id)
delete(c::Client, m::Member, r::Role, g::AbstractGuild) = remove_guild_member_role(c, g.id, m.user.id, r.id)


text:
######### StanSample Bernoulli example  ###########

using MonteCarloMeasurements
using StanSample

bernoulli_model = "
data {
  int<lower=1> N;
  int<lower=0,upper=1> y[N];
}
parameters {
  real<lower=0,upper=1> theta;
}
model {
  theta ~ beta(1,1);
  y ~ bernoulli(theta);
}
";

bernoulli_data = Dict("N" => 10, "y" => [0, 1, 0, 1, 0, 0, 0, 0, 0, 1])

sm = SampleModel("bernoulli", bernoulli_model);

rc = stan_sample(sm; data=bernoulli_data);

if success(rc)
  part_sm = read_samples(sm, :particles)	  # Return Particles NamedTuple
  part_sm |> display

  # Fetch cmdstan summary df
  sdf = read_summary(sm, true)

end


text:
function μ(E0::Real, K1::Real, K2::Real, cϕ::Real, sϕ::Real)
  n̂i = n̂(cϕ, sϕ);
  return ((K1 - K2) * E0 * cϕ * n̂i) + (K2 * [E0; 0.0]);
end

max_stars_repo_name: grasingerm/polymer-stats

max_issues_repo_name: grasingerm/polymer-stats

max_forks_repo_name: grasingerm/polymer-stats


text:
function gbset(field, value)
    libgb.GxB_Global_Option_set(field, value)
    return nothing
end

function gbget(field)
    return libgb.GxB_Global_Option_get(field)
end

function gbset(A::GBMatrix, field, value)
    libgb.GxB_Matrix_Option_set(A, field, value)
    return nothing
end

function gbget(A::GBMatrix, field)
    return libgb.GxB_Matrix_Option_get(A, field)
end

function gbset(A::GBVector, field, value)
    libgb.GxB_Vector_Option_set(A, field, value)
    return nothing
end

function gbget(A::GBVector, field)
    return libgb.GxB_Vector_Option_get(A, field)
end

function format(A::GBVecOrMat)
    t = gbget(A, SPARSITY_STATUS)
    f = gbget(A, FORMAT)
    return (GBSparsity(t), GBFormat(f))
end

@cenum GBOption::Int32 begin
    HYPER_SWITCH = 0
    BITMAP_SWITCH = 34
    FORMAT = 1
    SPARSITY_STATUS = 33
    SPARSITY_CONTROL = 32
    BASE1 = 104
    NTHREADS = 5
    BURBLE = 99
end

@cenum GBFormat::Int32 begin
    BYROW = 0 #libgb.GxB_BY_ROW
    BYCOL = 1 #libgb.GxB_BY_COL
    NOFORMAT = -1 #libgb.GxB_NO_FORMAT
end

"""
Sparsity options for GraphBLAS. values can be summed to produce additional options.
"""
@cenum GBSparsity::Int32 begin
    GBDENSE = 8 #libgb.GxB_FULL
    GBBITMAP = 4 #libgb.GxB_BITMAP
    GBSPARSE = 2 #libgb.GxB_SPARSE
    GBHYPER = 1 #libgb.GxB_HYPERSPARSE
    GBANYSPARSITY = 15 #libgb.GxB_ANY_SPARSITY
    GBDENSE_OR_BITMAP = 12 #libgb.GxB_FULL + libgb.GXB_BITMAP
    GBSPARSE_OR_HYPER = 3 #libgb.GxB_SPARSE + libgb.GXB_HYPERSPARSE
    #... Probably don't need others
end


text:
using Distributed
@everywhere using Mamba

## Data
salm = Dict{Symbol, Any}(
  :y => reshape(
    [15, 21, 29, 16, 18, 21, 16, 26, 33, 27, 41, 60, 33, 38, 41, 20, 27, 42],
    3, 6),
  :x => [0, 10, 33, 100, 333, 1000],
  :plate => 3,
  :dose => 6
)

## Model Specification
model = Model(

  y = Stochastic(2,
    (alpha, beta, gamma, x, lambda) ->
      UnivariateDistribution[(
        mu = exp(alpha + beta * log(x[j] + 10) + gamma * x[j] + lambda[i, j]);
        Poisson(mu)) for i in 1:3, j in 1:6
      ],
    false
  ),

  alpha = Stochastic(
    () -> Normal(0, 1000)
  ),

  beta = Stochastic(
    () -> Normal(0, 1000)
  ),

  gamma = Stochastic(
    () -> Normal(0, 1000)
  ),

  lambda = Stochastic(2,
    s2 -> Normal(0, sqrt(s2)),
    false
  ),

  s2 = Stochastic(
    () -> InverseGamma(0.001, 0.001)
  )

)

## Initial Values
inits = [
  Dict(:y => salm[:y], :alpha => 0, :beta => 0, :gamma => 0, :s2 => 10,
       :lambda => zeros(3, 6)),
  Dict(:y => salm[:y], :alpha => 1, :beta => 1, :gamma => 0.01, :s2 => 1,
       :lambda => zeros(3, 6))
]

## Sampling Scheme
scheme = [Slice([:alpha, :beta, :gamma], [1.0, 1.0, 0.1]),
          AMWG([:lambda, :s2], 0.1)]
setsamplers!(model, scheme)

## MCMC Simulations
sim = mcmc(model, salm, inits, 10000, burnin=2500, thin=2, chains=2)
describe(sim)


text:
# Julia program to Find the Sum of Digits of a Number

# Extracting Each digits
function sum_of_digits(num)
    sum = 0
    while(num != 0)
        sum = sum + (num % 10)
        num = num ÷ 10
    end
    return sum
end

print("Enter the number: ")
num = readline()
num = parse(Int, num)
sum = sum_of_digits(abs(num))
println("The sum of digits of the given number is $sum.")

"""
Time Complexity: O(log(num)), where 'num' is the length of the given number
Space Complexity: O(1)

SAMPLE INPUT AND OUTPUT

SAMPLE 1
Enter the number: -12
The sum of digits of the given number is 3.

SAMPLE 2
Enter the number: 43258
The sum of digits of the given number is 22.

"""


text:
# It is suggested that test code for each include file be placed in
# a file of the same name under "test/" (and included below) and that
# this test code be wrapped in a module. Any new module name will do -
# eg, `module TestDatasets` for code testing `datasets.jl`.

using Test

@testset "DecisionTree" begin
  @test include("DecisionTree.jl")
end

@testset "GaussianProcesses" begin
  @test include("GaussianProcesses.jl")
end

# @testset "MultivariateStats" begin
#   @test include("LocalMultivariateStats.jl")
# end

@testset "Clustering" begin
    @test include("Clustering.jl")
end

@testset "GLM" begin
    @test include("GLM.jl")
end

# @testset "XGBoost" begin
#   @test_broken include("XGBoost.jl")
# end


text:
# This file is a part of Julia. License is MIT: https://julialang.org/license

using Base.I18n

@test locale()==""
locale("en_US")
@test locale()=="en_US"

max_stars_repo_name: caodi/julia

max_issues_repo_name: caodi/julia

max_forks_repo_name: caodi/julia


text:
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: efs
using AWS.Compat
using AWS.UUIDs

"""
    CreateAccessPoint()

Creates an EFS access point. An access point is an application-specific view into an EFS file system that applies an operating system user and group, and a file system path, to any file system request made through the access point. The operating system user and group override any identity information provided by the NFS client. The file system path is exposed as the access point's root directory. Applications using the access point can only access data in its own directory and below. To learn more, see Mounting a File System Using EFS Access Points. This operation requires permissions for the elasticfilesystem:CreateAccessPoint action.

# Required Parameters
- `ClientToken`: A string of up to 64 ASCII characters that Amazon EFS uses to ensure idempotent creation.
- `FileSystemId`: The ID of the EFS file system that the access point provides access to.

# Optional Parameters
- `PosixUser`: The operating system user and group applied to all file system requests made using the access point.
- `RootDirectory`: Specifies the directory on the Amazon EFS file system that the access point exposes as the root directory of your file system to NFS clients using the access point. The clients using the access point can only access the root directory and below. If the RootDirectory > Path specified does not exist, EFS creates it and applies the CreationInfo settings when a client connects to an access point. When specifying a RootDirectory, you need to provide the Path, and the CreationInfo is optional.
- `Tags`: Creates tags associated with the access point. Each tag is a key-value pair.
"""
create_access_point(ClientToken, FileSystemId; aws_config::AWSConfig=global_aws_config()) = efs("POST", "/2015-02-01/access-points", Dict{String, Any}("ClientToken"=>ClientToken, "FileSystemId"=>FileSystemId); aws_config=aws_config)
create_access_point(ClientToken, FileSystemId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("POST", "/2015-02-01/access-points", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("ClientToken"=>ClientToken, "FileSystemId"=>FileSystemId), args)); aws_config=aws_config)

"""
    CreateFileSystem()

Creates a new, empty file system. The operation requires a creation token in the request that Amazon EFS uses to ensure idempotent creation (calling the operation with same creation token has no effect). If a file system does not currently exist that is owned by the caller's AWS account with the specified creation token, this operation does the following:   Creates a new, empty file system. The file system will have an Amazon EFS assigned ID, and an initial lifecycle state creating.   Returns with the description of the created file system.   Otherwise, this operation returns a FileSystemAlreadyExists error with the ID of the existing file system.  For basic use cases, you can use a randomly generated UUID for the creation token.   The idempotent operation allows you to retry a CreateFileSystem call without risk of creating an extra file system. This can happen when an initial call fails in a way that leaves it uncertain whether or not a file system was actually created. An example might be that a transport level timeout occurred or your connection was reset. As long as you use the same creation token, if the initial call had succeeded in creating a file system, the client can learn of its existence from the FileSystemAlreadyExists error.  The CreateFileSystem call returns while the file system's lifecycle state is still creating. You can check the file system creation status by calling the DescribeFileSystems operation, which among other things returns the file system state.  This operation also takes an optional PerformanceMode parameter that you choose for your file system. We recommend generalPurpose performance mode for most file systems. File systems using the maxIO performance mode can scale to higher levels of aggregate throughput and operations per second with a tradeoff of slightly higher latencies for most file operations. The performance mode can't be changed after the file system has been created. For more information, see Amazon EFS: Performance Modes. After the file system is fully created, Amazon EFS sets its lifecycle state to available, at which point you can create one or more mount targets for the file system in your VPC. For more information, see CreateMountTarget. You mount your Amazon EFS file system on an EC2 instances in your VPC by using the mount target. For more information, see Amazon EFS: How it Works.   This operation requires permissions for the elasticfilesystem:CreateFileSystem action.

# Required Parameters
- `CreationToken`: A string of up to 64 ASCII characters. Amazon EFS uses this to ensure idempotent creation.

# Optional Parameters
- `Encrypted`: A Boolean value that, if true, creates an encrypted file system. When creating an encrypted file system, you have the option of specifying CreateFileSystemRequestKmsKeyId for an existing AWS Key Management Service (AWS KMS) customer master key (CMK). If you don't specify a CMK, then the default CMK for Amazon EFS, /aws/elasticfilesystem, is used to protect the encrypted file system.
- `KmsKeyId`: The ID of the AWS KMS CMK to be used to protect the encrypted file system. This parameter is only required if you want to use a nondefault CMK. If this parameter is not specified, the default CMK for Amazon EFS is used. This ID can be in one of the following formats:   Key ID - A unique identifier of the key, for example 1234abcd-12ab-34cd-56ef-1234567890ab.   ARN - An Amazon Resource Name (ARN) for the key, for example arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab.   Key alias - A previously created display name for a key, for example alias/projectKey1.   Key alias ARN - An ARN for a key alias, for example arn:aws:kms:us-west-2:444455556666:alias/projectKey1.   If KmsKeyId is specified, the CreateFileSystemRequestEncrypted parameter must be set to true.  EFS accepts only symmetric CMKs. You cannot use asymmetric CMKs with EFS file systems.
- `PerformanceMode`: The performance mode of the file system. We recommend generalPurpose performance mode for most file systems. File systems using the maxIO performance mode can scale to higher levels of aggregate throughput and operations per second with a tradeoff of slightly higher latencies for most file operations. The performance mode can't be changed after the file system has been created.
- `ProvisionedThroughputInMibps`: The throughput, measured in MiB/s, that you want to provision for a file system that you're creating. Valid values are 1-1024. Required if ThroughputMode is set to provisioned. The upper limit for throughput is 1024 MiB/s. You can get this limit increased by contacting AWS Support. For more information, see Amazon EFS Limits That You Can Increase in the Amazon EFS User Guide.
- `Tags`: A value that specifies to create one or more tags associated with the file system. Each tag is a user-defined key-value pair. Name your file system on creation by including a \"Key\":\"Name\",\"Value\":\"{value}\" key-value pair.
- `ThroughputMode`: The throughput mode for the file system to be created. There are two throughput modes to choose from for your file system: bursting and provisioned. If you set ThroughputMode to provisioned, you must also set a value for ProvisionedThroughPutInMibps. You can decrease your file system's throughput in Provisioned Throughput mode or change between the throughput modes as long as it’s been more than 24 hours since the last decrease or throughput mode change. For more, see Specifying Throughput with Provisioned Mode in the Amazon EFS User Guide.
"""
create_file_system(CreationToken; aws_config::AWSConfig=global_aws_config()) = efs("POST", "/2015-02-01/file-systems", Dict{String, Any}("CreationToken"=>CreationToken); aws_config=aws_config)
create_file_system(CreationToken, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("POST", "/2015-02-01/file-systems", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("CreationToken"=>CreationToken), args)); aws_config=aws_config)

"""
    CreateMountTarget()

Creates a mount target for a file system. You can then mount the file system on EC2 instances by using the mount target. You can create one mount target in each Availability Zone in your VPC. All EC2 instances in a VPC within a given Availability Zone share a single mount target for a given file system. If you have multiple subnets in an Availability Zone, you create a mount target in one of the subnets. EC2 instances do not need to be in the same subnet as the mount target in order to access their file system. For more information, see Amazon EFS: How it Works.  In the request, you also specify a file system ID for which you are creating the mount target and the file system's lifecycle state must be available. For more information, see DescribeFileSystems. In the request, you also provide a subnet ID, which determines the following:   VPC in which Amazon EFS creates the mount target   Availability Zone in which Amazon EFS creates the mount target   IP address range from which Amazon EFS selects the IP address of the mount target (if you don't specify an IP address in the request)   After creating the mount target, Amazon EFS returns a response that includes, a MountTargetId and an IpAddress. You use this IP address when mounting the file system in an EC2 instance. You can also use the mount target's DNS name when mounting the file system. The EC2 instance on which you mount the file system by using the mount target can resolve the mount target's DNS name to its IP address. For more information, see How it Works: Implementation Overview.  Note that you can create mount targets for a file system in only one VPC, and there can be only one mount target per Availability Zone. That is, if the file system already has one or more mount targets created for it, the subnet specified in the request to add another mount target must meet the following requirements:   Must belong to the same VPC as the subnets of the existing mount targets   Must not be in the same Availability Zone as any of the subnets of the existing mount targets   If the request satisfies the requirements, Amazon EFS does the following:   Creates a new mount target in the specified subnet.   Also creates a new network interface in the subnet as follows:   If the request provides an IpAddress, Amazon EFS assigns that IP address to the network interface. Otherwise, Amazon EFS assigns a free address in the subnet (in the same way that the Amazon EC2 CreateNetworkInterface call does when a request does not specify a primary private IP address).   If the request provides SecurityGroups, this network interface is associated with those security groups. Otherwise, it belongs to the default security group for the subnet's VPC.   Assigns the description Mount target fsmt-id for file system fs-id  where  fsmt-id  is the mount target ID, and  fs-id  is the FileSystemId.   Sets the requesterManaged property of the network interface to true, and the requesterId value to EFS.   Each Amazon EFS mount target has one corresponding requester-managed EC2 network interface. After the network interface is created, Amazon EFS sets the NetworkInterfaceId field in the mount target's description to the network interface ID, and the IpAddress field to its address. If network interface creation fails, the entire CreateMountTarget operation fails.    The CreateMountTarget call returns only after creating the network interface, but while the mount target state is still creating, you can check the mount target creation status by calling the DescribeMountTargets operation, which among other things returns the mount target state.  We recommend that you create a mount target in each of the Availability Zones. There are cost considerations for using a file system in an Availability Zone through a mount target created in another Availability Zone. For more information, see Amazon EFS. In addition, by always using a mount target local to the instance's Availability Zone, you eliminate a partial failure scenario. If the Availability Zone in which your mount target is created goes down, then you can't access your file system through that mount target.  This operation requires permissions for the following action on the file system:    elasticfilesystem:CreateMountTarget    This operation also requires permissions for the following Amazon EC2 actions:    ec2:DescribeSubnets     ec2:DescribeNetworkInterfaces     ec2:CreateNetworkInterface

# Required Parameters
- `FileSystemId`: The ID of the file system for which to create the mount target.
- `SubnetId`: The ID of the subnet to add the mount target in.

# Optional Parameters
- `IpAddress`: Valid IPv4 address within the address range of the specified subnet.
- `SecurityGroups`: Up to five VPC security group IDs, of the form sg-xxxxxxxx. These must be for the same VPC as subnet specified.
"""
create_mount_target(FileSystemId, SubnetId; aws_config::AWSConfig=global_aws_config()) = efs("POST", "/2015-02-01/mount-targets", Dict{String, Any}("FileSystemId"=>FileSystemId, "SubnetId"=>SubnetId); aws_config=aws_config)
create_mount_target(FileSystemId, SubnetId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("POST", "/2015-02-01/mount-targets", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("FileSystemId"=>FileSystemId, "SubnetId"=>SubnetId), args)); aws_config=aws_config)

"""
    CreateTags()

Creates or overwrites tags associated with a file system. Each tag is a key-value pair. If a tag key specified in the request already exists on the file system, this operation overwrites its value with the value provided in the request. If you add the Name tag to your file system, Amazon EFS returns it in the response to the DescribeFileSystems operation.  This operation requires permission for the elasticfilesystem:CreateTags action.

# Required Parameters
- `FileSystemId`: The ID of the file system whose tags you want to modify (String). This operation modifies the tags only, not the file system.
- `Tags`: An array of Tag objects to add. Each Tag object is a key-value pair.

"""
create_tags(FileSystemId, Tags; aws_config::AWSConfig=global_aws_config()) = efs("POST", "/2015-02-01/create-tags/$(FileSystemId)", Dict{String, Any}("Tags"=>Tags); aws_config=aws_config)
create_tags(FileSystemId, Tags, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("POST", "/2015-02-01/create-tags/$(FileSystemId)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Tags"=>Tags), args)); aws_config=aws_config)

"""
    DeleteAccessPoint()

Deletes the specified access point. After deletion is complete, new clients can no longer connect to the access points. Clients connected to the access point at the time of deletion will continue to function until they terminate their connection. This operation requires permissions for the elasticfilesystem:DeleteAccessPoint action.

# Required Parameters
- `AccessPointId`: The ID of the access point that you want to delete.

"""
delete_access_point(AccessPointId; aws_config::AWSConfig=global_aws_config()) = efs("DELETE", "/2015-02-01/access-points/$(AccessPointId)"; aws_config=aws_config)
delete_access_point(AccessPointId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("DELETE", "/2015-02-01/access-points/$(AccessPointId)", args; aws_config=aws_config)

"""
    DeleteFileSystem()

Deletes a file system, permanently severing access to its contents. Upon return, the file system no longer exists and you can't access any contents of the deleted file system.  You can't delete a file system that is in use. That is, if the file system has any mount targets, you must first delete them. For more information, see DescribeMountTargets and DeleteMountTarget.   The DeleteFileSystem call returns while the file system state is still deleting. You can check the file system deletion status by calling the DescribeFileSystems operation, which returns a list of file systems in your account. If you pass file system ID or creation token for the deleted file system, the DescribeFileSystems returns a 404 FileSystemNotFound error.  This operation requires permissions for the elasticfilesystem:DeleteFileSystem action.

# Required Parameters
- `FileSystemId`: The ID of the file system you want to delete.

"""
delete_file_system(FileSystemId; aws_config::AWSConfig=global_aws_config()) = efs("DELETE", "/2015-02-01/file-systems/$(FileSystemId)"; aws_config=aws_config)
delete_file_system(FileSystemId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("DELETE", "/2015-02-01/file-systems/$(FileSystemId)", args; aws_config=aws_config)

"""
    DeleteFileSystemPolicy()

Deletes the FileSystemPolicy for the specified file system. The default FileSystemPolicy goes into effect once the existing policy is deleted. For more information about the default file system policy, see Using Resource-based Policies with EFS. This operation requires permissions for the elasticfilesystem:DeleteFileSystemPolicy action.

# Required Parameters
- `FileSystemId`: Specifies the EFS file system for which to delete the FileSystemPolicy.

"""
delete_file_system_policy(FileSystemId; aws_config::AWSConfig=global_aws_config()) = efs("DELETE", "/2015-02-01/file-systems/$(FileSystemId)/policy"; aws_config=aws_config)
delete_file_system_policy(FileSystemId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("DELETE", "/2015-02-01/file-systems/$(FileSystemId)/policy", args; aws_config=aws_config)

"""
    DeleteMountTarget()

Deletes the specified mount target. This operation forcibly breaks any mounts of the file system by using the mount target that is being deleted, which might disrupt instances or applications using those mounts. To avoid applications getting cut off abruptly, you might consider unmounting any mounts of the mount target, if feasible. The operation also deletes the associated network interface. Uncommitted writes might be lost, but breaking a mount target using this operation does not corrupt the file system itself. The file system you created remains. You can mount an EC2 instance in your VPC by using another mount target. This operation requires permissions for the following action on the file system:    elasticfilesystem:DeleteMountTarget     The DeleteMountTarget call returns while the mount target state is still deleting. You can check the mount target deletion by calling the DescribeMountTargets operation, which returns a list of mount target descriptions for the given file system.   The operation also requires permissions for the following Amazon EC2 action on the mount target's network interface:    ec2:DeleteNetworkInterface

# Required Parameters
- `MountTargetId`: The ID of the mount target to delete (String).

"""
delete_mount_target(MountTargetId; aws_config::AWSConfig=global_aws_config()) = efs("DELETE", "/2015-02-01/mount-targets/$(MountTargetId)"; aws_config=aws_config)
delete_mount_target(MountTargetId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("DELETE", "/2015-02-01/mount-targets/$(MountTargetId)", args; aws_config=aws_config)

"""
    DeleteTags()

Deletes the specified tags from a file system. If the DeleteTags request includes a tag key that doesn't exist, Amazon EFS ignores it and doesn't cause an error. For more information about tags and related restrictions, see Tag Restrictions in the AWS Billing and Cost Management User Guide. This operation requires permissions for the elasticfilesystem:DeleteTags action.

# Required Parameters
- `FileSystemId`: The ID of the file system whose tags you want to delete (String).
- `TagKeys`: A list of tag keys to delete.

"""
delete_tags(FileSystemId, TagKeys; aws_config::AWSConfig=global_aws_config()) = efs("POST", "/2015-02-01/delete-tags/$(FileSystemId)", Dict{String, Any}("TagKeys"=>TagKeys); aws_config=aws_config)
delete_tags(FileSystemId, TagKeys, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("POST", "/2015-02-01/delete-tags/$(FileSystemId)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("TagKeys"=>TagKeys), args)); aws_config=aws_config)

"""
    DescribeAccessPoints()

Returns the description of a specific Amazon EFS access point if the AccessPointId is provided. If you provide an EFS FileSystemId, it returns descriptions of all access points for that file system. You can provide either an AccessPointId or a FileSystemId in the request, but not both.  This operation requires permissions for the elasticfilesystem:DescribeAccessPoints action.

# Optional Parameters
- `AccessPointId`: (Optional) Specifies an EFS access point to describe in the response; mutually exclusive with FileSystemId.
- `FileSystemId`: (Optional) If you provide a FileSystemId, EFS returns all access points for that file system; mutually exclusive with AccessPointId.
- `MaxResults`: (Optional) When retrieving all access points for a file system, you can optionally specify the MaxItems parameter to limit the number of objects returned in a response. The default value is 100.
- `NextToken`:  NextToken is present if the response is paginated. You can use NextMarker in the subsequent request to fetch the next page of access point descriptions.
"""
describe_access_points(; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/access-points"; aws_config=aws_config)
describe_access_points(args::AbstractDict{String, Any}; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/access-points", args; aws_config=aws_config)

"""
    DescribeBackupPolicy()

Returns the backup policy for the specified EFS file system.

# Required Parameters
- `FileSystemId`: Specifies which EFS file system to retrieve the BackupPolicy for.

"""
describe_backup_policy(FileSystemId; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/file-systems/$(FileSystemId)/backup-policy"; aws_config=aws_config)
describe_backup_policy(FileSystemId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/file-systems/$(FileSystemId)/backup-policy", args; aws_config=aws_config)

"""
    DescribeFileSystemPolicy()

Returns the FileSystemPolicy for the specified EFS file system. This operation requires permissions for the elasticfilesystem:DescribeFileSystemPolicy action.

# Required Parameters
- `FileSystemId`: Specifies which EFS file system to retrieve the FileSystemPolicy for.

"""
describe_file_system_policy(FileSystemId; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/file-systems/$(FileSystemId)/policy"; aws_config=aws_config)
describe_file_system_policy(FileSystemId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/file-systems/$(FileSystemId)/policy", args; aws_config=aws_config)

"""
    DescribeFileSystems()

Returns the description of a specific Amazon EFS file system if either the file system CreationToken or the FileSystemId is provided. Otherwise, it returns descriptions of all file systems owned by the caller's AWS account in the AWS Region of the endpoint that you're calling. When retrieving all file system descriptions, you can optionally specify the MaxItems parameter to limit the number of descriptions in a response. Currently, this number is automatically set to 10. If more file system descriptions remain, Amazon EFS returns a NextMarker, an opaque token, in the response. In this case, you should send a subsequent request with the Marker request parameter set to the value of NextMarker.  To retrieve a list of your file system descriptions, this operation is used in an iterative process, where DescribeFileSystems is called first without the Marker and then the operation continues to call it with the Marker parameter set to the value of the NextMarker from the previous response until the response has no NextMarker.   The order of file systems returned in the response of one DescribeFileSystems call and the order of file systems returned across the responses of a multi-call iteration is unspecified.   This operation requires permissions for the elasticfilesystem:DescribeFileSystems action.

# Optional Parameters
- `CreationToken`: (Optional) Restricts the list to the file system with this creation token (String). You specify a creation token when you create an Amazon EFS file system.
- `FileSystemId`: (Optional) ID of the file system whose description you want to retrieve (String).
- `Marker`: (Optional) Opaque pagination token returned from a previous DescribeFileSystems operation (String). If present, specifies to continue the list from where the returning call had left off.
- `MaxItems`: (Optional) Specifies the maximum number of file systems to return in the response (integer). This number is automatically set to 100. The response is paginated at 100 per page if you have more than 100 file systems.
"""
describe_file_systems(; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/file-systems"; aws_config=aws_config)
describe_file_systems(args::AbstractDict{String, Any}; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/file-systems", args; aws_config=aws_config)

"""
    DescribeLifecycleConfiguration()

Returns the current LifecycleConfiguration object for the specified Amazon EFS file system. EFS lifecycle management uses the LifecycleConfiguration object to identify which files to move to the EFS Infrequent Access (IA) storage class. For a file system without a LifecycleConfiguration object, the call returns an empty array in the response. This operation requires permissions for the elasticfilesystem:DescribeLifecycleConfiguration operation.

# Required Parameters
- `FileSystemId`: The ID of the file system whose LifecycleConfiguration object you want to retrieve (String).

"""
describe_lifecycle_configuration(FileSystemId; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/file-systems/$(FileSystemId)/lifecycle-configuration"; aws_config=aws_config)
describe_lifecycle_configuration(FileSystemId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/file-systems/$(FileSystemId)/lifecycle-configuration", args; aws_config=aws_config)

"""
    DescribeMountTargetSecurityGroups()

Returns the security groups currently in effect for a mount target. This operation requires that the network interface of the mount target has been created and the lifecycle state of the mount target is not deleted. This operation requires permissions for the following actions:    elasticfilesystem:DescribeMountTargetSecurityGroups action on the mount target's file system.     ec2:DescribeNetworkInterfaceAttribute action on the mount target's network interface.

# Required Parameters
- `MountTargetId`: The ID of the mount target whose security groups you want to retrieve.

"""
describe_mount_target_security_groups(MountTargetId; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/mount-targets/$(MountTargetId)/security-groups"; aws_config=aws_config)
describe_mount_target_security_groups(MountTargetId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/mount-targets/$(MountTargetId)/security-groups", args; aws_config=aws_config)

"""
    DescribeMountTargets()

Returns the descriptions of all the current mount targets, or a specific mount target, for a file system. When requesting all of the current mount targets, the order of mount targets returned in the response is unspecified. This operation requires permissions for the elasticfilesystem:DescribeMountTargets action, on either the file system ID that you specify in FileSystemId, or on the file system of the mount target that you specify in MountTargetId.

# Optional Parameters
- `AccessPointId`: (Optional) The ID of the access point whose mount targets that you want to list. It must be included in your request if a FileSystemId or MountTargetId is not included in your request. Accepts either an access point ID or ARN as input.
- `FileSystemId`: (Optional) ID of the file system whose mount targets you want to list (String). It must be included in your request if an AccessPointId or MountTargetId is not included. Accepts either a file system ID or ARN as input.
- `Marker`: (Optional) Opaque pagination token returned from a previous DescribeMountTargets operation (String). If present, it specifies to continue the list from where the previous returning call left off.
- `MaxItems`: (Optional) Maximum number of mount targets to return in the response. Currently, this number is automatically set to 10, and other values are ignored. The response is paginated at 100 per page if you have more than 100 mount targets.
- `MountTargetId`: (Optional) ID of the mount target that you want to have described (String). It must be included in your request if FileSystemId is not included. Accepts either a mount target ID or ARN as input.
"""
describe_mount_targets(; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/mount-targets"; aws_config=aws_config)
describe_mount_targets(args::AbstractDict{String, Any}; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/mount-targets", args; aws_config=aws_config)

"""
    DescribeTags()

Returns the tags associated with a file system. The order of tags returned in the response of one DescribeTags call and the order of tags returned across the responses of a multiple-call iteration (when using pagination) is unspecified.   This operation requires permissions for the elasticfilesystem:DescribeTags action.

# Required Parameters
- `FileSystemId`: The ID of the file system whose tag set you want to retrieve.

# Optional Parameters
- `Marker`: (Optional) An opaque pagination token returned from a previous DescribeTags operation (String). If present, it specifies to continue the list from where the previous call left off.
- `MaxItems`: (Optional) The maximum number of file system tags to return in the response. Currently, this number is automatically set to 100, and other values are ignored. The response is paginated at 100 per page if you have more than 100 tags.
"""
describe_tags(FileSystemId; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/tags/$(FileSystemId)/"; aws_config=aws_config)
describe_tags(FileSystemId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/tags/$(FileSystemId)/", args; aws_config=aws_config)

"""
    ListTagsForResource()

Lists all tags for a top-level EFS resource. You must provide the ID of the resource that you want to retrieve the tags for. This operation requires permissions for the elasticfilesystem:DescribeAccessPoints action.

# Required Parameters
- `ResourceId`: Specifies the EFS resource you want to retrieve tags for. You can retrieve tags for EFS file systems and access points using this API endpoint.

# Optional Parameters
- `MaxResults`: (Optional) Specifies the maximum number of tag objects to return in the response. The default value is 100.
- `NextToken`: You can use NextToken in a subsequent request to fetch the next page of access point descriptions if the response payload was paginated.
"""
list_tags_for_resource(ResourceId; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/resource-tags/$(ResourceId)"; aws_config=aws_config)
list_tags_for_resource(ResourceId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("GET", "/2015-02-01/resource-tags/$(ResourceId)", args; aws_config=aws_config)

"""
    ModifyMountTargetSecurityGroups()

Modifies the set of security groups in effect for a mount target. When you create a mount target, Amazon EFS also creates a new network interface. For more information, see CreateMountTarget. This operation replaces the security groups in effect for the network interface associated with a mount target, with the SecurityGroups provided in the request. This operation requires that the network interface of the mount target has been created and the lifecycle state of the mount target is not deleted.  The operation requires permissions for the following actions:    elasticfilesystem:ModifyMountTargetSecurityGroups action on the mount target's file system.     ec2:ModifyNetworkInterfaceAttribute action on the mount target's network interface.

# Required Parameters
- `MountTargetId`: The ID of the mount target whose security groups you want to modify.

# Optional Parameters
- `SecurityGroups`: An array of up to five VPC security group IDs.
"""
modify_mount_target_security_groups(MountTargetId; aws_config::AWSConfig=global_aws_config()) = efs("PUT", "/2015-02-01/mount-targets/$(MountTargetId)/security-groups"; aws_config=aws_config)
modify_mount_target_security_groups(MountTargetId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("PUT", "/2015-02-01/mount-targets/$(MountTargetId)/security-groups", args; aws_config=aws_config)

"""
    PutBackupPolicy()

Updates the file system's backup policy. Use this action to start or stop automatic backups of the file system.

# Required Parameters
- `BackupPolicy`: The backup policy included in the PutBackupPolicy request.
- `FileSystemId`: Specifies which EFS file system to update the backup policy for.

"""
put_backup_policy(BackupPolicy, FileSystemId; aws_config::AWSConfig=global_aws_config()) = efs("PUT", "/2015-02-01/file-systems/$(FileSystemId)/backup-policy", Dict{String, Any}("BackupPolicy"=>BackupPolicy); aws_config=aws_config)
put_backup_policy(BackupPolicy, FileSystemId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("PUT", "/2015-02-01/file-systems/$(FileSystemId)/backup-policy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("BackupPolicy"=>BackupPolicy), args)); aws_config=aws_config)

"""
    PutFileSystemPolicy()

Applies an Amazon EFS FileSystemPolicy to an Amazon EFS file system. A file system policy is an IAM resource-based policy and can contain multiple policy statements. A file system always has exactly one file system policy, which can be the default policy or an explicit policy set or updated using this API operation. When an explicit policy is set, it overrides the default policy. For more information about the default file system policy, see Default EFS File System Policy.  This operation requires permissions for the elasticfilesystem:PutFileSystemPolicy action.

# Required Parameters
- `FileSystemId`: The ID of the EFS file system that you want to create or update the FileSystemPolicy for.
- `Policy`: The FileSystemPolicy that you're creating. Accepts a JSON formatted policy definition. To find out more about the elements that make up a file system policy, see EFS Resource-based Policies.

# Optional Parameters
- `BypassPolicyLockoutSafetyCheck`: (Optional) A flag to indicate whether to bypass the FileSystemPolicy lockout safety check. The policy lockout safety check determines whether the policy in the request will prevent the principal making the request will be locked out from making future PutFileSystemPolicy requests on the file system. Set BypassPolicyLockoutSafetyCheck to True only when you intend to prevent the principal that is making the request from making a subsequent PutFileSystemPolicy request on the file system. The default value is False.
"""
put_file_system_policy(FileSystemId, Policy; aws_config::AWSConfig=global_aws_config()) = efs("PUT", "/2015-02-01/file-systems/$(FileSystemId)/policy", Dict{String, Any}("Policy"=>Policy); aws_config=aws_config)
put_file_system_policy(FileSystemId, Policy, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("PUT", "/2015-02-01/file-systems/$(FileSystemId)/policy", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Policy"=>Policy), args)); aws_config=aws_config)

"""
    PutLifecycleConfiguration()

Enables lifecycle management by creating a new LifecycleConfiguration object. A LifecycleConfiguration object defines when files in an Amazon EFS file system are automatically transitioned to the lower-cost EFS Infrequent Access (IA) storage class. A LifecycleConfiguration applies to all files in a file system. Each Amazon EFS file system supports one lifecycle configuration, which applies to all files in the file system. If a LifecycleConfiguration object already exists for the specified file system, a PutLifecycleConfiguration call modifies the existing configuration. A PutLifecycleConfiguration call with an empty LifecyclePolicies array in the request body deletes any existing LifecycleConfiguration and disables lifecycle management. In the request, specify the following:    The ID for the file system for which you are enabling, disabling, or modifying lifecycle management.   A LifecyclePolicies array of LifecyclePolicy objects that define when files are moved to the IA storage class. The array can contain only one LifecyclePolicy item.   This operation requires permissions for the elasticfilesystem:PutLifecycleConfiguration operation. To apply a LifecycleConfiguration object to an encrypted file system, you need the same AWS Key Management Service (AWS KMS) permissions as when you created the encrypted file system.

# Required Parameters
- `FileSystemId`: The ID of the file system for which you are creating the LifecycleConfiguration object (String).
- `LifecyclePolicies`: An array of LifecyclePolicy objects that define the file system's LifecycleConfiguration object. A LifecycleConfiguration object tells lifecycle management when to transition files from the Standard storage class to the Infrequent Access storage class.

"""
put_lifecycle_configuration(FileSystemId, LifecyclePolicies; aws_config::AWSConfig=global_aws_config()) = efs("PUT", "/2015-02-01/file-systems/$(FileSystemId)/lifecycle-configuration", Dict{String, Any}("LifecyclePolicies"=>LifecyclePolicies); aws_config=aws_config)
put_lifecycle_configuration(FileSystemId, LifecyclePolicies, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("PUT", "/2015-02-01/file-systems/$(FileSystemId)/lifecycle-configuration", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("LifecyclePolicies"=>LifecyclePolicies), args)); aws_config=aws_config)

"""
    TagResource()

Creates a tag for an EFS resource. You can create tags for EFS file systems and access points using this API operation. This operation requires permissions for the elasticfilesystem:TagResource action.

# Required Parameters
- `ResourceId`: The ID specifying the EFS resource that you want to create a tag for.
- `Tags`:

"""
tag_resource(ResourceId, Tags; aws_config::AWSConfig=global_aws_config()) = efs("POST", "/2015-02-01/resource-tags/$(ResourceId)", Dict{String, Any}("Tags"=>Tags); aws_config=aws_config)
tag_resource(ResourceId, Tags, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("POST", "/2015-02-01/resource-tags/$(ResourceId)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("Tags"=>Tags), args)); aws_config=aws_config)

"""
    UntagResource()

Removes tags from an EFS resource. You can remove tags from EFS file systems and access points using this API operation. This operation requires permissions for the elasticfilesystem:UntagResource action.

# Required Parameters
- `ResourceId`: Specifies the EFS resource that you want to remove tags from.
- `tagKeys`: The keys of the key:value tag pairs that you want to remove from the specified EFS resource.

"""
untag_resource(ResourceId, tagKeys; aws_config::AWSConfig=global_aws_config()) = efs("DELETE", "/2015-02-01/resource-tags/$(ResourceId)", Dict{String, Any}("tagKeys"=>tagKeys); aws_config=aws_config)
untag_resource(ResourceId, tagKeys, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("DELETE", "/2015-02-01/resource-tags/$(ResourceId)", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("tagKeys"=>tagKeys), args)); aws_config=aws_config)

"""
    UpdateFileSystem()

Updates the throughput mode or the amount of provisioned throughput of an existing file system.

# Required Parameters
- `FileSystemId`: The ID of the file system that you want to update.

# Optional Parameters
- `ProvisionedThroughputInMibps`: (Optional) The amount of throughput, in MiB/s, that you want to provision for your file system. Valid values are 1-1024. Required if ThroughputMode is changed to provisioned on update. If you're not updating the amount of provisioned throughput for your file system, you don't need to provide this value in your request.
- `ThroughputMode`: (Optional) The throughput mode that you want your file system to use. If you're not updating your throughput mode, you don't need to provide this value in your request. If you are changing the ThroughputMode to provisioned, you must also set a value for ProvisionedThroughputInMibps.
"""
update_file_system(FileSystemId; aws_config::AWSConfig=global_aws_config()) = efs("PUT", "/2015-02-01/file-systems/$(FileSystemId)"; aws_config=aws_config)
update_file_system(FileSystemId, args::AbstractDict{String, <:Any}; aws_config::AWSConfig=global_aws_config()) = efs("PUT", "/2015-02-01/file-systems/$(FileSystemId)", args; aws_config=aws_config)


text:
using Pkg

# build example plot
cd("../examples")
Pkg.activate(".")
Pkg.instantiate()

include("../examples/explanation_diagram.jl")

# build docs
cd("../docs")
Pkg.activate(".")
Pkg.instantiate()

push!(LOAD_PATH,"../src/")

using Documenter, DocumenterMarkdown, NonuniformResampling1D

DocMeta.setdocmeta!(NonuniformResampling1D, :DocTestSetup,
    :(using NonuniformResampling1D); recursive=true
)

makedocs(
    format=Markdown(),
    modules=[NonuniformResampling1D]
)

cp("build/README.md", "../README.md", force=true)