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 Salsa20 do
@moduledoc """
Salsa20 symmetric stream cipher
As specified in http://cr.yp.to/snuffle/spec.pdf.
Also includes the HSalsa20 hashing function as specified in
http://cr.yp.to/highspeed/naclcrypto-20090310.pdf
"""
import Bitwise
defp rotl(x, r), do: rem(x <<< r ||| x >>> (32 - r), 0... | lib/salsa20.ex | 0.832339 | 0.629405 | salsa20.ex | starcoder |
defmodule Bypass do
@moduledoc """
Bypass provides a quick way to create a custom Plug that can be put in place
instead of an actual HTTP server to return prebaked responses to client
requests.
This module is the main interface to the library.
"""
defstruct pid: nil, port: nil
@typedoc """
Represen... | lib/bypass.ex | 0.804214 | 0.476641 | bypass.ex | starcoder |
defmodule Mongo.UnorderedBulk do
@moduledoc"""
An **unordered** bulk is filled in the memory with the bulk operations. These are divided into three lists (inserts, updates, deletes)
added. If the unordered bulk is written to the database, the groups are written in the following order:
1. inserts
2. updates
... | lib/mongo/unordered_bulk.ex | 0.892011 | 0.927363 | unordered_bulk.ex | starcoder |
defmodule Ada.Schema.Frequency do
@moduledoc """
The module expresses the idea of something that can be repeated at regular intervals.
While it's used mainly with `Ada.Schema.ScheduledTask`, it can be applied to other use cases.
See `t:t/0` for details.
"""
use Ecto.Schema
@derive {Jason.Encoder, excep... | lib/ada/schema/frequency.ex | 0.930734 | 0.654721 | frequency.ex | starcoder |
defmodule Day9 do
@moduledoc """
--- Day 9: Encoding Error ---
Part 1: first number in the list (after the preamble) which is not the sum of two
of the 25 numbers before it
Part 2: To find the encryption weakness, add together the smallest and
largest number in this contiguous range
"""
@preamble_le... | day9.ex | 0.585101 | 0.556038 | day9.ex | starcoder |
defmodule AdventOfCode2019.SetAndForget do
@moduledoc """
Day 17 — https://adventofcode.com/2019/day/17
"""
require AdventOfCode2019.IntcodeComputer
@spec part1(Enumerable.t()) :: integer
def part1(in_stream) do
in_stream
|> load_program()
|> gen_scaffold()
|> sum_align_params()
end
@... | lib/advent_of_code_2019/day17.ex | 0.664214 | 0.53607 | day17.ex | starcoder |
defmodule Delve.Plan do
@moduledoc """
Core logic for the plan / run graph construction.
There are 4 different node types in the run graph:
- resolver-nodes: represents a `Delve.Resolver` to be executed
- or-nodes: represents a set of paths of which at least ONE must be traversed
- and-nodes: represents a ... | lib/delve/plan.ex | 0.868743 | 0.720873 | plan.ex | starcoder |
defmodule Scenic.Primitive.Rectangle do
@moduledoc """
Draw a rectangle on the screen.
## Data
`{width, height}`
The data for a line is a tuple containing two numbers.
* `width` - width of the rectangle
* `height` - height of the rectangle
## Styles
This primitive recognizes the following styles... | lib/scenic/primitive/rectangle.ex | 0.934418 | 0.679378 | rectangle.ex | starcoder |
defmodule Mimic.DSL do
@moduledoc """
Stubs and expectations can be expressed in a more natural way.
```elixir
use Mimic.DSL
```
```elixir
test "basic example" do
stub Calculator.add(_x, _y), do: :stub
expect Calculator.add(x, y), do: x + y
expect Calculator.mult(x, y), do: x * y
assert... | lib/mimic/dsl.ex | 0.755141 | 0.903932 | dsl.ex | starcoder |
defmodule Militerm.Parsers.MML do
@moduledoc """
Parses MML into a data structure that can be used to output dynamic content.
Generally, this is used in item descriptions or other lightly dynamic content.
See Militerm.If.Builders.MML for information on building up the data structures needed
to output MML.
... | lib/militerm/parsers/mml.ex | 0.769773 | 0.831691 | mml.ex | starcoder |
defmodule KingAlbertEx.Board do
@moduledoc """
A Board represents the positions of all the cards on the "table" at a given point in time.
This module includes functions for creating, manipulating and querying a Board, as well
as displaying it to the user.
"""
# TODO Consider separating board display logic ... | lib/king_albert_ex/board.ex | 0.525612 | 0.561455 | board.ex | starcoder |
defmodule EnvVar.Provider do
@moduledoc """
A `Config.Provider` that reads a *configuration schema* from a map and
reads configuration from environment variables.
Variable names are constructed from the field names directly,
following a convention.
## Usage
Define a function that returns a map represen... | lib/providers/env_var_provider.ex | 0.899803 | 0.644617 | env_var_provider.ex | starcoder |
defmodule InflexDB.Client do
@moduledoc """
The client connection.
## Url
By default connects to localhost:8086. But it can be changed in the client struct.
```elixir
%InflexDB.Client{url: "http:://myinfluxdbinstance:8086"}
```
## No authentication
By default the client has no authentication meth... | lib/inflex_db/client.ex | 0.811863 | 0.752922 | client.ex | starcoder |
defmodule Nebulex.Adapters.Dist do
@moduledoc """
Adapter module for distributed or partitioned cache.
A distributed, or partitioned, cache is a clustered, fault-tolerant cache
that has linear scalability. Data is partitioned among all the machines
of the cluster. For fault-tolerance, partitioned caches can ... | lib/nebulex/adapters/dist.ex | 0.936289 | 0.752945 | dist.ex | starcoder |
defmodule TableRex.Table do
@moduledoc """
A set of functions for working with tables.
The `Table` is represented internally as a struct though the
fields are private and must not be accessed directly. Instead,
use the functions in this module.
"""
alias TableRex.Cell
alias TableRex.Column
alias Tabl... | lib/table_rex/table.ex | 0.921512 | 0.547585 | table.ex | starcoder |
defmodule AWS.CostExplorer do
@moduledoc """
The Cost Explorer API enables you to programmatically query your cost and usage
data.
You can query for aggregated data such as total monthly costs or total daily
usage. You can also query for granular data, such as the number of daily write
operations for Amaz... | lib/aws/generated/cost_explorer.ex | 0.919539 | 0.748663 | cost_explorer.ex | starcoder |
defmodule Expline do
use GenServer
require Logger
@moduledoc """
`Expline` is a `GenServer` that wraps the `Expline.Spline` module. It builds
the `Expline.Spline` after being supplied the input parameters in `start/3` or
`start_link/3`. After initializing, use the `interpolate/2` and
`interpolate/3` func... | lib/expline.ex | 0.8985 | 0.669704 | expline.ex | starcoder |
defmodule Xgit.ObjectId do
@moduledoc ~S"""
An object ID is a string that identifies an object within a repository.
This string must match the format for a SHA-1 hash (i.e. 40 characters
of lowercase hex).
"""
use Xgit.ObjectType
import Xgit.Util.ForceCoverage
alias Xgit.ContentSource
@typedoc "A ... | lib/xgit/object_id.ex | 0.887999 | 0.616532 | object_id.ex | starcoder |
defmodule ExMachina do
@moduledoc """
Defines functions for generating data
In depth examples are in the [README](README.html)
"""
defmodule UndefinedFactoryError do
@moduledoc """
Error raised when trying to build or create a factory that is undefined.
"""
defexception [:message]
def ... | lib/ex_machina.ex | 0.831725 | 0.489381 | ex_machina.ex | starcoder |
defmodule Typo.Utils.Guards do
@moduledoc false
defguardp is_colour_range(this) when this >= 0.0 and this <= 1.0
@doc "Returns `true` if `this` is a valid CMYK colour tuple."
defguard is_colour_cmyk(this)
when is_tuple(this) and tuple_size(this) == 4 and is_colour_range(elem(this, 0)) and
... | lib/typo/utils/guards.ex | 0.897925 | 0.735784 | guards.ex | starcoder |
defmodule Stripe.InvoiceItems do
@moduledoc """
Invoice Items
Sometimes you want to add a charge or credit to a customer but only
actually charge the customer's card at the end of a regular billing
cycle. This is useful for combining several charges to minimize
per-transaction fees or having Stripe tabu... | lib/stripe/invoice_items.ex | 0.900394 | 0.587529 | invoice_items.ex | starcoder |
defmodule Excal.Recurrence.Stream do
@moduledoc """
Generates Elixir streams from iCalendar recurrence rules (RRULE).
This is the most idiomatic way of interacting with iCalendar recurrence rules in Elixir. The streams created here act
like any other Elixir stream would act.
"""
alias Excal.Recurrence.Ite... | lib/excal/recurrence/stream.ex | 0.928466 | 0.536434 | stream.ex | starcoder |
defimpl Charts.StackedBarChart, for: Charts.BaseChart do
alias Charts.BaseChart
alias Charts.StackedBarChart.MultiBar
alias Charts.StackedColumnChart.Rectangle
alias Charts.BarChart.Dataset
def rows(%BaseChart{dataset: nil}), do: []
def rows(%BaseChart{dataset: dataset}), do: rows(dataset)
def rows(%Data... | charts/lib/charts/stacked_bar_chart/base_chart_impl.ex | 0.776411 | 0.444083 | base_chart_impl.ex | starcoder |
defmodule Cldr.Locale.Loader do
@moduledoc """
Provides a public interface to read the
raw JSON locale files and return the
CLDR data in a consistent format.
The functions in this module are intended for the
use of authors writing additional CLDR-based
libraries.
In addition, the functions in this mod... | lib/cldr/locale/loader.ex | 0.738292 | 0.429728 | loader.ex | starcoder |
defprotocol Brook.Deserializer.Protocol do
@moduledoc """
The protocol for standard de-serialization of Elixir structs passed
through the Brook event stream for decoding from the in-transit format.
Brook drivers are expected to implement a default de-serializer for
converting from a given encoding to an Elix... | lib/brook/deserializer.ex | 0.869701 | 0.452475 | deserializer.ex | starcoder |
defmodule Cuda.Graph.Node do
@moduledoc """
Represents an evaluation graph node.
You can use this module to define your own evaluation nodes. To do this you
should implement callbacks that will be called with user options, specified
at node creation time and current Cuda environment. Here is a simple example... | lib/cuda/graph/node.ex | 0.902675 | 0.834744 | node.ex | starcoder |
defmodule PelemayFp.Merger do
@moduledoc """
Merges two consecutive list of tuples of a `Range`, count and a list.
"""
@type t :: list({Range.t(), non_neg_integer, list})
@doc """
Merges two consecutive list of tuples of a `Range`, count and a list.
## Examples
iex> PelemayFp.Merger.merge([{1..2... | lib/pelemay_fp/merger.ex | 0.777553 | 0.592431 | merger.ex | starcoder |
defmodule AutoApi.UsageState do
@moduledoc """
Usage state
"""
alias AutoApi.{CommonData, State, UnitType}
use AutoApi.State, spec_file: "usage.json"
@type distance_over_time :: %{
distance: UnitType.length(),
time: UnitType.duration()
}
@type driving_modes_activation_period... | lib/auto_api/states/usage_state.ex | 0.800692 | 0.531513 | usage_state.ex | starcoder |
defmodule ExDoc.Markdown do
@moduledoc """
Adapter behaviour and conveniences for converting Markdown to HTML.
ExDoc is compatible with any markdown processor that implements the
functions defined in this module. The markdown processor can be changed
via the `:markdown_processor` option in your `mix.exs` or ... | spec/fixtures/mix/deps/ex_doc/lib/ex_doc/markdown.ex | 0.868046 | 0.753965 | markdown.ex | starcoder |
defmodule Breadboard.GPIO.BaseGPIO do
@moduledoc """
Define the behaviour to handle GPIOs pinout mapping for a specific platform.
In order to support a Pinout mapping for a specific platform this `behaviours` can be referenced by modules implementing `c:pinout_map/0` function.
This function must return a map w... | lib/breadboard/gpio/base_gpio.ex | 0.809728 | 0.942295 | base_gpio.ex | starcoder |
defmodule PardallWeb.PardallMarkdownHelpers do
alias PardallMarkdown.Content.{Link, AnchorLink}
use Phoenix.HTML
import Phoenix.LiveView.Helpers
def collapsible_taxonomy_tree_list(nil), do: nil
def collapsible_taxonomy_tree_list(taxonomies), do: collapsible_taxonomy_tree(taxonomies)
defp collapsible_taxo... | lib/pardall_web/views/pardall_markdown_helpers.ex | 0.68721 | 0.559531 | pardall_markdown_helpers.ex | starcoder |
defmodule SMPPEX.MC do
@moduledoc """
This is a module for launching a TCP listener (or any other listener supported by `ranch`, for example, `ssl`) which handles incoming connections with the passed `SMPPEX.Session` implementations.
To start an MC one generally should do the following.
1. Implement an `SMPPE... | lib/smppex/mc.ex | 0.916306 | 0.878939 | mc.ex | starcoder |
defmodule Robotica.Config do
@moduledoc """
Handle loading of Robotica specific configuration
"""
alias RoboticaCommon.Schema
alias RoboticaCommon.Validation
require Logger
defmodule Loader do
@moduledoc """
Internal loader for Robotica config
"""
defp classification_schema do
%{... | robotica/lib/robotica/config.ex | 0.745028 | 0.456591 | config.ex | starcoder |
defmodule Ratatouille.View do
@moduledoc """
In Ratatouille, a view is simply a tree of elements. Each element in the tree
holds an attributes map and a list of zero or more child nodes. Visually, it
looks like something this:
%Element{
tag: :view,
attributes: %{},
children: [
... | lib/ratatouille/view.ex | 0.896507 | 0.66608 | view.ex | starcoder |
defmodule Grizzly.ZWave.CommandClasses.ThermostatMode do
@moduledoc """
"ThermostatMode" Command Class
The Thermostat Mode Command Class is used to control which mode a thermostat operates.
"""
@behaviour Grizzly.ZWave.CommandClass
alias Grizzly.ZWave.DecodeError
@type mode ::
:off
... | lib/grizzly/zwave/command_classes/thermostat_mode.ex | 0.90218 | 0.52543 | thermostat_mode.ex | starcoder |
defmodule Hypex do
@moduledoc """
This module provides an Elixir implementation of HyperLogLog as described within
http://algo.inria.fr/flajolet/Publications/FlFuGaMe07.pdf. Various implementations
are provided in order to account for performance and memory optimizations.
A Hypex instance is simply a three-e... | lib/hypex.ex | 0.92571 | 0.772959 | hypex.ex | starcoder |
defmodule Horde.Supervisor do
@moduledoc """
A distributed supervisor.
Horde.Supervisor implements a distributed DynamicSupervisor backed by a add-wins last-write-wins δ-CRDT (provided by `DeltaCrdt.AWLWWMap`). This CRDT is used for both tracking membership of the cluster and tracking supervised processes.
Us... | lib/horde/supervisor.ex | 0.897678 | 0.865565 | supervisor.ex | starcoder |
defmodule Commanded.EventStore.Adapters.InMemory do
@moduledoc """
An in-memory event store adapter useful for testing as no persistence provided.
"""
@behaviour Commanded.EventStore
use GenServer
defmodule State do
@moduledoc false
defstruct [
:serializer,
persisted_events: [],
... | lib/commanded/event_store/adapters/in_memory.ex | 0.774754 | 0.404331 | in_memory.ex | starcoder |
defmodule AtomTweaksWeb.RenderHelpers do
@moduledoc """
Helper functions for rendering templates.
"""
use Phoenix.HTML
require Logger
import Phoenix.View
alias AtomTweaks.Tweaks.Tweak
@doc """
Renders the code for the given `tweak`.
"""
@spec render_code(Tweak.t()) :: Phoenix.HTML.safe()
def... | lib/atom_tweaks_web/helpers/render_helpers.ex | 0.781539 | 0.405037 | render_helpers.ex | starcoder |
defmodule Gorpo.Announce.Unit do
@moduledoc """
register a service on consul and periodically update its health
status. Normally, you shouldn't need to use this module
directly. Use Gorpo.Announce instead. The next example uses a dummy
driver which does nothing. You should use `Gorpo.Drivers.HTTPC` for
a re... | lib/gorpo/announce/unit.ex | 0.765243 | 0.478712 | unit.ex | starcoder |
defmodule PassiveSupport.Stream do
@moduledoc """
Helper functions for working with enumerables as streams.
"""
import PassiveSupport.Enum, only: [to_map: 1]
@doc """
Processes an item while iterating through the provided stream
`PassiveSupport.Stream.with_memo/3` attaches an arbitrary accumulator
`ac... | lib/passive_support/base/stream.ex | 0.859339 | 0.703842 | stream.ex | starcoder |
defmodule Aoc2019.Day6 do
@behaviour DaySolution
def solve_part1(), do: get_orbits() |> build_tree() |> count_all_descendants()
def solve_part2(), do: get_orbits() |> build_tree() |> min_orbital_transfers("YOU", "SAN")
defp get_orbits(),
do:
File.read!("inputs/input_day6")
|> String.split("\n"... | lib/aoc2019/day6.ex | 0.619701 | 0.450299 | day6.ex | starcoder |
defmodule SAXMap.Bench.V1 do
@moduledoc """
THIS IS THE OLD IMPLEMENT FOR COMPARE.
XML to Map conversion.
SAXMap uses a SAX parser (built on top of [Saxy](https://hex.pm/packages/saxy)) to transfer an XML string into a `Map` containing a collection of pairs where the key is the node name and the value is its ... | bench/lib/sax_map.ex | 0.875667 | 0.745398 | sax_map.ex | starcoder |
defmodule Automaton.Types.BT.ActionSelect do
@moduledoc """
Agent is a function from percept sequences to actions
Action Selection, Must be simple and fast
Given a set of PerceptMemory objects(structs) that detail the perceived state
of the world, the agent must decide which action(s) it is appropriate to
p... | lib/automata/reasoning/cognitive/action_selection/automaton_action_select.ex | 0.803637 | 0.736969 | automaton_action_select.ex | starcoder |
defmodule Formex.Ecto.CustomField.SelectAssoc do
@behaviour Formex.CustomField
import Ecto.Query
alias Formex.Field
alias Formex.Form
@repo Application.get_env(:formex, :repo)
@moduledoc """
This module generates a `:select` field with options downloaded from Repo.
Example of use for Article with one... | lib/custom_fields/select_assoc.ex | 0.850825 | 0.794505 | select_assoc.ex | starcoder |
defmodule Brick.Component do
@moduledoc """
Define a brick component.
## Example
defmodule Component do
# Allows any type supported by phoenix's format encoders
use #{inspect(__MODULE__)}, type: :html
end
"""
alias Brick.Component.Sources
@type variant :: atom
@type variant... | lib/brick/component.ex | 0.880637 | 0.412205 | component.ex | starcoder |
defmodule WiseHomex.ApiDefinition do
@moduledoc """
Converts the API configuration into data that can be used to dynamically create each api endpoint
"""
defmodule Reader do
@moduledoc """
Helper module for reading the API configuration.
Separating the modules this way allows us to use the function... | lib/wise_homex/api_definition.ex | 0.83825 | 0.511473 | api_definition.ex | starcoder |
defmodule Gasrate do
@moduledoc """
Documentation for Gasrate.
"""
@doc """
Fetch National Avg.
## Examples
iex> Gasrate.fetch_national_avg
{:ok, 2.273}
"""
def fetch_national_avg do
{_, response} = Gasrate.Http.state_gas_price_averages()
html = response.body
{:ok, html} =... | lib/gasrate.ex | 0.807878 | 0.472136 | gasrate.ex | starcoder |
defmodule ListUtils do
@doc """
#Example
iex> ListUtils.swap([1,2,3,4,5], 0, 4)
[5,2,3,4,1]
"""
def swap(l, i, j) do
swap(l, Enum.count(l), i, j)
end
defp swap(l, _n, i, i) do
l
end
defp swap(l, n, i, j) when i < n and j < n do
temp = Enum.at(l, i)
l
|> List.replace_a... | lib/heap.ex | 0.535584 | 0.448004 | heap.ex | starcoder |
defmodule Aecore.Pow.Hashcash do
@moduledoc """
Hashcash proof of work
"""
alias Aeutil.Scientific
alias Aecore.Chain.Header
use Bitwise
@doc """
Verify a nonce, returns :true | :false
"""
@spec verify(map()) :: boolean()
def verify(%Aecore.Chain.Header{} = block_header) do
block_header_has... | apps/aecore/lib/aecore/pow/hashcash.ex | 0.797439 | 0.407186 | hashcash.ex | starcoder |
defmodule Excal.Recurrence.Iterator do
@moduledoc """
Elixir wrapper around a libical recurrence iterator.
The iterator is fundamentally a mutable resource, so it acts more like a stateful reference, rather than an immutable
data structure. To create one, you will need a iCalendar recurrence rule string and a ... | lib/excal/recurrence/iterator.ex | 0.920772 | 0.514339 | iterator.ex | starcoder |
defmodule PINXS.Charges.Charge do
alias PINXS.HTTP.API
alias __MODULE__
@moduledoc """
The Charge module provides functions for working wtih charges.
## Required Fields
When creating a charge, the following fields are required.
- email
- description
- amount
- ip_address
and one of
- card
... | lib/charges/charge.ex | 0.777469 | 0.724529 | charge.ex | starcoder |
defmodule YuriTemplate.RFC6570 do
@moduledoc """
This module contains RFC6570-specific functions.
"""
@typedoc """
Internal template representation. Subject to change at any time
without prior notice.
"""
@opaque t :: [String.t() | varlist]
@typep varlist :: [op | varspec]
@typep op :: ?+ | ?\# |... | lib/yuri_template/rfc6570.ex | 0.82386 | 0.558447 | rfc6570.ex | starcoder |
defmodule Day2 do
@moduledoc """
URL: http://adventofcode.com/2017/day/2
Part 1:
The spreadsheet consists of rows of apparently-random numbers. To make sure
the recovery process is on the right track, they need you to calculate the
spreadsheet's checksum. For each row, determine the difference between the
... | day2.ex | 0.705785 | 0.647965 | day2.ex | starcoder |
defmodule DateTime.Extension do
@moduledoc """
A module to extend the calendar implementation that follows to ISO8601 with methods found in
Elixir 1.5.1. This is to allow ESpec to support Elixir >= 1.3.4 more easily.
"""
defstruct [
:year,
:month,
:day,
:hour,
:minute,
:second,
:t... | lib/espec/extension/datetime_extension.ex | 0.934208 | 0.417509 | datetime_extension.ex | starcoder |
defmodule Estated.Property.Assessment do
@moduledoc "Tax assessment information as provided by the assessor."
@moduledoc since: "0.2.0"
# Assessment is very similar to MarketAssessment, but they are separate in Estated and
# documented differently.
# credo:disable-for-this-file Credo.Check.Design.DuplicatedC... | lib/estated/property/assessment.ex | 0.80954 | 0.523786 | assessment.ex | starcoder |
defmodule I18nHelpers.Form.InputHelpers do
@moduledoc ~S"""
Provides view helpers to render HTML input fields for text that must be
provided in multiple languages. The multilingual texts passed to the
form (usually in a changeset) are expected to be maps where each key
represents a locale and each value conta... | lib/form/input_helpers.ex | 0.863895 | 0.63937 | input_helpers.ex | starcoder |
defmodule BiMultiMap do
@moduledoc """
Bi-directional multimap implementation backed by two multimaps.
Entries in bimap do not follow any order.
BiMultiMaps do not impose any restriction on the key and value type: anything
can be a key in a bimap, and also anything can be a value.
BiMultiMaps differ from... | lib/bimultimap.ex | 0.920518 | 0.759136 | bimultimap.ex | starcoder |
defmodule Akd.DeployHelper do
@moduledoc """
This module defines helper functions used to initialize, add hooks to, and
execute a deployment.
"""
alias Akd.{Destination, Deployment, Hook}
@doc """
This macro executes a pipeline (set of operations) defined in the current
module with a set of params tha... | lib/akd/helpers/deploy_helper.ex | 0.895357 | 0.437223 | deploy_helper.ex | starcoder |
defmodule NimbleOptions.Docs do
@moduledoc false
def generate(schema, options) when is_list(schema) and is_list(options) do
nest_level = Keyword.get(options, :nest_level, 0)
{docs, sections, _level} = build_docs(schema, {[], [], nest_level})
to_string([Enum.reverse(docs), Enum.reverse(sections)])
end... | lib/nimble_options/docs.ex | 0.53959 | 0.454109 | docs.ex | starcoder |
defmodule Mojito do
@moduledoc ~S"""
Mojito is an easy-to-use, high-performance HTTP client built using the
low-level [Mint library](https://github.com/ericmj/mint).
Mojito is built for comfort _and_ for speed. Behind a simple and
predictable interface, there is a sophisticated connection pool manager
tha... | lib/mojito.ex | 0.876013 | 0.602529 | mojito.ex | starcoder |
defmodule Commanded.Aggregates.ExecutionContext do
@moduledoc """
Defines the arguments used to execute a command for an aggregate.
The available options are:
- `command` - the command to execute, typically a struct
(e.g. `%OpenBankAccount{...}`).
- `retry_attempts` - the number of retries permit... | lib/commanded/aggregates/execution_context.ex | 0.888011 | 0.616229 | execution_context.ex | starcoder |
defmodule AWS.PI do
@moduledoc """
AWS Performance Insights enables you to monitor and explore different dimensions
of database load based on data captured from a running RDS instance.
The guide provides detailed information about Performance Insights data types,
parameters and errors. For more information ... | lib/aws/generated/pi.ex | 0.868702 | 0.636692 | pi.ex | starcoder |
defmodule McProtocol.DataTypes do
@moduledoc false
# For <<< (left shift) operator
use Bitwise
defmodule ChatMessage do
@moduledoc false
defstruct [:text, :translate, :with, :score, :selector, :extra,
:bold, :italic, :underligned, :strikethrough, :obfuscated, :color,
:clickEvent, :hoverEv... | lib/datatypes.ex | 0.616705 | 0.441071 | datatypes.ex | starcoder |
defmodule GatherSubmissions.Report do
alias GatherSubmissions.Submission
alias GatherSubmissions.Student
defmodule Attempt do
@moduledoc """
Describes an individual attempt of a given group. This is used when generating the table of
attempts in the LaTeX file.
"""
@type t() :: %__MODULE__{
... | lib/report/report.ex | 0.807423 | 0.599192 | report.ex | starcoder |
defmodule Stompex do
@moduledoc """
Stompex is a pure Elixir library for connecting to STOMP
servers.
## Configuration
Stompex provides a number of functions for setting up the
initial connection. Two of these allow you to provide
a number of options to tailer the connection to your needs.
Below i... | lib/stompex.ex | 0.818265 | 0.524151 | stompex.ex | starcoder |
defmodule Vapor.Provider.File do
@moduledoc """
Module for loading supported file format configs.
Supported file formats: `.json`, `.toml`, and `.yaml`. Bindings to specific keys must
be provided as a keyword list. The values for each key must be either a string
or a path based on the Access protocol.
## ... | lib/vapor/providers/file.ex | 0.838233 | 0.49408 | file.ex | starcoder |
defmodule Hangman.Reduction.Options do
@moduledoc """
Module generates `Reduction` key for use when reducing
possible `Hangman` words set. Used primarily during `Round` setup.
"""
alias Hangman.{Reduction, Round}
@doc """
Generates `Reduction.key` given round context
"""
@spec reduce_key(Round.con... | lib/hangman/reduction_options.ex | 0.860852 | 0.475484 | reduction_options.ex | starcoder |
defmodule Brahman.Dns.Resolver do
@moduledoc """
DNS Resolver worker
"""
use GenServer, restart: :temporary, shutdown: 5000
require Logger
alias Brahman.Metrics.Counters
alias Brahman.Balancers.P2cEwma
defmodule State do
@moduledoc false
defstruct [:upstream, :data, :parent, :mon_ref, :sock... | lib/brahman/dns/resolver.ex | 0.663015 | 0.489076 | resolver.ex | starcoder |
defmodule Mix.Tasks.Cmake do
use Mix.Task
alias Mix.Tasks.Cmake
defmacro conj_front(list, val, form) do
quote do
if unquote(val), do: unquote(form) ++ unquote(list), else: unquote(list)
end
end
@shortdoc "Generate CMake buiid scripts and then build/install the application"
@moduledoc """
G... | lib/mix/tasks/cmake.ex | 0.564699 | 0.481698 | cmake.ex | starcoder |
defmodule CoursePlanner.Terms.Term do
@moduledoc """
Defines the Term, usually a semester, in which courses take place
"""
use Ecto.Schema
import Ecto.Changeset
alias CoursePlanner.{Courses.OfferedCourse, Terms.Holiday}
alias Ecto.{Date, Changeset}
schema "terms" do
field :name, :string
fiel... | lib/course_planner/terms/term.ex | 0.660282 | 0.403244 | term.ex | starcoder |
defmodule Advent.Y2021.D16 do
@moduledoc """
https://adventofcode.com/2021/day/16
"""
use Bitwise, only_operators: true
@typep packet :: {integer(), integer(), any(), bitstring()}
@doc """
Decode the structure of your hexadecimal-encoded BITS transmission; what do
you get if you add up the version nu... | lib/advent/y2021/d16.ex | 0.760651 | 0.427337 | d16.ex | starcoder |
defmodule ExState.Definition.State do
alias ExState.Definition.Step
alias ExState.Definition.Transition
@type state_type :: :atomic | :compound | :final
@type t :: %__MODULE__{
name: String.t(),
type: state_type(),
initial_state: String.t(),
steps: [Step.t()],
... | lib/ex_state/definition/state.ex | 0.677901 | 0.65303 | state.ex | starcoder |
defmodule Test.Support.AssertNested do
@moduledoc false
@doc "Test whether the former data structure is a nested subset of the latter."
defmacro assert_nested(left, right) do
quote do
assert unquote(left) ==
Test.Support.AssertNested.nested_subset(unquote(left), unquote(right))
end
... | test/support/assert_nested.ex | 0.894005 | 0.728217 | assert_nested.ex | starcoder |
defmodule Day11 do
@moduledoc """
--- Day 11: Hex Ed ---
Crossing the bridge, you've barely reached the other side of the stream when a program comes up to you, clearly in
distress. "It's my child process," she says, "he's gotten lost in an infinite grid!"
Fortunately for her, you have plenty of experience ... | lib/day11.ex | 0.577614 | 0.655071 | day11.ex | starcoder |
defmodule YelpEx.Client.Base do
@moduledoc """
Client implementation module.
The components in this module can be
used to build a custom Yelp API client.
## Example:
```
defmodule YelpEx.SuperAwesomeClient do
use YelpEx.Client.Base
@spec search(Keyword.t) :: {:ok, %{}} | {:error, HTTPoison.Er... | lib/yelp_ex/client/base.ex | 0.864725 | 0.621986 | base.ex | starcoder |
defmodule BitwiseIp.Mask do
@moduledoc """
Functions for handling CIDR prefix lengths as bitmasks.
These functions are used internally by `BitwiseIp.Block` to parse CIDR
notation. For example, the IPv4 CIDR prefix length `/12` corresponds to an
unsigned 32-bit integer of 12 ones followed by 20 zeroes:
`0b1... | lib/bitwise_ip/mask.ex | 0.933885 | 0.931898 | mask.ex | starcoder |
defmodule Plymio.Funcio.Enum.Reduce do
@moduledoc ~S"""
Reduce Functions for Enumerables.
These functions reduce 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.Funcio.... | lib/funcio/enum/reduce/reduce.ex | 0.875401 | 0.501709 | reduce.ex | starcoder |
defmodule Botfuel do
@moduledoc """
Documentation for the Botfuel main module.
"""
alias Botfuel.{Entity,Classify,Spellcheck,Botmeter}
@doc """
Creates a new client process with the provided API `app_id` and `app_key` as a map.
The `Botfuel.Client` module can be started by hand in a supervision tree as... | lib/botfuel.ex | 0.856588 | 0.436802 | botfuel.ex | starcoder |
defmodule EthEvent.Api.Balance do
@moduledoc """
Defines the `Balance` event.
In order to request a `Balance`, you have to specify the desired `address`
and `block_number` (defaults to `"latest"`) by setting it in the event struct
itself e.g:
```
> alias EthEvent.Api.Balance
> {:ok, %Balance{} = balan... | lib/eth_event/api/balance.ex | 0.903871 | 0.863334 | balance.ex | starcoder |
defmodule Oasis.Token do
@moduledoc """
A simple wrapper of `Plug.Crypto` to provide a way to generate and verify bearer token for use
in the [bearer security scheme](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#securitySchemeObject)
of the OpenAPI Specification.
When we use `si... | lib/oasis/token.ex | 0.897095 | 0.670288 | token.ex | starcoder |
defmodule Elixoids.Bullet.Server do
@moduledoc """
Bullets are spawned by a game. They fly in the direction
in which the are spawned and then expire. They report their
position at a given FPS to the game.
Bullets have a position and velocity, a TTL, and the tag of their firer.
"""
use GenServer
alias ... | lib/elixoids/bullet/server.ex | 0.681515 | 0.606732 | server.ex | starcoder |
defmodule Operate.VM.Extension.String do
@moduledoc """
Extends the VM state with implementations of Lua's `string.pack` and
`string.unpack` functions.
"""
use Operate.VM.Extension
alias Operate.VM
def extend(vm) do
vm
|> VM.set_function!("string.pack", fn _vm, [fmt| args] -> apply(__MODULE__, :... | lib/operate/vm/extension/string.ex | 0.546496 | 0.553385 | string.ex | starcoder |
defmodule TextDelta.Application do
@moduledoc """
The application of a delta onto a text state.
Text state is always represented as a set of `t:TextDelta.Operation.insert/0`
operations. This means that any application should always result in a set of
`insert` operations or produce an error tuple.
In simpl... | lib/text_delta/application.ex | 0.923403 | 0.63409 | application.ex | starcoder |
defmodule Pathex.Lenses.All do
@moduledoc """
Private module for `all()` lens
> see `Pathex.Lenses.all/0` documentation
"""
# Helpers
defmacrop at_pattern(pipe, pattern, do: code) do
quote do
case unquote(pipe) do
unquote(pattern) -> unquote(code)
other -> other
end
end... | lib/pathex/lenses/all.ex | 0.840668 | 0.467149 | all.ex | starcoder |
defmodule Owl.Box do
@moduledoc """
Allows wrapping data to boxes.
"""
@border_styles %{
none: %{
top_left: "",
top: "",
top_right: "",
right: "",
left: "",
bottom_left: "",
bottom: "",
bottom_right: ""
},
solid: %{
top_left: "┌",
top: "─",... | lib/owl/box.ex | 0.895611 | 0.477615 | box.ex | starcoder |
defmodule Logi do
@moduledoc """
Logger Interface.
This module mainly provides logger related functions.
A logger has own headers, metadata, filter and can issue log messages to a destination channel.
It is an Elixir interface of the Erlang [logi](https://github.com/sile/logi) library.
## Examples
Bas... | lib/logi_ex.ex | 0.897336 | 0.817975 | logi_ex.ex | starcoder |
defmodule Lonely.Option do
@moduledoc """
Handles any value that could be `nil` as well.
Some functions result in either the value or just `nil`. For these ocasions
you can either transform it to a result with `Lonely.Result.wrap/1` or
use this module.
iex> import Lonely.Option
...> [1, 2, 3]
... | lib/lonely/option.ex | 0.789761 | 0.551936 | option.ex | starcoder |
defmodule Indacoin do
@moduledoc """
An Elixir interface to the Indacoin API.
## List Of Requests Params
- _cur_from_ :: string – Currency code which defines the currency in which customer wish to do the payment;
used to define price parameter. Possible values: `USD`, `EURO`, `RUB`.
- _cur_in_ :: string... | lib/indacoin.ex | 0.915394 | 0.472562 | indacoin.ex | starcoder |
defmodule Tint.Sigil do
@moduledoc """
A module providing a sigil to build colors.
"""
alias Tint.{CMYK, DIN99, HSV, Lab, RGB, XYZ}
@separator ","
@doc """
A sigil to build a color.
The sigil identifier is `K` (try using "kolor" as mnemonic) because `C` is
already taken by the built-in charlist si... | lib/tint/sigil.ex | 0.876925 | 0.460592 | sigil.ex | starcoder |
defmodule XGPS.Tools do
@moduledoc """
Several different helper functions.
"""
require Bitwise
@doc """
Will calculate and return a checksum defined for NMEA sentence.
"""
def calculate_checksum text do
Enum.reduce(String.codepoints(text), 0, &xor/2)
end
defp xor(x, acc) do
<<val::utf8>> =... | lib/xgps/tools.ex | 0.70028 | 0.566798 | tools.ex | starcoder |
defmodule Bunch.Config do
@moduledoc """
A bunch of helpers for parsing and validating configurations.
"""
alias Bunch.Type
use Bunch
@doc """
Parses `config` according to `fields_specs`.
`fields_specs` consist of constraints on each field. Supported constraints are:
* validate - function determi... | lib/bunch/config.ex | 0.874981 | 0.592549 | config.ex | starcoder |
defmodule Chess.Board do
defstruct [:pieces]
require Integer
def default() do
%__MODULE__{
pieces:
Enum.flat_map(%{white: 1, black: 6}, fn {color, y} ->
Enum.map(0..7, fn x ->
Chess.Pieces.new(
Chess.Pieces.Pawn,
color,
Chess.Posi... | lib/board.ex | 0.609292 | 0.482124 | board.ex | starcoder |
defmodule Crux.Rest.ApiError do
@moduledoc """
Represents a Discord API error.
Raised or returned whenever the api responded with a non `2xx` status code.
"""
@moduledoc since: "0.1.0"
alias Crux.Rest.Request
defexception(
status_code: nil,
code: nil,
message: nil,
path: nil,
method... | lib/rest/api_error.ex | 0.870797 | 0.412294 | api_error.ex | starcoder |
defmodule Grouper.Registry do
@moduledoc """
Provides name registration functions in the style of `:global` and
`Registry`. Usually used with `GenServer.start_link/3` using `:via` option
to provide an isolated namespace for various processes.
"""
alias Grouper.Data
@doc """
registers a process under a ... | lib/grouper/registry.ex | 0.846625 | 0.593256 | registry.ex | starcoder |
defmodule Bolero.Generators do
import Bolero.{Modifiers,Utils}
@big_int :math.pow(2, 60) |> trunc()
def any() do
oneof([
int(), real(), bool(), atom(), binary()
])
end
def atom() do
atom(0, 255)
end
def atom(size) do
charlist(size)
|> bind(&:erlang.list_to_atom/1)
end
def ... | lib/bolero/generators.ex | 0.501709 | 0.416945 | generators.ex | starcoder |
defmodule ArtemisWeb.KeyValueView do
use ArtemisWeb, :view
@default_display_size_limit_index 2_500
@default_display_size_limit_show 5_000
# Bulk Actions
def available_bulk_actions() do
[
%BulkAction{
action: &Artemis.DeleteKeyValue.call_many(&1, &2),
authorize: &has?(&1, "key-valu... | apps/artemis_web/lib/artemis_web/views/key_value_view.ex | 0.651022 | 0.461381 | key_value_view.ex | starcoder |
defmodule Advent.Critical.Finite do
def manhattan_distance({row1, col1}, {row2, col2}), do: abs(col1 - col2) + abs(row1 - row2)
def dangerous() do
load_coordinates()
|> calculate_grid()
|> Enum.group_by(fn {lable, _x, _y} -> lable end)
|> Enum.map(fn {lable, list} ->
{lable, Enum.count(list)}... | lib/advent/critical/finite.ex | 0.700588 | 0.567128 | finite.ex | starcoder |
defmodule Asteroid.ObjectStore.RefreshToken.Mnesia do
@moduledoc """
Mnesia implementation of the `Asteroid.ObjectStore.RefreshToken` behaviour
## Options
The options (`Asteroid.ObjectStore.RefreshToken.opts()`) are:
- `:table_name`: an `atom()` for the table name. Defaults to `:asteroid_refresh_token`
- `... | lib/asteroid/object_store/refresh_token/mnesia.ex | 0.86681 | 0.744029 | mnesia.ex | starcoder |
defmodule AstraeaVirgo.Cache.Contests.Problem do
@moduledoc """
Implement contest problem operation for cache
## Contest problem ID size
A size of Contest Problem IDs
- key: `Astraea:Contest:ID:<contest_id>:Problems:Size`
- type: string
## Contest Problem Info
A key-value mapping the contest probl... | lib/virgo/cache/contests/problem.ex | 0.501709 | 0.428473 | problem.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.