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 Rill.Consumer do
defmodule Defaults do
def poll_interval_milliseconds, do: 100
def batch_size, do: 1000
def position_update_interval, do: 100
end
defstruct position: 1,
timer_ref: nil,
messages: [],
identifier: nil,
handlers: [],
s... | lib/rill/consumer.ex | 0.832441 | 0.402216 | consumer.ex | starcoder |
defmodule Discord.SortedSet do
@moduledoc """
SortedSet provides a fast, efficient, rust-backed data structure that stores terms in Elixir
sort order and ensures the uniqueness of members.
See the [README](/sorted_set_nif/doc/readme.html) for more details about
"""
alias Discord.SortedSet.{NifBridge, Types... | lib/sorted_set.ex | 0.875055 | 0.63477 | sorted_set.ex | starcoder |
defmodule ExPlasma.Encoding do
@moduledoc """
Provides the common encoding functionality we use across
all the transactions and clients.
"""
@doc """
Converts binary and integer values into its hex string
equivalent.
## Examples
# Convert a raw binary to hex
iex> raw = <<29, 246, 47, 41, ... | lib/ex_plasma/encoding.ex | 0.892557 | 0.541106 | encoding.ex | starcoder |
defmodule Exq.Worker.Server do
@moduledoc """
Worker process is responsible for the parsing and execution of a Job.
It then broadcasts results to Stats / Manager.
Currently uses the `terminate` callback to track job success/failure.
## Initialization:
* `job_serialized` - Full JSON payload of the Job.
... | lib/exq/worker/server.ex | 0.754373 | 0.434341 | server.ex | starcoder |
defmodule ShEx.TripleExpressionReference do
@moduledoc false
def matches(triple_expression_ref, triples, graph, schema, association, state) do
triple_expression_ref
|> triple_expression_with_id(state)
|> ShEx.TripleExpression.matches(triples, graph, schema, association, state)
end
def min_cardinal... | lib/shex/shape_expressions/triple_expression_reference.ex | 0.735642 | 0.544196 | triple_expression_reference.ex | starcoder |
defmodule AMQPX.Receiver.Standard do
@doc """
Called on every incoming message.
The payload type will depend on the content type of the incoming message and
the codec registered for that content type. If there is no matching codec
for that content type, the payload will be passed as is.
"""
@callback han... | lib/amqpx/receiver/standard.ex | 0.873889 | 0.408277 | standard.ex | starcoder |
defmodule Bamboo.GmailAdapter do
@moduledoc """
Sends email using the Gmail API with OAuth2 authentication
There are a few preconditions that must be met before this adapter can be used to send email:
1. Admin access to a GSuite account
2. Implement [server-side authorization](https://developers.google.com/g... | lib/bamboo/adapters/gmail_adapter.ex | 0.734405 | 0.526343 | gmail_adapter.ex | starcoder |
defmodule Oban.Notifier do
@moduledoc """
The `Notifier` coordinates listening for and publishing notifications for events in predefined
channels.
Every Oban supervision tree contains a notifier process, registered as `Oban.Notifier`, which
itself maintains a single connection with an app's database. All inc... | lib/oban/notifier.ex | 0.908964 | 0.537223 | notifier.ex | starcoder |
defmodule ExploringMars.MissionRunner do
@moduledoc """
File I/O handling module. Reads parameters from an `io_device` (which should
be either a file or `:stdio` and runs each mission using the
`ExploringMars.Mission` module.
This module should change if the specification of how mission parameters are
lai... | lib/exploring_mars/mission_runner.ex | 0.772745 | 0.632148 | mission_runner.ex | starcoder |
defmodule Nebulex.Adapters.Local.Generation do
@moduledoc """
Generational garbage collection process.
The generational garbage collector manage the heap as several sub-heaps,
known as generations, based on age of the objects. An object is allocated
in the youngest generation, sometimes called the nursery, a... | lib/nebulex/adapters/local/generation.ex | 0.913669 | 0.652131 | generation.ex | starcoder |
defprotocol FunWithFlags.Group do
@moduledoc """
Implement this protocol to provide groups.
Group gates are similar to actor gates, but they apply to a category of entities rather than specific ones. They can be toggled on or off for the _name of the group_ (as an atom) instead of a specific term.
Group gates... | lib/fun_with_flags/protocols/group.ex | 0.899301 | 0.552841 | group.ex | starcoder |
defmodule Graphvix.DotHelpers do
@moduledoc """
This module contains a set of helper methods for converting Elixir graph data
into its DOT representation.
"""
@doc """
Convert top-level node and edge properties for a graph or subgraph into
correct DOT notation.
## Example
iex> graph = Graph.new... | lib/graphvix/dot_helpers.ex | 0.874654 | 0.512022 | dot_helpers.ex | starcoder |
defmodule Wanon.Integration.StateServer do
@moduledoc """
Tracks the current state for response sequences.
For a given path, there is a sequence of responses. After the sequence is finished
the genserver will keep answering with the last one.
The replies map contains the endpoint as a key and a list of answ... | integration/support/telegram_api.ex | 0.65202 | 0.520009 | telegram_api.ex | starcoder |
if Code.ensure_loaded?(Plug) do
defmodule Triplex.Plug do
@moduledoc """
This module have some basic functions for our triplex plugs.
The plugs we have for now are:
- `Triplex.ParamPlug` - loads the tenant from a body or query param
- `Triplex.SessionPlug` - loads the tenant from a session param... | lib/triplex/plugs/plug.ex | 0.712632 | 0.417895 | plug.ex | starcoder |
defmodule ESpec.DocExample do
@moduledoc """
Defines the 'extract' method with parse module content and return `%ESpec.DocExample{}` structs.
The struct is used by 'ESpec.DocTest' module to build the specs.
"""
@doc """
DocExample struct:
lhs - console input,
rhs - console output,
fun_arity - {fun, a... | lib/espec/doc_example.ex | 0.720663 | 0.569553 | doc_example.ex | starcoder |
defmodule Thrift do
@moduledoc ~S"""
[Thrift](https://thrift.apache.org/) implementation for Elixir including a
Thrift IDL parser, a code generator, and an RPC system
## Thrift IDL Parsing
`Thrift.Parser` parses [Thrift IDL](https://thrift.apache.org/docs/idl) into
an abstract syntax tree used for code ge... | lib/thrift.ex | 0.912789 | 0.686048 | thrift.ex | starcoder |
defmodule Grizzly.ZWave.CommandClasses.SceneActuatorConf do
@moduledoc """
"SceneActuatorConf" Command Class
The Scene Actuator Configuration Command Class is used to configure scenes settings for a node
supporting an actuator Command Class, e.g. a multilevel switch, binary switch etc.
"""
@behaviour Griz... | lib/grizzly/zwave/command_classes/scene_actuator_conf.ex | 0.867836 | 0.466116 | scene_actuator_conf.ex | starcoder |
defmodule Chronex do
##== Preamble ===========================================================
@moduledoc """
# Chronex
A small library to seamlessly add code instrumentation to your Elixir
projects.
The documentation for this project is available at
[HexDocs](https://hexdocs.pm/chronex/api-reference.htm... | lib/chronex.ex | 0.727201 | 0.845496 | chronex.ex | starcoder |
defmodule EWallet.Web.StartAfterPaginator do
@moduledoc """
The StartAfterPaginator allows querying of records by specified `start_after` and `start_by`.
They take in a query, break the query down,
then selectively query only records that are after the given `start_after`'s scope.
If the `start_after` is ni... | apps/ewallet/lib/ewallet/web/paginators/start_after_paginator.ex | 0.851444 | 0.736543 | start_after_paginator.ex | starcoder |
defmodule Flop.Phoenix do
@moduledoc """
View helper functions for Phoenix and Flop.
## Pagination
`Flop.meta/3` returns a `Flop.Meta` struct, which holds information such as
the total item count, the total page count, the current page etc. This is all
you need to render pagination links. `Flop.run/3`, `F... | lib/flop_phoenix.ex | 0.840226 | 0.506347 | flop_phoenix.ex | starcoder |
defmodule ExPoloniex.Trading do
@moduledoc """
Module for Poloniex Trading API methods
https://poloniex.com/support/api/
"""
alias ExPoloniex.{DepositsAndWithdrawals, Api}
@doc """
Returns all of your available balances
"""
def return_balances do
case Api.trading("returnBalances") do
{:ok... | lib/ex_poloniex/trading.ex | 0.81582 | 0.425426 | trading.ex | starcoder |
defmodule Accent.Scopes.Revision do
import Ecto.Query, only: [from: 2]
@doc """
## Examples
iex> Accent.Scopes.Revision.from_project(Accent.Revision, "test")
#Ecto.Query<from r0 in Accent.Revision, join: l1 in assoc(r0, :language), where: r0.project_id == ^\"test\", order_by: [desc: r0.master, asc: l1.n... | lib/accent/scopes/revision.ex | 0.567098 | 0.469277 | revision.ex | starcoder |
defmodule Strukt.Typespec do
@moduledoc false
defstruct [:caller, :info, :fields, :embeds]
@type t :: %__MODULE__{
# The module where the struct is being defined
caller: module,
# Metadata about all fields in the struct
info: %{optional(atom) => map},
# A list o... | lib/typespec.ex | 0.746416 | 0.512083 | typespec.ex | starcoder |
defmodule Hui do
@moduledoc """
Hui 辉 ("shine" in Chinese) is an [Elixir](https://elixir-lang.org) client and library for
[Solr enterprise search platform](http://lucene.apache.org/solr/).
### Usage
- Searching Solr: `q/1`, `q/6`, `search/2`, `search/7`
- Updating: `update/3`, `delete/3`, `delete_by_quer... | lib/hui.ex | 0.881008 | 0.745468 | hui.ex | starcoder |
defmodule MarcoPolo.REST do
@moduledoc """
This module provides an interface to the functionalities exposed by OrientDB's
REST API.
Not all the functionalities that OrientDB exposes are available through the
binary protocol that `MarcoPolo` uses: some of them are only available through
the HTTP REST API. T... | lib/marco_polo/rest.ex | 0.835349 | 0.602062 | rest.ex | starcoder |
defmodule Cards do
@moduledoc """
This module provides methods to handle `Cards` operations like shuffle and creates.
"""
@doc """
This method creates a full deck
## Examples
iex> Cards.create_deck
["Ace Spades", "Two Spades", "Three Spades", "Five Spades", "Ace Clubs",
"Two Clubs", "Thre... | cards/lib/cards.ex | 0.833053 | 0.580174 | cards.ex | starcoder |
defmodule Dynamo.Static do
@moduledoc false
use GenServer.Behaviour
@doc """
Looks up a static asset in the given Dynamo. If the
static asset exists, it returns the asset path appended
with a query string containing the last modification
time of the asset.
"""
def lookup(dynamo, path) do
path = ... | lib/dynamo/static.ex | 0.620966 | 0.440048 | static.ex | starcoder |
defmodule Esolix.Langs.Piet do
@moduledoc """
Documentation for the Piet Module
"""
# Data Structure used
alias Esolix.DataStructures.Stack
import ExUnit.CaptureIO
@typedoc """
List containing lines of pixels.
"""
@type pixels :: list(pixel_line())
@typedoc """
List of pixels, represented as... | lib/langs/piet.ex | 0.841435 | 0.485661 | piet.ex | starcoder |
defmodule Intcode do
def state_to_int_list(state) do
state |> String.split(",") |> Enum.map(fn s -> String.to_integer(String.trim(s)) end)
end
def state_to_int_map(state) do
state
|> String.split(",")
|> Enum.with_index()
|> Enum.map(fn {v, idx} -> {idx, String.to_integer(String.trim(v))} end... | lib/intcode.ex | 0.638159 | 0.473353 | intcode.ex | starcoder |
defmodule Kiq.Reporter do
@moduledoc """
Job handling is performed by reporters, which are customized `GenStage`
consumers.
This module specifies the reporter behaviour and provies an easy way to
define new reporters via `use Kiq.Reporter`. The `using` macro defines all
necessary `GenStage` functions and d... | lib/kiq/reporter.ex | 0.902382 | 0.469581 | reporter.ex | starcoder |
defmodule Cryptopunk.Crypto.Dogecoin do
@moduledoc """
Dogecoin address generation logic. It's similar to bitcoin legacy addresses.
"""
alias Cryptopunk.Crypto.Bitcoin
alias Cryptopunk.Key
@version_bytes %{
mainnet: 30,
testnet: 113
}
@doc """
Generate a dogecoin address.
It accepts thre... | lib/cryptopunk/crypto/dogecoin.ex | 0.846006 | 0.42913 | dogecoin.ex | starcoder |
defmodule BahnEx do
@moduledoc """
An Elixir wrapper for the [Deutsche Bahn (DB) Fahrplan API](https://developer.deutschebahn.com/store/apis/info?name=Fahrplan&version=v1&provider=DBOpenData)
"""
@doc """
Get information about locations matching the given name or name fragment `name_or_fragment`
Returns a... | lib/bahn_ex.ex | 0.866048 | 0.544983 | bahn_ex.ex | starcoder |
defmodule MateriaCommerce.Deliveries do
@moduledoc """
The Deliveries context.
"""
import Ecto.Query, warn: false
@repo Application.get_env(:materia, :repo)
alias MateriaCommerce.Deliveries.Delivery
@doc """
iex(1)> Application.put_env(:materia_utils, :calender_locale, "Asia/Tokyo")
iex(2)> results... | lib/materia_commerce/deliveries/deliveries.ex | 0.545528 | 0.448004 | deliveries.ex | starcoder |
defmodule Sanbase.Clickhouse.Metric.HistogramMetric do
import Sanbase.DateTimeUtils, only: [str_to_sec: 1]
import Sanbase.Clickhouse.Metric.HistogramSqlQuery
alias Sanbase.ClickhouseRepo
@spent_coins_cost_histograms ["price_histogram", "spent_coins_cost", "all_spent_coins_cost"]
def histogram_data("age_dis... | lib/sanbase/clickhouse/metric/histogram_metric.ex | 0.838316 | 0.609669 | histogram_metric.ex | starcoder |
defmodule Fex.MatchModel do
defmodule Model do
defstruct lambda: 1.0,
mu: 1.0,
stoppage1: 0,
stoppage2: 0,
status: {:first_half, 0, {0,0}}
end
@home_advantage 1.37
@type minute :: non_neg_integer
@type score :: {non_neg_integer, non_neg_integer}
@type status :: {:first_half, minute, s... | lib/match_model.ex | 0.766556 | 0.476762 | match_model.ex | starcoder |
defmodule AWS.CodeBuild do
@moduledoc """
AWS CodeBuild
AWS CodeBuild is a fully managed build service in the cloud. AWS CodeBuild
compiles your source code, runs unit tests, and produces artifacts that are
ready to deploy. AWS CodeBuild eliminates the need to provision, manage,
and scale your own build s... | lib/aws/code_build.ex | 0.810329 | 0.654853 | code_build.ex | starcoder |
defmodule Fiet do
@moduledoc """
Fiet is a feed parser which aims to provide extensibility, speed, and standard
compliance.
Currently Fiet supports [RSS 2.0](cyber.harvard.edu/rss/rss.html) and [Atom](https://tools.ietf.org/html/rfc4287).
## Feed format detecting
There are two main functions in this modu... | lib/fiet.ex | 0.858422 | 0.716863 | fiet.ex | starcoder |
defmodule BSV.Message do
@moduledoc """
The Message module provides functions for encrypting, decrypting, signing and
verifying arbitrary messages using Bitcoin keys.
Message encryption uses the Electrum-compatible BIE1 ECIES algorithm. Message
signing uses the Bitcoin Signed Message algorithm. Both alorithm... | lib/bsv/message.ex | 0.912646 | 0.490053 | message.ex | starcoder |
defmodule Crdt.ORSet do
@moduledoc """
An OR-Set Without Tombstones (ORSWOT) allows for insertions and removals of elements. Should an
insertion and removal be concurrent, the insertion wins.
"""
defstruct clock: %{}, entries: %{}, deferred: %{}
alias Crdt.VectorClock
@type t :: %__MODULE__{
c... | lib/crdt/or_set.ex | 0.868785 | 0.551091 | or_set.ex | starcoder |
defmodule Mongo.Collection do
@moduledoc """
Module holding operations that can be performed on a collection (find, count...)
Usage:
iex> _collection = Mongo.Helpers.test_collection("anycoll")
...> Mongo.Helpers.test_collection("anycoll") |> Mongo.Collection.count
{:ok, 6}
`count()` or `cou... | lib/mongo_collection.ex | 0.87877 | 0.425904 | mongo_collection.ex | starcoder |
defmodule Hocon.Tokens do
@moduledoc """
This module is responsible for pushing tokens to the list of tokens. It handles the cases of whitespaces and new lines.
Whitespaces are important in cases of unquoted strings und new lines are important for merging objects and arrays.
* whitespace are almost ignored
... | lib/hocon/tokens.ex | 0.885139 | 0.956022 | tokens.ex | starcoder |
defmodule BSV.OutPoint do
@moduledoc """
An OutPoint is a data structure representing a reference to a single
`t:BSV.TxOut.t/0`.
An OutPoint consists of a 32 byte `t:BSV.Tx.hash/0` and 4 byte
`t:BSV.TxOut.vout/0`.
Conceptually, an OutPoint can be seen as an edge in a graph of Bitcoin
transactions, linki... | lib/bsv/out_point.ex | 0.929768 | 0.77827 | out_point.ex | starcoder |
defmodule Grizzly.ZWave.Commands.AssociationReport do
@moduledoc """
Report the destinations for the given association group
Params:
* `:grouping_identifier` - the grouping identifier for the the association
group (required)
* `:max_nodes_supported` - the max number of destinations for the
a... | lib/grizzly/zwave/commands/association_report.ex | 0.764276 | 0.424472 | association_report.ex | starcoder |
defmodule Drop do
@moduledoc """
Functions for caclulating free-fall in a vaccuum and in constant gravity
"""
@doc """
the gravity-parallel speed of a dropped object in a vaccuum.
Parameters
----------
A tuple of:
{
`planemo`: atom
identifies the PLANEtary M... | drop.ex | 0.88981 | 0.750918 | drop.ex | starcoder |
defmodule Goodbot.Scenarios.FindShops do
@moduledoc """
This module defines a scenario that basically sets the logic that
should happen given specific params
"""
# We alias the Templates module as well as the Apis module,
# so that we don't have to write so much later
alias Goodbot.Templates
alias Go... | lib/goodbot/scenarios/find_shops.ex | 0.748536 | 0.543045 | find_shops.ex | starcoder |
defmodule Cldr.Message do
@moduledoc """
Implements the [ICU Message Format](http://userguide.icu-project.org/formatparse/messages)
with functions to parse and interpolate messages.
"""
alias Cldr.Message.{Parser, Interpreter, Print}
import Kernel, except: [to_string: 1, binding: 1]
defdelegate format_li... | lib/cldr/messages/messages.ex | 0.896744 | 0.65619 | messages.ex | starcoder |
defmodule WebDriver.Element do
@moduledoc """
This module handles WebDriver calls directed at specific DOM elements.
They all take an WebDriver.Element struct as the first argument.
The WebDriver.Element struct is supposed to be an opaque data type and
is not meant to be manipulated. It contains the ... | lib/webdriver/element.ex | 0.810479 | 0.825871 | element.ex | starcoder |
defmodule Supabase.Storage do
@moduledoc """
Module to work with Supabase storage and the same API the
[storage-js](https://github.com/supabase/storage-js) client provides.
"""
alias Supabase.Connection
alias Supabase.Storage.Buckets
alias Supabase.Storage.Objects
@spec list_buckets(Supabase.Connecti... | lib/supabase/storage.ex | 0.89737 | 0.446193 | storage.ex | starcoder |
defmodule ExlasticSearch.Query do
@moduledoc """
Elasticsearch query building functions. Basic usage for queryable Queryable is something like:
```
Queryable.search_query()
|> must(math(field, value))
|> should(match_phrash(field, value, opts))
|> filter(term(filter_field, value))
|> realize()
```
... | lib/exlasticsearch/query.ex | 0.913368 | 0.818882 | query.ex | starcoder |
defmodule Sanbase.Clickhouse.Exchanges.Trades do
use Ecto.Schema
@exchanges ["Binance", "Bitfinex", "Kraken", "Poloniex", "Bitrex"]
alias Sanbase.ClickhouseRepo
@table "exchange_trades"
schema @table do
field(:timestamp, :utc_datetime)
field(:source, :string)
field(:symbol, :string)
field(:... | lib/sanbase/clickhouse/exchanges/trades.ex | 0.76555 | 0.417539 | trades.ex | starcoder |
defmodule Solid.FileSystem do
@moduledoc """
A Solid file system is a way to let your templates retrieve other templates for use with the include tag.
You can implement a module that retrieve templates from the database, from the file system using a different path structure, you can provide them as hard-coded in... | lib/solid/file_system.ex | 0.76947 | 0.688612 | file_system.ex | starcoder |
defmodule ExPaint do
@moduledoc """
ExPaint provides simple primitive based drawing abilities with a flexible backend
system for raterizing.
"""
alias ExPaint.Image
@doc """
Creates an image reference of the given size into which primitives may be
drawn, and which may be rendered to a given format.
... | lib/ex_paint.ex | 0.959997 | 0.928862 | ex_paint.ex | starcoder |
defmodule StatesLanguage.Graph do
@moduledoc """
Functions for creating a Graph structure from deserialized JSON. This is used by Serializers and the core library. See `StatesLanguage.Serializer.D3Graph`.
"""
alias StatesLanguage.{Catch, Choice, Edge, Node}
defstruct [:comment, :edges, :nodes, :start]
@ty... | lib/states_language/graph.ex | 0.856962 | 0.54353 | graph.ex | starcoder |
defmodule ETH do
@moduledoc """
Elixir module that provides Ethereum utility functions
"""
@doc """
In order to use most of the functions in this library you need to be connected to an ethereum node.
This could be your own self-hosted node running locally or a public proxy.
## Examples
iex> ETH.b... | lib/eth.ex | 0.763219 | 0.498657 | eth.ex | starcoder |
defmodule UeberauthToken.Worker do
@moduledoc """
UeberauthToken.Worker is a background worker which verifies the authenticity of the
cached active tokens.
Tokens will be removed after their expiry time when the `:ttl` option is set by the `Cachex.put`
function. However, if one wants to be more aggressive in... | lib/ueberauth_token/worker.ex | 0.777046 | 0.408129 | worker.ex | starcoder |
defmodule StarkInfra.IssuingPurchase do
alias __MODULE__, as: IssuingPurchase
alias StarkInfra.Utils.Rest
alias StarkInfra.Utils.Check
alias StarkInfra.User.Project
alias StarkInfra.User.Organization
alias StarkInfra.Error
@moduledoc """
# IssuingPurchase struct
"""
@doc """
Displays the Issui... | lib/issuing_purchase/issuing_purchase.ex | 0.843895 | 0.563738 | issuing_purchase.ex | starcoder |
defmodule ExPurpleTiger.Data do
@moduledoc false
@adjectives [
"attractive",
"bald",
"beautiful",
"rare",
"clean",
"dazzling",
"lucky",
"elegant",
"fancy",
"fit",
"fantastic",
"glamorous",
"gorgeous",
"handsome",
"long",
"magnificent",
"muscular",... | lib/ex_purple_tiger/data.ex | 0.533397 | 0.574275 | data.ex | starcoder |
defmodule Pow.Store.Backend.Base do
@moduledoc """
Used to set up API for key-value cache store.
[Erlang match specification](https://erlang.org/doc/apps/erts/match_spec.html)
format is used for the second argument `all/2` callback. The second argument
is only for the key match, and will look like
`[:names... | lib/pow/store/backend/base.ex | 0.854582 | 0.457076 | base.ex | starcoder |
defmodule Twittex.Client do
@moduledoc """
Twitter client to work with the Twitter API.
The client is started as part of the application and authenticates using the defined configuration.
Basically, this means that once started, your application can use function from this module directly
without having to h... | lib/twittex/client.ex | 0.891522 | 0.782663 | client.ex | starcoder |
defmodule Absinthe.Blueprint.Input do
@moduledoc false
alias Absinthe.Blueprint
alias __MODULE__
import Kernel, except: [inspect: 1]
@type leaf ::
Input.Integer.t()
| Input.Float.t()
| Input.Enum.t()
| Input.String.t()
| Input.Variable.t()
| Input... | lib/absinthe/blueprint/input.ex | 0.723798 | 0.491944 | input.ex | starcoder |
defmodule SX1509.Registers.IO do
use Wafer.Registers
@moduledoc """
This module provides a selective register mapping for SX1509
The registers on SX1509 are numbered in such a way that "A" registers are located directly after the B registers.
So, rather than needing to sort out which register to write to (A ... | lib/sx1509/registers/io.ex | 0.695338 | 0.636932 | io.ex | starcoder |
defmodule Plymio.Funcio do
@moduledoc ~S"""
`Plymio.Funcio` is a collection of functions for various needs,
especially enumerables, including mapping the elements
concurrently in separate tasks.
It was written as a support package for the `Plymio` and `Harnais`
family of packages but all of the functions a... | lib/funcio/funcio.ex | 0.82887 | 0.685173 | funcio.ex | starcoder |
defmodule UnblockMeSolver.Move do
alias UnblockMeSolver.Move
@moduledoc false
@doc """
Determines if the problem is solvable
A problem is solvable when there are empty spaces to the right of the solution block ['A', 'A']
## Examples
iex> UnblockMeSolver.Move.solvable?([
...> ['B', 'B', nil,... | lib/unblock_me_solver/move.ex | 0.855021 | 0.565329 | move.ex | starcoder |
defmodule TtrCore.Cards do
@moduledoc """
Handles all card operations related to deck management and assigment
to players.
"""
alias TtrCore.Cards.{
TicketCard,
Tickets,
TrainCard
}
alias TtrCore.Players
alias TtrCore.Players.Player
@type card :: TrainCard.t | TicketCard.t
@doc """
... | lib/ttr_core/cards.ex | 0.860237 | 0.530054 | cards.ex | starcoder |
defmodule Geo.WKB.Encoder do
@moduledoc false
use Bitwise
alias Geo.{
Point,
PointZ,
PointM,
PointZM,
LineString,
Polygon,
MultiPoint,
MultiLineString,
MultiPolygon,
GeometryCollection,
Utils
}
alias Geo.WKB.Writer
@doc """
Takes a Geometry and returns a WKB... | lib/geo/wkb/encoder.ex | 0.870865 | 0.644309 | encoder.ex | starcoder |
defmodule Plug.Telemetry.ServerTiming do
@behaviour Plug
@external_resource "README.md"
@moduledoc File.read!("README.md")
|> String.split(~r/<!--\s*(BEGIN|END)\s*-->/, parts: 3)
|> Enum.at(1)
import Plug.Conn
@impl true
@doc false
def init(opts), do: opts
@impl true
@doc... | lib/plug_telemetry_server_timing.ex | 0.893132 | 0.496277 | plug_telemetry_server_timing.ex | starcoder |
defmodule Scrivener.HTML do
use Phoenix.HTML
@defaults [view_style: :bootstrap, action: :index, page_param: :page]
@view_styles [:bootstrap, :semantic, :foundation, :bootstrap_v4, :materialize, :bulma]
@raw_defaults [distance: 5, next: ">>", previous: "<<", first: true, last: true, ellipsis: raw("…")]
... | lib/scrivener/html.ex | 0.736116 | 0.40251 | html.ex | starcoder |
defmodule Cldr.Number.Format.Meta do
@moduledoc """
Describes the metadata that drives
number formatting and provides functions to
update the struct.
## Format definition
The `:format` is a keyword list that with two
elements:
* `:positive` which is a keyword list for
formatting a number >= zero
... | lib/cldr/number/format/meta.ex | 0.938576 | 0.954647 | meta.ex | starcoder |
defmodule Solana.SPL.Token.Mint do
@moduledoc """
Functions for interacting with the mint accounts of Solana's [Token
Program](https://spl.solana.com/token).
"""
alias Solana.{Instruction, Account, SPL.Token, SystemProgram}
import Solana.Helpers
@typedoc "Token Program mint account metadata."
@type t :... | lib/solana/spl/token/mint.ex | 0.865452 | 0.488649 | mint.ex | starcoder |
defmodule Analytics.Mixpanel.People do
@moduledoc """
This module is responsible for building a struct which is later can be used
to send all changes via batch request to the Mixpanel.
Whenever batch request is submitted it's validated as whole, so that if one of entries
is invalid there would be no changes ... | lib/analytics/mixpanel/people.ex | 0.84481 | 0.473414 | people.ex | starcoder |
defmodule Andy.GM.Perception do
@moduledoc "Perception behaviour to unify some of Prediction and PredictionError"
alias Andy.GM.{PredictionError, Prediction, Perception}
@callback source(perception :: any) :: String.t()
@callback conjecture_name(perception :: any) :: String.t()
@callback about(perception ::... | lib/andy/gm/perception.ex | 0.723407 | 0.553988 | perception.ex | starcoder |
import Kernel, except: [length: 1]
defmodule String do
@moduledoc %S"""
A String in Elixir is a UTF-8 encoded binary.
## String and binary operations
The functions in this module act according to the
Unicode Standard, version 6.3.0. For example,
`capitalize/1`, `downcase/1`, `strip/1` are provided by thi... | lib/elixir/lib/string.ex | 0.882592 | 0.556369 | string.ex | starcoder |
defmodule Patch.Assertions do
alias Patch.MissingCall
alias Patch.Mock
alias Patch.UnexpectedCall
@doc """
Asserts that the given module and function has been called with any arity.
```elixir
patch(Example, :function, :patch)
Patch.Assertions.assert_any_call(Example, :function) # fails
Example.f... | lib/patch/assertions.ex | 0.903024 | 0.860428 | assertions.ex | starcoder |
defmodule Harald.Host.ATT.FindInformationRsp do
@moduledoc """
Reference: version 5.2, Vol 3, Part F, 3.4.3.2
"""
def encode(%{format: format, information_data: information_data})
when format == :handle_and_16_bit_uuid do
encoded_information_data = encode_information_data(16, information_data)
{:... | lib/harald/host/att/find_information_rsp.ex | 0.670716 | 0.462837 | find_information_rsp.ex | starcoder |
defmodule Credo.Check.Refactor.FunctionArity do
@moduledoc """
A function can take as many parameters as needed, but even in a functional
language there can be too many parameters.
Can optionally ignore private functions (check configuration options).
"""
@explanation [
check: @moduledoc,
params: ... | lib/credo/check/refactor/function_arity.ex | 0.821474 | 0.431884 | function_arity.ex | starcoder |
defmodule Membrane.Core.OptionsSpecs do
@moduledoc false
use Bunch
alias Bunch.{KVEnum, Markdown}
alias Membrane.Pad
alias Membrane.Time
@default_types_params %{
atom: [spec: quote_expr(atom)],
boolean: [spec: quote_expr(boolean)],
string: [spec: quote_expr(String.t())],
keyword: [spec: q... | lib/membrane/core/options_specs.ex | 0.846403 | 0.682475 | options_specs.ex | starcoder |
defmodule VintageNet.PropertyTable do
@moduledoc """
PropertyTables are in-memory key-value stores
Users can subscribe to keys or groups of keys to be notified of changes.
Keys are hierarchically layed out with each key being represented as a list
for the path to the key. For example, to get the current sta... | lib/vintage_net/property_table.ex | 0.881053 | 0.512876 | property_table.ex | starcoder |
defmodule AWS.EKS do
@moduledoc """
Amazon Elastic Kubernetes Service (Amazon EKS) is a managed service that makes
it easy for you to run Kubernetes on AWS without needing to stand up or maintain
your own Kubernetes control plane.
Kubernetes is an open-source system for automating the deployment, scaling, a... | lib/aws/generated/eks.ex | 0.91468 | 0.664444 | eks.ex | starcoder |
defmodule Inspect.Algebra do
@moduledoc %S"""
A set of functions for creating and manipulating algebra
documents, as described in ["Strictly Pretty" (2000) by <NAME>][0].
An algebra document is represented by an `Inspect.Algebra` node
or a regular string.
iex> Inspect.Algebra.empty
:doc_nil
... | lib/elixir/lib/inspect/algebra.ex | 0.893872 | 0.741323 | algebra.ex | starcoder |
defmodule Set do
@moduledoc ~S"""
This module specifies the Set API expected to be
implemented by different representations.
It also provides functions that redirect to the
underlying Set, allowing a developer to work with
different Set implementations using one API.
To create a new set, use the `new` f... | lib/elixir/lib/set.ex | 0.932599 | 0.633127 | set.ex | starcoder |
defmodule Day2 do
@input "priv/inputs/day2.txt"
defp get_input(), do: File.read!(@input)
def part1() do
get_input()
|> get_program()
|> compute()
end
def part2(implementation \\ :beam) do
get_input()
|> get_program()
|> get_params(19690720, implementation)
end
defp get_... | lib/Day2.ex | 0.593963 | 0.460653 | Day2.ex | starcoder |
defmodule Benchee.Formatters.TaggedSave do
@moduledoc """
Store the whole suite in the Erlang `ExternalTermFormat` while tagging the
scenarios of the current run with a specified tag - can be used for storing
and later loading the results of previous runs with `Benchee.ScenarioLoader`.
Automatically configur... | lib/benchee/formatters/tagged_save.ex | 0.86757 | 0.506713 | tagged_save.ex | starcoder |
defmodule OffBroadwayOtpDistribution.Client do
@doc """
A base module for implementing the client for `OffBroadwayOtpDistribution.Receiver`.
## Example
The client process implemented using this module communicates to the receiver process
implemented as `OffBroadwayOtpDistribution.Receiver` via message passi... | lib/off_broadway_otp_distribution/client.ex | 0.877 | 0.668701 | client.ex | starcoder |
defmodule Rummage.Ecto.Hooks.Sort do
@moduledoc """
`Rummage.Ecto.Hooks.Sort` is the default sort hook that comes shipped
with `Rummage.Ecto`.
Usage:
For a regular sort:
This returns a `queryable` which upon running will give a list of `Parent`(s)
sorted by ascending `field_1`
```elixir
alias Rumma... | lib/rummage_ecto/hooks/sort.ex | 0.780871 | 0.852199 | sort.ex | starcoder |
defmodule Optimal.Doc do
@moduledoc """
Automatic opt documentation, to be placed into your function docstrings
"""
alias Optimal.Schema
@document_opts Optimal.schema(
opts: [name: :string, header_depth: :int],
defaults: [name: "Opts", header_depth: 1],
... | lib/optimal/doc.ex | 0.75985 | 0.410549 | doc.ex | starcoder |
defmodule ComplexNum.Polar do
# Uses the `real` part of the ComplexNum struct to store the `magnitude`
# And uses the `imaginary` part of the ComplexNum struct to store the `angle`.
alias ComplexNum.{Cartesian, Polar}
alias Numbers, as: N
@doc """
Creates a new Complex Numbers in Polar Form
from the gi... | lib/complex_num/polar.ex | 0.942639 | 0.982757 | polar.ex | starcoder |
defmodule Bolt.Sips.Router do
@moduledoc """
This "driver" works in tandem with Neo4j's [Causal Clustering](https://neo4j.com/docs/operations-manual/current/clustering/>) feature by directing read and write behaviour to appropriate cluster members
"""
use GenServer
require Logger
alias Bolt.Sips.Routing.Ro... | lib/bolt_sips/router.ex | 0.754599 | 0.405331 | router.ex | starcoder |
defmodule MetricsReporter.LatencyStatsCalculator.Percentage do
import String, only: [to_integer: 1]
import MetricsReporter.LatencyStatsCalculator, only: [sorted_keys_by_numeric_value: 1]
def calculate(bins, keys) do
bins
|> aggregate()
|> do_calculate(keys)
end
def default_data(keys), do: Map.ne... | monitoring_hub/apps/metrics_reporter/lib/metrics_reporter/latency_stats_calculator/percentage.ex | 0.604749 | 0.550305 | percentage.ex | starcoder |
defmodule Concentrate.StopTimeUpdate do
@moduledoc """
Structure for representing an update to a StopTime (e.g. a predicted arrival or departure)
"""
import Concentrate.StructHelpers
alias Concentrate.Filter.GTFS.Stops
defstruct_accessors([
:trip_id,
:stop_id,
:arrival_time,
:departure_time... | lib/concentrate/stop_time_update.ex | 0.808332 | 0.447823 | stop_time_update.ex | starcoder |
defmodule BreakerBox do
@moduledoc """
Server for circuit breakers.
Maintains state of registered breakers and their configurations, and allows
for querying the status of breakers, as well as enabling and disabling.
Modules can be automatically registered if they implement the
`BreakerBox.BreakerConfigura... | lib/breaker_box.ex | 0.872089 | 0.415017 | breaker_box.ex | starcoder |
defmodule Typelixir.NewBuilder do
require IEx
import Typelixir.Macros
require Typelixir.Macros
def pre(:expression, ast) do
case ast do
{:=, _, [ast1, ast2]} -> [pattern: ast1, expression: ast2, match: 2]
asts when is_list(asts) -> Enum.map(asts, &{:expression, &1}) ++ [list: length(asts)]
{:%{... | lib/typelixir/new_builder.ex | 0.503174 | 0.587588 | new_builder.ex | starcoder |
defmodule Academy.User do
@moduledoc ~S"""
Defines a user model.
Composition
-----------
A user is composed of a name, a biography, his availability and his avatar
(handled by the `Academy.Avatar` module).
A user also has a number of skill levels, which are defined in the
`Academy.SkillLevel` module.... | web/models/user.ex | 0.624637 | 0.430267 | user.ex | starcoder |
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# c... | lib/cfxxl.ex | 0.816443 | 0.58522 | cfxxl.ex | starcoder |
defmodule Lotus.Shared.Width do
@moduledoc """
Helper for width related UIKit classes. These utility functions will be consumed by any component that has width or responsiveness mixed in.
They are defined at https://getuikit.com/docs/width
"""
alias Lotus.Shared.Prefix
@responsive_widths ~w/small medium l... | lib/lotus/shared/width.ex | 0.886368 | 0.454291 | width.ex | starcoder |
defmodule Modbux.Tcp.Client do
@moduledoc """
API for Modbus TCP Client.
"""
alias Modbux.Tcp.Client
alias Modbux.Tcp
use GenServer, restart: :transient, shutdown: 500
require Logger
@timeout 2000
@port 502
@ip {0, 0, 0, 0}
@active false
@to 2000
defstruct ip: nil,
tcp_port: nil,... | lib/tcp/client.ex | 0.844794 | 0.583915 | client.ex | starcoder |
defmodule MatrixReloaded.Vector do
@moduledoc """
Provides a set of functions to work with vectors.
Mostly functions is written for a row vectors. So if you'll need a similar
functionality even for a column vectors you can use `transpose` function
on row vector.
"""
alias MatrixReloaded.Matrix
@type t... | lib/matrix_reloaded/vector.ex | 0.947381 | 0.819244 | vector.ex | starcoder |
defmodule Brando.Type.Status do
@moduledoc """
Defines a type for managing status in post schemas.
"""
use Ecto.Type
import Brando.Gettext
@type status :: :disabled | :draft | :pending | :published
@status_codes [draft: 0, published: 1, pending: 2, disabled: 3]
@doc """
Returns the internal type rep... | lib/brando/types/status.ex | 0.806815 | 0.436982 | status.ex | starcoder |
defmodule XmlToMap do
@moduledoc """
Simple convenience module for getting a map out of an XML string.
"""
alias XmlToMap.NaiveMap
@doc """
`naive_map/1` utility is inspired by `Rails Hash.from_xml()` but is
"naive" in that it is convenient (requires no setup) but carries the same
drawbacks.
For ex... | lib/elixir_xml_to_map.ex | 0.825941 | 0.521349 | elixir_xml_to_map.ex | starcoder |
defmodule StrawHat.Response do
@moduledoc """
Utilities for working with "result tuples".
* `{:ok, value}`
* `{:error, reason}`
"""
@type t(ok, error) :: {:ok, ok} | {:error, error}
@type ok_tuple :: {:ok, any}
@type error_tuple :: {:error, any}
@type result_tuple :: ok_tuple | error_tuple
@doc ~... | lib/straw_hat/response.ex | 0.874707 | 0.450057 | response.ex | starcoder |
defmodule OptionParser do
@moduledoc """
This module contains functions to parse command line arguments.
"""
@type argv :: [String.t]
@type parsed :: Keyword.t
@type errors :: [{String.t, String.t | nil}]
@type options :: [switches: Keyword.t, strict: Keyword.t, aliases: Keyword.t]
@doc """
Par... | lib/elixir/lib/option_parser.ex | 0.856092 | 0.426441 | option_parser.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.