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 Custodian.Github.Processor do
@moduledoc """
Processing functions for each type of event from GitHub's webhook that we
respond to.
Labels are defined according to the NewAperio [spec]. More information can
be found in the GitHub repo, which includes a programmatic tool for generating
our standard... | lib/custodian/github/processor.ex | 0.691602 | 0.544983 | processor.ex | starcoder |
defmodule PolyPartition.Helpers do
alias PolyPartition.Geometry
@moduledoc """
Helper functions for PolyPartition
"""
@doc """
Calculates the determinant of two points provided as a segment
## Examples
iex> PolyPartition.Helpers.det_seg([ [2, 3], [1, -1] ])
-5
"""
def det_seg(seg) do
... | lib/Helpers.ex | 0.884999 | 0.816845 | Helpers.ex | starcoder |
defmodule StepFlow.Amqp.CompletedConsumer do
@moduledoc """
Consumer of all job with completed status.
"""
require Logger
alias StepFlow.Amqp.CompletedConsumer
alias StepFlow.Jobs
alias StepFlow.Metrics.JobInstrumenter
alias StepFlow.Workflows
alias StepFlow.Workflows.StepManager
use StepFlow.Amqp... | lib/step_flow/amqp/completed_consumer.ex | 0.666605 | 0.415877 | completed_consumer.ex | starcoder |
defmodule Unpoly do
@moduledoc """
A Plug adapter and helpers for Unpoly, the unobtrusive JavaScript framework.
## Options
* `:cookie_name` - the cookie name where the request method is echoed to. Defaults to
`"_up_method"`.
* `:cookie_opts` - additional options to pass to method cookie.
See `Plu... | lib/unpoly.ex | 0.841451 | 0.580322 | unpoly.ex | starcoder |
defmodule Faker.Pokemon.En do
import Faker, only: [sampler: 2]
@moduledoc """
Functions for Pokemon names in English
"""
@doc """
Returns a Pokemon name
## Examples
iex> Faker.Pokemon.En.name()
"Fraxure"
iex> Faker.Pokemon.En.name()
"Shellos"
iex> Faker.Pokemon.En.name()
... | lib/faker/pokemon/en.ex | 0.63114 | 0.422088 | en.ex | starcoder |
defmodule Chiton do
@type coordinate::{integer(), integer()}
@spec expand_map(%{coordinate() => integer})::%{coordinate() => integer()}
def expand_map(map) do
{mx, my} = Map.keys(map) |> Enum.sort() |> List.last()
tile_coords = Map.to_list(map)
for x_xp <- 0..4 do
for y_xp <- 0..4 do
En... | lib/chiton.ex | 0.69451 | 0.564098 | chiton.ex | starcoder |
defmodule Welcome2Game.Game do
alias Welcome2Game.{
Card,
Plan,
State,
Tableau,
MoveFinder,
EstateMaker,
EstatePlanner,
GameEnder
}
use Gex.Game
def default_state() do
Welcome2Game.Game.new_game()
end
def random_state() do
Welcome2Game.Game.new_game()
end
def ... | apps/welcome2_game/lib/welcome2_game/game.ex | 0.520009 | 0.48182 | game.ex | starcoder |
defmodule Day15 do
@moduledoc """
Advent of Code 2019
Day 15: Oxygen System
"""
alias Day15.{Part1, Part2}
def get_program() do
Path.join(__DIR__, "inputs/day15.txt")
|> File.read!()
|> String.trim()
|> String.split(",")
|> Enum.map(&String.to_integer/1)
end
def execute() do
p... | lib/day15.ex | 0.715126 | 0.453867 | day15.ex | starcoder |
defmodule Day14 do
@moduledoc """
AoC 2019, Day 14 - Space Stoichiometry
"""
defmodule State do
defstruct ore_used: 0, steps: [], need: %{}, stock: %{}
end
@doc """
Amount of ORE required by the nanofactory to produce 1 FUEL
"""
def part1 do
Util.priv_file(:day14, "day14_input.txt")
|> F... | apps/day14/lib/day14.ex | 0.736969 | 0.465509 | day14.ex | starcoder |
defmodule CanvasAPI.TeamService do
@moduledoc """
A service for viewing and manipulating teams.
"""
use CanvasAPI.Web, :service
alias CanvasAPI.{Account, WhitelistedSlackDomain, Team}
import CanvasAPI.UUIDMatch
@preload [:oauth_tokens]
@doc """
Insert a team.
## Examples
```elixir
TeamServi... | lib/canvas_api/services/team_service.ex | 0.841337 | 0.800302 | team_service.ex | starcoder |
defmodule Result do
@moduledoc """
Tools for working with result tuples.
Influenced by the Rust Option/Result implementation.
"""
@type value :: any
@type error :: any
@type ok(value_type) :: {:ok, value_type}
@type ok :: ok(any)
@type err(error_type) :: {:error, error_type}
@type err :: err(any)
... | apps/rig/lib/result.ex | 0.919895 | 0.560493 | result.ex | starcoder |
defmodule Brainfux.Executor do
@moduledoc """
The actual execution functions are here.
Functions in this module are called runtime.
"""
alias Brainfux.State
@spec execute(State.t, String.t) :: State.t
def execute(state, "") do
state
end
def execute(state, "+" <> rest) do
[head | tail] = sta... | lib/brainfux/executor.ex | 0.740456 | 0.536616 | executor.ex | starcoder |
defmodule AWS.Organizations do
@moduledoc """
AWS Organizations
"""
@doc """
Sends a response to the originator of a handshake agreeing to the action
proposed by the handshake request.
This operation can be called only by the following principals when they also
have the relevant IAM permissions:
... | lib/aws/generated/organizations.ex | 0.832066 | 0.569912 | organizations.ex | starcoder |
defmodule Turbo.Ecto.Services.BuildSearchQuery do
@moduledoc """
`Turbo.Ecto.Services.BuildSearchQuery` is a service module which serves the search hook.
`@search_types` is a collection of all the 8 valid `search_types` that come shipped with
`Turbo.Ecto`'s default search hook. The types are:
* [x] `eq`: eq... | lib/turbo_ecto/services/build_search_query.ex | 0.808294 | 0.610541 | build_search_query.ex | starcoder |
defmodule Filtrex.Utils.Encoder do
@moduledoc """
Helper methods for implementing the `Filtrex.Encoder` protocol.
"""
@doc """
This macro allows a simple creation of encoders using a simple DSL.
Example:
```
encoder "equals", "does not equal", "column = ?", &(&1)
```
In this example, a comparator... | lib/filtrex/utils/encoder.ex | 0.919254 | 0.89974 | encoder.ex | starcoder |
defmodule Livebook.Utils.ANSI do
@moduledoc false
@type modifier ::
{:font_weight, :bold | :light}
| {:font_style, :italic}
| {:text_decoration, :underline | :line_through | :overline}
| {:foreground_color, color()}
| {:background_color, color()}
@type color :: ... | lib/livebook/utils/ansi.ex | 0.834845 | 0.538316 | ansi.ex | starcoder |
defmodule AWS.AppStream do
@moduledoc """
Amazon AppStream 2.0
This is the *Amazon AppStream 2.0 API Reference*.
This documentation provides descriptions and syntax for each of the actions and
data types in AppStream 2.0. AppStream 2.0 is a fully managed, secure
application streaming service that lets yo... | lib/aws/generated/app_stream.ex | 0.888124 | 0.443661 | app_stream.ex | starcoder |
defmodule Zstream.EncryptionCoder.Traditional do
@moduledoc """
Implements the tradition encryption.
"""
@behaviour Zstream.EncryptionCoder
use Bitwise
defmodule State do
@moduledoc false
defstruct key0: 0x12345678,
key1: 0x23456789,
key2: 0x34567890,
he... | lib/zstream/encryption_coder/traditional.ex | 0.613121 | 0.473536 | traditional.ex | starcoder |
defmodule ElixirRigidPhysics.Util.List do
@moduledoc """
List utils module for functions and things that should've been in the stdlib but aren't.
"""
@doc """
Function to find every pair of elements in a list.
## Examples
iex> alias ElixirRigidPhysics.Util.List
iex> List.generate_pairs([])
[]... | lib/util/list.ex | 0.647464 | 0.406008 | list.ex | starcoder |
defmodule Absinthe.Type.Interface do
@moduledoc """
A defined interface type that represent a list of named fields and their
arguments.
Fields on an interface have the same rules as fields on an
`Absinthe.Type.Object`.
If an `Absinthe.Type.Object` lists an interface in its `:interfaces` entry,
it guaran... | lib/absinthe/type/interface.ex | 0.880598 | 0.890865 | interface.ex | starcoder |
defmodule ApiWeb.RateLimiter do
@moduledoc """
Tracks user requests for rate limiting.
The rate limiter server counts the number of requests a given user has made
within a given interval. An error is returned for a user if they attempt to
make a request after they've reached their allotted request amount.
... | apps/api_web/lib/api_web/rate_limiter.ex | 0.828973 | 0.440168 | rate_limiter.ex | starcoder |
defmodule Riptide.Interceptor do
@moduledoc """
Riptide Interceptors let you define simple rules using Elixir's pattern matching that trigger conditionally when data is written or read. Each one is defined as a module that can be added to your Riptide configuration for easy enabling/disabling.
```elixir
config... | packages/elixir/lib/riptide/store/interceptor.ex | 0.943007 | 0.934813 | interceptor.ex | starcoder |
defmodule Genex.Tools.Benchmarks.SingleObjectiveContinuous do
@moduledoc """
Provides benchmark functions for Single Objective Continuous optimization problems.
These functions haven't been tested. More documentation/testing is coming later.
"""
@doc """
Cigar objective function.
Returns ```math```.
... | lib/genex/tools/benchmarks/single_objective_continuous.ex | 0.873485 | 0.927822 | single_objective_continuous.ex | starcoder |
defmodule SSD1322.SPIConnection do
@moduledoc """
Provides a high-level hardware interface to SSD1322-style SPI interfaces.
"""
defstruct spi: nil, dc: nil, reset: nil
@data_chunk_size 4096
@doc """
Initializes the SPI / GPIO connection to the display, but does not reset it
or otherwise communicate w... | lib/ssd1322/spi_connection.ex | 0.770724 | 0.427068 | spi_connection.ex | starcoder |
defmodule MangoPay.Mandate do
@moduledoc """
Functions for MangoPay [mandate](https://docs.mangopay.com/endpoints/v2.01/mandates#e230_the-mandate-object).
"""
use MangoPay.Query.Base
set_path "mandates"
@doc """
Get a mandate.
## Examples
{:ok, mandate} = MangoPay.Mandate.get(id)
"""
def ge... | lib/mango_pay/mandate.ex | 0.748536 | 0.464294 | mandate.ex | starcoder |
defmodule RList.Ruby do
@moduledoc """
Summarized all of Ruby's Array functions.
Functions corresponding to the following patterns are not implemented
- When a function with the same name already exists in Elixir.
- When a method name includes `!`.
- &, *, +, -, <<, <=>, ==, [], []=.
"""
@spec __usin... | lib/r_list/ruby.ex | 0.667473 | 0.57063 | ruby.ex | starcoder |
defmodule Combination do
@moduledoc """
Provide a set of algorithms to generate combinations and permutations.
For source collection containing non-distinct elements, pipe the resultant list through `Enum.uniq/1`
to remove duplicate elements.
"""
@doc """
Generate combinations based on given collection.... | lib/combination.ex | 0.890538 | 0.538134 | combination.ex | starcoder |
defmodule RateTheDub.Jikan do
@moduledoc """
Fetches information from the [Jikan](https://jikan.moe) API for MyAnimeList.
It is important to cache information from the API to be a good user and not hit
JIkan too hard. This will also make RateTheDub faster too!
"""
@character_role "Main"
@characters_take... | lib/ratethedub/jikan.ex | 0.775095 | 0.527864 | jikan.ex | starcoder |
defmodule Ash.Changeset.ManagedRelationshipHelpers do
@moduledoc """
Tools for introspecting managed relationships.
Extensions can use this to look at an argument that will be passed
to a `manage_relationship` change and determine what their behavior
should be. For example, AshAdmin uses these to find out wh... | lib/ash/changeset/managed_relationship_helpers.ex | 0.799129 | 0.427516 | managed_relationship_helpers.ex | starcoder |
defmodule Phoenix.NotAcceptableError do
@moduledoc """
Raised when one of the `accept*` headers is not accepted by the server.
This exception is commonly raised by `Phoenix.Controller.accepts/2`
which negotiates the media types the server is able to serve with
the contents the client is able to render.
If... | lib/phoenix/exceptions.ex | 0.749271 | 0.542439 | exceptions.ex | starcoder |
defmodule Data.Parser.BuiltIn do
@moduledoc """
Parsers for built-in Elixir data types.
"""
alias Error
alias FE.Result
alias Data.Parser
@doc """
Creates a parser that successfully parses `integer`s, and returns the
domain error `:not_an_integer` for all other inputs.
## Examples
iex> Data... | lib/data/parser/built_in.ex | 0.920616 | 0.562867 | built_in.ex | starcoder |
defmodule ExCO2Mini.Decoder do
require Logger
use Bitwise
@moduledoc """
Decodes packets from the CO₂Mini device.
"""
@key [<KEY>
@doc """
Returns a list of eight integers, representing the eight-byte key used to
communicate with the device.
"""
def key, do: @key
@doc """
Decodes (and chec... | lib/ex_co2_mini/decoder.ex | 0.859678 | 0.576125 | decoder.ex | starcoder |
defmodule Mix.Tasks.Cloak.Migrate do
@moduledoc """
Migrates a schema table to a new encryption cipher.
## Rationale
Cloak vaults will automatically decrypt fields which were encrypted
by a retired key, and reencrypt them with the new key when they change.
However, this usually is not enough for key rota... | lib/mix/tasks/cloak.migrate.ex | 0.876957 | 0.42919 | cloak.migrate.ex | starcoder |
defmodule ExInsights.Utils do
@moduledoc false
@doc ~S"""
Convert ms to c# time span format. Ported from https://github.com/Microsoft/ApplicationInsights-node.js/blob/68e217e6c6646114d8df0952437590724070204f/Library/Util.ts#L122
### Parameters:
'''
number: Number for time in milliseconds.
'''
### Ex... | lib/utils.ex | 0.858303 | 0.469155 | utils.ex | starcoder |
defmodule Petrovich.Parser do
@moduledoc """
Parser receives the name and case to infect it to.
Then it parses the rules to find the appropriate modifications.
It then calls `Applier` to modify the value.
This module should not be used directly. Use `Petrovich` module instead.
"""
alias Petrovich.{Appl... | lib/petrovich/parser.ex | 0.852874 | 0.631083 | parser.ex | starcoder |
defmodule GGity.Docs.Theme do
@moduledoc false
@doc false
@spec examples() :: iolist()
def examples do
[
"""
Examples.mtcars()
|> Plot.new(%{x: :wt, y: :mpg})
|> Plot.geom_point()
|> Plot.labs(title: "Fuel economy declines as weight decreases")
""",
"""
# Exa... | lib/mix/tasks/doc_examples/theme.ex | 0.761583 | 0.514705 | theme.ex | starcoder |
defmodule QueryBuilder.JoinMaker do
@moduledoc false
require Ecto.Query
@doc ~S"""
Options may be:
* `:mode`: if set to `:if_preferable`, schemas are joined only if it is better
performance-wise; this happens only for one case: when the association has a
one-to-one cardinality, it is better to join and ... | lib/join_maker.ex | 0.724286 | 0.461927 | join_maker.ex | starcoder |
defmodule Meeseeks do
alias Meeseeks.{Context, Document, Error, Parser, Result, Select, Selector, TupleTree}
@moduledoc """
Meeseeks is an Elixir library for parsing and extracting data from HTML and
XML with CSS or XPath selectors.
```elixir
import Meeseeks.CSS
html = HTTPoison.get!("https://news.ycom... | lib/meeseeks.ex | 0.724481 | 0.716591 | meeseeks.ex | starcoder |
defmodule Topo.Util do
@moduledoc false
@type point :: {number, number}
@spec cross(point, point, point) :: number
def cross({ax, ay}, {bx, by}, {cx, cy}) do
{ax - cx, ay - cy}
|> Vector.cross({bx - cx, by - cy})
|> Vector.component(:z)
end
@spec collinear?(point, point, point) :: boolean
d... | lib/topo/util.ex | 0.836821 | 0.649342 | util.ex | starcoder |
if Code.ensure_loaded?(Phoenix) do
defmodule PromEx.Plugins.Phoenix do
@moduledoc """
This plugin captures metrics emitted by Phoenix. Specifically, it captures HTTP request metrics and
Phoenix channel metrics.
## Plugin options
This plugin supports the following options:
- `metric_prefix`: ... | lib/prom_ex/plugins/phoenix.ex | 0.884127 | 0.643014 | phoenix.ex | starcoder |
defmodule WordsWithEnemies.GameChannel do
@moduledoc """
Contains callbacks that control the actual gameplay.
"""
use WordsWithEnemies.Web, :channel
import WordsWithEnemies.WordFinder, only: [word_list: 0, using: 2]
alias WordsWithEnemies.{Game, Letters, WordFinder, Hints, Player}
alias WordsWithEnemie... | web/channels/game_channel.ex | 0.672332 | 0.489686 | game_channel.ex | starcoder |
defmodule KittenBlue.JWK do
@moduledoc """
Structure containing `kid`, `alg`, `JOSE.JWK` and handling functions
"""
require Logger
defstruct [
:kid,
:alg,
:key
]
@type t :: %__MODULE__{kid: String.t(), alg: String.t(), key: JOSE.JWK.t()}
# Set the default value here to avoid compilation ... | lib/kitten_blue/jwk.ex | 0.819749 | 0.767646 | jwk.ex | starcoder |
defmodule Range do
@moduledoc """
Defines a Range.
A Range is represented internally as a struct. However,
the most common form of creating and matching on ranges
is via the `../2` macro, auto-imported from Kernel:
iex> range = 1..3
1..3
iex> first .. last = range
iex> first
1
... | lib/elixir/lib/range.ex | 0.868423 | 0.615146 | range.ex | starcoder |
defmodule Sammal.Tokenizer do
@moduledoc """
Tokenizer and various helper methods.
"""
alias Sammal.{Expr, SammalError}
@tokenizer_regex ~r/(['()]|"[^"]*"?|[\w-+\/.#]+)/
@doc ~S"""
Split a line of raw input into a list of Node structs.
## Example
iex> Sammal.Tokenizer.tokenize("(define x 10)")
... | lib/tokenizer.ex | 0.619932 | 0.435962 | tokenizer.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.76708 | 0.646097 | uri.ex | starcoder |
defmodule GEMS.MatrixStore do
@moduledoc """
Persistence layer for the current Matrix (public)
Used to retrieve the initial state of the matrix when a user
connects.
Note: there are a lot of ways to implement this, for now
I've chosen to leverage Presence, aka: Phoenix.Tracker, since
it's battletested. ... | lib/gems/matrix_store.ex | 0.826642 | 0.504211 | matrix_store.ex | starcoder |
defmodule Versioned.Absinthe do
@moduledoc """
Helpers for Absinthe schemas.
"""
alias Versioned.Helpers
@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.
... | lib/versioned/absinthe.ex | 0.776453 | 0.548794 | absinthe.ex | starcoder |
defmodule GitHooks.Tasks.MFA do
@moduledoc """
Represents a `{module, function, arity}` (a.k.a. `mfa`) that will be evaluated
by the Kernel module.
An `mfa` should be configured as `{module, function, arity}`. The function of
the module **will always receive the hook arguments** and the arity is
expected t... | lib/tasks/mfa.ex | 0.876039 | 0.90261 | mfa.ex | starcoder |
defmodule Pact do
@moduledoc """
A module for managing dependecies in your applicaiton without having to
"inject" dependencies all the way down your aplication. Pact allows you to
set and get dependencies in your application code, and generate fakes and
replace modules in your tests.
To use Pact, define a ... | lib/pact.ex | 0.737347 | 0.647164 | pact.ex | starcoder |
defmodule AWS.Organizations do
@moduledoc """
AWS Organizations API Reference
AWS Organizations is a web service that enables you to consolidate your
multiple AWS accounts into an *organization* and centrally manage your
accounts and their resources.
This guide provides descriptions of the Organizations ... | lib/aws/organizations.ex | 0.839997 | 0.564279 | organizations.ex | starcoder |
defmodule Confex.Type do
@moduledoc """
This module is responsible for Confex type-casting.
"""
@type value :: String.t() | nil
@type t ::
:string
| :integer
| :float
| :boolean
| :atom
| :module
| :list
| {module :: module, funct... | lib/confex/type.ex | 0.79049 | 0.450359 | type.ex | starcoder |
defmodule Nostrum.Voice do
@moduledoc """
Interface for playing and listening to audio through Discord's voice channels.
# Using Discord Voice Channels
To play sound in Discord with Nostrum, you'll need `ffmpeg` to be installed.
If you don't have the executable `ffmpeg` in the path, the absolute path may
b... | lib/nostrum/voice.ex | 0.897119 | 0.460471 | voice.ex | starcoder |
defmodule ScenicWidgets.Core.Structs.Frame do
@moduledoc """
A Frame struct defines the rectangular size of a component.
"""
defmodule Coordinates do
defstruct [x: 0, y: 0]
def new(x: x, y: y), do: %__MODULE__{x: x, y: y}
def new(%{x: x, y: y}), do: %__MODULE__{x: x, y: y}
... | lib/core/structs/frame.ex | 0.885235 | 0.673037 | frame.ex | starcoder |
defmodule ExDgraph.Utils do
@moduledoc "Common utilities"
alias ExDgraph.Expr.Uid
def as_rendered(value) do
case value do
x when is_list(x) -> x |> Poison.encode!()
%Date{} = x -> x |> Date.to_iso8601() |> Kernel.<>("T00:00:00.0+00:00")
%DateTime{} = x -> x |> DateTime.to_iso8601() |> Stri... | lib/exdgraph/utils.ex | 0.680135 | 0.462048 | utils.ex | starcoder |
defmodule Hangman.Player.FSM do
@moduledoc """
Module implements a non-process player fsm
which handles managing the state of types implemented
through Player and the Player Action protocol.
FSM provides a state machine wrapper over the `Player`
The FSM is not coupled at all to the
specific player typ... | lib/hangman/player_fsm.ex | 0.72526 | 0.873431 | player_fsm.ex | starcoder |
defmodule Phoenix.HTML do
@moduledoc """
Conveniences for working HTML strings and templates.
When used, it imports this module and, in the future,
many other modules under the `Phoenix.HTML` namespace.
## HTML Safe
One of the main responsibilities of this module is to
provide convenience functions for... | lib/phoenix/html.ex | 0.765374 | 0.571856 | html.ex | starcoder |
defmodule Raft.RPC do
@moduledoc """
Defines multiple rpc commands and functions for broadcasting messages to other
peers.
"""
alias Raft.Configuration.Server
require Logger
defmodule AppendEntriesReq do
@enforce_keys [:leader_id, :entries, :prev_log_index, :prev_log_term, :leader_commit]
defst... | lib/raft/rpc.ex | 0.557966 | 0.442215 | rpc.ex | starcoder |
defmodule CSQuery.Range do
@moduledoc """
An AWS CloudSearch structured query syntax representation of ranges that may
be inclusive or exclusive, open or closed, and may be constructed of
integers, floats, `t:DateTime.t/0` values, or (in some cases) strings.
> A brief note about notation: `{` and `}` denote ... | lib/csquery/range.ex | 0.926992 | 0.919895 | range.ex | starcoder |
defmodule Payjp.Customers do
@moduledoc """
Main API for working with Customers at Payjp. Through this API you can:
- create customers
- get a customer
- update customer
- delete single customer
- delete all customer
- get customers list
- get all customers
- list subscriptions for the customer
-... | lib/payjp/customers.ex | 0.834272 | 0.851768 | customers.ex | starcoder |
defmodule MarsRoverKata.Planet do
@moduledoc """
Represent the planet in which the robot moves.
The planet is represented by a grid of max_x * max_y shape on zero based
system and is a sphere so connects vertical edges towards themselves are
in inverted coordinates.
"""
alias MarsRoverKata.Point
alias... | lib/mars_rover_kata/planet.ex | 0.899204 | 0.72543 | planet.ex | starcoder |
defmodule StripePost.Client do
@moduledoc """
Access service functionality through Elixir functions,
wrapping the underlying HTTP API calls.
This is where you will want to write your custom
code to access your API.
"""
alias StripePost.Api
@doc """
Charge an account with the following body configur... | lib/stripe_post/client.ex | 0.85817 | 0.405125 | client.ex | starcoder |
defmodule ExPool.Pool do
@moduledoc """
Pool GenServer.
It provides an interface to start a pool, check in and check out workers.
```elixir
alias ExPool.Pool
# Starts a new pool
{:ok, pool} = Pool.start_link(config)
# Blocks until there is a worker available
worker = Pool.check_out(pool)
# do s... | lib/ex_pool/pool.ex | 0.74512 | 0.825379 | pool.ex | starcoder |
defmodule ExUssd do
alias __MODULE__
@typedoc """
ExUssd menu structure
"""
@type t :: %__MODULE__{
data: any(),
default_error: String.t(),
delimiter: String.t(),
error: String.t(),
is_zero_based: boolean(),
menu_list: list(ExUssd.t()),
n... | lib/ex_ussd.ex | 0.824709 | 0.70477 | ex_ussd.ex | starcoder |
defmodule Scenic.Primitive.Line do
@moduledoc """
Draw a line on the screen.
## Data
`{point_a, point_b}`
The data for a line is a tuple containing two points.
* `point_a` - position to start drawing from
* `point_b` - position to draw to
## Styles
This primitive recognizes the following styles
... | lib/scenic/primitive/line.ex | 0.907242 | 0.628821 | line.ex | starcoder |
defmodule Regex do
@moduledoc %B"""
Regular expressions for Elixir built on top of the re module
in the Erlang Standard Library. More information can be found
on re documentation: http://www.erlang.org/doc/man/re.html
Regular expressions in Elixir can be created using Regex.compile!
or using the special fo... | lib/elixir/lib/regex.ex | 0.908769 | 0.635958 | regex.ex | starcoder |
defmodule Tint do
@moduledoc """
A library allowing calculations with colors and conversions between different
colorspaces.
"""
alias Tint.{CMYK, DIN99, HSV, Lab, RGB, XYZ}
@typedoc """
A type representing a color.
"""
@type color ::
CMYK.t()
| DIN99.t()
| HSV.t()
... | lib/tint.ex | 0.932253 | 0.441974 | tint.ex | starcoder |
defmodule XUtil.GenServer do
@moduledoc "Simple utilities for avoiding boilerplate in a GenServer implementation."
@doc """
If your GenServer is a thin wrapper around a struct, you can make its handle_call()
implementation be "just this."
Supports operations that:
- Update the state
- May return an erro... | lib/x_util/gen_server.ex | 0.772745 | 0.496277 | gen_server.ex | starcoder |
defmodule CbLocomotion.StepperMotor do
use GenServer
# alias Saxophone.StepperMotor
defstruct pins: [], direction: :neutral, position: 0, step_millis: 0, timer_ref: nil, gear: :low
@position_pin_values [
[0, 0, 0, 1],
[0, 0, 1, 1],
[0, 0, 1, 0],
[0, 1, 1, 0],
[0, 1, 0, 0],
[1, 1, 0, 0]... | apps/cb_locomotion/lib/cb_locomotion/stepper_motor.ex | 0.567577 | 0.679764 | stepper_motor.ex | starcoder |
defmodule DiscordEx.Voice.Buffer do
@moduledoc """
Buffer Module for holding and reading audio.
"""
@doc "Create a new queue"
@spec start :: pid
def start do
{:ok, queue} = Agent.start_link fn -> <<>> end
queue
end
@doc "Write to the buffer/queue binary data"
@spec write(pid, binary) :: atom
... | lib/discord_ex/voice/buffer.ex | 0.735167 | 0.419321 | buffer.ex | starcoder |
defmodule Scenic.Primitive.Ellipse do
@moduledoc """
Draw an ellipse on the screen.
## Data
`{radius_1, radius_2}`
The data for an arc is a single number.
* `radius_1` - the radius of the ellipse in one direction
* `radius_2` - the radius of the ellipse in the other direction
## Styles
This prim... | lib/scenic/primitive/ellipse.ex | 0.945889 | 0.923316 | ellipse.ex | starcoder |
defmodule FibonacciHeap do
@moduledoc """
参考 : https://www.cs.princeton.edu/~wayne/teaching/fibonacci-heap.pdf
前提として、delete-minしか想定しないので、マークの設定はしない。
(ポインタがないので、ランク計算は、非効率になりうる)
また、ルートだけ一つに固定し、ルート以下の子供に対してフィボなビッチヒープを構成するようにする。
data: {property, queue}
queue: {property, queue}
# Insert
O(1)
data: {p... | lib/algs/heap/fibonacci_heap.ex | 0.573678 | 0.579162 | fibonacci_heap.ex | starcoder |
defmodule FE.Maybe do
@moduledoc """
`FE.Maybe` is an explicit data type for representing values that might or might not exist.
"""
alias FE.{Result, Review}
@type t(a) :: {:just, a} | :nothing
defmodule Error do
defexception [:message]
end
@doc """
Creates an `FE.Maybe` representing the absen... | lib/fe/maybe.ex | 0.866627 | 0.658774 | maybe.ex | starcoder |
defmodule Cizen.Filter.Code do
alias Cizen.Filter
@moduledoc false
@additional_operators [:is_nil, :to_string, :to_charlist]
@type t :: term
def with_prefix({:access, keys}, prefix) do
{:access, prefix ++ keys}
end
def with_prefix({op, args}, prefix) when is_atom(op) and is_list(args) do
args ... | lib/cizen/filter/code.ex | 0.606498 | 0.443239 | code.ex | starcoder |
defmodule Membrane.Core.Element.DemandHandler do
@moduledoc false
# Module handling demands requested on source pads.
alias Membrane.Core
alias Membrane.Element.Pad
alias Core.PullBuffer
alias Core.Element.{
BufferController,
CapsController,
DemandController,
EventController,
PadModel,... | lib/membrane/core/element/demand_handler.ex | 0.710628 | 0.402333 | demand_handler.ex | starcoder |
defmodule Ockam.Examples.Messaging.Ordering do
@moduledoc """
Examples of using ordering pipes
Creates a shuffle worker to re-order messages
Sends messages through shuffle and through shuffle wrapped in an ordered pipe
"""
alias Ockam.Examples.Messaging.Shuffle
def check_strict(pipe_mod) do
Ockam.N... | implementations/elixir/ockam/ockam/lib/ockam/examples/messaging/ordering.ex | 0.826467 | 0.461502 | ordering.ex | starcoder |
defmodule Exred.Node.Rpiphoto do
@moduledoc """
Takes a photo using the Raspberry PI's camera module
**Incoming message format**
```elixir
msg = %{
payload :: any,
filename :: String.t,
width :: String.t,
height :: String.t,
horizontal_flip :: String.t,
vertical_flip :... | lib/exred_node_rpiphoto.ex | 0.797951 | 0.716157 | exred_node_rpiphoto.ex | starcoder |
defmodule ESpec.ExampleRunner do
@moduledoc """
Contains all the functions need to run a 'spec' example.
"""
defmodule(AfterExampleError, do: defexception(example_error: nil, message: nil))
@dict_keys [:ok, :shared]
alias ESpec.Example
alias ESpec.AssertionError
alias ESpec.Output
@doc """
Runs ... | lib/espec/example_runner.ex | 0.740456 | 0.621282 | example_runner.ex | starcoder |
defmodule TimeZoneInfo.TimeZoneDatabase do
@moduledoc """
Implementation of the `Calendar.TimeZoneDatabase` behaviour.
"""
@behaviour Calendar.TimeZoneDatabase
alias TimeZoneInfo.{
DataStore,
GregorianSeconds,
IanaDateTime,
IsoDays,
Transformer.RuleSet
}
@compile {:inline, gap: 2, c... | lib/time_zone_info/time_zone_database.ex | 0.893733 | 0.530115 | time_zone_database.ex | starcoder |
defmodule Mix.Tasks.Format do
use Mix.Task
@shortdoc "Formats the given files/patterns"
@moduledoc """
Formats the given files and patterns.
mix format mix.exs "lib/**/*.{ex,exs}" "test/**/*.{ex,exs}"
If any of the files is `-`, then the output is read from stdin
and written to stdout.
## Forma... | lib/mix/lib/mix/tasks/format.ex | 0.882187 | 0.535949 | format.ex | starcoder |
defmodule Surface.Catalogue.Data do
@moduledoc """
Experimental module that provides conveniences for manipulating data
in Examples and Playgrounds.
Provide wrappers around built-in functions like `get_in/2` and `update_in/3`
using a shorter syntax for accessors.
## Accessor Mapping
* `[_]`: `Access.... | lib/surface/catalogue/data.ex | 0.880168 | 0.726353 | data.ex | starcoder |
defmodule DiscordBot.Model.Payload do
@moduledoc """
An object which wraps all gateway messages
"""
use DiscordBot.Model.Serializable
alias DiscordBot.Model.{Dispatch, Hello, Identify, Payload, StatusUpdate, VoiceState}
defstruct [
:opcode,
:data,
:sequence,
:name
]
@typedoc """
Th... | apps/discordbot/lib/discordbot/model/payload.ex | 0.867036 | 0.446676 | payload.ex | starcoder |
defmodule Solana.RPC.Request do
@moduledoc """
Functions for creating Solana JSON-RPC API requests.
This client only implements the most common methods (see the function
documentation below). If you need a method that's on the [full
list](https://docs.solana.com/developing/clients/jsonrpc-api#json-rpc-api-re... | lib/solana/rpc/request.ex | 0.836888 | 0.483892 | request.ex | starcoder |
defmodule Bamboo.RecipientReplacerAdapter do
@moduledoc """
Replaces to addresses with a provided recipients list.
It provides a wrapper for any other mailer adapter, usefull when working on releases
machine with real email address. It simply replaces `to` addresses
with the provided list of addresses and se... | lib/bamboo/adapters/recipient_replacer_adapter.ex | 0.686895 | 0.421076 | recipient_replacer_adapter.ex | starcoder |
defmodule Snitch.Domain.ShippingCalculator do
@moduledoc """
Defines the calculator module for shipping.
The core functionality of the module is to handle
caluclation of shipping rates.
"""
alias Snitch.Core.Tools.MultiTenancy.Repo
alias Snitch.Data.Model.GeneralConfiguration, as: GCModel
alias Snitch... | apps/snitch_core/lib/core/domain/shipping_calculator.ex | 0.719285 | 0.731514 | shipping_calculator.ex | starcoder |
defmodule Apq.DocumentProvider do
@moduledoc """
Apq document provider or Absinthe plug.
### Example
Define a new module and `use Apq.DocumentProvider`:
```elixir
defmodule ApqExample.Apq do
use Apq.DocumentProvider,
cache_provider: ApqExample.Cache,
max_query_size: 16384 #default
end
... | lib/apq/document_provider.ex | 0.824214 | 0.795738 | document_provider.ex | starcoder |
defmodule LocalLedger.Transaction.Validator do
@moduledoc """
This module is used to validate that the total of debits minus the total of
credits for a transaction is equal to 0.
"""
alias LocalLedger.Errors.{AmountNotPositiveError, InvalidAmountError, SameAddressError}
alias LocalLedgerDB.Entry
@doc ""... | apps/local_ledger/lib/local_ledger/transaction/validator.ex | 0.894884 | 0.414988 | validator.ex | starcoder |
defmodule Gherkin.TokenMatcher do
alias Gherkin.{Dialect, GherkinLine, Location, NoSuchLanguageError, Token}
@type on_match :: {:ok, Token.t(), t} | :error
@type t :: %__MODULE__{
active_doc_string_separator: <<_::24>> | nil,
default_language: String.t(),
dialect: Dialect.t(),
... | gherkin/elixir/lib/gherkin/token_matcher.ex | 0.821903 | 0.689685 | token_matcher.ex | starcoder |
defmodule Google.Bigtable.V2.Row do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
key: binary,
families: [Google.Bigtable.V2.Family.t()]
}
defstruct [:key, :families]
field :key, 1, type: :bytes
field :families, 2, repeated: true, type: Google.Bigtable.... | lib/google/bigtable/v2/data.pb.ex | 0.778607 | 0.689959 | data.pb.ex | starcoder |
defmodule Plotex do
alias Plotex.ViewRange
alias Plotex.Axis
alias Plotex.Output.Formatter
require Logger
@moduledoc """
Documentation for Plotex.
TODO
"""
defstruct [:config, :xticks, :yticks, :datasets]
@type data_types :: number | DateTime.t() | NaiveDateTime.t()
@type data_item :: Stream.t(... | lib/plotex.ex | 0.7773 | 0.586582 | plotex.ex | starcoder |
defmodule Stargate do
@moduledoc """
Stargate provides an Elixir client for the Apache Pulsar distributed message
log service, based on the Pulsar project's websocket API.
### Producer
Create a producer process under your application's supervision tree with the following:
options = [
name: :... | lib/stargate.ex | 0.854869 | 0.410874 | stargate.ex | starcoder |
defmodule WordsWithEnemies.Game.Server do
@moduledoc """
A process for controlling an individual game.
"""
use GenServer
require Logger
alias WordsWithEnemies.Game.Lobby
alias WordsWithEnemies.{Game, Player}
@doc """
Starts a new game process, and returns `{:ok, pid}`.
"""
def start_link(id, pla... | lib/words_with_enemies/game/server.ex | 0.717408 | 0.405449 | server.ex | starcoder |
defmodule Type.Bitstring do
@moduledoc """
Handles bitstrings and binaries in the erlang/elixir type system.
This type has two required parameters that define a semilattice over
the number line which are the allowed number of bits in the bitstrings
which are members of this type.
- `size` minimum size of ... | lib/type/bitstring.ex | 0.935927 | 0.983691 | bitstring.ex | starcoder |
defmodule Sippet.Transactions.Server.NonInvite do
@moduledoc false
use Sippet.Transactions.Server, initial_state: :trying
alias Sippet.Message.StatusLine, as: StatusLine
alias Sippet.Transactions.Server.State, as: State
@timer_j 32_000
def trying(:enter, _old_state, %State{request: request} = data) do
... | lib/sippet/transactions/server/non_invite.ex | 0.616243 | 0.424979 | non_invite.ex | starcoder |
defmodule KafkaEx.Config do
@moduledoc """
Configuring KafkaEx
```
""" <>
File.read!(Path.expand("../../config/config.exs", __DIR__)) <>
"""
```
"""
alias KafkaEx.Utils.Logger
@doc false
def disable_default_wor... | lib/kafka_ex/config.ex | 0.631708 | 0.496338 | config.ex | starcoder |
defmodule AWS.ComputeOptimizer do
@moduledoc """
AWS Compute Optimizer is a service that analyzes the configuration and
utilization metrics of your AWS compute resources, such as EC2 instances, Auto
Scaling groups, AWS Lambda functions, and Amazon EBS volumes.
It reports whether your resources are optimal, ... | lib/aws/generated/compute_optimizer.ex | 0.941506 | 0.512815 | compute_optimizer.ex | starcoder |
defmodule Primer.Navigation do
@moduledoc """
Functions for generating
[Primer Navigation](https://github.com/primer/primer/tree/master/modules/primer-navigation) elements.
"""
use Phoenix.HTML
alias Primer.Labels
alias Primer.Utility
@doc """
Renders a menu element.
**See:** [Menu element docume... | lib/primer/navigation.ex | 0.818084 | 0.765769 | navigation.ex | starcoder |
defmodule Membrane.MP4.MovieFragmentBox do
@moduledoc """
A module containing a function for assembling an MPEG-4 movie fragment box.
The movie fragment box (`moof` atom) is a top-level box and consists of:
* exactly one movie fragment header (`mfhd` atom)
The movie fragment header contains a sequenc... | lib/membrane_mp4/movie_fragment_box.ex | 0.87701 | 0.572424 | movie_fragment_box.ex | starcoder |
defmodule ExJenga.SendMoney.PesalinkToBank do
@moduledoc """
This enables your application to send money to a PesaLink participating bank.
It is restricted to Kenya.
"""
import ExJenga.JengaBase
alias ExJenga.Signature
@uri_affix "/transaction/v2/remittance#pesalinkacc"
@doc """
Send Money to other... | lib/ex_jenga/send_money/pesalink_to_bank.ex | 0.749912 | 0.481149 | pesalink_to_bank.ex | starcoder |
defmodule Pavlov.Mocks.Matchers do
@moduledoc """
Provides matchers for Mocked modules.
"""
import ExUnit.Assertions
import Pavlov.Mocks.Matchers.Messages
@doc """
Asserts whether a method was called with on a mocked module.
Use in conjunction with `with` to perform assertions on the arguments
passe... | lib/mocks/matchers.ex | 0.816809 | 0.639265 | matchers.ex | starcoder |
defmodule AWS.Transfer do
@moduledoc """
AWS Transfer Family is a fully managed service that enables the transfer of
files over the File Transfer Protocol (FTP), File Transfer Protocol over SSL
(FTPS), or Secure Shell (SSH) File Transfer Protocol (SFTP) directly into and
out of Amazon Simple Storage Service ... | lib/aws/generated/transfer.ex | 0.858867 | 0.510802 | transfer.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.