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 GameApp.Server do
@moduledoc """
`GameApp.Server` provides a stateful process that maintains an internal game
state and provides a public API for interacting with the game.
"""
use GenServer
alias __MODULE__, as: Server
alias GameApp.{Game, Player}
alias GameApp.Config, as: GameConfig
req... | apps/game/lib/game/server.ex | 0.822973 | 0.485661 | server.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.891445 | 0.77675 | currency_formatter.ex | starcoder |
defmodule Whistle.Program do
alias Whistle.Socket
require Whistle.Html
alias Whistle.Program.Instance
@json_library Application.get_env(:whistle, :json_library, Jason)
defmacro __using__(_opts) do
quote do
@behaviour Whistle.Program
alias Whistle.Html
require Whistle.Html
impor... | lib/whistle/program.ex | 0.80837 | 0.799931 | program.ex | starcoder |
defmodule Pushex.Validators.Type do
@moduledoc """
Ensure the value has the correct type.
The type can be provided in the following form:
* `type`: An atom representing the type.
It can be any of the `TYPE` in Elixir `is_TYPE` functions.
`:any` is treated as a special case and accepts any type.
* `... | lib/pushex/validators/type.ex | 0.806434 | 0.7495 | type.ex | starcoder |
defmodule LogjamAgent.Channel do
alias LogjamAgent.Instrumentation
@moduledoc """
Use this module if you want to activate Logjam reporting for `Phoenix` channel implementations.
This will automatically instrument the `join`, `handle_in` and `handle_out` functions.
Join is called when a client attempts to "j... | lib/logjam_agent/channel.ex | 0.893733 | 0.773815 | channel.ex | starcoder |
defmodule EarmarkTagCloud do
@moduledoc ~S"""
[](https://github.com/RobertDober/earmark_tag_cloud/actions/workflows/ci.yml)
[ do
path
|> File.stream!()
|> parse_map()
end
def parse_map(stream) do
{map, _} =
stream
|> Stream.map(&Strin... | lib/aoc2021/day11.ex | 0.697815 | 0.500793 | day11.ex | starcoder |
defmodule Toolshed.Log do
@moduledoc """
Utilities for attaching and detaching to the log
These utilities configure Elixir's console backend to attach
to the current group leader. This makes it work over `ssh` sessions
and play well with the IEx prompt.
"""
@doc """
Attach the current session to the E... | lib/toolshed/log.ex | 0.63409 | 0.464841 | log.ex | starcoder |
defmodule Rex2048.Game do
defstruct [:board, :score]
alias Rex2048.Board
alias Rex2048.Game
@doc """
iex> Rex2048.Game.init(2)
%Rex2048.Game{board: [2, 2, 0, 0], score: 0}
iex> Rex2048.Game.init(3)
%Rex2048.Game{board: [2, 0, 0, 0, 0, 0, 0, 0, 2], score: 0}
"""
def init(size) when... | lib/rex2048/game.ex | 0.610337 | 0.671024 | game.ex | starcoder |
defmodule Militerm.ECS.EctoComponent do
@moduledoc """
The component service tracks component data for entities with a backing store in an Ecto repo.
For eaxmple, if yu have a component named MyGame.Components.Health, you
can start a copy of this with:
Militerm.ECS.EctoComponent.start_link(name: MyGame.... | lib/militerm/ecs/ecto_component.ex | 0.769124 | 0.421135 | ecto_component.ex | starcoder |
defmodule Hobot do
@moduledoc """
A bot framework working on Erlang VM(Beam)
## Examples
For example, we can create an echo bot following like:
```
bot_name = "EchoBot"
adapter = %{module: Hobot.Plugin.Adapter.Shell}
handlers = [%{module: Hobot.Plugin.Handler.Echo, args: [["on_message"]]}]
{:ok, bo... | lib/hobot.ex | 0.665628 | 0.666353 | hobot.ex | starcoder |
defmodule TypoKiller.Files do
@moduledoc """
Parse all files and concat path to a folder to generate a complete list of files ready to be read
"""
@default_options [
# Defaults to 5KiB
max_size: 1024 * 5,
ignore_dot_files: true,
allowed_extensions: [],
blocked_extensions: [],
allowed_pa... | lib/typo_killer/files.ex | 0.611614 | 0.444987 | files.ex | starcoder |
defmodule Roulette do
@moduledoc ~S"""
Scalable PubSub client library which uses HashRing-ed gnatsd-cluster
## Prepare your own PubSub module
```elixir
defmodule MyApp.PubSub do
use Roulette, otp_app: :my_app
end
```
## Configuration
Setup configuration like following
```elixir
config :... | lib/roulette.ex | 0.761627 | 0.759827 | roulette.ex | starcoder |
defmodule Stripe.Connect.OAuth do
@moduledoc """
Work with Stripe Connect.
You can:
- generate the URL for starting the OAuth workflow
- authorize a new connected account with a token
- deauthorize an existing connected account
Stripe API reference: https://stripe.com/docs/connect/reference
"""
al... | lib/stripe/connect/oauth.ex | 0.881232 | 0.457803 | oauth.ex | starcoder |
defmodule Serum.HeaderParser do
@moduledoc false
_moduledocp = """
This module takes care of parsing headers of page (or post) source files.
Header is where all page or post metadata goes into, and has the following
format:
```
---
key: value
...
---
```
where `---` in the first and last lin... | lib/serum/header_parser.ex | 0.856332 | 0.88578 | header_parser.ex | starcoder |
defmodule Curve448 do
import Bitwise
@moduledoc """
Curve448 Diffie-Hellman functions
"""
@typedoc """
public or secret key
"""
@type key :: <<_::224>>
@p 726_838_724_295_606_890_549_323_807_888_004_534_353_641_360_687_318_060_281_490_199_180_612_328_166_730_772_686_396_383_698_676_545_930_088_884_... | lib/curve448.ex | 0.844281 | 0.453685 | curve448.ex | starcoder |
defmodule Riak.Ecto.Connection do
@moduledoc false
alias Riak.Ecto.NormalizedQuery.SearchQuery
alias Riak.Ecto.NormalizedQuery.FetchQuery
alias Riak.Ecto.NormalizedQuery.CountQuery
alias Riak.Ecto.NormalizedQuery.WriteQuery
## Worker
## Callbacks for adapter
def all(pool, query, opts \\ [])
def a... | lib/riak_ecto/connection.ex | 0.547343 | 0.451871 | connection.ex | starcoder |
defmodule ExJack.Server do
@moduledoc """
A GenServer module that interfaces with JACK audio API I/O.
There are two methods for outputting sound to JACK:
1. Calling `send_frames/1`
2. Setting an output function using `set_output_func/1`, which JACK
calls every time it wants frames.
At the moment, the... | lib/ex_jack/server.ex | 0.838977 | 0.498779 | server.ex | starcoder |
defmodule Absinthe.Relay.Node.IDTranslator do
@moduledoc """
An ID translator handles encoding and decoding a global ID
used in a Relay node.
This module provides the behaviour for implementing an ID Translator.
An example use case of this module would be a translator that encrypts the
global ID.
To us... | lib/absinthe/relay/node/id_translator.ex | 0.877962 | 0.666968 | id_translator.ex | starcoder |
defmodule Bamboo.AliyunAdapter do
@moduledoc """
Bamboo adapter to Sends emails through [Aliyun’s API](https://www.aliyun.com/product/directmail?spm=5176.8142029.388261.228.dKDNYN).
## Example config
```elixir
# In config/config.exs, or config.prod.exs, etc.
config :my_app, MyApp.Mailer,
adapter: Bamb... | lib/bamboo/adapters/aliyun_adapter.ex | 0.710025 | 0.608071 | aliyun_adapter.ex | starcoder |
defmodule AWS.KinesisVideoArchivedMedia do
alias AWS.Client
alias AWS.Request
def metadata do
%AWS.ServiceMetadata{
abbreviation: nil,
api_version: "2017-09-30",
content_type: "application/x-amz-json-1.1",
credential_scope: nil,
endpoint_prefix: "kinesisvideo",
global?: f... | lib/aws/generated/kinesis_video_archived_media.ex | 0.906818 | 0.751694 | kinesis_video_archived_media.ex | starcoder |
defmodule OT.Text.Application do
@moduledoc """
The application of a text operation to a piece of text.
"""
alias OT.Text, as: Text
alias Text.Operation
@typedoc """
The result of an `apply/2` function call, representing either success or error
in application of an operation
"""
@type apply_result... | lib/ot/text/application.ex | 0.88106 | 0.598077 | application.ex | starcoder |
use Croma
defmodule Antikythera.TermUtil do
@moduledoc """
Utils for calculating the actual size of terms.
These utils traverse terms and accumulate the size of terms including the actual size of binary.
"""
@doc """
Returns the actual size of `term` in bytes.
"""
defun size(term :: term) :: non_neg... | lib/util/term_util.ex | 0.809765 | 0.4231 | term_util.ex | starcoder |
defmodule Spreedly do
@moduledoc """
An Elixir client implementation of the Spreedly API.
For more info visit the [Spreedly API docs](https://docs.spreedly.com/reference/api/v1/)
for a detailed listing of available API methods.
## Usage
API interactions happen with a `Spreedly.Environment`.
iex> e... | lib/spreedly.ex | 0.907982 | 0.563378 | spreedly.ex | starcoder |
defmodule ChallengeGov.Challenges.Challenge do
@moduledoc """
Challenge schema
"""
use Ecto.Schema
import Ecto.Changeset
alias ChallengeGov.Accounts.User
alias ChallengeGov.Agencies.Agency
alias ChallengeGov.Challenges
alias ChallengeGov.Challenges.ChallengeOwner
alias ChallengeGov.Challenges.Fed... | lib/challenge_gov/challenges/challenge.ex | 0.706899 | 0.480905 | challenge.ex | starcoder |
defmodule BiMap do
@moduledoc """
Bi-directional map implementation backed by two maps.
> In computer science, a bidirectional map, or hash bag, is an associative data
> structure in which the `(key, value)` pairs form a one-to-one correspondence.
> Thus the binary relation is functional in each direction: `... | lib/bimap.ex | 0.946775 | 0.802362 | bimap.ex | starcoder |
defmodule OpentelemetryTelemetry do
@moduledoc """
`OpentelemetryTelemetry` provides conveniences for leveraging `telemetry`
events for `OpenTelemetry` bridge libraries.
## OpenTelemetry Contexts
`opentelemetry` does not automatically set current span context when ending
another span. Since `telemetry` ev... | utilities/opentelemetry_telemetry/lib/opentelemetry_telemetry.ex | 0.903477 | 0.815673 | opentelemetry_telemetry.ex | starcoder |
defmodule Cqrs.Documentation do
@moduledoc false
alias Cqrs.Documentation
defmacro option_docs(options) do
quote bind_quoted: [options: options] do
docs =
options
|> Enum.sort_by(&elem(&1, 0))
|> Enum.map(fn
{name, {:enum, possible_values}, opts} ->
default... | lib/cqrs/documentation.ex | 0.609524 | 0.470554 | documentation.ex | starcoder |
defmodule AWS.Config do
@moduledoc """
AWS Config
AWS Config provides a way to keep track of the configurations of all the AWS
resources associated with your AWS account.
You can use AWS Config to get the current and historical configurations of each
AWS resource and also to get information about the rel... | lib/aws/generated/config.ex | 0.873579 | 0.484014 | config.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.8339 | 0.706861 | meeseeks.ex | starcoder |
defmodule EVM.ExecEnv do
alias EVM.AccountRepo
alias EVM.{BlockHeaderInfo, Configuration}
@moduledoc """
Stores information about the execution environment which led
to this EVM being called. This is, for instance, the sender of
a payment or message to a contract, or a sub-contract call.
We've added our... | apps/evm/lib/evm/exec_env.ex | 0.846784 | 0.431345 | exec_env.ex | starcoder |
defmodule Yamlixir do
@moduledoc ~S"""
Simple YAML parser for Elixir.
"""
@type yaml :: String.t() | charlist
@type options :: keyword
@type decoded :: [any]
@type error :: Yamlixir.DecodingError.t()
@default_options [
detailed_constr: true,
str_node_as_binary: true
]
@doc ~S"""
Decodes... | lib/yamlixir.ex | 0.933952 | 0.402451 | yamlixir.ex | starcoder |
defmodule Wand.WandEncoder do
alias WandCore.WandFile
alias WandCore.WandFile.Dependency
alias WandCore.Poison.Encoder
@moduledoc """
A [Poison](https://github.com/devinus/poison#encoder) encoder for `WandCore.WandFile`
It differs from the normal JSON encoding of a struct in the following ways:
1. The ... | lib/wand_encoder.ex | 0.671794 | 0.518912 | wand_encoder.ex | starcoder |
defmodule JSONRPC2.Servers.TCP do
@moduledoc """
A server for JSON-RPC 2.0 using a line-based TCP transport.
"""
alias JSONRPC2.Servers.TCP.Protocol
@default_timeout 1000 * 60 * 60
@doc """
Start a server with the given `handler` on `port` with `opts`.
Available options:
* `name` - a unique name... | lib/jsonrpc2/servers/tcp.ex | 0.85931 | 0.441733 | tcp.ex | starcoder |
defmodule Talan.BloomFilter do
@moduledoc """
Bloom filter implementation with **concurrent accessibility**,
powered by [:atomics](http://erlang.org/doc/man/atomics.html) module.
"A Bloom filter is a space-efficient probabilistic data structure,
conceived by <NAME> in 1970,
that is used to test whether an ... | lib/talan/bloom_filter.ex | 0.920473 | 0.720983 | bloom_filter.ex | starcoder |
if Code.ensure_loaded?(Finch) do
defmodule Tesla.Adapter.Finch do
@moduledoc """
Adapter for [finch](https://github.com/keathley/finch).
Remember to add `{:finch, "~> 0.3"}` to dependencies. Also, you need to
recompile tesla after adding the `:finch` dependency:
```
mix deps.clean tesla
... | lib/tesla/adapter/finch.ex | 0.866048 | 0.850655 | finch.ex | starcoder |
defmodule TuneWeb.ExplorerLive do
@moduledoc """
Main view used in the application. Covers:
- Search
- Suggestions
- Displaying details for artists, albums, etc.
- Mini player
## Mounting and authentication
When mounting, `TuneWeb.ExplorerLive` uses the session data to start a
Spotify session. Note... | lib/tune_web/live/explorer_live.ex | 0.815747 | 0.518485 | explorer_live.ex | starcoder |
defmodule Exchema.Predicates do
@moduledoc """
Exschema default predicates library
"""
@type error :: {:error, any}
@type failure :: false | error | [error, ...]
@type success :: :ok | true | []
@type result :: failure | success
@doc """
Just applies the function as if it was a predicate.
It also ... | lib/exchema/predicates.ex | 0.879374 | 0.42054 | predicates.ex | starcoder |
defmodule Ueberauth.Strategy.Mailchimp do
@moduledoc """
Implements an ÜeberauthMailchimp strategy for authentication with mailchimp.com.
When configuring the strategy in the Üeberauth providers, you can specify some defaults.
config :ueberauth, Ueberauth,
providers: [
mailchimp: { Ueberauth.Strateg... | lib/ueberauth/strategy/mailchimp.ex | 0.57523 | 0.700216 | mailchimp.ex | starcoder |
defmodule Heroicons do
@moduledoc """
This package adds a convenient way of using [Heroicons](https://heroicons.com) with your Phoenix, Phoenix LiveView and Surface applications.
Heroicons is "A set of 450+ free MIT-licensed high-quality SVG icons for you to use in your web projects."
Created by the amazing fo... | lib/heroicons.ex | 0.856797 | 0.54256 | heroicons.ex | starcoder |
defmodule Farmbot.Regimen.Manager do
@moduledoc "Manages a Regimen"
use Farmbot.Logger
use GenServer
alias Farmbot.CeleryScript
alias Farmbot.Asset
alias Asset.Regimen
import Farmbot.System.ConfigStorage, only: [get_config_value: 3]
defmodule Error do
@moduledoc false
defexception [:epoch, :re... | lib/farmbot/regimen/manager.ex | 0.704567 | 0.446615 | manager.ex | starcoder |
defmodule RedixPool do
@moduledoc """
This module provides an API for using `Redix` through a pool of workers.
## Overview
`RedixPool` is very simple, it is merely wraps `Redix` with a pool of `Poolboy`
workers. All function calls get passed through to a `Redix` connection.
Please see the [redix](https:/... | lib/redix_pool.ex | 0.907369 | 0.722062 | redix_pool.ex | starcoder |
defmodule Rummage.Phoenix.SearchController do
@moduledoc """
`SearchController` a controller helper in `Rummage.Phoenix` which stores
helpers for Search hook in `Rummage`. This formats params before `index`
action into a format that is expected by the default `Rummage.Ecto`'s search
hook: `Rummage.Ecto.Search... | lib/rummage_phoenix/hooks/controllers/search_controller.ex | 0.809502 | 0.78108 | search_controller.ex | starcoder |
defmodule Day25 do
use Bitwise
def part1(input) do
Interpreter.new(input)
|> Map.put(:out_handler, {&analyse_signal/2, nil})
|> find_value(0)
end
defp find_value(interpreter, value) do
result = interpreter
|> Map.put(:a, value)
|> Interpreter.execute
case result do
:ok -> va... | day25/lib/day25.ex | 0.628179 | 0.593874 | day25.ex | starcoder |
defmodule Jason.OrderedObject do
@doc """
Struct implementing a JSON object retaining order of properties.
A wrapper around a keyword (that supports non-atom keys) allowing for
proper protocol implementations.
Implements the `Access` behaviour and `Enumerable` protocol with
complexity similar to keywords/... | lib/ordered_object.ex | 0.892443 | 0.671622 | ordered_object.ex | starcoder |
defmodule AWS.Signer do
@moduledoc """
With code signing for IoT, you can sign code that you create for any IoT device
that is supported by Amazon Web Services (AWS).
Code signing is available through [Amazon FreeRTOS](http://docs.aws.amazon.com/freertos/latest/userguide/) and [AWS IoT Device Management](http... | lib/aws/generated/signer.ex | 0.840488 | 0.490785 | signer.ex | starcoder |
defmodule IntSort.CLI do
@moduledoc """
Handles the command line and options parsing logic
"""
alias LargeSort.Shared.CLI
alias IntSort.CLI.Args
alias IntSort.CLI.Options
alias IntSort.Chunk
@type parsed_args() :: {keyword(), list(String.t()), list()}
@type output_func() :: (IO.chardata() | String.Ch... | int_sort/lib/cli/cli.ex | 0.846292 | 0.460107 | cli.ex | starcoder |
defmodule Plymio.Fontais.Vekil.ProxyForomDict do
# a vekil dictionary where the proxies are atoms and the forom quoted forms
# i.e. the dictionary used by Plymio.Vekil.Form
# has functions that mirror the Plymio.Fontais.Vekil protocol but does *not*
# implement the protocol
@moduledoc false
use Plymio.Fon... | lib/fontais/vekil/proxy_forom_dict.ex | 0.735357 | 0.44342 | proxy_forom_dict.ex | starcoder |
defmodule DreaeQL do
@moduledoc """
A library for parsing a simple query language into an abstract syntax tree.
"""
@doc """
Parses a string into a DreaeQL AST. Returns a tuple containing the AST
and any unused tokens, if any.
## Examples
```
iex> DreaeQL.parse("foo = 123 and bar = \\"456\\"")
... | lib/dreaeql.ex | 0.861567 | 0.888227 | dreaeql.ex | starcoder |
defmodule ExPool.State do
@moduledoc """
The internal state of the pool.
This module defines a `ExPool.State` struct and the main functions
for working with pool internal state.
## Fields
* `stash` - stash of available workers
* `monitors` - store for the monitored references
* `queue` - queue ... | lib/ex_pool/state.ex | 0.878386 | 0.476762 | state.ex | starcoder |
defmodule ChalkAuthorization do
@moduledoc """
Chalk is an authorization module with support for roles that can handle configurable custom actions and permissions. It also supports user and group based authorization.
It is inspired in the Unix file permissions.
"""
@doc """
Chalk integrates the next funct... | lib/chalk_authorization.ex | 0.901821 | 0.693439 | chalk_authorization.ex | starcoder |
defmodule Riffed.Enumeration do
@moduledoc """
Provides enumeration semantics, but with an Elixir flavor.
## Usage
Thrift enums are not handled well by the erlang thrift bindings. They're turned into
ints and left to fend for themselves. This is no way to treat an Enum. The `Riffed.Enum`
module brings the... | lib/riffed/enumeration.ex | 0.835651 | 0.505432 | enumeration.ex | starcoder |
defmodule Faqcheck.Sources.StringHelpers do
alias Faqcheck.Referrals.OperatingHours
@doc """
Try to extract business hours from a description string.
## Examples
iex> extract_hours("Something containing no hours")
[]
iex> extract_hours("Pantry Hours are Monday-Friday 10:00 am - 3:30 pm.")
... | apps/faqcheck/lib/faqcheck/sources/helpers/string_helpers.ex | 0.626353 | 0.556882 | string_helpers.ex | starcoder |
defmodule Day14 do
use Bitwise
def part1(input) do
0..127
|> Stream.map(fn n ->
input <> "-" <> Integer.to_string(n)
end)
|> Stream.map(&KnotHash.hash/1)
|> Stream.map(fn h ->
count_bits(h, 128, 0)
end)
|> Enum.reduce(&+/2)
end
def part2(input) do
chart = 0..127
... | day14/lib/day14.ex | 0.505615 | 0.478346 | day14.ex | starcoder |
defmodule CTE do
@moduledoc """
The Closure Table for Elixir strategy, CTE for short, is a simple and elegant way of storing and working with hierarchies. It involves storing all paths through a tree, not just those with a direct parent-child relationship. You may want to chose this model, over the [Nested Sets mod... | lib/cte.ex | 0.863204 | 0.90355 | cte.ex | starcoder |
defmodule Datacop do
@moduledoc """
An authorization library with `Dataloader` and `Absinthe` support.
"""
@typedoc """
Option
* `:subject` – any value you want to access in the authorize/3 callback.
* `:loader` – an initialized Dataloader struct with loaded sources.
"""
@type option :: {:subject, a... | lib/datacop.ex | 0.887516 | 0.453988 | datacop.ex | starcoder |
defmodule Microdata.Strategy.JSONLD do
@moduledoc """
`Microdata.Strategy.JSONLD` defines a strategy to extract linked data from a `Meeseeks.Document`, based on the W3C [JSON-LD standard](https://www.w3.org/TR/json-ld/).
### Caveats
- Only a small fraction of section 6 of the [JSON-LD specification](https://ww... | lib/microdata/strategy/json_ld.ex | 0.858778 | 0.532729 | json_ld.ex | starcoder |
defmodule Lemma.En.Verbs do
@moduledoc false
@verbs_set """
aah abacinate abandon abase abash abate abbreviate abdicate abduce abduct
aberrate abet abhor abide abjure ablactate ablate abnegate abolish abominate
abort abound about-face abrade abrase abreact abridge abrogate abscise abscond
abseil absent abso... | lib/en/verbs.ex | 0.522933 | 0.402891 | verbs.ex | starcoder |
defmodule FusionAuth.Plugs.AuthorizeJWT do
@moduledoc """
The `FusionAuth.Plugs.AuthorizeJWT` module provides authentication of JWT tokens on incoming requests.
## Examples
```
config/{env}.exs
config :fusion_auth,
token_header_key: "authorization"
```
```
lib/my_web_server/router.ex
... | lib/fusion_auth/plugs/authorize_jwt.ex | 0.881079 | 0.676874 | authorize_jwt.ex | starcoder |
defmodule Fares do
@moduledoc """
Handling logic around fares.
"""
alias Routes.Route
alias Schedules.Trip
alias Stops.Stop
alias Zones.Zone
@silver_line_rapid_transit ~w(741 742 743 746)
@silver_line_rapid_transit_set MapSet.new(@silver_line_rapid_transit)
@express_routes ~w(170 325 326 351 35... | apps/fares/lib/fares.ex | 0.709523 | 0.42185 | fares.ex | starcoder |
defmodule Optimal do
@moduledoc """
Documentation for Optimal.
"""
@type schema() :: Optimal.Schema.t()
@type error :: {atom, String.t()}
@type validation_result :: {:ok, Keyword.t()} | {:error, [error]}
@doc "See `Optimal.Schema.new/1`"
defdelegate schema(opts), to: Optimal.Schema, as: :new
defdele... | lib/optimal.ex | 0.842766 | 0.533397 | optimal.ex | starcoder |
defmodule Chunkr.PaginationPlanner do
@moduledoc """
Macros for establishing your pagination strategies.
For example:
defmodule MyApp.PaginationPlanner do
use Chunkr.PaginationPlanner
# Sort by a single column.
paginate_by :username do
sort :asc, as(:user).username
... | lib/chunkr/pagination_planner.ex | 0.841468 | 0.729411 | pagination_planner.ex | starcoder |
defmodule Asteroid.ObjectStore.AccessToken.Mnesia do
@moduledoc """
Mnesia implementation of the `Asteroid.ObjectStore.AccessToken` behaviour
## Options
The options (`Asteroid.ObjectStore.AccessToken.opts()`) are:
- `:table_name`: an `atom()` for the table name. Defaults to `:asteroid_access_token`
- `:tab... | lib/asteroid/object_store/access_token/mnesia.ex | 0.874627 | 0.782891 | mnesia.ex | starcoder |
defmodule DataBuffer.Telemetry do
@moduledoc """
DataBuffer produces multiple telemetry events.
## Events
* `[:data_buffer, :insert, :start]` - Called when a buffer insert starts.
#### Measurements
* `:system_time` - The current monotonic system time.
#### Metadata
* `:buffer` - The name... | lib/data_buffer/telemetry.ex | 0.848612 | 0.754712 | telemetry.ex | starcoder |
defmodule SPARQL.Functions.Cast do
alias RDF.Literal
defmodule Integer do
@moduledoc """
An `SPARQL.ExtensionFunction` for the `xsd:integer` XPath constructor function.
See:
- <https://www.w3.org/TR/sparql11-query/#FunctionMapping>
- <https://www.w3.org/TR/xpath-functions/#casting-to-numeric... | lib/sparql/functions/cast.ex | 0.633864 | 0.64377 | cast.ex | starcoder |
defmodule HTMLParser.TreeBuilder do
@moduledoc """
Builds an HTML node tree from a parsed list of tags with depth counts.
"""
alias HTMLParser.{HTMLCommentNode, HTMLNodeTree, HTMLTextNode, ParseState}
@spec build(ParseState.tags()) :: {:ok, [HTMLNodeTree.t()] | HTMLNodeTree.t()} | {:error, any()}
def buil... | lib/html_parser/tree_builder.ex | 0.811153 | 0.416174 | tree_builder.ex | starcoder |
defmodule SgfParsing do
# Used to make recursive parsers lazy
defmacro lazy(parser) do
quote do
fn string -> unquote(parser).(string) end
end
end
defmodule Sgf do
defstruct properties: %{}, children: []
end
@type sgf :: %Sgf{properties: map, children: [sgf]}
@doc """
Parse a string i... | exercises/practice/sgf-parsing/.meta/example.ex | 0.652241 | 0.407481 | example.ex | starcoder |
defprotocol FileStore do
@moduledoc """
FileStore allows you to read, write, upload, download, and interact
with files, regardless of where they are stored.
## Adapters
This package ships with the following adapters:
* `FileStore.Adapters.Disk`
* `FileStore.Adapters.S3`
* `FileStore.Adapters.Me... | lib/file_store.ex | 0.918681 | 0.414573 | file_store.ex | starcoder |
defmodule Bandit do
@moduledoc """
Bandit is an HTTP server for Plug apps.
As an HTTP server, Bandit's primary goal is to act as 'glue' between client connections managed
by [Thousand Island](https://github.com/mtrudel/thousand_island) and application code defined
via the [Plug API](https://github.com/elixir... | lib/bandit.ex | 0.884139 | 0.915469 | bandit.ex | starcoder |
defmodule Ecto.Adapters.Riak.Util do
@type entity :: Ecto.Entity.t
## ----------------------------------------------------------------------
## Search Schema and Buckets
## ----------------------------------------------------------------------e
@doc """
Returns the bucket name for an Ecto Model.
Each bu... | lib/ecto/adapters/riak/util.ex | 0.722821 | 0.455804 | util.ex | starcoder |
defmodule ExPng.Chunks.ImageData do
@moduledoc """
Stores the raw data of an IDAT image data chunk from a PNG image.
Since PNG images can be encoded with the image data split between multiple
IDAT chunks to allow generating an image in a streaming manner, `merge/1`
provides support for merging multiple chunk... | lib/ex_png/chunks/image_data.ex | 0.907035 | 0.796015 | image_data.ex | starcoder |
defmodule Okta do
@moduledoc """
This library provides an Elixir API for accessing the [Okta Developer APIs](https://developer.okta.com/docs/reference/).
Currently implemented are:
* [Users API](https://developer.okta.com/docs/reference/api/users/)
* [Groups API](https://developer.okta.com/docs/reference/api... | lib/okta.ex | 0.811788 | 0.756582 | okta.ex | starcoder |
defmodule QLib.LeasedQueue do
@moduledoc """
LeasedQueue is a simple and leased abstraction around state.
The items stored in a LeasedQueue have a limited lifetime. The LeasedQueue sets a
period time or lease time (by default 60 seconds) which is used to automatically
remove expired items.
An item expires... | lib/leased_queue.ex | 0.735737 | 0.427158 | leased_queue.ex | starcoder |
defmodule Backchain do
import KB
import Utils
@doc """
Applies backward chaining (reasoning) on a query (phrased as a predicate).
If the query subject(s) contain only constants, returns true or false.
E.g.,
Query: man(socrates) -> true
Query: mortal(hypatia) -> true
If the query subject(s) contain ... | lib/backchain.ex | 0.68658 | 0.4831 | backchain.ex | starcoder |
defmodule AntlUtilsElixir.DateTime.Comparison do
@moduledoc """
Little wrapper around DateTime
"""
@doc ~S"""
Returns whether datetime1 is greater than datetime2
## Examples
iex> Comparison.gt?(DateTime.from_naive!(~N[2018-01-01 00:00:00], "Etc/UTC"), DateTime.from_naive!(~N[2018-01-02 00:00:00], "... | lib/datetime/comparison.ex | 0.842102 | 0.411673 | comparison.ex | starcoder |
defmodule ReactPhoenix.ClientSide do
@moduledoc """
Functions to make rendering React components easy in Phoenix views.
Combined with the javascript also included in this package, rendering React
components in your Phoenix views can be much easier. The module was built
with Brunch in mind (vs Webpack). Since... | lib/react_phoenix/client_side.ex | 0.87339 | 0.790692 | client_side.ex | starcoder |
defmodule AWS.ElasticLoadBalancingv2 do
@moduledoc """
Elastic Load Balancing
A load balancer distributes incoming traffic across targets, such as your EC2
instances.
This enables you to increase the availability of your application. The load
balancer also monitors the health of its registered targets an... | lib/aws/generated/elastic_load_balancingv2.ex | 0.899449 | 0.703822 | elastic_load_balancingv2.ex | starcoder |
defmodule Exquisitle.Impl.Game do
alias Exquisitle.Impl.Game.{Guess, Tally}
alias Exquisitle.Type
@type t :: %__MODULE__{
state: Type.state(),
guessed_words: list(Type.hints()),
absent_letters: MapSet.t(String.t()),
present_letters: MapSet.t(String.t()),
correct_... | apps/exquisitle/lib/impl/game.ex | 0.600774 | 0.476275 | game.ex | starcoder |
defmodule Gig.Recipe.RefreshEvents do
@moduledoc """
This recipe takes a location id
and returns a list of Songkick events close to the
specified location.
"""
use Recipe
alias Gig.{Event,
Songkick.ApiClient}
# Setup rate limit to 60 calls per minute
@rate_limit_scale 60_000
@rate_lim... | lib/gig/recipe/refresh_events.ex | 0.729616 | 0.421135 | refresh_events.ex | starcoder |
defmodule ResponseSnapshot do
@moduledoc """
ResponseSnapshot is a testing tool for Elixir that captures the output of responses
and ensures that they do not change in between test runs. The output is saved to disk,
meant to be checked into source control. This output can be used by frontend and other tests
t... | lib/response_snapshot.ex | 0.91938 | 0.896115 | response_snapshot.ex | starcoder |
defmodule Routeguide.Point do
use Protobuf
@type t :: %__MODULE__{
latitude: integer,
longitude: integer
}
defstruct [:latitude, :longitude]
field :latitude, 1, optional: true, type: :int32
field :longitude, 2, optional: true, type: :int32
end
defmodule Routeguide.Rectangle do
... | test/support/route_guide.pb.ex | 0.737347 | 0.498779 | route_guide.pb.ex | starcoder |
defmodule BitPal.Crypto.Base32 do
@moduledoc """
This module implements the Base32 scheme used in various places in various
cryptocurrencies. Note that this is *not* the standard Base32 encoding, the
alphabet used here is different.
In addition to Base32 encoding/decoding, we also provide checksums using the... | lib/bitpal/crypto/base32.ex | 0.754373 | 0.590277 | base32.ex | starcoder |
defmodule Grizzly.ZWave.Commands.NetworkManagementMultiChannelCapabilityReport do
@moduledoc """
Command to query the capabilities of one individual endpoint or aggregated
end point
Params:
* `:seq_number` - the sequence number for this command
* `:node_id` - the node id that has the end point to query
... | lib/grizzly/zwave/commands/network_management_multi_channel_capability_report.ex | 0.861829 | 0.441312 | network_management_multi_channel_capability_report.ex | starcoder |
defmodule MangoPay.Wallet do
@moduledoc """
Functions for MangoPay [wallet](https://docs.mangopay.com/endpoints/v2.01/wallets#e20_the-wallet-object).
"""
use MangoPay.Query.Base
set_path "wallets"
@doc """
Get a wallet.
## Examples
{:ok, wallet} = MangoPay.Wallet.get(id)
"""
def get id do
... | lib/mango_pay/wallet.ex | 0.657868 | 0.40295 | wallet.ex | starcoder |
if Code.ensure_loaded?(Ecto) do
defmodule Dictator.Policies.BelongsTo do
@moduledoc """
Policy definition commonly used in typical `belongs_to` associations.
This policy assumes the users can read (`:show`, `:index`, `:new`,
`:create`) any information but only write (`:edit`, `:update`, `:delete`)
... | lib/dictator/policies/belongs_to.ex | 0.846371 | 0.844985 | belongs_to.ex | starcoder |
defmodule ExtraEnum.Mailbox do
@moduledoc """
Enumerates against the mailbox by matching.
Can match a single pattern or multiple patterns. Arbitrary code can be
executed when using the multiple pattern syntax, giving feature parity with
`Kernel.SpecialForms.receive/1`.
Stops enumerating when the end of t... | lib/extra_enum/mailbox.ex | 0.84497 | 0.474631 | mailbox.ex | starcoder |
defmodule Calixir.HolidaysTableMaker do
@moduledoc """
This module generates Elixir data from the Calixir-4.0 holidays data.
"""
@doc """
Returns the list of holiday lists.
"""
def holiday_dates_from_file(file) do
file
|> check_path
|> File.read!
|> String.trim
|> String.split("\n")
... | lib/calixir/holidays_table_maker.ex | 0.699357 | 0.472744 | holidays_table_maker.ex | starcoder |
defmodule Membrane.RTP.MPEGAudio.Depayloader do
@moduledoc """
Parses RTP payloads into parsable mpeg chunks based on [RFC 2038](https://tools.ietf.org/html/rfc2038#section-3.5)
```
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1... | lib/membrane_element_mpeg_audio/depayloader.ex | 0.766949 | 0.753036 | depayloader.ex | starcoder |
defmodule Blunt.Data.Factories.Values do
alias Blunt.Data.Factories.Values
@doc """
The `field` of the factory source data will be assigned
to the value
"""
defmacro const(field, value) do
quote do
%Values.Constant{field: unquote(field), value: unquote(value)}
end
end
@doc """
If the `... | apps/blunt_data/lib/blunt/data/factories/values.ex | 0.77768 | 0.778523 | values.ex | starcoder |
defmodule Tradehub.Ticker do
@moduledoc """
Enable features to work with tickers endpoints.
"""
import Tradehub.Raising
@typedoc "Candlestick resolution allowed value"
@type resolution :: 1 | 5 | 30 | 60 | 360 | 1440
@doc """
Requests candlesticks for the given market.
## Parameters
- **market*... | lib/tradehub/ticker.ex | 0.954942 | 0.697274 | ticker.ex | starcoder |
defmodule Aegis do
@moduledoc """
Lightweight, flexible authorization.
## Example
As an example, suppose your library defines the following resources:
defmodule User do
defstruct [id: nil]
end
defmodule Puppy do
defstruct [id: nil, user_id: nil, hungry: false]
end
... | lib/aegis.ex | 0.86431 | 0.760117 | aegis.ex | starcoder |
defmodule AwsExRay.Segment do
@moduledoc ~S"""
This module provides data structure which represents X-Ray's **segment**
"""
alias AwsExRay.Config
alias AwsExRay.Segment.Formatter
alias AwsExRay.Trace
alias AwsExRay.Util
alias AwsExRay.Record.HTTPRequest
alias AwsExRay.Record.HTTPResponse... | lib/aws_ex_ray/segment.ex | 0.832134 | 0.404655 | segment.ex | starcoder |
defmodule Haex.Data.TypeConstructorBuilder do
@moduledoc """
generates AST representation of `Haex.Data.TypeConstructor` to return from
`Haex.data/1` macro
"""
alias Haex.Ast
alias Haex.Data.DataConstructor
alias Haex.Data.DataConstructorBuilder
alias Haex.Data.TypeConstructor
@spec build(TypeConstr... | lib/haex/data/type_constructor_builder.ex | 0.74055 | 0.465266 | type_constructor_builder.ex | starcoder |
defmodule Lab42.SimpleStateMachine do
use Lab42.SimpleStateMachine.Types
@moduledoc """
## A simple state machine.
`SimpleStateMachine` is a minimalistic approach to write _State Machines_ which operate on a list of inputs.
The machine is defined by a map, mapping, transitions to each state, called `tra... | lib/lab42/simple_state_machine.ex | 0.833528 | 0.898855 | simple_state_machine.ex | starcoder |
defmodule Scenic.Primitive.Style.Input do
@moduledoc """
Flags whether or not track `cursor_button` events on this primitive.
Example:
```elixir
graph
|> rect( {100, 200}, id: :my_rect, input: :cursor_button )
```
### Data Format
The data for the input style is the type of input you want to rec... | lib/scenic/primitive/style/input.ex | 0.871653 | 0.784567 | input.ex | starcoder |
defmodule PixelFont.TableSource.OS_2.Enums do
weight_classes = [
thin: 100,
extra_light: 200,
light: 300,
normal: 400,
medium: 500,
semi_bold: 600,
bold: 700,
extra_bold: 800,
black: 900
]
weight_class_type_expr =
weight_classes
|> Keyword.keys()
|> Enum.reverse()
... | lib/pixel_font/table_source/os_2/enums.ex | 0.68215 | 0.472501 | enums.ex | starcoder |
defmodule GenStage.Utils do
@moduledoc false
@doc """
Validates the argument is a list.
"""
def validate_list(opts, key, default) do
{value, opts} = Keyword.pop(opts, key, default)
if is_list(value) do
{:ok, value, opts}
else
{:error, "expected #{inspect(key)} to be a list, got: #{in... | deps/gen_stage/lib/gen_stage/utils.ex | 0.785884 | 0.499634 | utils.ex | starcoder |
defprotocol Phoenix.HTML.Safe do
@moduledoc """
Defines the HTML safe protocol.
In order to promote HTML safety, Phoenix templates
do not use `Kernel.to_string/1` to convert data types to
strings in templates. Instead, Phoenix uses this
protocol which must be implemented by data structures
and guarantee ... | lib/phoenix_html/safe.ex | 0.830972 | 0.692902 | safe.ex | starcoder |
defmodule Livebook.JSInterop do
@moduledoc false
alias Livebook.Delta
@doc """
Returns the result of applying `delta` to `string`.
The delta operation lengths (retain, delete) are treated such that
they match the JavaScript strings behavior.
JavaScript uses UTF-16 encoding, in which every character is... | lib/livebook/js_interop.ex | 0.867443 | 0.792865 | js_interop.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.