code stringlengths 114 1.05M | path stringlengths 3 312 | quality_prob float64 0.5 0.99 | learning_prob float64 0.2 1 | filename stringlengths 3 168 | kind stringclasses 1
value |
|---|---|---|---|---|---|
defmodule Picam do
@moduledoc """
This module contains functions to manipulate, capture, and stream
MJPEG video on a Raspberry Pi using the camera module.
"""
@camera Application.get_env(:picam, :camera, Picam.Camera)
@doc """
Returns a binary with the contents of a single JPEG frame from the camera.
... | lib/picam.ex | 0.92976 | 0.68092 | picam.ex | starcoder |
defmodule Surface.Components.Link do
@moduledoc """
Generates a link to the given URL.
Provides similar capabilities to Phoenix's built-in `link/2` function.
Options `label` and `class` can be set directly and will override anything in `opts`.
All other options are forwarded to the underlying <a> tag.
##... | lib/surface/components/link.ex | 0.916006 | 0.844473 | link.ex | starcoder |
defmodule Cartographer.Encoder do
@moduledoc """
Cartographer.Encoder is a module which provides way to encode coordinates into
a geohash with given precision measured by amount of characters.
It uses a finite alphabet to present geocoordinates in human readable form.
"""
@min_lat -90
@max_lat +90
@m... | lib/cartographer/encoder.ex | 0.80329 | 0.582164 | encoder.ex | starcoder |
defmodule K8s.Client.Runner.Base do
@moduledoc """
Base HTTP processor for `K8s.Client`
"""
@type result :: {:ok, map() | reference()} | {:error, atom} | {:error, binary()}
alias K8s.Cluster
alias K8s.Conf.RequestOptions
alias K8s.Operation
@doc """
Runs a `K8s.Operation`.
## Examples
*Note:*... | lib/k8s/client/runner/base.ex | 0.912048 | 0.46223 | base.ex | starcoder |
defmodule JSONC do
@moduledoc """
This is a package for decoding [jsonc](https://komkom.github.io/jsonc-playground) documents and also transcoding them to json.
I'm also working on it to add a formatter.
jsonc is a superset of json, which means any json document is also a jsonc document but the reverse is not ... | lib/jsonc.ex | 0.910984 | 0.766381 | jsonc.ex | starcoder |
defmodule Elixium.KeyPair do
alias Elixium.Mnemonic
use Bitwise
require Integer
@algorithm :ecdh
@sigtype :ecdsa
@curve :secp256k1
@hashtype :sha256
@store "keys"
@moduledoc """
All the functions responsible for creating keypairs and using them to sign
data / verify signatures
"""
@doc... | lib/keypair.ex | 0.726231 | 0.460653 | keypair.ex | starcoder |
defmodule AWS.ElasticLoadBalancingv2 do
@moduledoc """
Elastic Load Balancing
A load balancer distributes incoming traffic across targets, such as your
EC2 instances. This enables you to increase the availability of your
application. The load balancer also monitors the health of its registered
targets and... | lib/aws/elastic_load_balancingv2.ex | 0.913268 | 0.706656 | elastic_load_balancingv2.ex | starcoder |
defmodule AWS.DevOpsGuru do
@moduledoc """
Amazon DevOps Guru is a fully managed service that helps you identify anomalous
behavior in business critical operational applications.
You specify the Amazon Web Services resources that you want DevOps Guru to
cover, then the Amazon CloudWatch metrics and Amazon W... | lib/aws/generated/dev_ops_guru.ex | 0.840815 | 0.494751 | dev_ops_guru.ex | starcoder |
defmodule BlockKeys.Mnemonic do
@moduledoc """
BIP32 implementation responsible for generating mnemonic phrases, seeds and public / private address trees.
"""
alias BlockKeys.Crypto
@pad_length_mnemonic 8
@pad_length_phrase 11
@pbkdf2_initial_round 1
@pbkdf2_rounds 2048
@allowed_entropy_lengths [33... | lib/block_keys/mnemonic.ex | 0.857485 | 0.479077 | mnemonic.ex | starcoder |
defmodule AWS.MechanicalTurk do
@moduledoc """
Amazon Mechanical Turk API Reference
"""
@doc """
The `AcceptQualificationRequest` operation approves a Worker's request for
a Qualification.
Only the owner of the Qualification type can grant a Qualification request
for that type.
A successful reques... | lib/aws/mechanical_turk.ex | 0.888269 | 0.616416 | mechanical_turk.ex | starcoder |
defmodule Appsignal.NifBehaviour do
@callback loaded?() :: boolean()
@callback running_in_container?() :: boolean()
end
defmodule Appsignal.Nif do
@behaviour Appsignal.NifBehaviour
@moduledoc """
It's a NIF! Oh no!
While people generally think NIFs are a bad idea, the overhead of
this particular NIF is... | lib/appsignal/nif.ex | 0.585457 | 0.436502 | nif.ex | starcoder |
defmodule ExPurpleTiger do
@moduledoc """
ExPurpleTiger generates animal-based hash digests meant to be memorable and
human-readable. This library is suitble for anthropomorphizing project names,
crypto addresses, UUIDs, or any complex string of characters that needs to be
displayed in a user interface.
"""... | lib/ex_purple_tiger.ex | 0.879484 | 0.554651 | ex_purple_tiger.ex | starcoder |
defprotocol ExMatch.Diff do
@fallback_to_any true
@spec diff(t, any, (atom -> any)) :: nil | {left :: any, right :: any}
def diff(left, right, get_opts)
end
defimpl ExMatch.Diff, for: Any do
def diff(value, value, _), do: nil
def diff(left = %struct{}, right = %struct{}, get_opts) do
case ExMatch.Diff.... | lib/exmatch/diff.ex | 0.810666 | 0.653486 | diff.ex | starcoder |
defmodule Thesis.Utilities do
@moduledoc """
Module that provides helper functions.
"""
@doc """
Removes special characters, keeps dashes and underscores, and replaces spaces
with dashes. Also downcases the entire string.
iex> import Thesis.Utilities
iex> parameterize("Jamon is so cool!")
... | lib/thesis/utilities.ex | 0.695855 | 0.413004 | utilities.ex | starcoder |
defmodule Rails do
@moduledoc """
Partial Railway Oriented Programming implementation in Elixir.
See this [blog article](https://fsharpforfunandprofit.com/rop/)
for more details.
"""
use Boundary, deps: [], exports: []
require Logger
@type success(x) :: {:ok, x}
@type success :: success(any)
@typ... | lib/rails.ex | 0.77949 | 0.461988 | rails.ex | starcoder |
defmodule Ockam.Messaging.PipeChannel.Simple do
@moduledoc """
Simple implementation of pipe channel.
Does not manage the session.
Requires a known address to the local pipe sender and remote channel end
Using two addresses for inner and outer communication.
forwards messages from outer address to the sen... | implementations/elixir/ockam/ockam/lib/ockam/messaging/pipe_channel/simple.ex | 0.875341 | 0.405566 | simple.ex | starcoder |
defmodule Grizzly.SwitchBinary do
@moduledoc """
Commands for working with devices that support the Switch Binary command class
"""
alias Grizzly.ZWave
alias Grizzly.ZWave.Command
alias Grizzly.ZWave.Commands.SwitchBinaryReport
@typedoc """
Optional parameters used when setting the switch state
- `... | lib/grizzly/switch_binary.ex | 0.920576 | 0.425516 | switch_binary.ex | starcoder |
defmodule Bodyguard.Plug.Authorize do
@behaviour Plug
import Bodyguard.Utilities
@moduledoc """
Perform authorization in a Plug pipeline.
## Options
* `:policy` *required* - the policy (or context) module
* `:action` *required* - the action, or a getter
* `:user` - the user getter
* `:params` - the... | lib/bodyguard/plug/authorize.ex | 0.828627 | 0.44065 | authorize.ex | starcoder |
defmodule Mfga do
alias Mfga.{Generator, Genetics}
@chromosome_size Application.get_env(:mfga, :chromosome_length)
@chromosome_values Application.get_env(:mfga, :chromosome_values)
@population_size Application.get_env(:mfga, :population_size)
@mutation_chance Application.get_env(:mfga, :mutation_chance)
d... | lib/mfga.ex | 0.70253 | 0.577614 | mfga.ex | starcoder |
defmodule GoogleCerts.CertificateDecodeException do
defexception message: "Could not decode certificate"
end
defmodule GoogleCerts.Certificate do
@moduledoc """
Struct to associate a `kid` to a certificate map.
kid is the id and cert can either be a map with a pem or a JWK map
version 1 cert is `%{"pem" =>... | lib/google_certs/certificates.ex | 0.898282 | 0.453443 | certificates.ex | starcoder |
defmodule ExPlasma.Output.Type.PaymentV1 do
@moduledoc """
Payment V1 Output Type.
"""
@behaviour ExPlasma.Output
alias ExPlasma.Output
@type address() :: <<_::160>>
@type output_guard() :: address()
@type token() :: address()
@type amount() :: non_neg_integer()
@type rlp() :: [output_guard() | ... | lib/ex_plasma/output/type/payment_v1.ex | 0.834811 | 0.452113 | payment_v1.ex | starcoder |
defmodule Genex.Tools.Selection do
@moduledoc """
Implementation of several popular selection methods.
Selection occurs in two stages in Genex: parent selection and survivor selection. Parent Selection dictates which chromosomes are to be reserved for crossover according to some crossover rate. In this stage, a ... | lib/genex/tools/selection.ex | 0.918604 | 0.872836 | selection.ex | starcoder |
defmodule Rihanna.Supervisor do
use Supervisor
@moduledoc """
The main supervisor for Rihanna.
Starts the Postgrex process necessary for enqueueing jobs, and also starts a
dispatcher for processing them.
## Setup
Add `Rihanna.Supervisor` to your supervision tree.
By adding it to your supervision tr... | lib/rihanna/supervisor.ex | 0.750461 | 0.651161 | supervisor.ex | starcoder |
defmodule Taxes.Organizer do
@moduledoc """
Module with methods to group taxes by markers
"""
alias Taxes.Types
@doc """
Method to wrap taxes from list into tree structure with `:inclusive` and `:exclusive` keys at top level.
This method modify incoming `payload` structure and add two new keys.
"""
@... | lib/taxes/organizer.ex | 0.8498 | 0.696436 | organizer.ex | starcoder |
defmodule Monok do
@moduledoc """
#### _Monad on :ok_
Provides the infix pipe operators `~>`, `~>>`, and `<~>` for writing clean pipelines that treat `{:ok, result}`
and `{:error, reason}` tuples like functors, monads or applicatives.
Also provides the functions `fmap`, `bind` and `lift` as which are functi... | lib/monok.ex | 0.911687 | 0.87213 | monok.ex | starcoder |
defmodule Razorpay.Payment do
import Razorpay
@derive {Poison.Encoder, except: [:entity]}
defstruct [:id, :amount, :currency, :status, :method, :description,
:refund_status, :amount_refunded, :email, :contact, :fee, :service_tax,
:error_code, :error_description, :notes, :order_id, :created_at]
@type t ::... | lib/razorpay/payment.ex | 0.588771 | 0.430028 | payment.ex | starcoder |
defmodule Membrane.RTP.InboundPacketTracker do
@moduledoc """
Module responsible for tracking statistics of incoming RTP packets for a single stream.
Tracker is capable of repairing packets' sequence numbers provided that it has information about how many packets has
been previously discarded. To updated numbe... | lib/membrane/rtp/inbound_packet_tracker.ex | 0.908747 | 0.513973 | inbound_packet_tracker.ex | starcoder |
defmodule Algorithms.DataStructures.SinglyLinkedList do
@moduledoc """
Access for SinglyLinkedList is O(n)
Search for SinglyLinkedList is O(n)
Deletion/Insertion at element is O(1)
"""
defmodule Node, do: defstruct([:value, :reference])
defmodule LinkedList, do: defstruct([:nodes])
@doc """
Adding to... | lib/data_structures/singly_linked_list.ex | 0.783077 | 0.41253 | singly_linked_list.ex | starcoder |
defmodule Posexional.Field do
@moduledoc """
generic utility functions for fields
"""
@doc """
justify a value given alignment, size and filler char, if the given value
is longer it gets trimmed
## Examples
iex> Posexional.Field.positionalize("test",
...> %{alignment: :left, size: 10, fil... | lib/posexional/field.ex | 0.812421 | 0.560974 | field.ex | starcoder |
defmodule Cldr.Number.Backend.Format do
@moduledoc false
def define_number_module(config) do
module = inspect(__MODULE__)
backend = config.backend
config = Macro.escape(config)
number_system = Module.concat(backend, Number.System)
quote location: :keep,
bind_quoted: [
mo... | lib/cldr/number/backend/format.ex | 0.774924 | 0.621282 | format.ex | starcoder |
defmodule Mandrake do
@moduledoc """
Mandrake is a functional programming library that bring something else magic in elixir. Facility, prosperity and maintainability are Mandrake characteristics. Mandrake contains mathematical, logical, relational and functional API that helps developers in their daily work.
... | lib/mandrake.ex | 0.818265 | 0.752945 | mandrake.ex | starcoder |
defmodule Taex.MovingAverage do
defmodule DoubleEma do
defstruct [:ema, :ema_2, :value]
end
defmodule TripleEma do
defstruct [:ema, :ema_2, :ema_3, :value]
end
defmodule VolumeWeightedMovingAverage do
defstruct [:prices, :volumes, :periods, :value]
def update(%VolumeWeightedMovingAverage{} ... | lib/taex/moving_average.ex | 0.830044 | 0.696526 | moving_average.ex | starcoder |
defmodule Calculator do
@moduledoc """
Documentation for Calculator.
"""
@doc """
Hello world.
## Examples
iex> Calculator.hello
:world
"""
def hello do
:world
end
@doc """
Sum the two numbers
### Examples
iex> Calculator.sum(2,4)
6
"""
def sum(x, y),... | lib/calculator.ex | 0.835953 | 0.689495 | calculator.ex | starcoder |
defmodule Day18 do
def part1(input) do
parse(input)
|> Enum.reduce(fn n, sum ->
reduce([sum, n])
end)
|> magnitude
end
def part2(input) do
numbers = parse(input)
Enum.reduce(numbers, 0, fn n1, highest ->
Enum.reduce(numbers -- [n1], highest, fn n2, highest ->
max(high... | day18/lib/day18.ex | 0.653127 | 0.430866 | day18.ex | starcoder |
defmodule AutoApi.Property do
@moduledoc """
Data wrapper for state properties.
The struct contains three fields: `data`, `timestamp` and `failure`.
The `data` field can be either a scalar or a map, and when set it contains
the actual value of the state property.
The `timestamp` field indicates when the ... | lib/auto_api/property.ex | 0.83128 | 0.648132 | property.ex | starcoder |
defmodule Day19 do
# looking at input, letters should be: H ... Z ?
# 2D Map with origin at top left, meaning going down increases y
@alphabet MapSet.new(["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"])
@valid MapSet.union(@alp... | 2017/elixir/day19/lib/day19.ex | 0.522202 | 0.655594 | day19.ex | starcoder |
defmodule Plymio.Funcio.Enum.Collate do
@moduledoc ~S"""
Collate Patterns for Enumerables.
These functions collate the elements of an *enum* according to one of the defined *patterns*.
See `Plymio.Funcio` for overview and documentation terms.
"""
use Plymio.Funcio.Attribute
@type error :: Plymio.Funci... | lib/funcio/enum/collate/collate.ex | 0.821331 | 0.474327 | collate.ex | starcoder |
defmodule MerkleMap.MerkleTree do
@moduledoc false
@opaque t() :: %__MODULE__{}
@type key :: term()
@type value :: term()
defstruct [:tree]
alias MerkleMap.MerkleTreeImpl
alias MerkleMap.MerkleTree.Diff
@spec new(Enumerable.t()) :: t()
def new(enum) do
Enum.reduce(enum, new(), fn {k, v}, tree ... | astreu/deps/merkle_map/lib/merkle_map/merkle_tree.ex | 0.843589 | 0.427964 | merkle_tree.ex | starcoder |
defprotocol Distopy.Source do
@doc """
Returns the list of environment variable names defined in the source.
"""
@spec list_keys(t) :: [binary]
def list_keys(t)
@doc """
Returns wether the given environment variable is defined in the source.
"""
@spec has_key?(t, key :: binary) :: boolean
def has_k... | lib/distopy/source.ex | 0.877863 | 0.476336 | source.ex | starcoder |
defmodule Imglab.Source do
@moduledoc """
Provides a way to define and store information about a imglab source.
"""
@default_host "imglab-cdn.net"
@default_https true
@default_subdomains true
@derive {Inspect, except: [:secure_key, :secure_salt]}
@enforce_keys [:name]
defstruct host: @default_host,... | lib/imglab/source.ex | 0.928401 | 0.622574 | source.ex | starcoder |
defmodule GraylogSearch do
@moduledoc """
GraylogSearch constructs search queries in a composable manner.
It more or less follows [Graylog's search query language](http://docs.graylog.org/en/latest/pages/queries.html).
## Basic Usage
All queries start with a base URL to the graylog instance.
```
Graylo... | lib/graylog_search.ex | 0.909538 | 0.885235 | graylog_search.ex | starcoder |
defmodule Blueprint.Application.Module do
@moduledoc """
A struct containing contents from a BEAM module useful for
inspecting.
By default messages will only be found when servers explicitly
match. This however can be extended by providing custom server
matching expressions in the con... | lib/blueprint/application/module.ex | 0.731826 | 0.465995 | module.ex | starcoder |
defmodule Phoenix.HTML do
@moduledoc """
The default building blocks for working with HTML safely
in Phoenix.
This library provides three main functionalities:
* HTML safety
* Form handling (with CSRF protection)
* A tiny JavaScript library to enhance applications
## HTML safety
One of the m... | lib/phoenix_html.ex | 0.861115 | 0.726935 | phoenix_html.ex | starcoder |
defmodule NoWayJose do
@moduledoc """
Provides functions for signing a map of "claims" into a JWT using
a signing key.
"""
require Logger
@typedoc """
A map containing the claims to be encoded. Map keys must be strings.
"""
@type claims :: %{binary() => term()}
@typedoc """
Algorithm used in JW... | lib/no_way_jose.ex | 0.841256 | 0.58602 | no_way_jose.ex | starcoder |
defmodule Zaryn.TransactionChain.Transaction.CrossValidationStamp do
@moduledoc """
Represent a cross validation stamp validated a validation stamp.
"""
defstruct [:node_public_key, :signature, inconsistencies: []]
alias Zaryn.Crypto
alias Zaryn.TransactionChain.Transaction.ValidationStamp
@type incons... | lib/zaryn/transaction_chain/transaction/cross_validation_stamp.ex | 0.908385 | 0.433442 | cross_validation_stamp.ex | starcoder |
defmodule ExTorch.Utils do
alias ExTorch.Utils.Types, as: Types
defmodule ListWrapper do
@typedoc """
This struct wraps a list of elements or a list with lists of elements into
a representation suitable to be converted into an ExTorch.Tensor
"""
@type t :: %__MODULE__{
list: [number... | lib/extorch/utils.ex | 0.822474 | 0.660908 | utils.ex | starcoder |
defmodule Animu.Media.Anime do
@moduledoc """
Stores and builds Anime data
"""
use Animu.Ecto.Schema
alias Animu.Ecto.Image
alias __MODULE__
alias Animu.Media
alias Media.Franchise
alias Anime.{Bag, Options}
alias Anime.{Episode, Season, Genre}
schema "anime" do
## Meta Data
field :na... | lib/animu/media/anime.ex | 0.608012 | 0.483831 | anime.ex | starcoder |
defmodule ESpec.DatesTimes.Comparator do
@moduledoc false
alias ESpec.DatesTimes.Delegator
alias ESpec.DatesTimes.Types
@units [
:year,
:month,
:week,
:day,
:hour,
:minute,
:second,
:millisecond,
:microsecond
]
@spec diff(non_neg_integer, non_neg_integer, Types.time_un... | lib/espec/dates_times/comparator.ex | 0.787319 | 0.66133 | comparator.ex | starcoder |
defmodule Cashtrail.Banking.Account do
@moduledoc """
This is an `Ecto.Schema` struct that represents a banking account of the entity.
## Definition
According to [Investopedia](https://www.investopedia.com/terms/a/account.asp),
the term account generally refers to a record-keeping or ledger activity. This
... | apps/cashtrail/lib/cashtrail/banking/account.ex | 0.878131 | 0.732664 | account.ex | starcoder |
defmodule Mix.Tasks.EnableGmailInboxSync do
use Mix.Task
@shortdoc "Script to enable the Gmail inbox sync feature for the given account"
@moduledoc """
Example:
```
$ mix enable_gmail_inbox_sync [ACCOUNT_ID]
$ mix enable_gmail_inbox_sync [ACCOUNT_ID] [HISTORY_ID]
```
On Heroku:
```
$ heroku run... | lib/mix/tasks/enable_gmail_inbox_sync.ex | 0.727879 | 0.608303 | enable_gmail_inbox_sync.ex | starcoder |
defmodule Geometry.PointM do
@moduledoc """
A point struct, representing a 2D point with a measurement.
"""
import Geometry.Guards
alias Geometry.{GeoJson, Hex, PointM, WKB, WKT}
defstruct [:coordinate]
@blank " "
@empty %{
{:ndr, :hex} => "000000000000F87F000000000000F87F000000000000F87F",
... | lib/geometry/point_m.ex | 0.965576 | 0.796649 | point_m.ex | starcoder |
defmodule AWS.Rekognition do
@moduledoc """
This is the Amazon Rekognition API reference.
"""
@doc """
Compares a face in the *source* input image with each face detected in the
*target* input image.
<note> If the source image contains multiple faces, the service detects the
largest face and uses it ... | lib/aws/rekognition.ex | 0.967101 | 0.986752 | rekognition.ex | starcoder |
defmodule Vega.Card do
@moduledoc """
This module describes a card struct. A card is a basic data structure, which contains a lot of interesting details
of a card.
"""
use Yildun.Collection
alias Vega.Card
alias Vega.Comment
@collection "cards"
collection "cards" do
attribute :id, String.t()... | lib/vega/card.ex | 0.79653 | 0.489931 | card.ex | starcoder |
defmodule I18nHelpers.Ecto.Translator do
@doc ~S"""
Translates an Ecto struct, a list of Ecto structs or a map containing translations.
Translating an Ecto struct for a given locale consists of the following steps:
1. Get the list of the fields that need to be translated from the Schema.
The Schema m... | lib/ecto/translator.ex | 0.805096 | 0.510863 | translator.ex | starcoder |
defmodule DealerReviews.Scraper do
@moduledoc """
Contains functions to request data from the site
and convert the html document to review structs.
"""
@doc """
Takes an integer range of pages then calls
`get_reviews_page` for each page and combines
the outputs.
"""
def get_reviews_pages(pages) do
... | lib/scraper.ex | 0.669205 | 0.504211 | scraper.ex | starcoder |
defmodule MrRoboto.Rules do
@moduledoc """
The Rules module defines the rules for a user-agent.
The Rules module defines the MrRoboto.Rules struct which provides a convenient
way to track the directives for a user agent
The Rules module also provides functionality for checking whether a path is
legal for ... | lib/mr_roboto/rules.ex | 0.906047 | 0.850903 | rules.ex | starcoder |
defmodule PropCheck.Test.PingPongMaster do
@moduledoc """
This is the ping pong master from Proper's Process Interaction Tutorial,
translated from Erlang to Elixir.
From the tutorial introduction:
In this tutorial, we will use PropEr to test a group of interacting processes.
The system under test consists... | test/support/ping_pong_master.ex | 0.685844 | 0.407805 | ping_pong_master.ex | starcoder |
defmodule ExPlasma.Output.Position do
@moduledoc """
Generates an Output position if given the:
`blknum` - The block number for this output
`txindex` - The index of the Transaction in the block.
`oindex` - The index of the Output in the Transaction.
"""
@behaviour ExPlasma.Output
alias ExPlasma.Outpu... | lib/ex_plasma/output/position.ex | 0.918242 | 0.727951 | position.ex | starcoder |
defmodule Boids.Motion do
require Logger
alias Boids.Physics.Vector
@max_speed 10
def applyforce(boid, force) do
%Boids.Boid{
position: boid.position,
velocity: boid.velocity,
accleration: Vector.add(boid.accleration, force)
}
end
def move_boid(boid, others) do
sep = separat... | lib/boids/motion.ex | 0.586286 | 0.706038 | motion.ex | starcoder |
defmodule Vivid.Bounds do
alias Vivid.{Bounds, Point, Shape, Bounds.Of}
defstruct ~w(min max)a
@moduledoc """
Provides information about the bounds of a box and pixel positions within it.
## Example
iex> use Vivid
...> Box.init(Point.init(5,10),Point.init(15,20))
...> |> Bounds.bounds()
#Vi... | lib/vivid/bounds.ex | 0.95264 | 0.776369 | bounds.ex | starcoder |
defmodule Lexdee do
@moduledoc """
Documentation for Lexdee.
"""
@doc """
Hello world.
## Examples
iex> Lexdee.hello()
:world
"""
alias Lexdee.Client
defdelegate create_client(base_url, cert \\ nil, key \\ nil),
to: Client,
as: :new
alias Lexdee.Profiles
defdelegate list... | lib/lexdee.ex | 0.684475 | 0.457379 | lexdee.ex | starcoder |
defmodule Chameleon.HSV do
@enforce_keys [:h, :s, :v]
defstruct @enforce_keys
@moduledoc """
HSV (hue, saturation, value) represents colors using a cylinder where colors
are sorted by angles and then adjusted via the saturation and value
parameters.
See Chameleon.HSL for a related, but different colorsp... | lib/chameleon/hsv.ex | 0.891233 | 0.439988 | hsv.ex | starcoder |
defmodule Day6 do
def from_file(path) do
File.stream!(path)
|> Enum.map(
&(
String.split(&1, ",")
|> Enum.map(
fn x ->
x
|> String.trim
|> String.to_integer end
)
|> List.to_tuple)
... | lib/day6.ex | 0.689933 | 0.560433 | day6.ex | starcoder |
defmodule Cocktail.Validation.DayOfMonth do
@moduledoc false
import Cocktail.Validation.Shift
import Cocktail.Util, only: [next_gte: 2]
# assumed that DST can not "take" more than 4 hours between any 2 consecutive days
@min_dst_resultant_hours 20
@type t :: %__MODULE__{days: [Cocktail.day_of_month()]}
... | lib/cocktail/validation/day_of_month.ex | 0.718199 | 0.48932 | day_of_month.ex | starcoder |
defmodule Coxir.Gateway.Worker do
@moduledoc false
use WebSockex
alias Coxir.Stage.Producer
def start_link(state) do
state = state
|> Map.merge(
%{
beat: nil,
session: nil,
sequence: nil
}
)
WebSockex.start_link(state.gateway, __MODULE__, state)
end
de... | lib/coxir/gateway/worker.ex | 0.6705 | 0.483222 | worker.ex | starcoder |
defmodule LdGraph2.Graph do
@moduledoc """
A directed graph.
"""
defstruct nodes: %{}
### =========================================================================
### Putting new nodes and edges
### =========================================================================
@spec put_node(%LdGraph2.Gra... | apps/ld_graph2/lib/ld_graph2/graph.ex | 0.889211 | 0.910823 | graph.ex | starcoder |
defmodule Canvas.Resources.Users do
@moduledoc """
Provides functions to interact with the
[course endpoints](https://canvas.instructure.com/doc/api/users).
"""
alias Canvas.{Client, Listing, Response}
alias Canvas.Resources.User
@doc """
A paginated list of of users associated with this account.
S... | lib/canvas/resources/users.ex | 0.754553 | 0.414928 | users.ex | starcoder |
defmodule Calcy.Evaluator do
@moduledoc """
Documentation for the Evaluator.
"""
import IO.ANSI
@doc """
Returns the value of a addition operation between the left and right hand sides
"""
def eval(env, {:plus, right, left}) do
eval(env, right) + eval(env, left)
end
@d... | lib/calcy/evaluator.ex | 0.845656 | 0.821796 | evaluator.ex | starcoder |
defmodule MPEGAudioFrameParser.Frame do
defstruct version_id: nil,
crc_protection: false,
bitrate: nil,
layer: nil,
sample_rate: nil,
padding: 0,
channel_mode: nil,
data: <<>>,
valid: false,
complete: false
... | lib/mpeg_audio_frame_parser/frame.ex | 0.566378 | 0.554048 | frame.ex | starcoder |
defmodule Swiss.Enum do
@moduledoc """
Helper functions for dealing with Enumerables.
"""
alias Swiss.Enum.KeyValueError
@doc """
Finds the first element in `enumerable` where its `key` equals `value`.
Returns `default` if not found.
### Examples
iex> Swiss.Enum.find_by([%{life: 11}, %{life: ... | lib/swiss/enum.ex | 0.875168 | 0.578746 | enum.ex | starcoder |
defmodule NervesTime.RTC.Abracon do
@moduledoc """
Abracon RTC implementation for NervesTime
To configure NervesTime to use this module, update the `:nerves_time` application
environment like this:
```elixir
config :nerves_time, rtc: NervesTime.RTC.Abracon
```
If not using `"i2c-1"` or the default I2... | lib/nerves_time/rtc/abracon.ex | 0.781872 | 0.771456 | abracon.ex | starcoder |
defmodule Ambi do
@moduledoc """
Ambi keeps the contexts that define your domain
and business logic.
Contexts are also responsible for managing your data, regardless
if it comes from the database, an external API or others.
"""
import Ecto.Query, warn: false
use Timex
require Logger
alias Ambi.Rep... | lib/ambi.ex | 0.651022 | 0.414069 | ambi.ex | starcoder |
defmodule Calixir.SampleDatesTableMaker do
@moduledoc """
This module generates Elixir data from the Calixir-4.0 sample data.
"""
@doc """
Transforms the sample files into one set with sample dates.
"""
def sample_dict_from_files(files) do
files
|> check_path
|> datasets_from_files
|> sam... | lib/calixir/sample_dates_table_maker.ex | 0.83901 | 0.640601 | sample_dates_table_maker.ex | starcoder |
defmodule ExXirr do
@moduledoc """
Library to calculate XIRR and absolute rate of return
through the Newton Raphson method.
"""
@max_error 1.0e-3
@days_in_a_year 365
# Public API
@doc """
Function to calculate the rate of return for a given array of
dates and values.
## Examples
iex> d ... | lib/ex_xirr.ex | 0.861727 | 0.727661 | ex_xirr.ex | starcoder |
defmodule Game.Dice.Face do
@moduledoc """
Face of the dice determines the action of the dice,
when not {disabled} do {type} {stance} for {count} times with {amount}
which will intersect with opposing faces for {intersects} times
"""
alias Game.Dice
alias Game.Dice.Face
@type t :: %Face{
coun... | src/server/lib/game/dice/face.ex | 0.890245 | 0.637003 | face.ex | starcoder |
defmodule ExUnitFixtures.AutoImport do
@moduledoc """
A mechanism for automatically importing fixtures into the current test module.
In a relatively large test suite you'll most likely need to declare some
fixtures that are to be shared between all tests in a project or module.
`ExUnitFixtures.AutoImport` pr... | lib/ex_unit_fixtures/auto_import.ex | 0.887787 | 0.70724 | auto_import.ex | starcoder |
defmodule Ecto.Adapters.SQL do
@moduledoc """
Behaviour and implementation for SQL adapters.
The implementation for SQL adapter provides a
pooled based implementation of SQL and also expose
a query function to developers.
Developers that use `Ecto.Adapters.SQL` should implement
a connection module with ... | deps/ecto/lib/ecto/adapters/sql.ex | 0.892328 | 0.517022 | sql.ex | starcoder |
defmodule Mix.Releases.Checks do
@moduledoc """
This module defines a behavior for, and orchestrator of, static analysis checks
to be performed at release-time. These checks are intended to operate on the fully
reified release configuration and metadata, and return warnings, errors, or ok for
the release asse... | lib/mix/lib/releases/checks.ex | 0.763484 | 0.435601 | checks.ex | starcoder |
defmodule Norm.Spec.Selection do
@moduledoc false
# Provides the definition for selections
defstruct subset: nil
alias Norm.Schema
alias Norm.SpecError
def new(schema, path) do
select(schema, path, %{})
end
defp select(_, [], selection), do: %__MODULE__{subset: selection}
defp select(schema, ... | lib/norm/spec/selection.ex | 0.738575 | 0.437643 | selection.ex | starcoder |
defmodule Credo.CLI.Output do
@moduledoc """
This module provides helper functions regarding command line output.
"""
@category_tag_map %{"refactor" => "F"}
@priority_values_map [
higher: [color: :red, arrow: "\u2191"],
high: [color: :red, arrow: "\u2197"],
normal: [color: :yellow, arrow: "\u2192... | lib/credo/cli/output.ex | 0.756762 | 0.418964 | output.ex | starcoder |
defmodule ExampleFiles.File do
@moduledoc """
A `GenServer` that provides access to a project file that serves as an example
or a template for a project file.
The state of an `ExampleFiles.File` process is its filesystem path.
"""
use GenServer
@typedoc """
An error encountered while processing an ex... | lib/example_files/file.ex | 0.691185 | 0.583856 | file.ex | starcoder |
defmodule AWS.AppMesh do
@moduledoc """
AWS App Mesh is a service mesh based on the Envoy proxy that makes it easy
to monitor and
control microservices. App Mesh standardizes how your microservices
communicate, giving you
end-to-end visibility and helping to ensure high availability for your
applicatio... | lib/aws/app_mesh.ex | 0.875335 | 0.550728 | app_mesh.ex | starcoder |
defmodule Benchmarks.GoogleMessage3.Message10576 do
@moduledoc false
use Protobuf, syntax: :proto2
@type t :: %__MODULE__{}
defstruct []
end
defmodule Benchmarks.GoogleMessage3.Message10154 do
@moduledoc false
use Protobuf, syntax: :proto2
@type t :: %__MODULE__{
field10192: binary,
... | bench/lib/datasets/google_message3/benchmark_message3_6.pb.ex | 0.823115 | 0.565899 | benchmark_message3_6.pb.ex | starcoder |
defmodule VendingMachine.MakeCurrency do
alias VendingMachine.CurrencyNote
alias VendingMachine.CurrencyCoin
def make_currency(currency_specification) do
case currency_specification do
100.00 ->
%CurrencyNote{
background_color: "Teal",
fluorescent_strip_color: "Pink",
... | lib/vending_machine/currency/make_currency.ex | 0.687105 | 0.402011 | make_currency.ex | starcoder |
defmodule AWS.SFN do
@moduledoc """
AWS Step Functions
AWS Step Functions is a service that lets you coordinate the components of
distributed applications and microservices using visual workflows.
You can use Step Functions to build applications from individual components,
each of which performs a discre... | lib/aws/generated/sfn.ex | 0.909523 | 0.707405 | sfn.ex | starcoder |
defmodule Sqlite.Ecto2 do
@moduledoc ~S"""
Ecto Adapter module for SQLite.
It uses Sqlitex and Esqlite for accessing the SQLite database.
## Configuration Options
When creating an `Ecto.Repo` that uses a SQLite database, you should configure
it as follows:
```elixir
# In your config/config.exs file
... | lib/sqlite_ecto.ex | 0.76555 | 0.739986 | sqlite_ecto.ex | starcoder |
defmodule Mechanize.Query do
@moduledoc """
Provides an easy support for querying elements in many Mechanize modules.
This module is not primarily designed to be used by cliente code, instead you should use
indirectly throught `Mechanize.Page.search/2` and `Mechanize.Page.filter_out/2`. Many other
functions ... | lib/mechanize/query.ex | 0.945801 | 0.856872 | query.ex | starcoder |
defmodule Money do
@moduledoc """
Money implements a set of functions to store, retrieve, convert and perform
arithmetic on a `Money.t` type that is composed of a currency code and
a decimal currency amount.
Money is very opinionated in the interests of serving as a dependable library
that can underpin acc... | lib/money.ex | 0.924437 | 0.759426 | money.ex | starcoder |
defmodule WeePub.Subscriber.Filter do
@moduledoc false
@doc """
Captures a pattern and turns it into a filter function
"""
defmacro filter(pattern) do
quote do
fn (message) ->
case message do
unquote(pattern) -> true
_ -> false
end
end
end
end
end
de... | lib/wee_pub/subscriber.ex | 0.874359 | 0.748007 | subscriber.ex | starcoder |
defmodule Cog.Pipeline.OutputSink do
alias Experimental.GenStage
alias Cog.Chat.Adapter, as: ChatAdapter
alias Cog.Events.PipelineEvent
alias Cog.Pipeline
alias Cog.Pipeline.{Destination, DataSignal, DoneSignal, Evaluator}
alias Cog.Template
alias Cog.Template.Evaluator
@moduledoc ~s"""
Specialized ... | lib/cog/pipeline/output_sink.ex | 0.772574 | 0.462048 | output_sink.ex | starcoder |
defmodule Ecto.Repo do
@moduledoc """
This module is used to define a repository. A repository maps to a data
store, for example an SQL database. A repository must implement `conf/0` and
set an adapter (see `Ecto.Adapter`) to be used for the repository.
When used, the following options are allowed:
* `:ad... | lib/ecto/repo.ex | 0.869063 | 0.601945 | repo.ex | starcoder |
defmodule ExDiceRoller.Filters do
@moduledoc """
Filters are used to filter the final value of an evaluated dice roll using
either a provided comparator and comparison number, such as `>=: 3`, or
dropping highest or lowest value, such as `drop_highest: true`. Possible
comparators include:
* numerical: `>=`... | lib/filters.ex | 0.787441 | 0.787237 | filters.ex | starcoder |
defmodule Snitch.Data.Model.LineItem do
@moduledoc """
LineItem API and utilities.
"""
use Snitch.Data.Model
import Ecto.Changeset, only: [change: 1]
alias Snitch.Data.Model.{Variant, Product}
alias Snitch.Data.Schema.LineItem
alias Snitch.Domain.Order
alias Snitch.Tools.Money, as: MoneyTools
alia... | apps/snitch_core/lib/core/data/model/line_item.ex | 0.862714 | 0.68591 | line_item.ex | starcoder |
defmodule Infer.Archive do
@moduledoc """
Archive type matchers based on the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming))
"""
defdelegate epub?(binary), to: Infer.Book
@doc """
Takes the binary file contents as arguments. Returns `true` if it's a zip archive.
See: https://en... | lib/matchers/archive.ex | 0.858881 | 0.518607 | archive.ex | starcoder |
defmodule Timex.Helpers do
@moduledoc false
use Timex.Constants
import Timex.Macros
alias Timex.Types
@doc """
Given a {year, day} tuple where the day is the iso day of that year, returns
the date tuple of format {year, month, day}.
## Examples
iex> Timex.Helpers.iso_day_to_date_tuple(1988, 24... | lib/timex/helpers.ex | 0.858911 | 0.5901 | helpers.ex | starcoder |
defmodule AWS.OpsWorks do
@moduledoc """
AWS OpsWorks
Welcome to the *AWS OpsWorks Stacks API Reference*.
This guide provides descriptions, syntax, and usage examples for AWS OpsWorks
Stacks actions and data types, including common parameters and error codes.
AWS OpsWorks Stacks is an application manage... | lib/aws/generated/ops_works.ex | 0.887869 | 0.558688 | ops_works.ex | starcoder |
defmodule DBConnection.Sojourn.Broker do
@moduledoc """
A `:sbroker` callback module using a timeout strategy for the client queue and
a CoDel strategy for the connection queue.
### Queue options
* `:queue_timeout` - The time to wait for control of the connection's
state (default: `5_000`)
* `:que... | deps/db_connection/lib/db_connection/sojourn/broker.ex | 0.841109 | 0.641478 | broker.ex | starcoder |
defmodule SurveyTool.RatingQuestion do
@moduledoc """
Module representing a rating question type question in a survey.
"""
alias __MODULE__, as: RatingQuestion
defstruct scores: [], text: nil, theme: nil
@typedoc "An optional list of integer scores"
@type scores() :: [integer] | []
@typedoc "Optional... | lib/survey_tool/rating_question.ex | 0.904677 | 0.555676 | rating_question.ex | starcoder |
defmodule Day6 do
@moduledoc """
A debugger program here is having an issue: it is trying to repair a memory reallocation routine, but it keeps getting
stuck in an infinite loop.
In this area, there are sixteen memory banks; each memory bank can hold any number of blocks. The goal of the
reallocation routine... | lib/day6.ex | 0.661923 | 0.707582 | day6.ex | starcoder |
defmodule Day16 do
@moduledoc """
Documentation for Day16.
"""
def part1 do
[rules, _ticket, others] =
read_data("input.txt")
|> Enum.to_list()
rules = parse_rules(rules)
extract_invalid_values(others |> Enum.slice(1..-1), rules) |> Enum.sum() |> IO.puts()
end
def part2 do
[ru... | day16/lib/day16.ex | 0.569254 | 0.435721 | day16.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.