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 SMSFactor.Campaigns do
@moduledoc """
Wrappers around **Campaigns** section of SMSFactor API.
"""
@typedoc """
Params for retrieving campaigns history.
- `start` : You can define the start record for pagination. Default 0
- `length` : You can define the number of records to retrieve per reques... | lib/sms_factor/campaigns.ex | 0.809163 | 0.423667 | campaigns.ex | starcoder |
defmodule X.Component do
@moduledoc ~S"""
Extends given module with the X component functions:
## Example
defmodule ExampleComponent do
use X.Component,
assigns: %{
:message => String.t()
},
template: ~X"\""
<div>
{{ message }}
... | lib/x/component.ex | 0.881341 | 0.518668 | component.ex | starcoder |
defmodule Grizzly.ZIPGateway.Config do
@moduledoc false
# This module is for making the `zipgateway.cfg` file
@type t :: %__MODULE__{
unsolicited_destination_ip6: String.t(),
unsolicited_destination_port: :inet.port_number(),
ca_cert: Path.t(),
cert: Path.t(),
p... | lib/grizzly/zipgateway/config.ex | 0.782205 | 0.418251 | config.ex | starcoder |
defmodule OLED.Display.Server do
@moduledoc """
Display server
"""
alias OLED.Display.Impl
@typedoc """
Pixel state
`:on` - Pixel High in normal mode
`:off` - Pixel Low in normal mode
"""
@type pixel_state :: :on | :off
@typedoc """
Pixel options
`mode` - Can be `:normal` or `:xor`
`st... | lib/oled/display/server.ex | 0.811564 | 0.529811 | server.ex | starcoder |
defmodule Zig do
@moduledoc """
Inline NIF support for [Zig](https://ziglang.org)
### Motivation
> Zig is a general-purpose programming language designed for robustness,
> optimality, and maintainability.
The programming philosophy of Zig matches up nicely with the programming
philosophy of the BEAM ... | lib/zig.ex | 0.846054 | 0.916409 | zig.ex | starcoder |
defmodule EQRCode.SVG do
@moduledoc """
Render the QR Code matrix in SVG format
```elixir
qr_code_content
|> EQRCode.encode()
|> EQRCode.svg(color: "#cc6600", shape: "circle", width: 300)
```
You can specify the following attributes of the QR code:
* `color`: In hexadecimal format. The default is `... | lib/eqrcode/svg.ex | 0.882921 | 0.891717 | svg.ex | starcoder |
defmodule Matrix do
@moduledoc """
多次元配列を取り扱うヘルパーモジュールです。
## 2 x 3 行列の場合
iex> Matrix.new(2, 3)
[
[nil, nil],
[nil, nil],
[nil, nil]
]
## 行列をマップに変換する
iex> Matrix.new(3, 3)
...> |> Matrix.to_map()
%{
0 => %{ 0 => nil, 1 => nil, 2 => nil},
1 => %{ 0 => nil,... | lib/algs/matrix.ex | 0.581065 | 0.720786 | matrix.ex | starcoder |
defmodule Elixirfm.Artist do
@moduledoc """
Functions for Last.fm Artist endpoints.
todo:
artist.addTags
artist.removeTags
"""
@method "artist"
defp req(uri), do: Elixirfm.get_request(@method <> uri)
defp req(uri, args), do: Elixirfm.get_request(@method <> uri, args)
@doc """
Search an art... | lib/elixirfm/artist.ex | 0.743727 | 0.400017 | artist.ex | starcoder |
defmodule Cli.Parse do
@moduledoc """
Module used for parsing user input.
"""
require Logger
@day_minutes 24 * 60
@application_options [verbose: :boolean, config: :string]
@doc """
Extracts options from the supplied arguments that are not task/query related.
The supported options are:
- `:verbo... | lib/cli/parse.ex | 0.819821 | 0.530845 | parse.ex | starcoder |
defmodule Tempus.Slot do
@moduledoc """
Declares a timeslot and exports functions to check whether the given date
and/or datetime is covered by this slot or not.
This module probably should not be called directly.
"""
alias __MODULE__
@typedoc "A timeslot to be used in `Tempus`"
@type t :: %__MODULE... | lib/slot.ex | 0.914901 | 0.565359 | slot.ex | starcoder |
defmodule ExWire.Sync do
@moduledoc """
This is the heart of our syncing logic. Once we've connected to a number
of peers via `ExWire.PeerSup`, we begin to ask for new blocks from those
peers. As we receive blocks, we add them to our `ExWire.Struct.BlockQueue`.
If the blocks are confirmed by enough peers, the... | apps/ex_wire/lib/ex_wire/sync.ex | 0.592902 | 0.47524 | sync.ex | starcoder |
defmodule Cashtrail.Entities.Tenants do
@moduledoc """
Create or drop tenants for one Entity.
Every created Entity should be a tenant and have its data. Tenants are schemas
in the Postgres having the data related to the Entity.
"""
alias Cashtrail.Entities
@doc """
Create a tenant for the given Entit... | apps/cashtrail/lib/cashtrail/entities/tenants.ex | 0.864839 | 0.58433 | tenants.ex | starcoder |
defmodule Bodyguard do
@moduledoc """
Authorize actions at the boundary of a context
Please see the [README](readme.html).
"""
@type opts :: keyword
@doc """
Authorize a user's action.
Simply converts the `opts` to a `params` map and defers to the
`c:Bodyguard.Policy.authorize/3` callback on the... | lib/bodyguard.ex | 0.861931 | 0.60013 | bodyguard.ex | starcoder |
defmodule PasswordlessAuth do
@moduledoc """
PasswordlessAuth provides functionality for generating numeric codes that
can be used for verifying a user's ownership of a phone number, email address
or any other identifying address.
It is designed to be used in a verification system, such as a passwordless aut... | lib/passwordless_auth.ex | 0.861916 | 0.576751 | passwordless_auth.ex | starcoder |
defmodule Remedy.Component.ActionRow do
@moduledoc """
Action Rows.
"""
use Remedy.Schema.Component
@defaults %{
type: 1,
components: []
}
@type t :: %{
type: Component.type(),
components: [Component.components()]
}
@doc """
Create an empty action row.
Options... | components/action_row.ex | 0.80213 | 0.462716 | action_row.ex | starcoder |
defmodule Eeyeore.Settings do
use GenServer
require Logger
@moduledoc """
The main settings for Eeyeore
These settings include things like, default LED Color,
default number of bolts on a trigger, and maximum brightness. This module also
broadcasts changes for network connections such as MQTT.
"""
... | lib/eeyeore/settings.ex | 0.695752 | 0.424084 | settings.ex | starcoder |
defmodule Brando.LivePreview do
@moduledoc """
Create a `MyAppWeb.LivePreview` module if it does not already exist
```
use Brando.LivePreview
preview_target Brando.Pages.Page do
mutate_data fn entry -> %{entry | title: "custom"} end
layout_module MyAppWeb.LayoutView
view_module MyAppWeb.PageVi... | lib/brando/live_preview.ex | 0.777173 | 0.53692 | live_preview.ex | starcoder |
defmodule ExKdl do
@moduledoc """
A robust and efficient decoder and encoder for the KDL Document Language.
"""
alias ExKdl.{DecodeError, EncodeError, Encoder, Lexer, Node, Parser}
@doc """
Decodes a KDL-encoded document from the `input` binary.
## Examples
iex> ExKdl.decode("node 10")
{:o... | lib/ex_kdl.ex | 0.930332 | 0.602032 | ex_kdl.ex | starcoder |
IO.puts("------------ Atom ------------")
atom_apple = :apple
atom_orange = :orange
atom_true = :true
atom_false = :false
atom_nil = :nil
IO.puts("is_atom(atom_apple) => #{is_atom(atom_apple)}")
IO.puts("atom_apple == atom_orange => #{atom_apple == atom_orange}")
IO.puts("is_atom(true) => #{is_atom(true)}")
IO.puts(... | 01_variables_and_types/04_basic_types/types.ex | 0.690037 | 0.537345 | types.ex | starcoder |
defmodule HoodMelville do
@moduledoc """
Documentation for HoodMelville.
"""
@type rotation_state ::
{:reversing, integer(), [term()], [term()], [term()], [term()]}
| {:idle}
| {:appending, integer(), [term()], [term()]}
| {:done, [term()]}
@type queue :: {integer(), [... | lib/hood_melville.ex | 0.738198 | 0.508117 | hood_melville.ex | starcoder |
defmodule Oban do
@moduledoc """
Oban isn't an application and won't be started automatically. It is started by a supervisor that
must be included in your application's supervision tree. All of your configuration is passed
into the `Oban` supervisor, allowing you to configure Oban like the rest of your applicat... | lib/oban.ex | 0.898363 | 0.787032 | oban.ex | starcoder |
defmodule OpcUA.Server do
use OpcUA.Common
alias OpcUA.{NodeId}
@moduledoc """
OPC UA Server API module.
This module provides functions for configuration, add/delete/read/write nodes and discovery a OPC UA Server.
`OpcUA.Server` is implemented as a `__using__` macro so that you can put it in... | lib/opc_ua/server.ex | 0.809351 | 0.72657 | server.ex | starcoder |
defmodule Uplink.Monitors.Ecto do
use Uplink.Monitor
@default_buckets [5, 10, 20, 50, 100, 200, 500, 1000, 1500, 2000, 5000, 10000]
@moduledoc """
Ecto definitions. Include these if using Ecto.
Keep the prefix consistent among repos. The repo name is captured as a tag
from the metadata for reporting purpo... | monitors/ecto.ex | 0.84941 | 0.582758 | ecto.ex | starcoder |
defmodule Blockchain.Block.Validation do
@moduledoc """
This module provides functions to validate a block.
"""
alias Blockchain.Block
@doc """
Determines whether or not a block is valid. This is
defined in Eq.(29) of the Yellow Paper.
Note, this is a serious intensive operation, and not
faint of he... | apps/blockchain/lib/blockchain/validation.ex | 0.798815 | 0.462959 | validation.ex | starcoder |
defmodule Mentat do
@external_resource readme = "README.md"
@moduledoc readme
|> File.read!()
|> String.split("<!--MDOC !-->")
|> Enum.fetch!(1)
use Supervisor
use Oath
@type cache_opts() :: Keyword.t()
@type name :: atom()
@type key :: term()
@type value :: term... | lib/mentat.ex | 0.810966 | 0.630002 | mentat.ex | starcoder |
defmodule PassiveSupport.Map do
@moduledoc """
Convenience functions for working with maps.
"""
alias PassiveSupport, as: Ps
@type key :: any
@doc ~S"""
Returns a new map with `key` replaced by `new_key` or the return of `fun`
If `key` is not found within `map`, returns the `map` unaltered.
Usefu... | lib/passive_support/base/map.ex | 0.840455 | 0.538619 | map.ex | starcoder |
defmodule Phoenix.LiveDashboard.Router do
@moduledoc """
Provides LiveView routing for LiveDashboard.
"""
@doc """
Defines a LiveDashboard route.
It expects the `path` the dashboard will be mounted at
and a set of options.
## Options
* `:metrics` - Configures the module to retrieve metrics from.... | lib/phoenix/live_dashboard/router.ex | 0.85987 | 0.479808 | router.ex | starcoder |
defmodule RingBuffer do
@moduledoc """
RingBuffer provides an Elixir ring buffer implementation based on Erlang :queue.
There are other fine Elxir libraries providing implementations of
ring or circular buffers. This one provides a wanted feature that the
others did not provide, namely that the item that was... | lib/ring_buffer.ex | 0.911074 | 0.551211 | ring_buffer.ex | starcoder |
defprotocol Vaporator.CloudFs do
@moduledoc """
Protocol for the most basic set of Cloud file-system operations
Impls must implement the following functions:
- list_folder
- get_metadata
- file_download
- file_upload
- ...
"""
@doc """
Need to be able to get the file's hash based on the destin... | lib/vaporator/cloudfs/cloudfs.ex | 0.866133 | 0.453685 | cloudfs.ex | starcoder |
defmodule Saul do
@moduledoc """
Contains the core of the functionality provided by Saul.
Saul is a data validation and conformation library. It tries to solve the
problem of validating the shape and content of some data (most useful when
such data come from an external source) and of conforming those data t... | lib/saul.ex | 0.945601 | 0.912903 | saul.ex | starcoder |
defmodule URI do
@on_load :preload_parsers
defrecord Info, [scheme: nil, path: nil, query: nil,
fragment: nil, authority: nil,
userinfo: nil, host: nil, port: nil,
specifics: nil]
import Bitwise
@moduledoc """
Utilities for working with and creating ... | lib/elixir/lib/uri.ex | 0.769427 | 0.507751 | uri.ex | starcoder |
defmodule Grizzly.ZWave.CommandClasses.NetworkManagementInstallationMaintenance do
@moduledoc """
"NetworkManagementInstallationMaintenance" Command Class
The Network Management Installation and Maintenance Command Class is used to access statistical
data.
"""
@type route_type ::
:no_route | :la... | lib/grizzly/zwave/command_classes/network_management_installation_maintenance.ex | 0.803752 | 0.470189 | network_management_installation_maintenance.ex | starcoder |
defmodule Extractly.Toc.Renderer.AstRenderer do
@doc ~S"""
Transform a normalized tuple list (that is a list of tuples of the form {n, text})
in which there exists an entry of the form {m, text} for all m betwenn min(n) and
max(n)
Two formats are supported
### The _simple_ `PushList`
where the tuple l... | lib/extractly/toc/renderer/ast_renderer.ex | 0.75101 | 0.547222 | ast_renderer.ex | starcoder |
defmodule Jot do
@moduledoc ~S"""
Jot is a fast and minimal template engine influenced by Pug and Slim.<br>
It's also slightly more fun than HTML.
Here's what it looks like.
html(lang="en")
head
title Jot
body
h1#question Why?
.col
p Because this... | lib/jot.ex | 0.569254 | 0.590366 | jot.ex | starcoder |
defmodule QbBackend.Accounts do
@moduledoc """
This is the boundary module for the Accounts Context
We use this module to perform Accounts related actions
"""
alias QbBackend.{
Repo,
Accounts.User,
Accounts.Profile
}
@doc """
This function takes the id of a user and proceeds to find the as... | lib/qb_backend/accounts/accounts.ex | 0.677794 | 0.410934 | accounts.ex | starcoder |
defmodule Defql do
@moduledoc """
Module provides macros to create function with SQL as a body.
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `defql` to your list of dependencies in `mix.exs`:
```elixir
defp deps do
[
{:defql, "~> 0... | lib/defql.ex | 0.682468 | 0.875202 | defql.ex | starcoder |
defmodule Bonny.Controller do
@moduledoc """
`Bonny.Controller` defines controller behaviours and generates boilerplate for generating Kubernetes manifests.
> A custom controller is a controller that users can deploy and update on a running cluster, independently of the cluster’s own lifecycle. Custom controller... | lib/bonny/controller.ex | 0.883418 | 0.502258 | controller.ex | starcoder |
defmodule Membrane.ParentSpec do
@moduledoc """
Structure representing the topology of a pipeline/bin.
It can be incorporated into a pipeline or a bin by returning
`t:Membrane.Pipeline.Action.spec_t/0` or `t:Membrane.Bin.Action.spec_t/0`
action, respectively. This commonly happens within `c:Membrane.Pipeline... | lib/membrane/parent_spec.ex | 0.936052 | 0.863103 | parent_spec.ex | starcoder |
defmodule Imagineer.Image.PNG.Filter.Basic do
alias Imagineer.Image.PNG
alias PNG.Filter.Basic
import PNG.Helpers, only: [bytes_per_pixel: 2, bytes_per_row: 3, null_binary: 1]
@none 0
@sub 1
@up 2
@average 3
@paeth 4
@doc """
Takes an image's scanlines and returns the rows unfiltered
Types are d... | lib/imagineer/image/png/filter/basic.ex | 0.646014 | 0.448366 | basic.ex | starcoder |
defmodule Rummage.Phoenix.Plug do
@moduledoc """
This plug ensures that the `rummage` params are properly set before
`index` action of the controller. If they are not, then it formats them
accordingly.
This plug only works with the default `Rummmage.Ecto` hooks.
"""
@doc """
`init` initializes the plu... | lib/rummage_phoenix/plug.ex | 0.752695 | 0.418162 | plug.ex | starcoder |
defmodule AWS.IoTSiteWise do
@moduledoc """
Welcome to the AWS IoT SiteWise API Reference.
AWS IoT SiteWise is an AWS service that connects [Industrial Internet of Things (IIoT)](https://en.wikipedia.org/wiki/Internet_of_things#Industrial_applications)
devices to the power of the AWS Cloud. For more informati... | lib/aws/generated/iot_site_wise.ex | 0.87079 | 0.453322 | iot_site_wise.ex | starcoder |
defmodule ExDoc.HTMLFormatter.Templates do
@moduledoc """
Handle all template interfaces for the HTMLFormatter.
"""
require EEx
alias ExDoc.HTMLFormatter.Autolink
@doc """
Generate content from the module template for a given `node`
"""
def module_page(node) do
types = node.typespecs
fun... | lib/ex_doc/html_formatter/templates.ex | 0.681833 | 0.428771 | templates.ex | starcoder |
defmodule Leibniz do
@moduledoc """
Leibniz is a math expression parser and evaluator.
"""
@doc ~S"""
Evaluates a valid math expression interpolating any given values.
## Examples
iex> Leibniz.eval("2 * 10 / 2")
{:ok, 10.0}
iex> Leibniz.eval("2 * foo + bar - baz", foo: 5.3, bar: 10,... | lib/leibniz.ex | 0.83957 | 0.552359 | leibniz.ex | starcoder |
defmodule Xlack do
@moduledoc """
Xlack is a genserver-ish interface for working with the Xlack real time
messaging API through a Websocket connection.
To use this module you'll need a need a Xlack API token which can be retrieved
by following the [Token Generation Instructions] or by creating a new [bot
i... | lib/xlack.ex | 0.863002 | 0.796411 | xlack.ex | starcoder |
defmodule Callback do
@typedoc """
A module-function-arity tuple with an explicit arity.
"""
@type mfa(arity) :: { module, atom, arity }
@typedoc """
A module-function-parameter tuple.
This either contains a list of parameters that will be passed to the function,
and any input ... | lib/callback.ex | 0.859914 | 0.667027 | callback.ex | starcoder |
defmodule FFprobe do
@moduledoc """
Execute ffprobe CLI commands.
> `ffprobe` is a simple multimedia streams analyzer. You can use it to output
all kinds of information about an input including duration, frame rate, frame size, etc.
It is also useful for gathering specific information about an input to be us... | lib/ffprobe.ex | 0.787237 | 0.474388 | ffprobe.ex | starcoder |
defmodule Assent.Strategy.OAuth do
@moduledoc """
OAuth 1.0a strategy.
`authorize_url/1` returns a map with a `:session_params` and `:url` key. The
`:session_params` key carries a `:oauth_token_secret` value for the request.
## Configuration
- `:consumer_key` - The OAuth consumer key, required
- `:... | lib/assent/strategies/oauth.ex | 0.902445 | 0.512205 | oauth.ex | starcoder |
defmodule Storage do
@moduledoc """
The main module, which contains all the core functions for basic handling of files.
This module has functions only for direct handling of the files, `Storage.Object` can
be used to make it easier storing files of specific types.
## Configuration
Here's an example confi... | lib/storage.ex | 0.885235 | 0.703129 | storage.ex | starcoder |
defmodule Olagarro.PDF.Document do
@moduledoc """
Defines a structure representing a PDF document.
"""
defstruct [
:version,
:eol_marker
]
@doc """
Read a PDF document from an I/O stream.
## Options
These are the options:
* `:eol_marker` - The character or character sequence used in th... | lib/olagarro/pdf/document.ex | 0.821796 | 0.405743 | document.ex | starcoder |
defmodule Codenamex.Game.Board do
@moduledoc """
This module manages the board logic.
All the functions besides setup/0 expect a board state.
A state is a variation of what was created by the setup/0 function.
"""
alias Codenamex.Game.Card
alias Codenamex.Game.Dictionary
alias Codenamex.Game.Team
@c... | lib/codenamex/game/board.ex | 0.795896 | 0.485661 | board.ex | starcoder |
defmodule Day10.Asteroids do
def run(1) do
10
|> InputFile.contents_of
|> String.split("\n")
|> Day10.Asteroids.parse
|> Day10.Asteroids.counts
|> Enum.map(fn({loc, set}) -> {MapSet.size(set), loc} end)
|> Enum.max
|> IO.puts
end
def run(2) do
10
|> InputFile.contents_of
... | year_2019/lib/day_10/asteroids.ex | 0.590425 | 0.505554 | asteroids.ex | starcoder |
defmodule Fuel.Ctx do
@moduledoc """
Provides functions for interacting with a `ctx`.
The `ctx` is based on the golang `context.Context` and provides many of the same functional features.
Using a `ctx` provides a common thread of data that can be used all through your application.
It can be used in plug, gr... | lib/fuel/ctx/ctx.ex | 0.836988 | 0.664361 | ctx.ex | starcoder |
defmodule Combine do
@moduledoc """
Main entry point for the Combine API.
To use:
defmodule Test do
use Combine # defaults to parsers: [:text, :binary]
# use Combine, parsers: [:text]
# use Combine, parsers: [:binary]
# use Combine, parsers: [] # does not import any parsers... | elixir/codes-from-books/little-elixir/cap8/blitzy/deps/combine/lib/combine.ex | 0.698844 | 0.478712 | combine.ex | starcoder |
defmodule AWS.CodeStarConnections do
@moduledoc """
AWS CodeStar Connections
This AWS CodeStar Connections API Reference provides descriptions and usage
examples of the operations and data types for the AWS CodeStar Connections API.
You can use the connections API to work with connections and installations... | lib/aws/generated/code_star_connections.ex | 0.87643 | 0.478894 | code_star_connections.ex | starcoder |
defmodule Militerm.Systems.Mixins do
@moduledoc """
The Mixins system manages running code defined in a mixin and inspecting aspects
of the mixin.
"""
alias Militerm.Services.Mixins, as: MixinService
alias Militerm.Systems.Mixins
require Logger
def introspect(this_mixin) do
data = MixinService.ge... | lib/militerm/systems/mixins.ex | 0.710829 | 0.411406 | mixins.ex | starcoder |
defmodule ExStoneOpenbank.Authenticator do
@moduledoc """
Responsible for authentication of the service application.
Authentication is done through issuing a JWT to the token endpoint according to client_credentials
flow. The JWT is signed using the private key in the given configuration.
The result is an a... | lib/ex_stone_openbank/authenticator.ex | 0.805288 | 0.423756 | authenticator.ex | starcoder |
defmodule Ash.Resource do
@moduledoc """
A resource is a static definition of an entity in your system.
Resource DSL documentation: `Ash.Resource.Dsl`
"""
@type t :: module
@type record :: struct()
use Ash.Dsl,
single_extension_kinds: [:data_layer],
many_extension_kinds: [
:authorizers,
... | lib/ash/resource.ex | 0.755817 | 0.412294 | resource.ex | starcoder |
defmodule Telnyx do
@moduledoc """
[Telnyx](https://telnyx.com) is a real-time communications platform with full, feature-rich functionality, making it quick and easy to set up and port numbers around the world, configure messaging, control VoIP and IP network functions, and define how and where communications can ... | lib/telnyx.ex | 0.666171 | 0.891339 | telnyx.ex | starcoder |
import TypeClass
defclass Witchcraft.Setoid do
@moduledoc ~S"""
A setoid is a type with an equivalence relation.
This is most useful when equivalence of some data is not the same as equality.
Since some types have differing concepts of equality, this allows overriding
the behaviour from `Kernel.==/2`. To g... | lib/witchcraft/setoid.ex | 0.793066 | 0.621498 | setoid.ex | starcoder |
defmodule Tds.Date do
@moduledoc """
Struct for MSSQL date.
https://msdn.microsoft.com/en-us/library/bb630352.aspx
## Fields
* `year`
* `month`
* `day`
"""
@type t :: %__MODULE__{year: 1..9999, month: 1..12, day: 1..31}
defstruct year: 1900,
month: 1,
day: 1
end
def... | lib/tds/date_time.ex | 0.875208 | 0.551634 | date_time.ex | starcoder |
defmodule YubikeyOTP.OTP do
@moduledoc """
## OTP Format
The format of the OTP is documented in:
https://developers.yubico.com/OTP/OTPs_Explained.html
"""
alias YubikeyOTP.CRC
alias YubikeyOTP.ModHex
alias YubikeyOTP.OTP
@type t :: %__MODULE__{
public_id: binary(),
prefix: nil | binary(),
... | lib/yubikey_otp/otp.ex | 0.88136 | 0.469703 | otp.ex | starcoder |
defmodule Ratatouille.Renderer.Element.Table do
@moduledoc false
@behaviour Ratatouille.Renderer
# Minimum padding on the right of each column
@min_padding 2
alias ExTermbox.Position
alias Ratatouille.Renderer.{Box, Canvas, Element, Text}
@impl true
def render(%Canvas{} = canvas, %Element{children: r... | lib/ratatouille/renderer/element/table.ex | 0.805364 | 0.558809 | table.ex | starcoder |
defmodule PlugSessionMnesia.Store do
@moduledoc """
Stores the session in a Mnesia table.
The store itself does not create the Mnesia table. It expects an existing
table to be passed as an argument. You can create it yourself following the
*Storage* section or use the helpers provided with this application (... | lib/plug_session_mnesia/store.ex | 0.872971 | 0.571169 | store.ex | starcoder |
defmodule Ueberauth.Strategy.AzureAD do
@moduledoc """
provides an Ueberauth strategy for authenticating against OAuth2
endpoints in Microsoft Identity (Azure) 2.0.
## Setup
1. Setup your application at the new [Microsoft app registration portal](https://apps.dev.microsoft.com).
1. Add `:ueberauth_azure_... | lib/ueberauth/strategy/azure_ad.ex | 0.873417 | 0.822403 | azure_ad.ex | starcoder |
defmodule ExSel do
@moduledoc """
Simple runtime expression language for elixir.
## Variables
A variable should start with a lowercase letter and is followed by mixed case letters, numbers or underscore
`true` and `false` are reserved symbols
# valid:
a , myVar , my_Var, var1
# invalid:
... | lib/ex_sel.ex | 0.824956 | 0.563588 | ex_sel.ex | starcoder |
defmodule Meilisearch.Document do
@moduledoc """
Collection of functions used to manage documents.
[MeiliSearch Documentation - Documents](https://docs.meilisearch.com/references/documents.html)
"""
alias Meilisearch.HTTP
@doc """
Get one document by id.
## Example
iex> Meilisearch.Document.g... | lib/meilisearch/document.ex | 0.743541 | 0.408542 | document.ex | starcoder |
defmodule ICalendar.RRULE.Type do
alias ICalendar.RRULE
use Timex
@moduledoc """
Defines `ICalendar.RRULE.Type` Ecto.Type.
"""
@behaviour Ecto.Type
@doc """
The Ecto primitive type.
"""
def type, do: :map
@doc """
Casts the given value to `ICalendar.RRULE` struct.
It supports:
*... | lib/icalendar/rrule/type.ex | 0.869562 | 0.410904 | type.ex | starcoder |
defmodule BitstylesPhoenix.Component.Content do
use BitstylesPhoenix.Component
@moduledoc """
The Content component.
"""
@doc ~s"""
Renders a content div, to add some spacing to the sides of your content.
## Attributes
- `variant` — Variant of the content you want, from those available in the CSS cl... | lib/bitstyles_phoenix/component/content.ex | 0.784443 | 0.408601 | content.ex | starcoder |
defmodule Exgencode do
@moduledoc """
Documentation for Exgencode.
"""
defprotocol Pdu.Protocol do
@doc "Returns the size of the field in bits."
def sizeof(pdu, field_name)
@doc "Returns the size of the pdu for given version."
@spec sizeof_pdu(Exgencode.pdu(), Version.version() | nil, Exgencode... | lib/exgencode.ex | 0.914049 | 0.438905 | exgencode.ex | starcoder |
defmodule CircularBuffer do
use GenServer
@moduledoc """
An API to a stateful process that fills and empties a circular buffer
"""
# CLIENT API
@doc """
Create a new buffer of a given capacity
"""
@spec new(capacity :: integer) :: {:ok, pid}
def new(capacity) do
GenServer.start_link(__MODULE_... | exercises/practice/circular-buffer/.meta/example.ex | 0.824356 | 0.423071 | example.ex | starcoder |
defmodule Memento do
require Memento.Mnesia
require Memento.Error
@moduledoc """
Simple + Powerful interface to the Erlang Mnesia Database.
See the [README](https://github.com/sheharyarn/memento) to get
started.
"""
# Public API
# ----------
@doc """
Start the Memento Application.
Thi... | lib/memento/memento.ex | 0.732209 | 0.730578 | memento.ex | starcoder |
defmodule AWS.WAF.Regional do
@moduledoc """
This is the *AWS WAF Regional API Reference* for using AWS WAF with Elastic
Load Balancing (ELB) Application Load Balancers. The AWS WAF actions and
data types listed in the reference are available for protecting Application
Load Balancers. You can use these actio... | lib/aws/waf_regional.ex | 0.889481 | 0.776348 | waf_regional.ex | starcoder |
defmodule ElxValidation.Alpha do
@moduledoc """
### string
- The field under validation must be a string. If you would like to allow the field to also be null, you should assign
the nullable rule to the field.
```
data = %{
user_name1: "john_007",
user_name2: 1879, ---> return error
}
rules ... | lib/rules/alpha.ex | 0.820793 | 0.774285 | alpha.ex | starcoder |
defmodule AWS.Health do
@moduledoc """
AWS Health
The AWS Health API provides programmatic access to the AWS Health
information that appears in the [AWS Personal Health
Dashboard](https://phd.aws.amazon.com/phd/home#/). You can use the API
operations to get information about AWS Health events that affect ... | lib/aws/generated/health.ex | 0.894847 | 0.639173 | health.ex | starcoder |
defmodule Plexy.Logger do
@moduledoc """
Plexy.Logger is a proxy to Elixir's built-in logger that knows how to
handle non char-data and has a few other helpful logging functions.
"""
alias Plexy.Config
require Logger
@overrides [:info, :warn, :debug, :error]
for name <- @overrides do
@doc """
... | lib/plexy/logger.ex | 0.862149 | 0.465752 | logger.ex | starcoder |
defmodule EtsLock do
@moduledoc ~S"""
EtsLock is a library for acquiring exclusive locks on data in
[ETS](http://erlang.org/doc/man/ets.html) tables.
Using `with_ets_lock/4`, you can process all `{key, value}` tuples for a
given `key` while being sure other processes using `with_ets_lock/4`
are not mutatin... | lib/ets_lock.ex | 0.799207 | 0.459319 | ets_lock.ex | starcoder |
defmodule EctoSchemaStore.Assistant do
@moduledoc """
Provides macros to customize configuration aspects of a store module.
"""
@doc """
Creates variations of the existing edit functions with a predefined configuration.
Functions preconfigured:
* `insert`
* `insert!`
* `insert_fields`
* `insert_f... | lib/ecto_schema_store/assistant.ex | 0.778102 | 0.678567 | assistant.ex | starcoder |
defmodule GitHubActions.Yaml do
@moduledoc false
@spec encode(any()) :: String.t()
def encode(data) do
data
|> do_encode([], 0)
|> Enum.reverse()
|> Enum.join("\n")
|> newline()
end
defp do_encode(data, lines, _depth) when is_binary(data) do
string = if num_or_version?(data), do: "'#... | lib/git_hub_actions/yaml.ex | 0.663778 | 0.480174 | yaml.ex | starcoder |
defmodule ElixirKeeb.UI.DataFaker do
use GenServer
@wait_before_more_data_ms 1500
@impl true
def init({elem, how_many}) do
data = 1..how_many
|> Enum.map(fn _ -> elem end)
Process.send_after(self(), :more_data, @wait_before_more_data_ms)
{:ok, %{data: data, max: how_many}}
end
@i... | lib/elixir_keeb_ui/data_faker.ex | 0.672762 | 0.428891 | data_faker.ex | starcoder |
defmodule SMPPEX do
@moduledoc ~S"""
SMPPEX is a framework for building SMPP servers and clients (which are often
referred to as MC and ESME entities respectevely).
The major features exposed by the library are:
* `SMPPEX.ESME` module and behaviour for implementing ESME entities;
* `SMPPEX.MC` module ... | lib/smppex.ex | 0.842053 | 0.86113 | smppex.ex | starcoder |
defmodule Fares.Month do
@moduledoc """
Calculates the lowest and highest monthly pass fare for a particular trip.
"""
alias Fares.{Fare, Repo}
alias Routes.Route
alias Schedules.Trip
alias Stops.Stop
@type fare_fn :: (Keyword.t() -> [Fare.t()])
@spec recommended_pass(
Route.t() | Route.i... | apps/fares/lib/month.ex | 0.742515 | 0.41938 | month.ex | starcoder |
defmodule Grizzly.ZWave.Commands.ConfigurationSet do
@moduledoc """
Set the configuration parameter
Params:
* `:size` - specifies the size of the configuration parameter
(required if not resetting to default)
* `:value` - the value of the parameter, can be set to `:default` to set
the parame... | lib/grizzly/zwave/commands/configuration_set.ex | 0.872673 | 0.609379 | configuration_set.ex | starcoder |
defmodule Bonny.Server.Watcher do
@moduledoc """
Continuously watch a list `Operation` for `add`, `modify`, and `delete` events.
"""
@callback add(map()) :: :ok | :error
@callback modify(map()) :: :ok | :error
@callback delete(map()) :: :ok | :error
@doc """
[`K8s.Operation`](https://hexdocs.pm/k8s/K8... | lib/bonny/server/watcher.ex | 0.869548 | 0.609001 | watcher.ex | starcoder |
defmodule Search.Document do
@moduledoc """
Provides a behaviour and common functions for managing Elasticsearch Documents.
"""
# requires
require Logger
alias Ecto.{Query}
alias Search.Indices.BulkIndex
## Module Attributes
@empty_value "______"
@doc """
Hook to allow for manipulation of the ... | lib/elastic_jsonapi/document.ex | 0.837254 | 0.455078 | document.ex | starcoder |
defmodule Phoenix.LiveController do
@moduledoc ~S"""
Controller-style abstraction for building multi-action live views on top of `Phoenix.LiveView`.
`Phoenix.LiveView` API differs from `Phoenix.Controller` API in order to emphasize stateful
lifecycle of live views, support long-lived processes behind them and ... | lib/phoenix_live_controller.ex | 0.834845 | 0.464051 | phoenix_live_controller.ex | starcoder |
defmodule MixTemplates do
@moduledoc ~S"""
> NOTE: This documentation is intended for folks who want to write
> their own templates. If you just want to use a template, then
> have a look at the README, or try `mix help template` and
> `mix help gen`.
This is the engine that supports templated directory trees.
A t... | lib/mix_templates.ex | 0.776326 | 0.547101 | mix_templates.ex | starcoder |
defmodule ExPwned.Breaches do
@moduledoc """
Module to interact with hibp API to retrive breaches data
"""
use ExPwned.Api
@doc """
return a list of all breaches a particular account has been involved in.
The API takes a single parameter which is the account to be searched for.
The account is not case... | lib/ex_pwned/breaches.ex | 0.766992 | 0.494873 | breaches.ex | starcoder |
defmodule Multiverse.Adapters.ISODate do
@moduledoc """
Adapter that fetches ISO-8601 date from request header and `Elixir.Date`
to resolve changes that must be applied to the connection.
This adapter requires you to configure which version is used by default,
when value in a header was malformed or not set.... | lib/multiverse/adapters/iso_date.ex | 0.891082 | 0.434401 | iso_date.ex | starcoder |
defmodule Aecore.Sync.Jobs do
@moduledoc """
Handles the functionality of scheduling the required jobs for the sync to be done.
This implementations uses the `job` library, where each job is regulated to a specific queue.
We have 3 main queues:
- `:sync_ping_workers` -> Handles the ping between nodes
- `:s... | apps/aecore/lib/aecore/sync/jobs.ex | 0.83612 | 0.427158 | jobs.ex | starcoder |
defmodule Asteroid.Token do
require Logger
@moduledoc """
Types and exceptions for tokens
"""
defmodule InvalidTokenError do
@moduledoc """
Error returned when a token was requested but an error happened when retrieving it
"""
@enforce_keys [:sort, :id]
defexception [:sort, :id, reason... | lib/asteroid/token.ex | 0.892466 | 0.620866 | token.ex | starcoder |
defmodule Pbuf.Tests.Root do
@moduledoc false
alias Pbuf.Decoder
@derive {Jason.Encoder, []}
defstruct [
]
@type t :: %__MODULE__{
}
@spec new(Enum.t) :: t
def new(data \\ []), do: struct(__MODULE__, data)
@spec encode_to_iodata!(t | map) :: iodata
def encode_to_iodata!(_data) do
... | test/schemas/generated/nested_enum.pb.ex | 0.795975 | 0.533458 | nested_enum.pb.ex | starcoder |
defmodule Protobuf.DefineMessage do
@moduledoc false
alias Protobuf.Decoder
alias Protobuf.Encoder
alias Protobuf.Field
alias Protobuf.OneOfField
alias Protobuf.Delimited
alias Protobuf.Utils
def def_message(name, fields, inject: inject, doc: doc, syntax: syntax) when is_list(fields) do
struct_fie... | lib/exprotobuf/define_message.ex | 0.634883 | 0.435601 | define_message.ex | starcoder |
defmodule Cldr.Number.Formatter.Currency do
@moduledoc """
Number formatter for the `:currency` `:long` format.
This formatter implements formatting a currency in a long form. This
is not the same as decimal formatting with a currency placeholder.
To explain the difference, look at the following examples:
... | lib/cldr/number/formatter/currency_formatter.ex | 0.915983 | 0.75656 | currency_formatter.ex | starcoder |
if Code.ensure_loaded?(PryIn) do
# Based on https://github.com/pryin-io/pryin/blob/9fec04d61a7b8d4ff337653294f13c4e345c7029/lib/pryin/instrumenter.ex
defmodule Calcinator.PryIn.Instrumenter do
@moduledoc """
Collects metrics about
* `:alembic`
* `:calcinator_authorization`
* `Calcinator.autho... | lib/calcinator/pry_in/instrumenter.ex | 0.794026 | 0.630002 | instrumenter.ex | starcoder |
defmodule RDF.XML.Decoder do
@moduledoc """
A decoder for RDF/XML serializations to `RDF.Graph`s.
As for all decoders of `RDF.Serialization.Format`s, you normally won't use these
functions directly, but via one of the `read_` functions on the `RDF.XML` format
module or the generic `RDF.Serialization` module.... | lib/rdf/xml/decoder.ex | 0.81637 | 0.593315 | decoder.ex | starcoder |
defmodule Bauer.Node do
@moduledoc """
This module is designed to encapsulate information about a HTML
node: the tag name, attributes, and children nodes.
Currently `Bauer.Node` is just a convenience struct for tuples
return by `Floki`. This should be the only place `Floki` is used.
By design, we should be... | lib/bauer/node.ex | 0.830697 | 0.522446 | node.ex | starcoder |
defmodule Mambo.Brain do
@moduledoc """
Implements the Mambo memory using mnesia, 3 tables are available:
1 - {:mquotes, :id, :content}
2 - {:mlastfm, :id, :username}
3 - {:mscripts, :key, :value}
"""
# API.
# Quotes.
def add_quote(id, content) do
f = fn() -> :mnesia.write({:mquotes, id, ... | lib/mambo/brain.ex | 0.621885 | 0.46132 | brain.ex | starcoder |
defmodule Cassette.Controller do
@moduledoc """
A helper module to quickly validate roles and get the current user
To use in your controller, add as a plug restricting the actions:
```elixir
defmodule MyApp.MyController do
use MyApp.Web, :controller
use Cassette.Controller
plug :require_role!,... | lib/cassette/controller.ex | 0.819785 | 0.635887 | controller.ex | starcoder |
defmodule Rewire do
@moduledoc """
Rewire is a libary for replacing hard-wired dependencies of the module your unit testing.
This keeps your production code free from any unit testing-specific concerns.
## Usage
Given a module such as this:
```elixir
# this module has a hard-wired dependency on the `En... | lib/rewire.ex | 0.873282 | 0.863737 | rewire.ex | starcoder |
defmodule Juvet do
@moduledoc """
Juvet is an application framework to facilitate the building of conversational-based user interfaces.
Juvet helps developers consume messages from and produce responses for popular chat-based providers.
Juvet currently supports [Slack](https://slack.com) with support for more... | lib/juvet.ex | 0.895141 | 0.875628 | juvet.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.