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 Statifier.Codec.YAML.Walker do
@moduledoc """
Helper for walking a YAML document and dispatching events to a handler to
process elements as they are found.
See `:xmerl_sax_parser` for reference implementation this is emulating.
"""
@type element :: %{optional(String.t()) => any()}
@typedoc ""... | impl/ex/lib/codec/yaml/walker.ex | 0.822581 | 0.550426 | walker.ex | starcoder |
defmodule Jan.Registry do
@moduledoc """
This module is responsible for storing and retrieving a process for a given room.
We have a process for each room, and use the room id to identify them.
When a new room is created, we add a new entry in this `Map`, using the room id
as the key and the pid as a value.
... | lib/jan/registry.ex | 0.663669 | 0.442155 | registry.ex | starcoder |
defmodule OptionEx do
@moduledoc """
OptionEx is a module for handling functions returning a `t:OptionEx.t/0`.
This module is inspired by the f# Option module, and [Railway Oriented Programming](https://fsharpforfunandprofit.com/rop/) as explained by <NAME>. This module is intended to make working with `nil` valu... | lib/option_ex.ex | 0.894637 | 0.610221 | option_ex.ex | starcoder |
defmodule Model.Alert do
@moduledoc """
An `effect` on the provided service (`informed_entity`) described by a `banner`, `header`, and `description` that is
active for one or more periods (`active_period`) caused by a `cause`. The alert has a `lifecycle` that can be read
by humans in its `timeframe`. The over... | apps/model/lib/model/alert.ex | 0.889198 | 0.644358 | alert.ex | starcoder |
defmodule Yacto.Migration.Migrator do
require Logger
@spec migrated_versions(Ecto.Repo.t(), atom, module) :: [integer]
def migrated_versions(repo, app, schema) do
verbose_schema_migration(repo, "retrieve migrated versions", fn ->
Yacto.Migration.SchemaMigration.ensure_schema_migrations_table!(repo)
... | lib/yacto/migration/migrator.ex | 0.687105 | 0.461441 | migrator.ex | starcoder |
defmodule Supervisor.Behaviour do
@moduledoc """
This module is a convenience to define Supervisor
callbacks in Elixir. By using this module, you get
the module behaviour automatically tagged as
`:supervisor` and some helper functions are imported
to make defining supervisors easier.
For more information... | lib/elixir/lib/supervisor/behaviour.ex | 0.8308 | 0.603348 | behaviour.ex | starcoder |
defmodule SimpleMqtt.Subscriptions do
alias SimpleMqtt.Topics
@moduledoc """
Represents collection of subscribed topics for multiple processes.
"""
@type subscriptions :: %{}
@doc """
Creates new subscriptions collection.
"""
@spec new() :: subscriptions()
def new() do
Map.new()
end
@doc... | lib/subscriptions.ex | 0.81582 | 0.416559 | subscriptions.ex | starcoder |
defmodule RMQ.Consumer do
@moduledoc ~S"""
RabbitMQ Consumer.
## Configuration
* `:connection` - the connection module which implements `RMQ.Connection` behaviour.
Defaults to `RMQ.Connection`;
* `:queue` - the name of the queue to consume. Will be created if does not exist.
Also can be a tu... | lib/rmq/consumer.ex | 0.881761 | 0.455925 | consumer.ex | starcoder |
defmodule Scrivener.HTML.SEO do
import Phoenix.HTML.Tag, only: [tag: 2]
import Scrivener.HTML.Helper, only: [fetch_options: 2]
alias Scrivener.Page
@defaults Scrivener.HTML.defaults()
@moduledoc """
SEO related functions for pagination.
See [Indicating paginated content to Google](https://web.archive.o... | lib/scrivener/html/seo.ex | 0.688573 | 0.429788 | seo.ex | starcoder |
defmodule Exemvi.QR.MP do
alias Exemvi.QR.MP.Object, as: MPO
@moduledoc """
This module contains core functions for Merchant-Presented Mode QR Code
"""
@doc """
Validate whole QR Code
Returns either:
- `{:ok, qr_code}` where `qr_code` is the QR Code orginally supplied to the function
- `{:error, r... | lib/exemvi/qr/mp/mp.ex | 0.853837 | 0.66488 | mp.ex | starcoder |
defmodule AWS.EFS do
@moduledoc """
Amazon Elastic File System
Amazon Elastic File System (Amazon EFS) provides simple, scalable file
storage for use with Amazon EC2 instances in the AWS Cloud. With Amazon
EFS, storage capacity is elastic, growing and shrinking automatically as
you add and remove files, s... | lib/aws/efs.ex | 0.893555 | 0.637539 | efs.ex | starcoder |
defmodule Request.Validator.Plug do
alias Plug.Conn
alias Ecto.Changeset
alias Request.Validator
alias Request.Validator.{DefaultRules, Rules, Rules.Array, Rules.Map_}
import Plug.Conn
@doc ~S"""
Init the Request.Validator.Plug with an optional error callback
and handlers with their corresponding requ... | lib/plug.ex | 0.734215 | 0.455804 | plug.ex | starcoder |
defmodule Lab42.StateMachine.Runner do
use Lab42.StateMachine.Types
@moduledoc """
Runs the state machine by finding and executing transitions
"""
@doc false
@spec run( state_t(), list(), list(), any(), transition_map_t() ) :: result_t()
def run(current_state, input, result, data, state_definitions)
... | lib/lab42/state_machine/runner.ex | 0.832883 | 0.635491 | runner.ex | starcoder |
require Math
defmodule BloomFilter do
@moduledoc """
Bloom Filter implementation in Elixir. Bloom filters are probabilistic data structures designed
to efficiently tell you whether an element is present in a set.
## Usage Example
iex> f = BloomFilter.new 100, 0.001
iex> f = Bloo... | lib/bloom_filter.ex | 0.934163 | 0.656163 | bloom_filter.ex | starcoder |
defmodule Tanx.ContinuousGame.Impl do
@default_player_timeout 60.0
defstruct(
maze: nil,
player_timeout: @default_player_timeout,
player_handles: %{},
players: %{},
player_id_map: %{}
)
end
defimpl Tanx.Game.Variant, for: Tanx.ContinuousGame.Impl do
require Logger
@tank_starting_armor 2... | apps/tanx/lib/tanx/continuous_game/impl.ex | 0.53607 | 0.454593 | impl.ex | starcoder |
defmodule Burrito.Versions.ReleaseFile do
@moduledoc """
This module provides some helpful functions for requesting, parsing and sorting release files.
A release file is a simplistic JSON format that contains the releases of an app, where to fetch them, and some release notes.
(And any other information you wan... | lib/versions/release_file.ex | 0.741674 | 0.784649 | release_file.ex | starcoder |
defmodule Day2 do
def data do
"inputs/02.txt"
|> File.read!()
|> String.split("\n", trim: true)
end
def run(validator) when validator in [Day2.PasswordValidator1, Day2.PasswordValidator2] do
Enum.count(data(), fn line ->
line
|> validator.validate()
|> Map.get(:valid?)
end)
... | lib/Day2.ex | 0.725065 | 0.523968 | Day2.ex | starcoder |
defmodule Jaxon.Decoders.Query do
alias Jaxon.ParseError
@query_object 0
@query_array 1
@key 2
@reduce 3
@object 4
@query_key 5
@array 6
@query 7
@skip 8
@skip_value 9
def query(_event_stream, []) do
raise(ArgumentError, "Empty query given")
end
def query(event_stream, query) do
e... | lib/jaxon/decoders/query.ex | 0.682468 | 0.579579 | query.ex | starcoder |
defmodule GenStage.PartitionDispatcher do
@moduledoc """
A dispatcher that sends events according to partitions.
Keep in mind that, if partitions are not evenly distributed,
a backed-up partition will slow all other ones.
## Options
The partition dispatcher accepts the following options
on initializati... | deps/gen_stage/lib/gen_stage/dispatchers/partition_dispatcher.ex | 0.897393 | 0.67141 | partition_dispatcher.ex | starcoder |
defmodule Kaffe.Producer do
@moduledoc """
The producer pulls in values from the Kaffe producer configuration:
- `heroku_kafka_env` - endpoints and SSL configuration will be pulled from ENV
- `endpoints` - plaintext Kafka endpoints
- `topics` - a list of Kafka topics to prep for producing
- `parti... | lib/kaffe/producer.ex | 0.882066 | 0.637482 | producer.ex | starcoder |
defmodule Issues.TableFormatter do
import Enum, only: [each: 2, map: 2, map_join: 3, max: 1]
@doc """
Takes a list of row data, where each row is a HashDict,
and a list of headers. Prints a table to STDOUT of the
data from each row identified by each header. That is,
each header identifies a column, and... | issues/lib/issues/table_formatter.ex | 0.857709 | 0.791217 | table_formatter.ex | starcoder |
defmodule Tirexs.Search.Aggs do
@moduledoc false
@note """
It helps provide aggregated data based on a search query. It is based on
simple building blocks called aggregations, that can be composed
in order to build complex summaries of the data.
"""
use Tirexs.DSL.Logic
alias Tirexs.{Query.Filter}
... | lib/tirexs/search/aggs.ex | 0.572364 | 0.566798 | aggs.ex | starcoder |
defmodule Day17 do
@moduledoc """
Advent of Code 2019
Day 17: Set and Forget
I have no idea why Part 2 doesn't work. It actually does work (answer:
597517) with continuous video feed turned on, but not when it's turned off.
Too lazy to debug this atm.
"""
alias Day17.{Part1, Part2}
def get_program(... | lib/day17.ex | 0.623262 | 0.577019 | day17.ex | starcoder |
defmodule CrissCrossDHT.Server.Utils do
require Logger
@moduledoc false
@doc ~S"""
This function gets a tuple as IP address and a port and returns a
string which contains the IPv4 or IPv6 address and port in the following
format: "127.0.0.1:6881".
## Example
iex> CrissCrossDHT.Server.Utils.tuple_... | lib/criss_cross_dht/server/utils.ex | 0.700485 | 0.502869 | utils.ex | starcoder |
defmodule Merkel.BinaryNode do
alias Merkel.BinaryNode, as: Node
# The node has a hash, a search_key, a height key
# For leaf nodes the key and value fields are used, otherwise they are nil
# For inner nodes the two child fields left and right are used, otherwise they are nil
# This allows us to use pattern ... | lib/merkel/node.ex | 0.709321 | 0.49469 | node.ex | starcoder |
defmodule Assert do
@moduledoc """
Assert the data type of environment variables at compile time
"""
@doc ~S"""
## Examples
iex> System.put_env("NOT_INT", "123")
iex> Assert.init("./test/assertions/1_assertions.txt")
** (RuntimeError) Expected environment variable NOT_INT to be type float... | lib/assert.ex | 0.808559 | 0.47524 | assert.ex | starcoder |
defprotocol Numy.Vc do
@moduledoc """
Interface to immutable Vector.
"""
@doc "Make a clone"
def clone(v)
@doc "Assign 0.0 to each element of the vector."
def assign_zeros(v)
@doc "Assign 1.0 to each element of the vector."
def assign_ones(v)
@doc "Assign random values to the elements."
def assi... | lib/vector/vc.ex | 0.848753 | 0.557002 | vc.ex | starcoder |
defmodule Expat.Macro do
@moduledoc """
Expat internals for working with Macro.t()
""" && false
alias Expat, as: E
@doc "Defines a named pattern"
@spec define_pattern(defm :: :defmacro | :defmacrop, E.pattern()) :: E.pattern()
def define_pattern(defm, pattern)
def define_pattern... | lib/expat/macro.ex | 0.613121 | 0.413832 | macro.ex | starcoder |
defmodule AWS do
@moduledoc """
AWS provides an API to talk with Amazon Web Services.
Each module in this project corresponds with an AWS service,
and they can be used by calling the functions of those
modules. For example, "AWS DynamoDB" operations can be found
in `AWS.DynamoDB` module.
First we need t... | lib/aws.ex | 0.860516 | 0.434701 | aws.ex | starcoder |
defmodule ExCoveralls.Local do
@moduledoc """
Locally displays the result to screen.
"""
defmodule Count do
@moduledoc """
Stores count information for calculating coverage values.
"""
defstruct lines: 0, relevant: 0, covered: 0
end
@doc """
Provides an entry point for the module.
"""... | lib/excoveralls/local.ex | 0.619701 | 0.46393 | local.ex | starcoder |
defmodule Chain do
@moduledoc """
Chain is inspired by the Railway programming and JavaScript well known Promise API.
Its purpose is to ease the construction of multi-step data processing in a more readable manner than using elixir
native `with` macro.
Chain is more flexible than a `with` macro as the erro... | lib/chain.ex | 0.850887 | 0.949201 | chain.ex | starcoder |
defmodule MMDB2Encoder.Data do
@moduledoc false
# standard data types
@binary 2
@bytes 4
@extended 0
# extended data types
@extended_boolean 7
@extended_cache_container 5
@extended_end_marker 6
@type datatype :: :binary | :boolean | :bytes | :cache_container | :end_marker
@type valuetype :: bin... | lib/mmdb2_encoder/data.ex | 0.85558 | 0.502869 | data.ex | starcoder |
defmodule Day16 do
def version_sum(str) do
str
|> parse()
|> then(fn %{version: v} -> v end)
end
def parse(str) when is_binary(str) do
str
|> String.split("", trim: true)
|> Enum.map(&String.to_integer(&1, 16))
|> Enum.map(&Integer.digits(&1, 2))
|> Enum.flat_map(&pad/1)
|> pa... | year_2021/lib/day_16.ex | 0.594551 | 0.558327 | day_16.ex | starcoder |
defmodule Protobuf.Encoder do
import Protobuf.WireTypes
import Bitwise, only: [bsr: 2, band: 2, bsl: 2, bor: 2]
alias Protobuf.{MessageProps, FieldProps}
@spec encode(atom, struct, keyword) :: iodata
def encode(mod, struct, opts) do
case struct do
%{__struct__: _} ->
encode(struct, opts)
... | lib/protobuf/encoder.ex | 0.800419 | 0.434821 | encoder.ex | starcoder |
defmodule X509.SignatureAlgorithm do
@moduledoc false
import X509.ASN1
# Returns a signature algorithm record for the given public key type and hash
# algorithm; this is essentially the reverse of
# `:public_key.pkix_sign_types/1`
def new(hash, signature, type \\ :SignatureAlgorithm)
def new(hash, rsa... | lib/x509/signature_algorithm.ex | 0.838415 | 0.508422 | signature_algorithm.ex | starcoder |
defmodule JTIRegister.ETS do
@default_cleanup_interval 15
@moduledoc """
Implementation of the `JTIRegister` behaviour relying on ETS
Stores the JTIs in an ETS table. It is therefore **not** distributed and not suitable
when having more than one node.
Uses monotonic time, so that erroneous server time do... | lib/jti_register/ets.ex | 0.785473 | 0.467696 | ets.ex | starcoder |
defmodule Mix.Tasks.Hex.Organization do
use Mix.Task
@shortdoc "Manages Hex.pm organizations"
@moduledoc """
Manages the list of authorized Hex.pm organizations.
Organizations is a feature of Hex.pm to host and manage private packages. See
<https://hex.pm/docs/private> for more information.
By default... | lib/mix/tasks/hex.organization.ex | 0.832339 | 0.431165 | hex.organization.ex | starcoder |
defmodule Andy.GM.CourseOfAction do
@moduledoc "A course of action is a sequence of named Intentions meant to be realized as Intents in an attempt
to validate some activation of a conjecture"
require Logger
alias Andy.GM.{
GenerativeModelDef,
CourseOfAction,
Conjecture,
ConjectureActivation,... | lib/andy/gm/course_of_action.ex | 0.672654 | 0.575886 | course_of_action.ex | starcoder |
defmodule Farmbot.Serial.Gcode.Parser do
@moduledoc """
Parses farmbot_arduino_firmware G-Codes.
"""
@spec parse_code(binary) :: {binary, tuple}
# / ???
def parse_code("R00 Q" <> tag), do: {tag, :idle}
def parse_code("R01 Q" <> tag), do: {tag, :received}
def parse_code("R02 Q" <> tag), do: {tag, :do... | lib/serial/gcode/parser.ex | 0.508788 | 0.463869 | parser.ex | starcoder |
defmodule Nostrum.Struct.Emoji do
@moduledoc ~S"""
Struct representing a Discord emoji.
## Mentioning Emojis in Messages
A `Nostrum.Struct.Emoji` can be mentioned in message content using the `String.Chars`
protocol or `mention/1`.
```Elixir
emoji = %Nostrum.Struct.Emoji{id: 437093487582642177, name: "... | lib/nostrum/struct/emoji.ex | 0.884564 | 0.571886 | emoji.ex | starcoder |
defmodule ExExport do
@show_definitions Application.get_env(:ex_export, :show_definitions, false)
@moduledoc """
This module inspects another module for public functions and generates the defdelegate needed to add them to the local modules name space
"""
@doc """
require in the module and them call expo... | lib/ex_export.ex | 0.691602 | 0.789761 | ex_export.ex | starcoder |
defmodule Alchemy.Permissions do
@moduledoc """
This module contains useful functions for working for the permission
bitsets discord provides.
To combine the permissions of an overwrite
with the permissions of a role, the bitwise `|||` can be used.
## Example Usage
```elixir
Cogs.def perms(role_name) ... | lib/Structs/permissions.ex | 0.888442 | 0.878419 | permissions.ex | starcoder |
defmodule FloUI.Scrollable.Drag do
@moduledoc """
Module for handling the drag controllability for `Scenic.Scrollable` components.
"""
alias Scenic.Math.Vector2
alias Scenic.Math
@typedoc """
Atom representing a mouse button.
"""
@type mouse_button :: 0 | 1 | 2
@typedoc """
Data structure with ... | lib/scrollable/utility/drag.ex | 0.886629 | 0.713955 | drag.ex | starcoder |
defmodule Pummpcomm.Session.PumpFake do
use GenServer
@moduledoc """
Fakes `Pummpcomm.Session`
"""
def start_link(_pump_serial, local_timezone) do
GenServer.start_link(__MODULE__, local_timezone, name: __MODULE__)
end
def init(local_timezone) do
{:ok, local_timezone}
end
def get_current_cg... | lib/pummpcomm/session/pump_fake.ex | 0.727201 | 0.425009 | pump_fake.ex | starcoder |
defmodule LoggerErrorCounterBackend do
@moduledoc """
A `Logger` backend that publishes the number of error messages and the last error message
In your config, simply do something like this:
```elixir
config :logger_error_counter_backend, path: [:log, :errors]
```
LoggerErrorCounterBackend is configu... | lib/logger_error_counter_backend.ex | 0.839092 | 0.784814 | logger_error_counter_backend.ex | starcoder |
defmodule Changelog.Episode do
use Changelog.Schema, default_sort: :published_at
alias Changelog.{
EpisodeHost,
EpisodeGuest,
EpisodeRequest,
EpisodeTopic,
EpisodeStat,
EpisodeSponsor,
Files,
Github,
NewsItem,
Notifier,
Podcast,
Regexp,
Search,
Transcripts
... | lib/changelog/schema/episode/episode.ex | 0.535584 | 0.487612 | episode.ex | starcoder |
defmodule AWS.EMRcontainers do
@moduledoc """
Amazon EMR on EKS provides a deployment option for Amazon EMR that allows you to
run open-source big data frameworks on Amazon Elastic Kubernetes Service (Amazon
EKS).
With this deployment option, you can focus on running analytics workloads while
Amazon EMR o... | lib/aws/generated/emrcontainers.ex | 0.879619 | 0.439567 | emrcontainers.ex | starcoder |
defmodule Mariaex.RowParser do
@moduledoc """
Parse a row of the MySQL protocol
This parser makes extensive use of binary pattern matching and recursion to take advantage
of Erlang's optimizer that will not create sub binaries when called recusively.
"""
use Bitwise
alias Mariaex.Column
alias Mariaex.M... | lib/mariaex/row_parser.ex | 0.583915 | 0.474996 | row_parser.ex | starcoder |
defmodule Rolodex.Schema do
@moduledoc """
Exposes functions and macros for defining reusable parameter schemas.
It includes two macros. Used together, you can setup a reusable schema:
- `schema/3` - for declaring a schema
- `field/3` - for declaring schema fields
It also exposes the following functions:... | lib/rolodex/schema.ex | 0.886917 | 0.66266 | schema.ex | starcoder |
defmodule Cldr.Interval do
@moduledoc """
Interval formats allow for software to format intervals like "Jan 10-12, 2008" as a
shorter and more natural format than "Jan 10, 2008 - Jan 12, 2008". They are designed
to take a start and end date, time or datetime plus a formatting pattern
and use that information ... | lib/cldr/interval.ex | 0.923816 | 0.929248 | interval.ex | starcoder |
defmodule Elixoids.Game.Server do
@moduledoc """
Game process. One process per running Game.
Each object in the game is represented by a Process.
The processes update themselves and they report their new state to the Game.
Players are identified by a name (AAA..ZZZ) and control a Ship process.
"""
use G... | lib/elixoids/game/server.ex | 0.711732 | 0.463444 | server.ex | starcoder |
defmodule Paidy.Token do
@moduledoc """
API for working with Token at Paidy. Through this API you can:
* suspend a token
* resume a token
* delete a token
* get a token
* get all tokens
tokens for credit card allowing you to use instead of a credit card number in various operations.
(API ref https:... | lib/paidy/token.ex | 0.908453 | 0.866246 | token.ex | starcoder |
defmodule Statux.Models.TrackingData do
@moduledoc """
This Structure holds data that is required to track :count or :duration constraints.
It is updated whenever new data comes in and is used to decide wether or not a
state can be transitioned into.
"""
use StructAccess
use TypedStruct
typedstruct do
... | lib/Statux/models/tracking_data.ex | 0.542621 | 0.547525 | tracking_data.ex | starcoder |
defmodule Automaton.Types.TWEANN.Actuator do
@moduledoc """
An actuator is a process that accepts signals from the neurons in the output
layer, orders them into a vector, and then uses this vector to control some
function that acts on the environ or even the NN itself.
Actuator's are represented with the tup... | lib/automata/automaton_types/neuroevolution/actuator.ex | 0.697815 | 0.712682 | actuator.ex | starcoder |
defmodule AWS.Batch do
@moduledoc """
Using AWS Batch, you can run batch computing workloads on the AWS Cloud.
Batch computing is a common means for developers, scientists, and engineers to
access large amounts of compute resources. AWS Batch uses the advantages of this
computing workload to remove the undi... | lib/aws/generated/batch.ex | 0.917034 | 0.543772 | batch.ex | starcoder |
defmodule ListToCsv.Key do
@moduledoc """
`ListToCsv.Key` contains types and utilities for keys.
"""
@type t() :: String.t() | atom() | integer() | function()
@type many() :: list(t()) | t() | {function(), many()}
@doc """
build prefix keys with trailing `:N`
## Examples
iex> build_prefix(:na... | lib/list_to_csv/key.ex | 0.905134 | 0.662965 | key.ex | starcoder |
defmodule Membrane.RTP.OutboundPacketTracker do
@moduledoc """
Tracks statistics of outbound packets.
Besides tracking statistics, tracker can also serialize packet's header and payload stored inside an incoming buffer
into a proper RTP packet. When encountering header extensions, it remaps its identifiers fro... | lib/membrane/rtp/outbound_packet_tracker.ex | 0.832373 | 0.482002 | outbound_packet_tracker.ex | starcoder |
defmodule OMG.Signature do
@moduledoc """
Adapted from https://github.com/exthereum/blockchain.
Defines helper functions for signing and getting the signature
of a transaction, as defined in Appendix F of the Yellow Paper.
For any of the following functions, if chain_id is specified,
it's assumed that we'... | apps/omg/lib/omg/signature.ex | 0.882801 | 0.433322 | signature.ex | starcoder |
defmodule Panoramix.Error do
defexception [:message, :code]
@type t :: %__MODULE__{}
end
defmodule Panoramix do
@moduledoc """
Post a query to Druid Broker or request its status.
Use Panoramix.Query to build a query.
## Examples
Build a query like this:
```elixir
use Panoramix
q = from "my_da... | lib/panoramix.ex | 0.827793 | 0.821008 | panoramix.ex | starcoder |
defmodule Cldr.DateTime.Relative.Backend do
@moduledoc false
def define_date_time_relative_module(config) do
backend = config.backend
config = Macro.escape(config)
quote location: :keep, bind_quoted: [config: config, backend: backend] do
defmodule DateTime.Relative do
@second 1
@... | lib/cldr/backend/relative.ex | 0.930213 | 0.595081 | relative.ex | starcoder |
defmodule GoogleSheets.Loader.Docs do
@moduledoc """
Implements GoogleSheets.Loader behavior by fetching a Spreadsheet through Google spreadsheet API.
The only configuration value required is :url, which should point to the Atom feed of the spreadsheet.
See [README](extra-readme.html) how to publish a spreadsh... | lib/google_sheets/loader/docs.ex | 0.721547 | 0.577257 | docs.ex | starcoder |
defmodule Schedules.HoursOfOperation do
@moduledoc false
alias Schedules.Departures
@type departure :: Departures.t() | :no_service
@type t :: %__MODULE__{
week: {departure, departure},
saturday: {departure, departure},
sunday: {departure, departure}
}
defstruct week: {... | apps/schedules/lib/hours_of_operation.ex | 0.841207 | 0.518729 | hours_of_operation.ex | starcoder |
defmodule ChallengeGov.Messages.MessageContext do
@moduledoc """
MessageContext schema
-----------------------------
- Types of Message Contexts -
-----------------------------
Gives a description of each context type and the relevant params, permissions, and reply functionality
If a param is not listed ... | lib/challenge_gov/messages/message_context.ex | 0.806738 | 0.513059 | message_context.ex | starcoder |
defmodule AMQP.Connection do
@moduledoc """
Functions to operate on Connections.
"""
import AMQP.Core
alias AMQP.Connection
defstruct [:pid]
@type t :: %Connection{pid: pid}
@doc """
Opens an new Connection to an AMQP broker.
The connections created by this module are supervised under amqp_cli... | lib/amqp/connection.ex | 0.829112 | 0.772015 | connection.ex | starcoder |
defmodule Grizzly.ZWave.Commands.PriorityRouteReport do
@moduledoc """
This command is used to advertise the current network route in use for an actual destination NodeID.
Params:
* `:node_id` - the NodeID destination for which the current network route is requested (required)
* `:type` - the route typ... | lib/grizzly/zwave/commands/priority_route_report.ex | 0.846609 | 0.409634 | priority_route_report.ex | starcoder |
defmodule Verk.Job do
@moduledoc """
The Job struct.
Set `config :verk, max_retry_count: value` on your config file to set the default max
amount of retries on all your `Verk.Job` when none is informed. Defaults at `25`.
"""
@keys [
error_message: nil,
failed_at: nil,
retry_count: 0,
queue... | lib/verk/job.ex | 0.81549 | 0.403655 | job.ex | starcoder |
defmodule TypeCheck.Builtin.FixedList do
@moduledoc """
Checks whether the value is a list with the expected elements
On failure returns a problem tuple with:
- `:not_a_list` if the value is not a list
- `:different_length` if the value is a list but not of equal size.
- `:element_error` if one of th... | lib/type_check/builtin/fixed_list.ex | 0.860472 | 0.667586 | fixed_list.ex | starcoder |
defmodule Bandit.PhoenixAdapter do
@moduledoc """
A Bandit adapter for Phoenix.
Note that this adapter does not currently support WebSocket connections; it is
only suitable for use with HTTP(S)-only Phoenix instances.
To use this adapter, your project will need to include Bandit as a dependency; see
https... | lib/bandit/phoenix_adapter.ex | 0.853226 | 0.836955 | phoenix_adapter.ex | starcoder |
defmodule ExHal.Assertions do
@moduledoc """
Convenience functions for asserting things about HAL documents
```elixir
iex> import ExUnit.Assertions
nil
iex> import ExHal.Assertions
nil
iex> assert_property ~s({"name": "foo"}), "name"
true
iex> assert_property ~s({"name": "foo"}), "address"
** (Ex... | lib/exhal/assertions.ex | 0.887793 | 0.806777 | assertions.ex | starcoder |
defmodule Utility.Test.MockCache do
@moduledoc """
This cache is designed to be isolated by process and only visible to that process, ideally for
ExUnit tests since each test is a spawned process. However, this can only be done:
1) if the test process directly calls start_mock/1 AND does not call the cache th... | test/support/mock_cache.ex | 0.77518 | 0.516474 | mock_cache.ex | starcoder |
defmodule AWS.Health do
@moduledoc """
AWS Health
The AWS Health API provides programmatic access to the AWS Health
information that is presented in the [AWS Personal Health
Dashboard](https://phd.aws.amazon.com/phd/home#/). You can get information
about events that affect your AWS resources:
<ul> <li>... | lib/aws/health.ex | 0.871235 | 0.64542 | health.ex | starcoder |
defmodule OLED.Display do
@moduledoc """
Defines a display module
When used, the displaly expects an `:app` as option.
The `:app` should be the app that has the configuration.
Example:
defmodule MyApp.MyDisplay do
use OLED.Display, app: :my_app
end
Could be configured with:
con... | lib/oled/display.ex | 0.923489 | 0.473292 | display.ex | starcoder |
defmodule Lemma.En.Nouns do
@moduledoc false
@nouns_set """
'hood .22 0 1 1-dodecanol 1-hitter 10 100 1000 10000 100000 1000000 1000000000
1000000000000 11 11-plus 12 120 13 14 144 15 1530s 16 17 1728 1750s 1760s 1770s
1780s 1790s 18 1820s 1830s 1840s 1850s 1860s 1870s 1880s 1890s 19 1900s 1920s
1930s 1940s... | lib/en/nouns.ex | 0.541166 | 0.572663 | nouns.ex | starcoder |
defmodule IO.ANSI.Sequence do
@moduledoc false
defmacro defsequence(name, code \\ "", terminator \\ "m") do
quote bind_quoted: [name: name, code: code, terminator: terminator] do
def unquote(name)() do
"\e[#{unquote(code)}#{unquote(terminator)}"
end
defp escape_sequence(unquote(Atom.... | lib/elixir/lib/io/ansi.ex | 0.833731 | 0.492005 | ansi.ex | starcoder |
defmodule Quark.Compose do
@moduledoc ~S"""
Function composition is taking two functions, and joining them together to
create a new function. For example:
## Examples
iex> sum_plus_one = compose([&(&1 + 1), &Enum.sum/1])
...> sum_plus_one.([1,2,3])
7
In this case, we have joined `Enum.sum... | lib/quark/compose.ex | 0.845879 | 0.673423 | compose.ex | starcoder |
defmodule Scenic.Primitive.Script do
@moduledoc """
A reference to a draw script.
The `Script` primitive is used to refer to a script that you created
and loaded into the ViewPort separately from the graph. This script also
has full access to the `Scenic.Script` API.
For example, the check mark shape in ... | lib/scenic/primitive/script.ex | 0.891946 | 0.826991 | script.ex | starcoder |
defmodule OMG.ChildChain.BlockQueue.GasAnalyzer do
@moduledoc """
Takes the transaction hash and puts it in the FIFO queue
for each transaction hash we're trying to get the gas we've used to submit the block and send it of as a telemetry event
to datadog
"""
require Logger
@retries 3
defstruct txhas... | apps/omg_child_chain/lib/omg_child_chain/block_queue/gas_analyzer.ex | 0.727395 | 0.412619 | gas_analyzer.ex | starcoder |
defmodule StringFormatterIolist do
@moduledoc """
A module used to evaluate {placeholders} in strings given a list of params
"""
import StringFormatterUtils, only: [normalize_params: 1, eval_holder: 2]
@status_normal :normal
@status_reading_placeholder :reading_placeholder
@doc """
Format a string wi... | pattern_matching_and_state_machines/lib/string_formatter_iolist.ex | 0.682679 | 0.437583 | string_formatter_iolist.ex | starcoder |
defmodule CanvasAPI.Canvas.Formatter do
@moduledoc """
Converts a canvas to a given format.
"""
alias CanvasAPI.{Block, Canvas}
@spec to_markdown(Canvas.t | Block.t) :: String.t
def to_markdown(block_parent) do
block_parent.blocks
|> Enum.reduce("", &block_to_markdown/2)
|> String.trim_trailin... | web/models/canvas/formatter.ex | 0.810779 | 0.75358 | formatter.ex | starcoder |
use Croma
alias Croma.Result, as: R
defmodule Antikythera.VersionStr do
@moduledoc """
Format of versions of antikythera instances and gears.
The format rule is a stricter variant of [semantic versioning](https://semver.org/);
pre-release part and build metadata part are filled with information
from the cu... | lib/type/string.ex | 0.596316 | 0.48871 | string.ex | starcoder |
defmodule Collision.Polygon.Vertex do
@moduledoc """
A vertex is a point in the Cartesian space where a polygon's
edges meet.
"""
defstruct x: 0, y: 0
alias Collision.Polygon.Vertex
@typedoc """
Vertices in two dimensional space are defined by `x` and `y` coordinates.
"""
@type t :: Vertex.t
@d... | lib/collision/polygon/vertex.ex | 0.930205 | 0.940188 | vertex.ex | starcoder |
defmodule AMQPX.Receiver do
use Supervisor
@moduledoc """
Provides message handling with transparent connection recovery.
Starts a supervisor with a connection watchdog and a handler process.
In case of connection loss the process group will be shutdown and restarted until it can reconnect.
The message h... | lib/amqpx/receiver.ex | 0.819929 | 0.485173 | receiver.ex | starcoder |
defmodule Bitcoin.Protocol.Types.NetworkAddress do
use Bitcoin.Common
@moduledoc """
Network address type from the Bitconi protocol ( https://en.bitcoin.it/wiki/Protocol_documentation#Network_address )
It appears in two variations. When exchanging info about peers (Addr message) it includes the time fiel... | lib/bitcoin/protocol/types/network_address.ex | 0.798501 | 0.507324 | network_address.ex | starcoder |
defmodule ExIntegrate.Core.Pipeline do
@moduledoc """
A collection of Steps to be run sequentially.
"""
alias ExIntegrate.Core.Step
@behaviour Access
@enforce_keys [:name, :steps]
defstruct @enforce_keys ++ [failed?: false]
@type key :: String.t()
@type t :: %__MODULE__{
failed?: boolea... | lib/ex_integrate/core/pipeline.ex | 0.845049 | 0.633269 | pipeline.ex | starcoder |
defmodule Membrane.Filter do
@moduledoc """
Module defining behaviour for filters - elements processing data.
Behaviours for filters are specified, besides this place, in modules
`Membrane.Element.Base`,
`Membrane.Element.WithOutputPads`,
and `Membrane.Element.WithInputPads`.
Filters can have both input... | lib/membrane/filter.ex | 0.877483 | 0.512693 | filter.ex | starcoder |
defmodule Chex.Piece do
@moduledoc false
alias Chex.{Board, Game}
@callback possible_moves(Chex.game(), Chex.square(), Chex.color()) :: [Chex.square()]
@callback attacking_squares(Chex.game(), Chex.square(), Chex.color()) :: [Chex.square()]
@spec possible_moves(Chex.game(), Chex.square()) :: [Chex.square()... | lib/chex/piece.ex | 0.852076 | 0.572962 | piece.ex | starcoder |
defmodule Farmbot.Firmware.Gcode.Param do
@moduledoc "Firmware paramaters."
@doc "Turn a number into a param, or a param into a number."
@spec parse_param(integer | t) :: t | integer
def parse_param(0), do: :param_version
def parse_param(1), do: :param_test
def parse_param(2), do: :param_config_ok
def pa... | lib/farmbot/firmware/gcode/param.ex | 0.665519 | 0.678999 | param.ex | starcoder |
defmodule SmartGlobal.Guard do
defguard is_simple(x) when is_atom(x) or is_number(x) or is_binary(x) or is_bitstring(x)
defguard is_var(x) when is_tuple(x) and :erlang.size(x) == 2 and elem(x, 0) == :var and is_atom(elem(x, 1))
end
defmodule SmartGlobal.Error do
defexception [:message]
@impl true
def excep... | lib/smart_global.ex | 0.627837 | 0.770162 | smart_global.ex | starcoder |
defmodule ExHeap do
@moduledoc """
ExHeap is a small wrapper for sending
tracking and user data to Heap Analytic's Server-Side API.
It takes care of forming the requests, headers, etc,
but mostly lets you pass through your data untouched.
Basic usage:
```elixir
iex> ExHeap.track("<EMAIL>", "My He... | lib/ex_heap.ex | 0.872327 | 0.665721 | ex_heap.ex | starcoder |
defmodule Xtree do
@moduledoc """
Builds an X-Tree
Each node has:
- `n_id` - (integer() >= 0) The unique ID in the tree
"""
alias Xtree.Util
alias Xtree.Protocol
defstruct n_id: 0,
type: :element,
label: "",
value: "",
index: 0,
idx_label: ""... | lib/xtree.ex | 0.712532 | 0.428054 | xtree.ex | starcoder |
defmodule MT940.StatementLineInformation do
@moduledoc ~S"""
## Information to Account Owner
Additional information about the transaction detailed in the preceding
statement line and which is to be passed on to the account owner.
"""
defstruct [
:modifier,
:content,
:code,
:transaction_des... | lib/model/statement_line_information.ex | 0.670285 | 0.401365 | statement_line_information.ex | starcoder |
defmodule Sanity.Pbuf.Tests.EverythingType do
@moduledoc false
use Protobuf, enum: true, syntax: :proto3
@type t :: integer | :EVERYTHING_TYPE_UNKNOWN | :EVERYTHING_TYPE_SAND | :EVERYTHING_TYPE_SPICE
field :EVERYTHING_TYPE_UNKNOWN, 0
field :EVERYTHING_TYPE_SAND, 1
field :EVERYTHING_TYPE_SPICE, 2
end
defm... | test/schemas/generated/sanity.everything.pb.ex | 0.669096 | 0.608361 | sanity.everything.pb.ex | starcoder |
defmodule Nebulex.Adapters.Nil do
@moduledoc """
The **Nil adapter** is a special cache adapter that disables the cache;
it loses all the items saved on it and it returns `nil` for all the read
and `true` for all save operations. This adapter is mostly useful for tests.
## Example
Suppose you have an appl... | lib/nebulex/adapters/nil.ex | 0.859 | 0.578895 | nil.ex | starcoder |
defprotocol Plymio.Vekil.Forom do
@moduledoc ~S"""
The `Plymio.Vekil.Forom` protocol is implemented by the values
returned by the *vekil* accessor functions (e.g. `Plymio.Vekil.proxy_fetch/2`).
See `Plymio.Vekil` for a general overview and explanation of the documentation terms.
## Implementation Modules' ... | lib/vekil/protocol/forom.ex | 0.906963 | 0.768386 | forom.ex | starcoder |
defmodule ExRandomString do
@moduledoc """
Library for generating random strings. Based on NodeJS library
[randomstring](https://www.npmjs.com/package/randomstring).
## Installation
The package can be installed by adding `ex_random_string` to your list of
dependencies in `mix.exs`:
```elixir
def deps... | lib/ex_random_string.ex | 0.858006 | 0.864368 | ex_random_string.ex | starcoder |
defmodule Pummpcomm.History.AlarmSensor do
@moduledoc """
An alarm raised on the pump on behalf of the CGM.
"""
use Bitwise
alias Pummpcomm.{BloodGlucose, DateDecoder}
@behaviour Pummpcomm.History.Decoder
# CONSTANTS
# TODO change to atom to match Pummpcomm.History.AlarmPump and because dialyzer can... | lib/pummpcomm/history/alarm_sensor.ex | 0.57093 | 0.508361 | alarm_sensor.ex | starcoder |
defmodule Pushest.Socket.Data.Presence do
@moduledoc ~S"""
Structure representing presence information, connected user IDs and data of them.
"""
defstruct count: 0, hash: %{}, ids: [], me: %{}
@doc ~S"""
Merges current Presence struct with new presence data frame. Always keeps :me
part from current stat... | lib/pushest/socket/data/presence.ex | 0.771112 | 0.438004 | presence.ex | starcoder |
defmodule Bolt.Cogs.Role.Deny do
@moduledoc false
@behaviour Nosedrum.Command
alias Bolt.Converters
alias Bolt.Helpers
alias Bolt.Humanizer
alias Bolt.ModLog
alias Bolt.Repo
alias Bolt.Schema.SelfAssignableRoles
alias Nosedrum.Predicates
alias Nostrum.Api
@impl true
def usage, do: ["role deny... | lib/bolt/cogs/role/deny.ex | 0.860208 | 0.497864 | deny.ex | starcoder |
defmodule Himamo.BaumWelch.StepE do
alias Himamo.Logzero
import Logzero
@moduledoc ~S"""
Defines components of the E-step of the Baum-Welch algorithm (Expectation).
Calculates required statistics for the given model.
"""
alias Himamo.{Matrix, Model, ObsSeq}
@doc ~S"""
Computes alpha variable for B... | lib/himamo/baum_welch/step_e.ex | 0.852537 | 0.792544 | step_e.ex | starcoder |
defmodule Symbelix do
alias Symbelix.Expression
@moduledoc """
Expression parser and evaluator.
"""
@spec run(source :: String.t(), library :: Module.t()) :: any()
@doc """
Runs a program specified by the source code `source` together with
the function library `library`. Returns the result of the prog... | lib/symbelix.ex | 0.802633 | 0.570571 | symbelix.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.