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 MircParser do
@moduledoc """
Parse mIRC colour codes and render to HTML.
Full documentation about these codes can be found [online](https://modern.ircdocs.horse/formatting.html).
The characters used for each kind of formatting are:
* "x02": Bold. Represented with `<b>`.
* "x1D": Italic. Represen... | lib/mirc_parser.ex | 0.8488 | 0.691914 | mirc_parser.ex | starcoder |
defprotocol Enum.Iterator do
@moduledoc """
This is the protocol used by the `Enum` module.
Usually, when you invoke a function in the module `Enum`,
the first argument passed to `Enum` is a collection which
is forwarded to this protocol in order to retrieve information
on how to iterate the collection. Tha... | lib/elixir/lib/enum.ex | 0.894306 | 0.75729 | enum.ex | starcoder |
defmodule Matcha.Context do
@moduledoc """
Different types of match spec are intended to be used for different purposes,
and support different instructions in their bodies for different use-cases.
The modules implementing the `Matcha.Context` behaviour define the different types of `Matcha.Spec`,
provide doc... | lib/matcha/context.ex | 0.867738 | 0.775137 | context.ex | starcoder |
defmodule TableRex.Renderer.Text do
@moduledoc """
Renderer module which handles outputting ASCII-style tables for display.
"""
alias TableRex.Cell
alias TableRex.Table
alias TableRex.Renderer.Text.Meta
@behaviour TableRex.Renderer
@doc """
Provides a level of sane defaults for the Text rendering mo... | lib/table_rex/renderer/text.ex | 0.89117 | 0.685397 | text.ex | starcoder |
defmodule Relate do
@moduledoc """
Relate implements relational operators on Elixir enumerables.
Join functions take two enumerables containing objects as well as one or
two arguments to specify how the value to use as a basis for joining
will be determined.
If either `fki1` or `fki2` are functions, the ... | lib/relate.ex | 0.898503 | 0.764232 | relate.ex | starcoder |
defmodule Kday do
@moduledoc """
Functions to return the date of the first, last or nth day of the week
on, nearest, before or after a given date.
"""
@days_in_a_week 7
@doc """
Return the date of the `day_of_week` on or before the
specified `date`.
## Arguments
* `date` is `%Date{}`, a `%DateT... | lib/kday.ex | 0.953676 | 0.714155 | kday.ex | starcoder |
defmodule Harnais.Map do
@moduledoc ~S"""
Functions for Testing Maps
## Documentation Terms
In the documentation these terms, usually in *italics*, are used to mean the same thing.
### *opts*
An *opts* is a `Keyword` list.
## Bang and Query Functions
All functions have bang and query peers.
Th... | lib/map.ex | 0.878105 | 0.547706 | map.ex | starcoder |
defmodule Search.Scope do
@moduledoc """
Defines a set of behaviours the `Search.Request` depends on to build a proper search request.
"""
@typedoc """
Defined set of key / values that define an Elasticsearch Filter.
"""
@type filter_body :: %{
optional(:must) => list(),
optional(:mus... | lib/elastic_jsonapi/scope.ex | 0.857828 | 0.488405 | scope.ex | starcoder |
defmodule Chunky.Geometry.Triangle.Predicates do
@moduledoc """
Predicate functions take a single triangle as an argument, and return a boolean, an assessment of some
characteristic of the triangle. Predicate functions will, in almost every possible case, return a boolean,
even in situations that would normally... | lib/geometry/triangle/predicates.ex | 0.924925 | 0.946695 | predicates.ex | starcoder |
defmodule Unicode do
alias Unicode.CompiletimeHelper
@moduledoc """
Provides functionality to efficiently check properties of Unicode codepoints, graphemes and strings.
The current implementation is based on Unicode version _8.0.0_.
"""
@derived_core_properties %{
Math: :math,
Alphabetic: :alpha... | lib/unicode.ex | 0.705785 | 0.484563 | unicode.ex | starcoder |
defmodule Terminus do
@moduledoc """

Terminus allows you to crawl and subscribe to Bitcoin transaction events and
download binary data from transact... | lib/terminus.ex | 0.888202 | 0.687892 | terminus.ex | starcoder |
defmodule BlueHeron.HCI.Event.CommandStatus do
use BlueHeron.HCI.Event, code: 0x0F
@moduledoc """
The HCI_Command_Status event is used to indicate that the command described by
the Command_Opcode parameter has been received, and that the Controller is
currently performing the task for this command.
This e... | lib/blue_heron/hci/events/command_status.ex | 0.672547 | 0.442155 | command_status.ex | starcoder |
defmodule Ecto.Query.Builder.Preload do
@moduledoc false
alias Ecto.Query.Builder
@doc """
Escapes a preload.
A preload may be an atom, a list of atoms or a keyword list
nested as a rose tree.
iex> escape(:foo, [])
{[:foo], []}
iex> escape([foo: :bar], [])
{[foo: [:bar]], []}
... | lib/ecto/query/builder/preload.ex | 0.847448 | 0.529385 | preload.ex | starcoder |
defmodule Jaxon.Path do
alias Jaxon.{ParseError, EncodeError}
@moduledoc ~S"""
Utility module for parsing and encoding JSON path expressions.
"""
@type t :: [String.t() | :all | :root | integer]
@doc ~S"""
Encoding path expressions:
```
iex> Jaxon.Path.encode([:root, "test", 0])
{:ok, "$.test[0]... | lib/jaxon/path.ex | 0.793466 | 0.796767 | path.ex | starcoder |
defmodule NExJsonSchema.Validator.Properties do
alias NExJsonSchema.Schema
alias NExJsonSchema.Validator
@spec validate(Root.t(), Schema.resolved(), NExJsonSchema.json()) :: Validator.errors_with_list_paths()
def validate(root, schema, properties = %{}) do
validated_known_properties = validate_known_proper... | lib/ex_json_schema/validator/properties.ex | 0.816736 | 0.431045 | properties.ex | starcoder |
defmodule ExDiceRoller.Compiler do
@moduledoc """
Provides functionality for compiling expressions into ready-to-execute
functions.
Compiler's main job is to perform the following:
* takes a concrete parse tree, generally outputted by `ExDiceRoller.Parser`,
and recursively navigates the tree
* each expr... | lib/compiler.ex | 0.876845 | 0.73035 | compiler.ex | starcoder |
defmodule Openpayex.Customers do
@moduledoc """
Functions for working with customers at Openpay. Through this API you can:
* create a customer
* get a customer
* delete a customer
* list customers
"""
alias Openpayex.OpenPay.OpenPayHelper
@doc """
Create a customer
## Example:
```
params =... | lib/openpayex/customers.ex | 0.802633 | 0.523238 | customers.ex | starcoder |
defmodule Search.Request do
@moduledoc """
Formats the HTTP search request prams into an Elasticsearch query AND executes the query on Elasticsearch.
"""
require Logger
import Destructure
alias Elastix.Search, as: ExSearch
alias Search.{Paginator, Response, Scope}
alias Plug.Conn
@default_sort %{"... | lib/elastic_jsonapi/request.ex | 0.836371 | 0.418875 | request.ex | starcoder |
defmodule Oban.Telemetry do
@moduledoc """
Telemetry integration for event metrics, logging and error reporting.
### Initialization Events
Oban emits the following telemetry event when an Oban supervisor is started:
* `[:oban, :supervisor, :init]` - when the Oban supervisor is started this will execute
... | lib/oban/telemetry.ex | 0.84412 | 0.821367 | telemetry.ex | starcoder |
defmodule Fountainedge do
@moduledoc """
Documentation for Fountainedge.
"""
alias __MODULE__, as: Workflow
alias Fountainedge.{Schema, Edge, State, Node, Token, OutEdge}
@enforce_keys [:schema, :states]
defstruct schema: %Schema{nodes: [], edges: []}, states: []
def transition %Workflow{} = workflo... | lib/fountainedge.ex | 0.674479 | 0.710164 | fountainedge.ex | starcoder |
defmodule GenServer do
@moduledoc """
A behaviour module for implementing the server of a client-server relation.
A GenServer is a process as any other Elixir process and it can be used
to keep state, execute code asynchronously and so on. The advantage of using
a generic server process (GenServer) implement... | lib/elixir/lib/gen_server.ex | 0.874077 | 0.661527 | gen_server.ex | starcoder |
defmodule AWS.Kinesis.Analytics do
@moduledoc """
"""
@doc """
Adds a streaming source to your Amazon Kinesis application. For conceptual
information, see [Configuring Application
Input](http://docs.aws.amazon.com/kinesisanalytics/latest/dev/how-it-works-input.html).
You can add a streaming source eit... | lib/aws/kinesis_analytics.ex | 0.907515 | 0.702591 | kinesis_analytics.ex | starcoder |
defmodule Number.Phone do
@moduledoc """
Provides functions to convert numbers into formatted phone number strings.
"""
import Number.Macros, only: [is_blank: 1]
@doc """
Formats a number into a US phone number (e.g., (555) 123-9876). You can
customize the format in the options list.
## Parameters
... | lib/number/phone.ex | 0.830697 | 0.553686 | phone.ex | starcoder |
defmodule Saxon.Sax do
@moduledoc """
An overly simplified SAX parser, aiming at reducing memory footprint when dealing with large text nodes.
Supports **only** the following events:
* `:start_document (state)`
* `:end_document (state, conn)`
* `:start_element (element_name, attributes, state)`
* `:... | lib/sax/sax.ex | 0.734881 | 0.636636 | sax.ex | starcoder |
defmodule AWS.ComprehendMedical do
@moduledoc """
Amazon Comprehend Medical extracts structured information from unstructured
clinical text. Use these actions to gain insight in your documents.
"""
@doc """
Gets the properties associated with a medical entities detection job. Use
this operation to get t... | lib/aws/generated/comprehend_medical.ex | 0.853272 | 0.677078 | comprehend_medical.ex | starcoder |
defmodule Fares.FareInfo do
@moduledoc """
Retrieve saved fare data from the file system and map to structs.
"""
alias Fares.Fare
@doc "Load fare info from a CSV file."
@spec fare_info() :: [Fare.t()]
def fare_info() do
"priv/fares-july1.csv"
|> fare_data()
|> Enum.flat_map(&mapper/1)
|>... | apps/fares/lib/fare_info.ex | 0.753104 | 0.62111 | fare_info.ex | starcoder |
defmodule AWS.ApplicationInsights do
@moduledoc """
Amazon CloudWatch Application Insights for .NET and SQL Server
Amazon CloudWatch Application Insights for .NET and SQL Server is a service that
helps you detect common problems with your .NET and SQL Server-based
applications.
It enables you to pinpoint... | lib/aws/generated/application_insights.ex | 0.874453 | 0.581778 | application_insights.ex | starcoder |
defmodule ExUnit.Formatter do
@moduledoc """
This module holds helper functions related to formatting and contains
documentation about the formatting protocol.
Formatters are registered at the `ExUnit.EventManager` event manager and
will be send events by the runner.
The following events are possible:
... | lib/ex_unit/lib/ex_unit/formatter.ex | 0.864925 | 0.741077 | formatter.ex | starcoder |
defmodule Chopperbot.Split.InputTransformer do
alias Chopperbot.Split.Order
@doc """
Transform inputs to a list of orders.
## Examples
iex> transform(["turbo", "10", "kendo", "200"])
{:ok, [{"turbo", 10.0}, {"kendo", 200.0}]}
iex> transform(["ant", "200", "pipe", "100", "share", "-30"])
... | lib/chopperbot/split/parser/input_transformer.ex | 0.84626 | 0.404743 | input_transformer.ex | starcoder |
defmodule AWS.Codeartifact do
@moduledoc """
AWS CodeArtifact is a fully managed artifact repository compatible with
language-native package managers and build tools such as npm, Apache Maven, and
pip.
You can use CodeArtifact to share packages with development teams and pull
packages. Packages can be pul... | lib/aws/generated/codeartifact.ex | 0.924479 | 0.604662 | codeartifact.ex | starcoder |
defmodule FalconPlusApi.Api.Graph do
alias Maxwell.Conn
alias FalconPlusApi.{Util, Sig, Api}
@doc """
* [Session](#/authentication) Required
* dashobard 画图资料
* consol_fun:
* AVERAGE
* MAX
* MIN
### Request
```{
"step": 60,
"start_time": 1481854596,
"hos... | lib/falcon_plus_api/api/graph.ex | 0.557845 | 0.677301 | graph.ex | starcoder |
defmodule EventStore.MonitoredServer do
@moduledoc false
# Starts a `GenServer` process using a given module-fun-args tuple. Monitors
# the started process and attempts to restart it on terminate using an
# exponential backoff strategy. Allows interested processes to be informed
# when the process terminates... | lib/event_store/monitored_server.ex | 0.721841 | 0.433981 | monitored_server.ex | starcoder |
defmodule Keyword do
@moduledoc """
A keyword is a list of tuples where the first element
of the tuple is an atom and the second element can be
any value.
A keyword may have duplicated keys, so it is not strictly
a dictionary. However most of the functions in this module
allows it to behave exactly as a ... | lib/elixir/lib/keyword.ex | 0.921913 | 0.673702 | keyword.ex | starcoder |
defmodule Hui.Encode do
@moduledoc """
Utilities for encoding Solr query and update data structures.
"""
alias Hui.Query
@type solr_query :: Keyword.t | Query.Facet.t | Query.FacetRange.t | Query.FacetInterval.t
@doc """
Encodes list of Solr query keywords to IO data.
"""
@spec encode(solr_query) :... | lib/hui/encode.ex | 0.73782 | 0.477798 | encode.ex | starcoder |
defmodule Multipart do
@moduledoc """
`Multipart` constructs multipart messages.
It aims to produce multipart messages that are compatible with [RFC
2046](https://tools.ietf.org/html/rfc2046#section-5.1) for general use, and
[RFC 7578](https://tools.ietf.org/html/rfc7578) for constructing
`multipart/form-d... | lib/multipart.ex | 0.824568 | 0.484319 | multipart.ex | starcoder |
defmodule Ockam.Examples.SecureChannel.Local do
@moduledoc """
Local node secure channel example
run/0 - run the example. Creates a secure channel and sends a message
send_and_wait/0 - send more messages through the channel
"""
## Ignore no local return for secure channel
@dialyzer [:no_return, {:nowar... | implementations/elixir/ockam/ockam/lib/ockam/examples/secure_channel/local.ex | 0.805747 | 0.415343 | local.ex | starcoder |
defmodule Brex.Result.Base do
@moduledoc """
Tools for doing basic result tuple manipulations.
"""
@type s(x) :: {:ok, x} | {:error, any}
@type t(x) :: :ok | s(x)
@type p() :: :ok | {:error, any}
@type s() :: s(any)
@type t() :: t(any)
@doc """
Wraps value in an `ok` tuple.
Will be inlined at c... | lib/result/base.ex | 0.882472 | 0.472683 | base.ex | starcoder |
defmodule Cache do
@moduledoc """
Functions for manipulating and maintaining the marshal decode caches
"""
@doc """
Add a symbol to the cache.
# Examples
iex> Cache.add_to_symbol_cache(:test, {%{}, %{}})
{%{0 => :test}, %{}}
"""
def add_to_symbol_cache(symbol, {symbol_cache, object_cache}... | lib/cache.ex | 0.777764 | 0.471527 | cache.ex | starcoder |
defmodule UAInspector.Util do
@moduledoc false
@doc """
Generate a regex to be used for engine version detection.
"""
@spec build_engine_regex(name :: String.t()) :: Regex.t()
def build_engine_regex("Gecko") do
# sigil_S used to ensure escaping is kept as-is
# Concatenated expression:
# - [ ](?... | lib/ua_inspector/util.ex | 0.851567 | 0.477859 | util.ex | starcoder |
defmodule VintageNetQMI do
@moduledoc """
Use a QMI-enabled cellular modem with VintageNet
This module is not intended to be called directly but via calls to `VintageNet`. Here's a
typical example:
```elixir
VintageNet.configure(
"wwan0",
%{
type: VintageNetQMI,
vintage_net_qmi: %{
... | lib/vintage_net_qmi.ex | 0.838101 | 0.759961 | vintage_net_qmi.ex | starcoder |
defmodule Ecto.Enum do
@moduledoc """
A custom type that maps atoms to strings.
`Ecto.Enum` must be used whenever you want to keep atom values in a field.
Since atoms cannot be persisted to the database, `Ecto.Enum` converts them
to string when writing to the database and converts them back to atoms when
l... | lib/ecto/enum.ex | 0.822581 | 0.616359 | enum.ex | starcoder |
defmodule APDS9960.Sensor do
@moduledoc "The APDS9960 sensor."
alias APDS9960.{Comm, Sensor, Transport}
@i2c_address 0x39
use TypedStruct
typedstruct do
field(:transport, Transport.t(), enforce: true)
end
@typedoc "The APDS9960 sensor option"
@type option() :: [
{:bus_name, binary}
... | lib/apds9960/sensor.ex | 0.839339 | 0.416945 | sensor.ex | starcoder |
defmodule ForthVM.Words.Flow do
@moduledoc """
Flow words
"""
import ForthVM.Utils
alias ForthVM.Process
# ---------------------------------------------
# Flow control: start end DO do_stack LOOP
# ---------------------------------------------
@doc """
do: ( end_count count -- ) start loop decla... | lib/forthvm/words/flow.ex | 0.729712 | 0.636028 | flow.ex | starcoder |
defmodule ExSieve.Node.Condition do
@moduledoc false
alias ExSieve.Node.{Condition, Attribute}
defstruct values: nil, attributes: nil, predicat: nil, combinator: nil
@type t :: %__MODULE__{}
@basic_predicates ~w(eq
not_eq
cont
not_cont
... | lib/ex_sieve/node/condition.ex | 0.789153 | 0.454896 | condition.ex | starcoder |
defmodule Plymio.Funcio.Enum.Index do
@moduledoc ~S"""
Functions for an Enumerable's Indices
## Documentation Terms
### *index range*
See `Plymio.Funcio.Index` for an explanation of *index range*
See `Plymio.Funcio` for an overview and explanation of other terms used in the documentation.
"""
impor... | lib/funcio/enum/index/index.ex | 0.876304 | 0.492798 | index.ex | starcoder |
defmodule Artemis.Repo.Select do
require Ecto.Query
@moduledoc """
Functions that execute Ecto `select` queries
"""
@doc """
Helper function to parse options and potentially call `select_fields/3` and
`exclude_fields/3`
"""
def select_query(ecto_query, schema, params) do
params = get_select_quer... | apps/artemis/lib/artemis/repo/select.ex | 0.720958 | 0.507873 | select.ex | starcoder |
defmodule Flop.Filter do
@moduledoc """
Defines a filter.
"""
use Ecto.Schema
import Ecto.Changeset
import Flop.Schema
alias Ecto.Changeset
alias Flop.CustomTypes.Any
alias Flop.CustomTypes.ExistingAtom
alias Flop.CustomTypes.Operator
@typedoc """
Represents filter query parameters.
### F... | lib/flop/filter.ex | 0.83498 | 0.702862 | filter.ex | starcoder |
defmodule Shapt.Adapters.Env do
@behaviour Shapt.Adapter
@moduledoc """
An adapter to load toggle state from environment variables or an env file.
"""
@typedoc """
Additional option to configure the toggle.
#{__MODULE__} only defines one additional option that is `:key`.
The key is the name of the envi... | lib/shapt/adapters/env.ex | 0.768038 | 0.575886 | env.ex | starcoder |
defmodule Beamchmark.Suite.Measurements.CpuInfo do
@moduledoc """
Module representing statistics about cpu usage.
Method of measuring:
- Take a snapshot of cpu usage every `cpu_interval` milliseconds
- Calculate the average cpu usage of processor (combining each core usage)
- At the end combine the r... | lib/beamchmark/suite/measurements/cpu_info.ex | 0.787523 | 0.521837 | cpu_info.ex | starcoder |
defmodule Kitto do
@moduledoc """
This is the documentation for the Kitto project.
You can find documentation about developing with Kitto and configuration
options at the [wiki](https://github.com/kittoframework/kitto#support)
By default, Kitto applications depend on the following packages:
* [Plug](ht... | lib/kitto.ex | 0.666497 | 0.466481 | kitto.ex | starcoder |
defmodule App do
@moduledoc """
This is a module that provides simple blockchain example
with Merkle trees.
Using the following technology mocks:
- Using :ets module for transaction store.
- Using sha256 for hashing.
Providing the following functionalities.
- create a block.
- add transacti... | merkle-tree/elixir/lib/app.ex | 0.883864 | 0.532243 | app.ex | starcoder |
defmodule Commanded.Commands.CompositeRouter do
@moduledoc """
Composite router allows you to combine multiple router modules into a single
router able to dispatch any registered command from an included child router.
One example usage is to define a router per context and then combine each
context's router ... | lib/commanded/commands/composite_router.ex | 0.852506 | 0.402715 | composite_router.ex | starcoder |
defmodule CBOR do
@moduledoc """
The Concise Binary Object Representation (CBOR) is a data format
whose design goals include the possibility of extremely small code
size, fairly small message size, and extensibility without the need
for version negotiation. These design goals make it different from
earlier... | lib/cbor.ex | 0.852736 | 0.837753 | cbor.ex | starcoder |
defprotocol Marker.Encoder do
@moduledoc """
The Marker Encoder protocol.
This protocol is used by Marker's compiler to convert different Elixir
data types to it's `Marker.Compiler.element` type.
Elements can be of the type `String.t`,
`Marker.Element.t`, or `Macro.t`, so any implementation of the
`Mark... | lib/marker/encoder.ex | 0.900089 | 0.508544 | encoder.ex | starcoder |
defmodule FakeServer do
alias FakeServer.HTTP.Server
alias FakeServer.Agents.EnvAgent
@moduledoc """
Manage HTTP servers on your tests
"""
@doc """
Runs a test with an HTTP server.
If you need an HTTP server on your test, just write it using `test_with_server/3` instead of `ExUnit.Case.test/3`. Thei... | lib/fake_server.ex | 0.891999 | 0.79649 | fake_server.ex | starcoder |
defmodule AoC.Day10 do
@moduledoc false
def part_1 do
"data/day10-input.txt"
|> File.stream!()
|> Enum.map(&String.trim/1)
|> AoC.Day10.max_detected()
|> elem(1)
end
def part_2 do
map_data =
"data/day10-input.txt"
|> File.stream!()
|> Enum.map(&String.trim/1)
{ba... | lib/aoc/day_10.ex | 0.685107 | 0.522263 | day_10.ex | starcoder |
defmodule OpencensusEcto do
@moduledoc """
Telemetry handler for creating OpenCensus spans from Ecto query events.
"""
import Bitwise
require Record
Record.defrecordp(
:span,
Record.extract(:span, from_lib: "opencensus/include/opencensus.hrl")
)
Record.defrecordp(
:span_ctx,
Record.e... | lib/opencensus_ecto.ex | 0.823931 | 0.494995 | opencensus_ecto.ex | starcoder |
defmodule OMG.Watcher.State.Transaction.Payment do
@moduledoc """
Internal representation of a raw payment transaction done on Plasma chain.
This module holds the representation of a "raw" transaction, i.e. without signatures nor recovered input spenders
"""
alias OMG.Watcher.Crypto
alias OMG.Output
al... | apps/omg_watcher/lib/omg_watcher/state/transaction/payment.ex | 0.894421 | 0.625295 | payment.ex | starcoder |
defmodule AWS.Firehose do
@moduledoc """
Amazon Kinesis Data Firehose API Reference
Amazon Kinesis Data Firehose is a fully managed service that delivers real-time
streaming data to destinations such as Amazon Simple Storage Service (Amazon
S3), Amazon Elasticsearch Service (Amazon ES), Amazon Redshift, and... | lib/aws/generated/firehose.ex | 0.918613 | 0.684343 | firehose.ex | starcoder |
defmodule Tint.Distance do
@moduledoc """
A module providing functions for color distance calculations and a behavior
to implement custom distance algorithms.
"""
alias Tint.DistanceCache
@typedoc """
A function that allows calculating the distance between two colors.
"""
@type distance_fun :: (Tint... | lib/tint/distance.ex | 0.91183 | 0.82386 | distance.ex | starcoder |
defmodule MementoWeb.QsParamsValidator do
@default_page 1
@default_per_page 25
@default_type :all
@moduledoc """
This module validates and parses a map with string keys representing a query string
and returns a stable map that can be used with database queries.
When the params map doesn't have necessary... | lib/memento_web/qs_params_validator.ex | 0.846371 | 0.401893 | qs_params_validator.ex | starcoder |
defmodule CodeCorps.ModelCase do
@moduledoc """
This module defines the test case to be used by
model tests.
You may define functions here to be used as helpers in
your model tests. See `errors_on/2`'s definition as reference.
Finally, if the test case interacts with the database,
it cannot be async. Fo... | test/support/model_case.ex | 0.909217 | 0.737158 | model_case.ex | starcoder |
defmodule Philosopher do
@moduledoc """
Documentation for `Philosophers`.
"""
@doc """
Hello world.
## Examples
iex> Philosophers.hello()
:world
"""
def hello do
:world
end
@dream 800
@eat 100
@delay 0
@timeout 1000
# Create a new philosopher process.
def start(hung... | philosophers/lib/philosophers.ex | 0.778313 | 0.446253 | philosophers.ex | starcoder |
defmodule Imglab do
@moduledoc """
Provides a set of functions to work with imglab services.
"""
alias Imglab.Source
alias Imglab.Signature
alias Imglab.Utils
@doc """
Returns a formatted URL `string` with the specified parameters.
* `source_name_or_source` must be a `string` indicating a source na... | lib/imglab.ex | 0.913126 | 0.651105 | imglab.ex | starcoder |
defmodule SingletonSupervisor do
@moduledoc ~S"""
A singleton supervisor within an erlang cluster.
`SingletonSupervisor` by defualt uses `{:global, SingletonSupervisor}` as name, and further
instances with the same name will not start a supervisor but a placeholder to monitor
the already started one.
When... | lib/singleton_supervisor.ex | 0.723016 | 0.419321 | singleton_supervisor.ex | starcoder |
defmodule Routemaster.Drains.IgnoreStale do
@moduledoc """
Drops stale events from the current payload to only include
events that reflect an entity state that is _more recent_ than
previously received events.
Helps to ignore events received out-of-order (e.g. an `update`
event about en entity received a... | lib/routemaster/drain/drains/ignore_stale.ex | 0.72526 | 0.547041 | ignore_stale.ex | starcoder |
defmodule ExploringMars.Mission do
@moduledoc """
This module defines a mission. A mission encapsulates a single run of a probe,
being defined by a single set of problem parameters (bounds, initial position,
and instructions).
Calling `ExploringMars.Mission.run/3` with these parameters will produce the
sta... | lib/exploring_mars/mission.ex | 0.923876 | 0.876898 | mission.ex | starcoder |
defmodule Concentrate.VehiclePosition do
@moduledoc """
Structure for representing a transit vehicle's position.
"""
import Concentrate.StructHelpers
defstruct_accessors([
:id,
:trip_id,
:stop_id,
:label,
:license_plate,
:latitude,
:longitude,
:bearing,
:speed,
:odomet... | lib/concentrate/vehicle_position.ex | 0.804943 | 0.65055 | vehicle_position.ex | starcoder |
defmodule Visualizer.Data do
require Logger
defp initial_state() do
%{nodes: [], links: []}
end
def start_link() do
Agent.start_link(fn -> initial_state() end, name: __MODULE__)
end
def add_node(name, group) do
Agent.update(__MODULE__, fn state ->
%{nodes: nodes, links: links} = state
... | lib/visualizer/data.ex | 0.551574 | 0.527925 | data.ex | starcoder |
defmodule Vow do
@moduledoc """
QUICK SUMMARY
SHOW HOW TO USE (conform/2, unform/2, gen/2)
`Vow.Conformable`
`Vow.Generatable`
## Conformable Types
The following Elixir types have `Vow.Conformable` implementations and their
behavior will be discussed in their corresponding section below. They are
... | lib/vow.ex | 0.892399 | 0.924108 | vow.ex | starcoder |
defmodule ISO8583.DataTypes do
@moduledoc """
This module provides utilities for validation `ISO 8583` field data types based the description below pulled
from a postilion interface documentation. Each character gets validated against the regex that defines each fata type.
- `a` - Alphabetic characters, `A` th... | lib/iso_8583/data_types/data_types.ex | 0.863449 | 0.748076 | data_types.ex | starcoder |
defmodule Code do
@moduledoc """
The Code module is responsible to manage code compilation,
code evaluation and code loading.
It complements (Erlang's code module)[1] to add behavior
which is specific to Elixir.
[1]: (www.erlang.org/doc/man/code.html)
"""
@doc """
Returns all the loaded files.
... | lib/elixir/lib/code.ex | 0.846117 | 0.446615 | code.ex | starcoder |
defmodule EthEvent do
@moduledoc """
[](https://travis-ci.org/etherharvest/eth_event) [](https://hex.pm/packages/eth_event) [ do
neurons = 1..num |> Enum.map(fn _ -> Neuron.create end)
%Layer{neurons: neurons}
end
def connect(src, dest) do
for src_pid <- src.neurons, dest_pid <- dest.neurons do... | lib/neural_network/layer.ex | 0.701202 | 0.552962 | layer.ex | starcoder |
defmodule ExPixBRCode.ValueObject do
@moduledoc """
Value object is a data structure that has no identity.
We use value objects as a means of defining a data structure with its validations.
Also, it has helpers for turning structs into maps (the opposite of
`ExPixBRCode.Changests.cast_and_apply`).
"""
... | lib/ex_pix_brcode/value_object.ex | 0.820865 | 0.5119 | value_object.ex | starcoder |
defmodule Typo.Font.TrueTypeFont.Kern do
@moduledoc false
alias Typo, as: T
alias Typo.Font.TrueTypeFont
alias Typo.Font.TrueTypeFont.Kern
@type pairs_map :: %{optional({T.uint8(), T.uint16(), T.uint16()}) => number()}
@type t :: %__MODULE__{
kern_pairs: pairs_map()
}
defstruct kern... | lib/typo/font/true_type_font/kern.ex | 0.804252 | 0.476701 | kern.ex | starcoder |
defmodule ChangesetMerger.ExpiresAt do
@moduledoc """
Several helper functions to generate date/time values to represent
an expiring value.
"""
@doc """
Generate an unguessable (non incremented) public token_expires_at
## Examples
iex> ChangesetMerger.ExpiresAt.generate("2017-09-21T04:50:34-05:00... | lib/changeset_merger/expires_at.ex | 0.826397 | 0.413714 | expires_at.ex | starcoder |
defmodule Attempt.Bucket.Dynamic do
@moduledoc """
Implementation of a Dynamic Token Bucket
This token bucket is designed to maximise
throughput without overloading the service
it is protecting.
For applications that require rate limiting
the token bucket `Attempt.Bucket.Token` is
recommended.
The ... | lib/attempt/bucket/dynamic.ex | 0.806243 | 0.4099 | dynamic.ex | starcoder |
defmodule Wonderland.Data.Either do
use Calculus
use Wonderland.TypeClass
use Wonderland.Combinator
@moduledoc """
Classic sum type which represents 2 alternatives
- Bifunctor
- Functor (as right)
- Monad (as right)
- Applicative (as right)
"""
@typep a :: term
@typep b :: term
@type t(a, b... | lib/wonderland/data/either.ex | 0.898031 | 0.898944 | either.ex | starcoder |
defmodule SanbaseWeb.Graphql.BlockchainTypes do
use Absinthe.Schema.Notation
object :blockchain_metadata do
field(:blockchain, non_null(:string))
field(:slug, non_null(:string))
field(:ticker, non_null(:string))
field(:infrastructure, non_null(:string))
field(:created_on, :datetime)
# Metr... | lib/sanbase_web/graphql/schema/types/blockchain_types.ex | 0.912864 | 0.473414 | blockchain_types.ex | starcoder |
defmodule StarkInfra.CreditNote.Transfer do
alias __MODULE__, as: Transfer
alias StarkInfra.Utils.Check
@moduledoc """
Groups Transfer related functions
"""
@doc """
CreditNote signer's information.
## Parameters (required):
- `:name` [string]: receiver full name. ex: "<NAME>"
- `:tax_id` [st... | lib/credit_note/transfer.ex | 0.8618 | 0.550607 | transfer.ex | starcoder |
defmodule MultiFormat do
@moduledoc """
`MultiFormat` is a helper for `Phoenix.Router` when working with multi format
routes.
It allows routes to match for one or more extensions (or none) without
having to manually define all of them and assigning pipelines with the
matching `plug :accepts, …`.
## Ex... | lib/multi_format.ex | 0.870198 | 0.467636 | multi_format.ex | starcoder |
defmodule EEx.SyntaxError do
defexception [:message, :file, :line, :column]
@impl true
def message(exception) do
"#{exception.file}:#{exception.line}:#{exception.column}: #{exception.message}"
end
end
defmodule EEx do
@moduledoc ~S"""
EEx stands for Embedded Elixir. It allows you to embed
Elixir cod... | lib/eex/lib/eex.ex | 0.828939 | 0.524943 | eex.ex | starcoder |
defmodule Mix.Project do
@moduledoc """
Defines and manipulates Mix projects.
A Mix project is defined by calling `use Mix.Project` in a module, usually
placed in `mix.exs`:
defmodule MyApp.MixProject do
use Mix.Project
def project do
[
app: :my_app,
ve... | lib/mix/lib/mix/project.ex | 0.872239 | 0.536191 | project.ex | starcoder |
defmodule Edeliver do
@moduledoc """
Execute edeliver tasks on the production / staging nodes.
This internal module provides functions on the nodes which are
used by some edeliver tasks e.g. to get the running release version
(`edeliver version`), show the pending migrations
(`edeliver show migra... | lib/edeliver.ex | 0.90372 | 0.788543 | edeliver.ex | starcoder |
defmodule ExACN.PDU.Flags do
defstruct length: false, vector: false, header: false, data: false
@moduledoc """
Functions for processing flags at the beginning of PDUs.
These flags are encoded in the first four bits of the PDU and indicate if it
shares common data with the previous packet or requires a longer... | lib/ex_acn/pdu/flags.ex | 0.81309 | 0.717556 | flags.ex | starcoder |
defmodule Sparklinex.MogrifyDraw do
import Mogrify
def create_canvas(width, height, background_color) do
%Mogrify.Image{path: "test.png", ext: "png"}
|> custom("size", "#{width}x#{height}")
|> canvas(background_color)
end
def draw_line(canvas, {{x1, y1}, {x2, y2}}) do
custom(
canvas,
... | lib/sparklinex/mogrify_draw.ex | 0.627495 | 0.619155 | mogrify_draw.ex | starcoder |
defmodule DataMatrix.Encode do
@moduledoc false
@symbol_capacity Code.eval_file("lib/datamatrix/static/total_data_codewords.tuple") |> elem(0)
@ascii_digit 48..57
@ascii_pad 129
@upper_shift 235
@doc """
## Examples
iex> DataMatrix.Encode.encode("1234569")
{:ok, 1, <<142, 164, 186, 58, 129>... | lib/datamatrix/encode.ex | 0.591605 | 0.405449 | encode.ex | starcoder |
defmodule Appsignal.TransactionRegistry do
@moduledoc """
Internal module which keeps a registry of the transaction handles
linked to their originating process.
This is used on various places to link a calling process to its transaction.
For instance, the `Appsignal.ErrorHandler` module uses it to be able t... | lib/appsignal/transaction/registry.ex | 0.858274 | 0.505005 | registry.ex | starcoder |
defmodule EctoImmigrant.Migration do
@moduledoc """
Data migrations are used to modify the data in your database over time.
This module provides many helpers for migrating the database,
allowing developers to use Elixir to alter their storage in
a way that is database independent.
Here is an example:
... | lib/migration.ex | 0.841647 | 0.535949 | migration.ex | starcoder |
defmodule Cog.Command.Service.Memory do
@moduledoc """
Stores state isolated to a specific pipeline. Tokens originally created by
the token service are used to namespace each key, so pipelines have their own
keyspace. When the pipeline ends successfully or crashes the memory service
is notifed, and keys owned... | lib/cog/command/service/memory.ex | 0.82347 | 0.54153 | memory.ex | starcoder |
defmodule Membrane.Dashboard.Charts.Full do
@moduledoc """
Module responsible for preparing data for uPlot charts when they are being entirely reloaded.
Every chart visualizes one particular metric of pipelines. Chart data returned
by query is a list of maps (one for every chart) which consist of:
- series -... | lib/membrane_dashboard/charts/full.ex | 0.925592 | 0.682765 | full.ex | starcoder |
defmodule Xgit.DirCache do
@moduledoc ~S"""
A directory cache records the current (intended) contents of a working tree
when last scanned or created by git.
In Xgit, the `DirCache` structure is an abstract, in-memory data structure
without any tie to a specific persistence mechanism. Persistence is implement... | lib/xgit/dir_cache.ex | 0.908933 | 0.659309 | dir_cache.ex | starcoder |
defmodule IncrementalSlug do
@moduledoc """
Store a unique slug.
Append an increment (1-10), if this slug is already taken.
## Example
| id | title | slug |
|----|--------------|------------------|
| 1 | Slug Doe | Slug-Doe |
| 2 | Slug Doe | Slug-Doe-1 |
... | backend/my_deps/incremental_slug/lib/incremental_slug.ex | 0.893913 | 0.765681 | incremental_slug.ex | starcoder |
defmodule Attempt.Bucket.Token do
@moduledoc """
Implementation of a Token Bucket
A token bucket provides a form of [rate limiting](https://en.wikipedia.org/wiki/Token_bucket)
This implmentation is designed to allow for both
synchronous and asynchronous token requests. The
intent is to simplify the highe... | lib/attempt/bucket/token.ex | 0.817246 | 0.47524 | token.ex | starcoder |
defmodule Rules.Graph.Brut.Inversion_ do
def rules_result, do: Enum.random(["", "12"])
def generate_zones do
[
%{id: "123", name: "Cartier EU"},
%{id: "11", name: "Cartier Asia"},
%{id: "41", name: "Cartier NA"},
]
end
def generate_stocks do
[
%{location: "PW", location_typ... | rules/lib/rules_inversion.ex | 0.540681 | 0.512876 | rules_inversion.ex | starcoder |
defmodule FusionAuth do
require Logger
@moduledoc """
The `FusionAuth` module provides functions for building a dynamic HTTP client as well as standardizing the responses returned from the FusionAuth API.
## Examples
iex> FusionAuth.client("http://localhost:9011", "<KEY>", "6b40f9d6-cfd8-4312-bff8-b082... | lib/fusion_auth.ex | 0.929544 | 0.585723 | fusion_auth.ex | starcoder |
defmodule Google.Bigtable.Admin.V2.Instance do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
name: String.t(),
display_name: String.t(),
state: integer,
type: integer,
labels: %{String.t() => String.t()}
}
defstruct [:name, :dis... | lib/grpc/admin/instance.pb.ex | 0.692538 | 0.406774 | instance.pb.ex | starcoder |
if Code.ensure_loaded?(Decorator.Define) do
defmodule Nebulex.Hook do
@moduledoc """
Pre/Post Hooks
Since `v2.0.0`, pre/post hooks are not supported and/or handled by `Nebulex`
itself. Hooks feature is not a common use-case and also it is something that
can be be easily implemented on top of the ... | lib/nebulex/hook.ex | 0.894417 | 0.556821 | hook.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.