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 ExJenga.SendMoney.ToMobileWallets do
@moduledoc """
This enables your application to send money to telco :iphone: wallets across Kenya, Uganda, Tanzania & Rwanda.
"""
import ExJenga.JengaBase
alias ExJenga.Signature
@doc """
Send Money To Mobile Wallets
## Parameters
attrs: - a map conta... | lib/ex_jenga/send_money/to_mobile_wallets.ex | 0.810141 | 0.479626 | to_mobile_wallets.ex | starcoder |
defmodule Lingua do
@moduledoc """
Lingua wraps [<NAME>](https://github.com/pemistahl)'s [linuga-rs](https://github.com/pemistahl/lingua-rs) language detection library.
This wrapper follows the lingua-rs API closely, so consult the [documentation](https://docs.rs/lingua/1.0.3/lingua/index.html) for more informati... | lib/lingua.ex | 0.87639 | 0.723383 | lingua.ex | starcoder |
defmodule NYSETL.Engines.E2.Processor do
@moduledoc """
For a TestResult record, decide the following
* Find or create a Person record, based on :patient_key or unique (dob/last_name/first_name)
* Create or update one more IndexCase records for this county
* Create or update a LabResult record for the IndexC... | lib/nys_etl/engines/e2/processor.ex | 0.743727 | 0.42185 | processor.ex | starcoder |
defmodule ShittyLinqEx do
@moduledoc """
Documentation for `ShittyLinqEx`.
"""
@doc """
Applies an accumulator function over a sequence. The specified seed value is used as the initial
accumulator value, and the specified function is used to select the result value.
## Parameters
- `source`: an enume... | lib/shitty_linq_ex.ex | 0.904824 | 0.672795 | shitty_linq_ex.ex | starcoder |
defmodule Entitiex.Entity do
@moduledoc """
Defines a entity module.
## Example
defmodule UserEntity do
use Entitiex.Entity
expose [:first_name, :last_name], format: :to_s
expose :contacts, using: ContactEntity, if: :owner_is_admin?
expose [:registered_at, :updated_at], fo... | lib/entitiex/entity.ex | 0.869271 | 0.449997 | entity.ex | starcoder |
defmodule Furlong.Solver do
@moduledoc """
Elixir-port of the Kiwisolver; usage example below adapted from [Kiwisolver docs](https://kiwisolver.readthedocs.io/en/latest/basis/basic_systems.html).
Variables are represented by refs.
```
# create variables
x1 = make_ref()
x2 = make_ref()
xm = make_ref()
... | lib/furlong/solver.ex | 0.853654 | 0.825976 | solver.ex | starcoder |
defmodule NervesLivebook.PatternLED do
@moduledoc """
Functions for sending patterns to LEDs
This module uses the Linux's sysclass LED pattern trigger to control LEDs.
With it, you can make LEDs do tons of things without spending any time in the
Erlang VM. The code in this module constructs patterns to blink... | lib/nerves_livebook/pattern_led.ex | 0.837188 | 0.841761 | pattern_led.ex | starcoder |
defmodule Socket.TCP do
@moduledoc """
This module wraps a passive TCP socket using `gen_tcp`.
## Options
When creating a socket you can pass a series of options to use for it.
* `:as` sets the kind of value returned by recv, either `:binary` or `:list`,
the default is `:binary`
* `:mode` can be eit... | deps/socket/lib/socket/tcp.ex | 0.916147 | 0.629945 | tcp.ex | starcoder |
defprotocol Chess.Piece do
def position(piece)
def color(piece)
def moves(piece, board)
def to_string(piece)
end
defmodule Chess.Pieces do
def new(piece_kind, color, position) do
struct(piece_kind, color: color, position: position)
end
defmodule Pawn do
defstruct [:color, :position]
end
def... | lib/pieces.ex | 0.504639 | 0.655639 | pieces.ex | starcoder |
defmodule Bricks.Guards do
@moduledoc false
defguard is_byte(x) when is_integer(x) and x >= 0 and x <= 255
defguard is_char(x) when is_integer(x) and x >= 0 and x <= 0x10FFFF
defguard is_opt_atom(x) when is_atom(x) or is_nil(x)
defguard is_opt_bool(x) when is_boolean(x) or is_nil(x)
defguard is_opt_int(x... | bricks/lib/guards.ex | 0.578329 | 0.613844 | guards.ex | starcoder |
defmodule Utils do
@moduledoc """
Documentation for `Utils`.
"""
alias Kino.ValidatedForm
defp box(text, style) do
"<div style=\"margin: 0 10px; font-size: 24px; font-weight: bold; height: 50px; width: 50px; background-color: #{style.background}; border: #{style.border} solid 1px; display: flex; align-i... | utils/lib/utils.ex | 0.593491 | 0.45048 | utils.ex | starcoder |
defmodule AWS.WAFV2 do
@moduledoc """
<note> This is the latest version of the **AWS WAF** API, released in
November, 2019. The names of the entities that you use to access this API,
like endpoints and namespaces, all have the versioning information added,
like "V2" or "v2", to distinguish from the prior ver... | lib/aws/waf_v2.ex | 0.887247 | 0.560192 | waf_v2.ex | starcoder |
defmodule RationalNumbers do
@moduledoc false
@type rational :: {integer, integer}
@doc """
Add two rational numbers
"""
@spec add(a :: rational, b :: rational) :: rational
def add({a1, b1}, {a2, b2}) do
if additive_inverse?({a1, b1}, {a2, b2}) do
{0, 1}
else
reduce({a1 * b2 + a2 * b1... | rational-numbers/lib/rational_numbers.ex | 0.83104 | 0.482673 | rational_numbers.ex | starcoder |
defmodule Ash.Helpers do
@moduledoc false
@spec try_compile(term) :: :ok
def try_compile(module) when is_atom(module) do
Code.ensure_loaded(module)
:ok
end
def try_compile(_), do: :ok
def implements_behaviour?(module, behaviour) do
:attributes
|> module.module_info()
|> Enum.flat_map(... | lib/ash/helpers.ex | 0.694095 | 0.521654 | helpers.ex | starcoder |
defmodule Viztube.Youtube do
@moduledoc """
This module handles Youtube API calls
"""
@doc """
Get a video using YT API.
Parameters
- Part: String with get options "snippet", "recordingDetails"....
- Id: String with the video id
Returns `{:ok, [results], [metadata]}`
"""
def vide... | apps/viztube/lib/viztube/youtube.ex | 0.849269 | 0.484624 | youtube.ex | starcoder |
import Kernel, except: [to_binary: 1]
defmodule Macro do
@moduledoc """
This module provides conveniences for working with macros.
"""
@doc """
Returns a list of binary operators. This is available
as a macro so it can be used in guard clauses.
"""
defmacro binary_ops do
[
:===, :!==,
... | lib/elixir/lib/macro.ex | 0.620277 | 0.529932 | macro.ex | starcoder |
defmodule Shippex.Package do
@moduledoc """
Defines the struct for storing a `Package`, which is then passed along with
an origin and destination address for shipping estimates. A `description` is
optional, as it may or may not be used with various carriers.
For USPS, a package has a `container` string which... | lib/shippex/package.ex | 0.894107 | 0.767951 | package.ex | starcoder |
defmodule Multiverses do
@moduledoc """
Elixir introduces into the world of programming, the "multiverse testing"
pattern. This is a pattern where integration tests are run concurrently
and each test sees a shard of global state.
## Pre-Existing Examples:
- `Mox`: each test has access to the global modul... | lib/multiverses.ex | 0.868688 | 0.864024 | multiverses.ex | starcoder |
defmodule Still.Preprocessor do
@moduledoc """
Defines functions to be used by the several preprocessors as well as the
behaviour they should have.
Preprocessors are the cornerstone of Still. A preprocessor chain can take a
markdown file, execute its embedded Elixir, extract metadata from its front
matter,... | lib/still/preprocessor.ex | 0.782953 | 0.403097 | preprocessor.ex | starcoder |
defmodule Quetzal do
@moduledoc """
Quetzal - Analytical web apps, fast, easy and real-time using Elixir. No Javascript required.
Quetzal provides easy and fast tools to make analytical web apps with real-time updates.
Quetzal provides the next features:
* Allows create componets from Elixir code and rende... | lib/quetzal.ex | 0.821582 | 0.702211 | quetzal.ex | starcoder |
defmodule Dispatch do
@moduledoc """
Main module, exposes a way to fetch random reviewers for a repo
and a way to request reviewers to a repo.
"""
alias Dispatch.Absences
alias Dispatch.Repositories
alias Dispatch.Settings
alias Dispatch.Utils.Normalization
defmodule BlocklistedUser do
@enforce_... | lib/dispatch/dispatch.ex | 0.770119 | 0.435121 | dispatch.ex | starcoder |
defmodule AWS.ResourceGroups do
@moduledoc """
AWS Resource Groups
AWS Resource Groups lets you organize AWS resources such as Amazon EC2
instances, Amazon Relational Database Service databases, and Amazon S3 buckets
into groups using criteria that you define as tags.
A resource group is a collection of ... | lib/aws/generated/resource_groups.ex | 0.864268 | 0.505005 | resource_groups.ex | starcoder |
defmodule Advent20.SeatingSystem do
@moduledoc """
Day 11: Seating System
"""
def parse(input) do
input
|> String.split("\n", trim: true)
|> Enum.with_index()
|> Enum.reduce(%{}, fn {line, y}, all_coordinates ->
String.codepoints(line)
|> Enum.with_index()
|> Enum.reject(fn {c... | lib/advent20/11_seating_system.ex | 0.809314 | 0.594463 | 11_seating_system.ex | starcoder |
defmodule OAuthXYZ.Model.TransactionRequest do
@moduledoc """
Request Handling Module.
```
# Transaction request
{
"resources": [
{
"actions": [
"read",
"write",
"dolphin"
],
"locations": [
"https:... | lib/oauth_xyz/model/transaction_request.ex | 0.577138 | 0.705886 | transaction_request.ex | starcoder |
defmodule Expanse.Length do
@moduledoc """
This Module includes Length conversion functions
"""
@doc """
Convert KM to Meters
"""
def km_to_m(x) do
y = round(x * 1000)
if y < 1 do
y = 1
end
y
end
@doc """
Convert KM to Centimeters
"""
def km_to_cm(x) do
y = round(x * 100000)
if y < 1 do
y ... | lib/expanse.length.ex | 0.553505 | 0.591251 | expanse.length.ex | starcoder |
defmodule Pow.Ecto.Schema.Password.Pbkdf2 do
@moduledoc """
The Pbkdf2 hash generation code is pulled from
[Plug.Crypto.KeyGenerator](https://github.com/elixir-plug/plug_crypto/blob/v1.2.1/lib/plug/crypto/key_generator.ex)
and is under Apache 2 license.
"""
use Bitwise
@doc """
Compares the two binarie... | lib/pow/ecto/schema/password/pbkdf2.ex | 0.861013 | 0.50293 | pbkdf2.ex | starcoder |
defmodule Tensorflow.FunctionSpec.ExperimentalCompile do
@moduledoc false
use Protobuf, enum: true, syntax: :proto3
@type t :: integer | :DEFAULT | :ON | :OFF
field(:DEFAULT, 0)
field(:ON, 1)
field(:OFF, 2)
end
defmodule Tensorflow.SavedObjectGraph.ConcreteFunctionsEntry do
@moduledoc false
use Proto... | lib/tensorflow/core/protobuf/saved_object_graph.pb.ex | 0.848219 | 0.585486 | saved_object_graph.pb.ex | starcoder |
defmodule Day22 do
def part1(input) do
parse(input)
|> Enum.reject(fn {_, {xr, yr, zr}} ->
Enum.any?([xr, yr, zr], fn r ->
r.first < -50 || r.last > 50
end)
end)
|> solve
end
def part2(input) do
solve(parse(input))
end
def solve(operations) do
cuboids = []
ope... | day22/lib/day22.ex | 0.50708 | 0.553867 | day22.ex | starcoder |
defmodule Thundermoon.CounterRoot do
@moduledoc """
This module provides functions to read and change the counter.
It takes care that only one operation is executed and that
after a change a read operation will reflect this changes:
```
assert %{digit_1: 0, digit_10: 0, digit_100: 0} = Counter.get_digits()
... | apps/thundermoon/lib/thundermoon/counter/counter_root.ex | 0.708818 | 0.917635 | counter_root.ex | starcoder |
defmodule AdventOfCode do
@moduledoc """
Helper module for dealing with text input from the AOC puzzles.
Originally created for the 2021 competition.
To use from LiveBook:
IEx.Helpers.c("lib/advent_of_code.ex")
alias AdventOfCode, as: AOC
"""
alias Kino
# Grid-based helpers
def as_grid(multi... | lib/advent_of_code.ex | 0.689724 | 0.441793 | advent_of_code.ex | starcoder |
defmodule RTypes do
@moduledoc """
RTypes is an Elixir library which helps automatically create a validation function for
a given user type. The function can be used to check the shape of the data after
de-serialisation or in unit-tests.
Let's suppose we have a type
```elixir
@type t :: 0..255
```
... | lib/rtypes.ex | 0.896585 | 0.91804 | rtypes.ex | starcoder |
defmodule SystemRegistry do
@moduledoc """
A transactional nested term storage and dispatch system.
`SystemRegistry` takes a different approach to a typical publish-subscribe pattern by
focusing on data instead of events. It is local
(as opposed to distributed) and transactional (as opposed to asynchronous)
... | lib/system_registry.ex | 0.90556 | 0.513973 | system_registry.ex | starcoder |
defmodule Kuddle.Path do
@moduledoc """
Utility module for looking up nodes in a document.
Usage:
nodes = Kuddle.select(document, path)
[{:node, "node", attrs, children}] = Kuddle.select(document, ["node"])
"""
alias Kuddle.Value
alias Kuddle.Node
@typedoc """
A Kuddle document is a lis... | lib/kuddle/path.ex | 0.868708 | 0.583322 | path.ex | starcoder |
defmodule Dogma.Script do
@moduledoc """
This module provides the struct that we use to represent source files, their
abstract syntax tree, etc, as well as a few convenient functions for working
with them.
"""
defmodule InvalidScriptError do
@moduledoc "An exception that can raised when source has inva... | lib/dogma/script.ex | 0.638046 | 0.431704 | script.ex | starcoder |
defmodule Membrane.FFmpeg.SWScale.Scaler do
@moduledoc """
This element performs video scaling, using SWScale module of FFmpeg library.
There are two options that have to be specified when creating Scaler:
- `output_width` - desired scaled video width.
- `output_height` - desired scaled video height.
Both... | lib/membrane_ffmpeg_swscale/scaler.ex | 0.92427 | 0.643665 | scaler.ex | starcoder |
defmodule Sketch.Graph do
@moduledoc """
Provides functions to model graph-like structures.
"""
defstruct nodes: %{}, in_edges: %{}, out_edges: %{}
@doc """
Creates an empty graph
## Examples
iex> Sketch.Graph.new
...> |> Sketch.Graph.nodes
[]
"""
def new, do: %__MODULE__{}
@d... | lib/sketch/graph.ex | 0.827236 | 0.548915 | graph.ex | starcoder |
defmodule KitchenCalculator do
@spec get_volume(tuple) :: any
def get_volume(volume_pair) do
elem(volume_pair, 1)
end
@spec to_milliliter(
{:cup, number}
| {:fluid_ounce, number}
| {:milliliter, number}
| {:tablespoon, number}
| {:teaspoon, number}
... | kitchen-calculator/lib/kitchen_calculator.ex | 0.770637 | 0.623076 | kitchen_calculator.ex | starcoder |
defmodule Xgit.Ref do
@moduledoc ~S"""
A reference is a struct that describes a mutable pointer to a commit or similar object.
A reference is a key-value pair where the key is a name in a specific format
(see [`git check-ref-format`](https://git-scm.com/docs/git-check-ref-format))
and the value (`:target`) i... | lib/xgit/ref.ex | 0.909551 | 0.764672 | ref.ex | starcoder |
defmodule PipeTo do
@doc """
PipeTo operator.
This operator will replace the placeholder argument `_` in the right-hand
side function call with left-hand side expression.
### Examples
iex> 1 ~> Enum.at(1..3, _)
2
It can mix with `|>` operation
### Examples
iex> 1 ~> Enum.at(1... | lib/pipe_to.ex | 0.834306 | 0.609728 | pipe_to.ex | starcoder |
defmodule Desktop do
@moduledoc """
This is the documentation for the Desktop project.
By default, Desktop applications depend on the following packages:
* [Phoenix](https://hexdocs.pm/phoenix) - the Phoenix web framework
* [Phoenix LiveView](https://hexdocs.pm/phoenix_live_view) - real-time
user... | lib/desktop.ex | 0.610802 | 0.757705 | desktop.ex | starcoder |
defmodule ExploringElixir.Time do
def for_next_week(fun) when is_function(fun, 1) do
today = Date.utc_today
next_week = Date.add today, 7
Date.range(today, next_week) |> Enum.each(fun)
:ok
end
def seconds_per_day, do: 60 * 60 * 24
end
defmodule ExploringElixir.Time.Local do
def beam_timestamp ... | lib/exploring_elixir/e008/time.ex | 0.563138 | 0.442938 | time.ex | starcoder |
defmodule Rheostat do
@moduledoc """
A configurable stats provider. Rheostat provides a common interface to
stats provider.
Configure the provider with:
```
config :rheostat, adapter: Rheostat.Adapter.Statix
```
"""
@doc """
Opens the connection to the stats server. configuration is read from
t... | lib/rheostat.ex | 0.951718 | 0.930962 | rheostat.ex | starcoder |
defmodule Appsignal.Utils.MapFilter do
require Logger
@moduledoc """
Helper functions for filtering parameters to prevent sensitive data
to be submitted to AppSignal.
"""
@doc """
Filter parameters based on Appsignal and Phoenix configuration.
"""
def filter_parameters(values), do: filter_values(val... | lib/appsignal/utils/map_filter.ex | 0.744006 | 0.634982 | map_filter.ex | starcoder |
defmodule BioMonitor.RoutineCalculations do
@moduledoc """
Module in charge of processing the readings to infer new data
"""
require Math
defmodule Result do
@moduledoc """
Struct that reperesent a result as a 2 axis point.
"""
defstruct x: 0, y: 0
end
defmodule PartialResult do
... | lib/bio_monitor/routine_calculations.ex | 0.858748 | 0.589716 | routine_calculations.ex | starcoder |
defmodule SanbaseWeb.Graphql.Resolvers.SignalResolver do
import Sanbase.Utils.Transform, only: [maybe_apply_function: 2]
import SanbaseWeb.Graphql.Helpers.{Utils, CalibrateInterval}
import Absinthe.Resolution.Helpers, only: [on_load: 2]
import Sanbase.Model.Project.Selector, only: [args_to_selector: 1, args_to... | lib/sanbase_web/graphql/resolvers/signal_resolver.ex | 0.626581 | 0.460835 | signal_resolver.ex | starcoder |
defmodule StringFormatterSplit do
@moduledoc """
A module used to evaluate {placeholders} in strings given a list of params
"""
import StringFormatterUtils, only: [normalize_params: 1, eval_holder: 2]
@status_normal :normal
@status_reading_placeholder :reading_placeholder
@doc """
Format a string wit... | pattern_matching_and_state_machines/lib/string_formatter_split.ex | 0.778565 | 0.568056 | string_formatter_split.ex | starcoder |
defmodule Re.Shortlists.Salesforce.Opportunity do
@moduledoc """
Module for validating and parse salesforce opportunity entity on shortlist context
"""
alias Re.Slugs
use Ecto.Schema
import Ecto.Changeset
import EctoEnum
@primary_key {:id, :string, []}
defenum(Schema,
infrastructure: "Infraes... | apps/re/lib/shortlists/salesforce.opportunity.ex | 0.564098 | 0.401219 | salesforce.opportunity.ex | starcoder |
defmodule ExOauth2Provider.Plug.VerifyHeader do
@moduledoc """
Use this plug to authenticate a token contained in the header.
You should set the value of the Authorization header to:
Authorization: <token>
## Example
plug ExOauth2Provider.Plug.VerifyHeader
A "realm" can be specified when using t... | lib/ex_oauth2_provider/plug/verify_header.ex | 0.709019 | 0.494507 | verify_header.ex | starcoder |
defmodule DistanceMatrixApi do
@moduledoc """
Provides functions to interact with Google Distance Matrix API.
"""
@base_url "https://maps.googleapis.com/maps/api/distancematrix/json?"
@separator "|"
@doc """
Expected usage :
travels = DistanceMatrixApi.TravelList.new |>
DistanceMatrixApi.Trave... | lib/distance_matrix_api.ex | 0.798147 | 0.554229 | distance_matrix_api.ex | starcoder |
defmodule Crit.Assertions.Map do
import Crit.Assertions.Defchain
import ExUnit.Assertions
@doc """
Test the existence and value of multiple fields with a single assertion:
assert_fields(some_map, key1: 12, key2: "hello")
Alternately, you can test just for existence:
assert_fields(some_map, [:k... | test/support/assertions/map.ex | 0.774029 | 0.884987 | map.ex | starcoder |
defmodule Day13 do
def part1(file_name \\ "test.txt") do
file_name
|> parse()
|> grid()
|> grab_first_fold()
|> fold()
|> count_visible()
end
def part2(file_name \\ "test.txt") do
file_name
|> parse()
|> grid()
|> fold()
|> prep_for_print()
|> IO.puts()
end
de... | jpcarver+elixir/day13/lib/day13.ex | 0.604866 | 0.509276 | day13.ex | starcoder |
defmodule Day18.SnailfishMath do
@moduledoc """
Operate on Snailfish numbers.
Snailfish numbers are represented as recursively nested lists
(pairs).
"""
@doc """
Reduce number until no actions can be taken
"""
def reduce([_left, _right] = number) do
Stream.iterate({:cont, number}, fn {_flag, num... | day18/solver.ex | 0.839076 | 0.755502 | solver.ex | starcoder |
defmodule Edeliver.Relup.Instructions.StartSection do
@moduledoc """
This upgrade instruction starts a new section
and logs that info on the node which runs the upgrade and
in the upgrade script started by the
`$APP/bin/$APP upgarde $RELEASE` command. Usage:
```
Edeliver.Relup.Instructions.S... | lib/edeliver/relup/instructions/start_section.ex | 0.595845 | 0.652996 | start_section.ex | starcoder |
defmodule Honeydew do
@doc """
Creates a supervision spec for a pool.
`pool_name` is how you'll refer to the queue to add a task.
`worker_module` is the module that the workers in your queue will run.
`worker_opts` are arguments handed to your module's `init/1`
You can provid... | lib/honeydew.ex | 0.701713 | 0.471041 | honeydew.ex | starcoder |
defmodule Breadboard.GPIO.SunxiPin do
@moduledoc false
use Breadboard.GPIO.BaseGPIOHelper
# [sysfs: 12, pin_key: :pin3, pin_label: :pa12, pin_name: "PA12", pin: 3]
@pinout_map %{
3 => [pin_name: "PA12", mux2_label: "TWIO_SDA"],
5 => [pin_name: "PA11"],
7 => [pin_name: "PA6"],
8 => [pin_name: ... | lib/breadboard/gpio/sunxi_gpio.ex | 0.559049 | 0.765987 | sunxi_gpio.ex | starcoder |
defmodule ExHashRing.Info do
@moduledoc """
Provides an interface for querying information about Rings.
Each Ring has some associated information that is available at all times to aid in performing
client-context queries into the underlying ETS table.non_neg_integer()
"""
use GenServer
alias ExHashRing... | lib/ex_hash_ring/info.ex | 0.820865 | 0.415996 | info.ex | starcoder |
defmodule Sentry.Client do
@moduledoc ~S"""
This module interfaces directly with Sentry via HTTP.
The client itself can be configured via the :client
configuration. It must implement the `Sentry.HTTPClient`
behaviour and it defaults to `Sentry.HackneyClient`.
It makes use of `Task.Supervisor` to allow sen... | lib/sentry/client.ex | 0.868994 | 0.492615 | client.ex | starcoder |
defmodule Geolix.Adapter.LookupCache do
@moduledoc """
Lookup cache adapter for Geolix.
## Adapter Configuration
To start using the adapter in front of a regular adapter you need to modify
the database entry of your `:geolix` configuration:
config :geolix,
databases: [
%{
... | lib/lookup_cache.ex | 0.721645 | 0.465205 | lookup_cache.ex | starcoder |
defmodule AshPostgres.Reference do
@moduledoc """
Contains configuration for a database reference
"""
defstruct [:relationship, :on_delete, :on_update, :name]
def schema do
[
relationship: [
type: :atom,
required: true,
doc: "The relationship to be configured"
],
... | lib/reference.ex | 0.849238 | 0.609001 | reference.ex | starcoder |
defmodule Fxnk.Functions do
@moduledoc """
`Fxnk.Functions` are functions for computation or helpers.
"""
@doc """
`always/1` returns the value passed to it always.
## Examples
iex> fourtyTwo = Fxnk.Functions.always(42)
iex> fourtyTwo.("hello")
42
"""
@spec always(any()) :: (any() ->... | lib/fxnk/functions.ex | 0.907453 | 0.464051 | functions.ex | starcoder |
defmodule FunWithFlags.Store.Persistent do
@moduledoc """
A behaviour module for implementing persistence adapters.
The package ships with persistence adapters for Redis and Ecto, but you
can provide your own adapters by adopting this behaviour.
"""
@doc """
A persistent adapter should return either
[... | lib/fun_with_flags/store/persistent.ex | 0.707101 | 0.50769 | persistent.ex | starcoder |
defmodule OpenGraph do
@moduledoc """
Fetch and parse websites to extract Open Graph meta tags.
The example above shows how to fetch the GitHub Open Graph rich objects.
iex> OpenGraph.fetch("https://github.com")
{:ok, %OpenGraph{description: "GitHub is where people build software. More than 15 milli... | lib/open_graph.ex | 0.76533 | 0.596962 | open_graph.ex | starcoder |
defmodule ExPixBRCode.JWS.JWKSStorage do
@moduledoc """
A JWKS storage of validated keys and certificates.
"""
alias ExPixBRCode.JWS.Models.JWKS.Key
alias ExPixBRCode.JWS.Models.JWSHeaders
defstruct [:jwk, :certificate, :key]
@typedoc """
Storage item.
It has a parsed JWK, the certificate of the k... | lib/ex_pix_brcode/jws/jwks_storage.ex | 0.814238 | 0.557845 | jwks_storage.ex | starcoder |
defmodule AdventOfCode.Solutions.Day10 do
@moduledoc """
Solution for day 10 exercise.
### Exercise
https://adventofcode.com/2021/day/10
"""
require Logger
def score(filename) do
input =
filename
|> File.read!()
|> parse_input()
{syntax_errors_score, autocompletion_score} = c... | lib/advent_of_code/solutions/day10.ex | 0.74826 | 0.456046 | day10.ex | starcoder |
defmodule Blockchain.Chain do
@moduledoc """
A structure that holds the necessary ETS tables to store blocks
"""
alias Blockchain.{Block, Transaction}
require Logger
@opaque t() :: %__MODULE__{blocks: term(), transactions: term()}
defstruct [:blocks, :transactions]
@doc """
Find a block in the cha... | apps/blockchain/lib/blockchain/chain.ex | 0.806052 | 0.660564 | chain.ex | starcoder |
defmodule Bamboo.MailgunHelper do
@moduledoc """
Functions for using features specific to Mailgun
(e.g. tagging, templates).
"""
alias Bamboo.Email
@doc """
Add a tag to outgoing email to help categorize traffic based on some
criteria, perhaps separate signup emails from password recovery emails
or ... | lib/bamboo/adapters/mailgun_helper.ex | 0.69233 | 0.428742 | mailgun_helper.ex | starcoder |
defmodule Contex.TimeScale do
@moduledoc """
A time scale to map date and time data to a plotting coordinate system.
Almost identical `Contex.ContinuousLinearScale` in terms of concepts and
usage, except it applies to `DateTime` and `NaiveDateTime` domain data
types.
`TimeScale` handles the complexities o... | lib/chart/scale/time_scale.ex | 0.882915 | 0.670502 | time_scale.ex | starcoder |
defmodule ExOneroster.Demographics do
@moduledoc """
The boundary for the Demographics system.
"""
import Ecto.Query, warn: false
alias ExOneroster.Repo
alias ExOneroster.Demographics.Demographic
@doc """
Returns the list of demographics.
## Examples
iex> list_demographics()
[%Demogra... | lib/ex_oneroster/demographics/demographics.ex | 0.884464 | 0.57529 | demographics.ex | starcoder |
defmodule Clex.CL.ImageFormat do
@moduledoc ~S"""
This module defines a `Record` type that represents the `cl_image_format` as specified in the Open CL specification:
```c
typedef struct _cl_image_format {
cl_channel_order image_channel_order;
cl_channel_type image_channel_data_type;
} cl_image_forma... | lib/clex/cl/image_format.ex | 0.952541 | 0.970576 | image_format.ex | starcoder |
defmodule Absinthe.Type.Custom do
use Absinthe.Schema.Notation
@moduledoc """
This module contains the following additional data types:
- datetime (UTC)
- naive_datetime
- date
- time
- decimal (only if [Decimal](https://hex.pm/packages/decimal) is available)
Further description of these types can b... | lib/absinthe/type/custom.ex | 0.882769 | 0.638032 | custom.ex | starcoder |
defmodule Mix.Tasks.Xref do
use Mix.Task
import Mix.Compilers.Elixir,
only: [read_manifest: 1, source: 0, source: 1, source: 2, module: 1]
@shortdoc "Prints cross reference information"
@recursive true
@manifest "compile.elixir"
@moduledoc """
Prints cross reference information between modules.
... | lib/mix/lib/mix/tasks/xref.ex | 0.876911 | 0.596727 | xref.ex | starcoder |
defmodule Xlsxir.ParseStyle do
@moduledoc """
Holds the SAX event instructions for parsing style data via `Xlsxir.SaxParser.parse/2`
"""
# the following module attributes hold `numStyleId`s for standard number styles, grouping them between numbers and dates
@num [
0,
1,
2,
3,
4,
9,
... | lib/xlsxir/parse_style.ex | 0.798658 | 0.51251 | parse_style.ex | starcoder |
defmodule AutoApi.RaceState do
@moduledoc """
Keeps Race state
"""
alias AutoApi.{CommonData, State, UnitType}
use AutoApi.State, spec_file: "race.json"
@type direction ::
:longitudinal
| :lateral
| :front_lateral
| :rear_lateral
@type acceleration :: %{directio... | lib/auto_api/states/race_state.ex | 0.814311 | 0.444203 | race_state.ex | starcoder |
defmodule AWS.SSM do
@moduledoc """
AWS Systems Manager
AWS Systems Manager is a collection of capabilities that helps you automate
management tasks such as collecting system inventory, applying operating system
(OS) patches, automating the creation of Amazon Machine Images (AMIs), and
configuring operati... | lib/aws/generated/ssm.ex | 0.894738 | 0.593138 | ssm.ex | starcoder |
defmodule Commanded.Registration.SwarmRegistry.Monitor do
@moduledoc """
A `GenServer` process that starts and monitors another process that is
distributed using Swarm.
This is used to ensure the process can be supervised by a `Supervisor`.
"""
use GenServer
require Logger
alias Commanded.Registrati... | lib/commanded/registration/swarm_registry/monitor.ex | 0.68763 | 0.455986 | monitor.ex | starcoder |
defmodule SpadesGame.GamePlayer do
@moduledoc """
Represents a player inside a game of spades.
They will have a hand of cards, a bid etc.
"""
alias SpadesGame.{Deck, Card, GamePlayer}
@derive Jason.Encoder
defstruct [:hand, :tricks_won, :bid]
use Accessible
@type t :: %GamePlayer{
hand: D... | backend/lib/spades_game/game_player.ex | 0.798108 | 0.527682 | game_player.ex | starcoder |
defmodule Membrane.AudioMixer do
@moduledoc """
This element performs audio mixing.
Audio format can be set as an element option or received through caps from input pads. All
received caps have to be identical and match ones in element option (if that option is
different from `nil`).
Input pads can have o... | lib/membrane_audio_mixer.ex | 0.886611 | 0.546859 | membrane_audio_mixer.ex | starcoder |
defmodule Wax.Metadata.Statement do
@moduledoc """
Structure representing a FIDO2 metadata statement
Reference: [FIDO Metadata Statements](https://fidoalliance.org/specs/fido-uaf-v1.2-rd-20171128/fido-metadata-statement-v1.2-rd-20171128.html#metadata-keys)
Note that the following keys are not included in this... | lib/wax/metadata/statement.ex | 0.841142 | 0.597755 | statement.ex | starcoder |
defmodule Google.Bigtable.Admin.V2.CreateInstanceRequest.ClustersEntry do
@moduledoc false
use Protobuf, map: true, syntax: :proto3
@type t :: %__MODULE__{
key: String.t(),
value: Google.Bigtable.Admin.V2.Cluster.t() | nil
}
defstruct [:key, :value]
field :key, 1, type: :string
... | lib/google/bigtable/admin/v2/bigtable_instance_admin.pb.ex | 0.784236 | 0.422624 | bigtable_instance_admin.pb.ex | starcoder |
% Allow Erlang records to be imported into Elixir. For example,
% we can retrieve the `file_info` record from Erlang as follow:
%
% Code.require "record"
%
% module FileInfo
% mixin Record
% record 'file_info, 'from_lib: "kernel/include/file.hrl"
% end
%
% % Manually access the Erlang file... | lib/record.ex | 0.637595 | 0.504578 | record.ex | starcoder |
defmodule Stripe.Customer do
@moduledoc """
Work with Stripe customer objects.
You can:
- Create a customer
- Retrieve a customer
- Update a customer
- Delete a customer
Does not yet render lists or take options.
Stripe API reference: https://stripe.com/docs/api#customer
"""
@type t :: %__MOD... | lib/stripe/customer.ex | 0.747616 | 0.627894 | customer.ex | starcoder |
defmodule Guardian do
@moduledoc """
A module that provides JWT based authentication for Elixir applications.
Guardian provides the framework for using JWT in any Elixir application,
web based or otherwise, where authentication is required.
The base unit of authentication currency is implemented using JWTs.... | backend/deps/guardian/lib/guardian.ex | 0.836254 | 0.462412 | guardian.ex | starcoder |
defmodule GimTest.Animal do
@moduledoc false
use Gim.Schema
# alias GimTest.Movies.{Genre, Person, Performance}
@keys [
:impound_no,
:intake_date,
:intake_type,
:animal_type,
:neutered_status,
:sex,
:age_intake,
:condition,
:breed,
:aggressive,
:independent,
:int... | test/support/animal.ex | 0.733738 | 0.449634 | animal.ex | starcoder |
defmodule Serum.Plugins.TableOfContents do
@moduledoc """
A Serum plugin that inserts a table of contents.
## Using the Plugin
First, add this plugin to your `serum.exs`:
%{
plugins: [
#{__MODULE__ |> to_string() |> String.replace_prefix("Elixir.", "")}
]
}
This plugi... | lib/serum/plugins/table_of_contents.ex | 0.865281 | 0.608769 | table_of_contents.ex | starcoder |
defmodule Locale do
@moduledoc """
Utilities for working with locales (in the form of `en-US`).
The main goal is to be able to display a list of languages in their own spelling (`en-US` is "American English", `fr-CA` is "Français canadien").
## The Locale struct
The fields are:
* `direction` - In what di... | lib/locale.ex | 0.920191 | 0.514522 | locale.ex | starcoder |
defmodule AWS.GlobalAccelerator do
@moduledoc """
AWS Global Accelerator
This is the *AWS Global Accelerator API Reference*.
This guide is for developers who need detailed information about AWS Global
Accelerator API actions, data types, and errors. For more information about
Global Accelerator features,... | lib/aws/generated/global_accelerator.ex | 0.882675 | 0.647645 | global_accelerator.ex | starcoder |
defmodule AWS.FMS do
@moduledoc """
AWS Firewall Manager
This is the *AWS Firewall Manager API Reference*. This guide is for
developers who need detailed information about the AWS Firewall Manager API
actions, data types, and errors. For detailed information about AWS
Firewall Manager features, see the [A... | lib/aws/generated/fms.ex | 0.847037 | 0.475057 | fms.ex | starcoder |
defmodule Tipalti.Invoice do
@moduledoc """
Represents a Tipalti Invoice.
"""
alias Tipalti.CustomField
defmodule Line do
@moduledoc """
Represents a Tipalti Invoice Line.
"""
@type t :: %__MODULE__{
amount: Money.t(),
description: String.t() | nil,
custo... | lib/tipalti/invoice.ex | 0.775477 | 0.575827 | invoice.ex | starcoder |
defmodule Kashup.Element do
@moduledoc """
GenServer callback that is responsible for managing the state of a key's value.
Afforded by the use of one GenServer process per key, Kashup is capable of storing very large
values of arbitrary type. Additionally, an expiration can be assigned to `Kashup.Element`'s b... | lib/kashup/element/element.ex | 0.923721 | 0.880181 | element.ex | starcoder |
defmodule SpadesGame.GameScoreRoundTeam do
@moduledoc """
Represents one round of scoring for one team.
"""
alias SpadesGame.{GamePlayer, GameScoreRoundTeam}
@derive Jason.Encoder
defstruct [
# Score of the team going into the round
:before_score,
# # of bags the team had going into the round
... | backend/lib/spades_game/game_score_round_team.ex | 0.7237 | 0.464598 | game_score_round_team.ex | starcoder |
defmodule Tesla.Middleware.Tapper do
@behaviour Tesla.Middleware
@moduledoc """
Enables distributed request tracing using Tapper
See https://github.com/Financial-Times/tapper how to set up Tapper.
### Example usage
```
defmodule MyClient do
use Tesla
plug Tesla.Middleware.Tapper
end
```
... | lib/tesla/middleware/tapper.ex | 0.831485 | 0.704897 | tapper.ex | starcoder |
defmodule BitcoinAddress.Secp256k1 do
@moduledoc """
Utility module to deal with functionality around secp265k1
Elliptic Point Cryptography. Specifically,
- Generating a secp256k1 public key from a private key
- Extracting an Elliptic Curve point (EC Point) with coordinates {x, y}
from a secp256k1 public... | lib/bitcoin_address/secp256k1.ex | 0.895721 | 0.419262 | secp256k1.ex | starcoder |
defmodule Pumba.UserAgents do
@moduledoc """
Worker retrieves user agents for different browsers
and provides random access to user agen strings.
Maintained state looks like
```ex
%{
client: Pumba.Client.DefaultClient,
browsers: %{},
names: []
}
```
Where `browsers` is a map w... | lib/pumba/user_agents.ex | 0.852905 | 0.708931 | user_agents.ex | starcoder |
defmodule Militerm.ECS.Ability do
@doc false
defmacro __using__(_opts) do
quote do
import Militerm.ECS.Ability
end
end
@doc """
Defines an event handler for the given `event`.
Takes the following args:
- as: the role
- for: the entity playing the role
- args: the map of slots fro... | lib/militerm/ecs/ability.ex | 0.681621 | 0.437944 | ability.ex | starcoder |
defmodule Geometry.MultiPolygon do
@moduledoc """
A set of polygons from type `Geometry.Polygon`
`MultiPoint` implements the protocols `Enumerable` and `Collectable`.
## Examples
iex> Enum.map(
...> MultiPolygon.new([
...> Polygon.new([
...> LineString.new([
...> ... | lib/geometry/multi_polygon.ex | 0.931595 | 0.559591 | multi_polygon.ex | starcoder |
defmodule Jason.Helpers do
@moduledoc """
Provides macro facilities for partial compile-time encoding of JSON.
"""
alias Jason.{Codegen, Fragment}
@doc ~S"""
Encodes a JSON map from a compile-time keyword.
Encodes the keys at compile time and strives to create as flat iodata
structure as possible to ... | lib/helpers.ex | 0.872341 | 0.437523 | helpers.ex | starcoder |
defmodule Mongo.Messages do
@moduledoc """
This module encodes and decodes the data from and to the mongodb server.
We only support MongoDB >= 3.2 and use op_query with the hack collection "$cmd"
Other op codes are deprecated. Therefore only op_reply and op_query are supported.
"""
defmacro __using__... | lib/mongo/messages.ex | 0.534612 | 0.531513 | messages.ex | starcoder |
defmodule Canvas.Resources.Enrollments do
@moduledoc """
Provides functions to interact with the
[enrollment term endpoints](https://canvas.instructure.com/doc/api/enrollments).
"""
alias Canvas.{Client, Listing, Response}
alias Canvas.Resources.{Enrollment, User}
@doc """
Depending on the URL given, ... | lib/canvas/resources/enrollments.ex | 0.830834 | 0.581541 | enrollments.ex | starcoder |
defmodule Militerm.Systems.MML do
@moduledoc """
Manages the rendering handlers for MML tags for different device contexts.
"""
use Militerm.ECS.System
alias Militerm.Services.MML, as: MMLService
alias Militerm.Parsers.MML, as: MMLParser
@doc """
Accepts output and forwards it to the registered inter... | lib/militerm/systems/mml.ex | 0.787155 | 0.404213 | mml.ex | starcoder |
defmodule Versioned.Absinthe do
@moduledoc """
Helpers for Absinthe schemas.
"""
@doc """
Declare an object, versioned compliment, and interface, based off name `name`.
The caller should `use Absinthe.Schema.Notation` as here we return code
which invokes its `object` macro.
Both objects belong to an ... | lib/versioned/absinthe.ex | 0.695958 | 0.465023 | absinthe.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.