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 |
|---|---|---|---|---|---|
if Code.ensure_loaded?(Plug) do
defmodule Unleash.Plug do
@moduledoc """
An extra fancy `Plug` and utility functions to help when developing `Plug`
or `Phoenix`-based applications. It automatically puts together a
`t:Unleash.context/0` under the `Plug.Conn`'s `Plug.assigns/0`.
To use, call `plug ... | lib/unleash/plug.ex | 0.834609 | 0.542742 | plug.ex | starcoder |
defmodule DAG do
@moduledoc File.read!("#{__DIR__}/../README.md")
defstruct vs: MapSet.new(), es: MapSet.new()
alias __MODULE__, as: M
@doc """
Creates an empty DAG.
"""
def new do
{:ok, %M{}}
end
@doc """
Add a vertex to the DAG.
"""
def add_vertex(%M{} = m, v) do
{:ok, %M{m | vs: M... | lib/dag.ex | 0.873032 | 0.553324 | dag.ex | starcoder |
defmodule Plymio.Ast.Vorm.Vormen.Transform do
@moduledoc false
alias Plymio.Option.Utility, as: POU
alias Plymio.Ast.Utility, as: PAU
alias Plymio.Ast.Vorm.Error, as: PAVE
use Plymio.Ast.Vorm.Attribute
defdelegate new_error(opts), to: PAVE, as: :new
defdelegate new_error_result(opts), to: PAVE, as: :n... | lib/ast/vorm/vormen/transform.ex | 0.649579 | 0.554712 | transform.ex | starcoder |
defmodule Godfist.Static do
@moduledoc """
Module to interact with the Static data provided by Riot.
I'm not going to provide examples in this Module unless it's necessary.
Just pass each region as an atom and id if it requires it.
On some of these functions I could have provided the ids as options and use
... | lib/godfist/requests/static.ex | 0.769687 | 0.448909 | static.ex | starcoder |
defmodule KafkaEx.GenConsumer.Supervisor do
@moduledoc """
A supervisor for managing `GenConsumer` processes that are part of a consumer
group.
The supervisor will launch individual `GenConsumer` processes for each
partition given by the `partitions` argument to `start_link/4`. When
terminated, each of the... | lib/kafka_ex/gen_consumer/supervisor.ex | 0.867233 | 0.624279 | supervisor.ex | starcoder |
defmodule Ecto.Filters do
@moduledoc """
Adds a macro `filter` and private function `apply_filter/2` to transform
request params into ecto query expressions.
## Example
use Ecto.Filters
filter(:comment_body, fn query, value ->
query
|> join(:left, [p], c in assoc(p, :comments), as:... | lib/ecto/filters/filters.ex | 0.785514 | 0.455622 | filters.ex | starcoder |
defmodule SanbaseWeb.Graphql.ClickhouseDataloader do
alias Sanbase.Clickhouse
alias Sanbase.Model.Project
alias Sanbase.Metric
def data(), do: Dataloader.KV.new(&query/2)
def query(:aggregated_metric, args) do
args_list = args |> Enum.to_list()
args_list
|> Enum.group_by(fn %{metric: metric, fr... | lib/sanbase_web/graphql/dataloader/clickhouse_dataloader.ex | 0.868688 | 0.568536 | clickhouse_dataloader.ex | starcoder |
defmodule HLClock.Timestamp do
@moduledoc """
HLC Timestamp
Implements the necessary components of the HLC tuple (i.e. logical time and
logical counter) with extension to support node ids to provide unique
timestamps even in cases where time and counter are the same
Binary representations assume big endia... | lib/hlclock/timestamp.ex | 0.907019 | 0.729255 | timestamp.ex | starcoder |
defmodule Emulator do
@moduledoc """
Documentation for `Emulator`.
"""
@doc """
Hello world.
## Examples
iex> Emulator.hello()
:world
"""
def hello do
:world
end
def run(code, mem, out) do
reg = Register.new()
run(0, code, mem, reg, out)
end
def run(pc, code, mem, r... | emulator/lib/emulator.ex | 0.741955 | 0.481576 | emulator.ex | starcoder |
defmodule Openflow.Hello do
@moduledoc "OpenFlow Hello codec module"
import Bitwise
@ofp_hello_size 4
defstruct(version: 4, xid: 0, elements: [])
alias __MODULE__
def ofp_type, do: 0
def new(version) when is_integer(version) do
%Hello{elements: [versionbitmap: [version]]}
end
def new(versio... | lib/openflow/hello.ex | 0.602529 | 0.635859 | hello.ex | starcoder |
defmodule Extatus.Metric.Gauge do
@moduledoc """
This module defines a wrapper over `Prometheus.Metric.Gauge` functions to
be compatible with `Extatus` way of handling metrics.
"""
alias Extatus.Settings
@metric Settings.extatus_gauge_mod()
@doc """
Creates a gauge using the `name` of a metric.
"""
... | lib/extatus/metric/gauge.ex | 0.858955 | 0.59302 | gauge.ex | starcoder |
defmodule AWS.DeviceFarm do
@moduledoc """
Welcome to the AWS Device Farm API documentation, which contains APIs for:
* Testing on desktop browsers
Device Farm makes it possible for you to test your web applications on desktop
browsers using Selenium.
The APIs for desktop browser testing contain `Test... | lib/aws/generated/device_farm.ex | 0.805096 | 0.46478 | device_farm.ex | starcoder |
defmodule Astarte.Flow.Blocks.ModbusTCPSource do
@moduledoc """
An Astarte Flow source that produces data by polling a Modbus device. This block
is built to poll a single Modbus slave, if you want to poll multiple slaves you
must instantiate multiple flows changing the slave id.
The message contains these f... | lib/astarte_flow/blocks/modbus_tcp_source.ex | 0.810291 | 0.531757 | modbus_tcp_source.ex | starcoder |
defmodule Benchee.Conversion do
@moduledoc """
Integration of the conversion of multiple units with benchee.
Can be used by plugins to use benchee unit scaling logic.
"""
alias Benchee.Conversion.{Count, Duration, Memory}
@doc """
Takes scenarios and a given scaling_strategy, returns the best units for... | lib/benchee/conversion.ex | 0.91934 | 0.639201 | conversion.ex | starcoder |
defmodule OMG.Eth do
@moduledoc """
Library for common code of the adapter/port to contracts deployed on Ethereum.
NOTE: The library code is not intended to be used outside of `OMG.Eth`: use `OMG.Eth.RootChain` and `OMG.Eth.Token` as main
entrypoints to the contract-interaction functionality.
NOTE: This wr... | apps/omg_eth/lib/eth.ex | 0.894138 | 0.576542 | eth.ex | starcoder |
defmodule TelemetryInfluxDB.Test.FluxParser do
alias NimbleCSV.RFC4180, as: CSV
@column_types %{
"boolean" => :boolean,
"double" => :double,
"string" => :string,
"long" => :long,
"unsignedLong" => :unsigned_long,
"dateTime:RFC3339" => :datetime
}
def parse_tables(csv) do
csv
|>... | test/support/flux_parser.ex | 0.59972 | 0.450118 | flux_parser.ex | starcoder |
alias InterpreterTerms.SymbolMatch, as: Sym
alias InterpreterTerms.WordMatch, as: Word
defmodule Interpreter.Diff do
def similarity( a, b ) do
{ matching, total } = similarity_calc( a, b )
matching / total
end
@doc """
Returns a similarity number. Comparing how similar the two objects
are.
We co... | lib/interpreter/diff/diff.ex | 0.77343 | 0.493958 | diff.ex | starcoder |
defmodule Job do
@moduledoc """
Managed execution of potentially failing actions.
A job is a logical unit of work which is split into multiple _actions_, where each action is
running in its own separate process, which is a child of the job process.
## Basic sketch
Job.start_link(fn ->
# this ... | lib/job.ex | 0.860193 | 0.710603 | job.ex | starcoder |
defmodule FilterQueryParser do
@moduledoc """
Small library to handle parsing of github style filter queries.
## Examples
iex> FilterQueryParser.parse("campaign:Lagerverkauf trainer:Josè")
{:ok, [{"campaign", "Lagerverkauf"}, {"trainer", "Josè"}]}
"""
import NimbleParsec
@doc "See module doc... | lib/filter_query_parser.ex | 0.76145 | 0.432782 | filter_query_parser.ex | starcoder |
defmodule Grizzly.Inclusion do
@moduledoc """
Z-Wave Inclusion Server
## Overview
When using this process inclusion and exclusion are
done asynchronously and information will be communicated
via message passing.
By default this process will send information about the
inclusion to the process that sta... | lib/grizzly/inclusion.ex | 0.887281 | 0.903294 | inclusion.ex | starcoder |
defmodule Itsy.Float do
use Bitwise
require Itsy.Bit
alias Itsy.Bit
@type infinity :: :"-inf" | :"+inf"
@type rounding :: :down | :up | :even
@type sign_size :: non_neg_integer
@type exponent_size :: non_neg_integer
@type mantissa_size :: non_neg_integer
@type encoding :: { sign_si... | lib/itsy/float.ex | 0.868186 | 0.416559 | float.ex | starcoder |
defmodule Crawly.Engine do
@moduledoc """
Crawly Engine - process responsible for starting and stopping spiders.
Stores all currently running spiders.
"""
require Logger
use GenServer
@type t :: %__MODULE__{
started_spiders: started_spiders(),
known_spiders: [Crawly.spider()]
... | lib/crawly/engine.ex | 0.801819 | 0.410106 | engine.ex | starcoder |
defmodule AWS.Billingconductor do
@moduledoc """
Amazon Web Services Billing Conductor is a fully managed service that you can
use to customize a [pro forma](https://docs.aws.amazon.com/enterprisebilling/6b7c01c5-b592-467e-9769-90052eaf359c/userguide/understanding-eb.html#eb-other-definitions)
version of your ... | lib/aws/generated/billingconductor.ex | 0.825941 | 0.529446 | billingconductor.ex | starcoder |
defmodule OMG.API.State.Transaction do
@moduledoc """
Internal representation of transaction spent on Plasma chain
"""
alias OMG.API.Crypto
alias OMG.API.State.Transaction.Signed
@zero_address Crypto.zero_address()
@max_inputs 2
defstruct [
:blknum1,
:txindex1,
:oindex1,
:blknum2,
... | apps/omg_api/lib/state/transaction.ex | 0.86592 | 0.634317 | transaction.ex | starcoder |
defmodule Statifier.Schema.State do
@moduledoc """
A State node in a Schema tree
State nodes model the different states a state machine can transition to.
They optionally form a hierarchy where a state is a parent to other state
node(s). This hierarchy forms a lineage where when in a child state you are
a... | impl/ex/lib/schema/state.ex | 0.801548 | 0.950227 | state.ex | starcoder |
defmodule LocalHex.Registry do
@moduledoc """
Module meant for maintaining a registry of available packages of a repository.
Current `Registry` is kept in a simple Map structure and looks like the following:
```
%{
"package_1" => [
%{
version: "0.0.1"
},
%{
version: "0.... | lib/local_hex/registry.ex | 0.739799 | 0.697119 | registry.ex | starcoder |
defmodule Number.Delimit do
@moduledoc """
Provides functions to delimit numbers into strings.
"""
@doc """
Formats a number into a string with grouped thousands using `delimiter`.
## Parameters
* `number` - A float or integer to convert.
* `options` - A keyword list of options. See the documentatio... | lib/number/delimit.ex | 0.88113 | 0.554832 | delimit.ex | starcoder |
defmodule KaufmannEx.Config do
@moduledoc """
Convenience Getters for pulling config.exs values
A config.exs may look like
```
# test env
config :kaufmann_ex,
consumer_group: System.get_env("CONSUMER_GROUP"),
default_topic: System.get_env("KAFKA_TOPIC"),
max_demand: 1, # batch size leave at 1 f... | lib/kaufmann_ex/config.ex | 0.803598 | 0.478102 | config.ex | starcoder |
defimpl Vivid.Rasterize, for: Vivid.Line do
alias Vivid.{Point, Line, Bounds}
@moduledoc """
Generates points between the origin and termination point of the line
for rendering using the Digital Differential Analyzer (DDA) algorithm.
"""
@doc ~S"""
Rasterize all points of `line` within `bounds` into a `... | lib/vivid/rasterize/line.ex | 0.936431 | 0.762203 | line.ex | starcoder |
defprotocol PersistentTree.Day09.Tree do
def add(tree, val)
def preorder(tree)
def postorder(tree)
def in_order(tree)
end
defmodule PersistentTree.Day09.Leaf,
do: defstruct []
defmodule PersistentTree.Day09.Node,
do: defstruct [:item, :left, :right]
defimpl PersistentTree.Day09.Tree, f... | persistent_tree/lib/persistent_tree/day09.ex | 0.734215 | 0.592342 | day09.ex | starcoder |
defmodule LogjamAgent.Action do
alias LogjamAgent.Instrumentation
@moduledoc """
Use this module if you want to activate Logjam reporting for your
Phoenix controllers. It automatically instruments all exported functions
in your module to submit data to the logjam service.
## Example:
```elixir
def... | lib/logjam_agent/action.ex | 0.827967 | 0.717408 | action.ex | starcoder |
defmodule Lens do
alias Focus.Types
@moduledoc """
Lenses combine getters and setters for keys in data structures.
Lenses should match/operate over a single value in a data structure,
e.g. a key in a map/struct.
"""
@enforce_keys [:get, :put]
defstruct [:get, :put]
@type t :: %Lens{
get:... | lib/lens/lens.ex | 0.881098 | 0.70805 | lens.ex | starcoder |
defmodule Range do
@moduledoc """
Ranges represent a sequence of zero, one or many, ascending
or descending integers with a common difference called step.
The most common form of creating and matching on ranges is
via the [`first..last`](`../2`) and [`first..last//step`](`..///3`)
notations, auto-imported ... | lib/elixir/lib/range.ex | 0.872775 | 0.76238 | range.ex | starcoder |
defmodule Tensor.Matrix do
alias Tensor.{Vector, Matrix, Tensor}
defmodule Inspect do
@doc false
def inspect(matrix, _opts) do
"""
#Matrix<(#{Tensor.Inspect.dimension_string(matrix)})
#{inspect_contents(matrix)}
>
"""
end
defp inspect_contents(matrix) do
content... | lib/tensor/matrix.ex | 0.919679 | 0.77081 | matrix.ex | starcoder |
defmodule Bolt.Cogs.Tempmute do
@moduledoc false
@behaviour Nosedrum.Command
alias Bolt.Converters
alias Bolt.ErrorFormatters
alias Bolt.Events.Handler
alias Bolt.Schema.{Infraction, MuteRole}
alias Bolt.{Helpers, ModLog, Parsers, Repo}
alias Nosedrum.Predicates
alias Nostrum.Api
alias Nostrum.Stru... | lib/bolt/cogs/tempmute.ex | 0.84994 | 0.562026 | tempmute.ex | starcoder |
defmodule Lab42.StateMachine do
use Lab42.StateMachine.Types
@moduledoc """
# Lab42.StateMachine
## Synopsis
A simple State Machine operating on a list of input values, a map of transition definitions
and an accumulator.
## What is the _Transition Definitions Map_?
It maps each `state` to a li... | lib/lab42/state_machine.ex | 0.8727 | 0.945801 | state_machine.ex | starcoder |
defmodule Pavlov.Case do
@moduledoc """
Use this module to prepare other modules for testing.
## Example
defmodule MySpec do
use Pavlov.Case
it "always passes" do
assert true
end
end
"""
@doc false
defmacro __using__(opts \\ []) do
async = Keyword.get(opt... | lib/case.ex | 0.828002 | 0.409398 | case.ex | starcoder |
defmodule Legion.Telephony.PhoneNumber do
@moduledoc """
Declares types and utility functions for working with phone numbers.
"""
@typedoc """
Describes the type of the phone number.
"""
@type host_type() ::
:fixed_line
| :mobile
| :fixed_line_or_mobile
| :toll_fre... | apps/legion/lib/telephony/phone_number.ex | 0.833562 | 0.429071 | phone_number.ex | starcoder |
defmodule Loom.GCounter do
@moduledoc """
Grow only counters
GCounters can only ever increment. They are useful for view and hit counters,
which will never shrink.
They are not delta-CRDT's, as they are rather lightweight in general. A delta-
CRDT implementation would just return the latest value for an a... | lib/loom/gcounter.ex | 0.774029 | 0.463505 | gcounter.ex | starcoder |
defmodule Daguex.Processor.ConvertImage do
@moduledoc """
Processor that convert given image to targeting format
This processor in the charge of converting image to specified format
and save the results to the `variants` field of `Daguex.Image`
Convert `Context.image_file` to the format specified in the opts... | lib/daguex/processor/convert_image.ex | 0.835047 | 0.654087 | convert_image.ex | starcoder |
defmodule Mix.Tasks.PhoenixConfig.Gen.Resource do
use Mix.Task
alias Mix.PhoenixConfigHelpers
alias PhoenixConfig.EctoContextGenerator
@shortdoc "Creates a resource file that will be used to configure absinthe routes and can create schemas"
@moduledoc """
You can use this to create all resources needed fo... | lib/mix/tasks/gen.resource.ex | 0.644337 | 0.582372 | gen.resource.ex | starcoder |
defmodule Adventofcode.Day19TractorBeam do
use Adventofcode
alias __MODULE__.{Grid, Position, Printer, Program}
def part_1(input) do
input
|> part_1_grid()
|> Grid.locations_affected_by_beam()
end
def part_1_grid(input) do
input
|> Program.parse()
|> Grid.new(view: {0..49, 0..49})
... | lib/day_19_tractor_beam.ex | 0.639286 | 0.560403 | day_19_tractor_beam.ex | starcoder |
defmodule Coherence.Schema do
@moduledoc """
Add Coherence support to a User schema module.
Add `use Coherence.Schema, opts \\ []` to your User module to add a number of
Module functions and helpers.
The optional `opt` parameter can be used to disable options enabled in the
global configuration by passing... | lib/coherence/schema.ex | 0.91182 | 0.515437 | schema.ex | starcoder |
defmodule Circuits.GPIO do
alias Circuits.GPIO.Nif
@type pin_number :: non_neg_integer()
@type pin_direction :: :input | :output
@type value :: 0 | 1
@type edge :: :rising | :falling | :both | :none
@type pull_mode :: :not_set | :none | :pullup | :pulldown
# Public API
@doc """
Open a GPIO for use.... | lib/gpio.ex | 0.870115 | 0.841174 | gpio.ex | starcoder |
defmodule Automata.OperatorStats do
@moduledoc false
use GenServer
alias Automata.FailuresManifest
@typep counter :: non_neg_integer
@spec stats(pid) :: %{
failures: counter,
total: counter
}
def stats(pid) when is_pid(pid) do
GenServer.call(pid, :stats, :infinity)
end... | lib/automata/core/control/operator/operator_stats.ex | 0.740831 | 0.409575 | operator_stats.ex | starcoder |
defmodule Ecto.Adapter do
@moduledoc """
Specifies the minimal API required from adapters.
"""
@type t :: module
@typedoc """
The metadata returned by the adapter `c:init/1`.
It must be a map and Ecto itself will always inject
two keys into the meta:
* the `:cache` key, which as ETS table that c... | lib/ecto/adapter.ex | 0.901144 | 0.543348 | adapter.ex | starcoder |
defmodule Cldr.Territory.Backend do
def define_territory_module(config) do
module = inspect(__MODULE__)
backend = config.backend
config = Macro.escape(config)
quote location: :keep, bind_quoted: [module: module, backend: backend, config: config] do
defmodule Territory do
alias Cldr.Loca... | lib/cldr/backend.ex | 0.838448 | 0.481698 | backend.ex | starcoder |
defmodule Game.Format.Rooms do
@moduledoc """
Format functions for rooms
"""
import Game.Format.Context
alias Data.Exit
alias Data.Room
alias Game.Door
alias Game.Format
alias Game.Format.NPCs, as: FormatNPCs
alias Game.Format.Proficiencies, as: FormatProficiencies
@doc """
Display a room's n... | lib/game/format/rooms.ex | 0.680666 | 0.425247 | rooms.ex | starcoder |
defmodule Lastfm.Archive do
@moduledoc """
A behaviour module for implementing a Lastfm archive.
The module also provides a struct that keeps metadata about the archive.
An archive contains scrobbles data retrieved from Lastfm API. It can be based
upon various storage implementation such as file systems and ... | lib/lastfm/archive.ex | 0.803444 | 0.496033 | archive.ex | starcoder |
defmodule Garuda.GameRoom do
@moduledoc """
Behaviours and functions for implementing core game-logic rooms.
Game-rooms are under-the-hood genservers, with certain extra gamey properties.
We can write our gameplay code in game-room, and game-channel act as event handler.
Events from game-channel can be then ... | lib/framework/game_room.ex | 0.753285 | 0.478346 | game_room.ex | starcoder |
defmodule BsvRpc.TransactionInput do
# TODO Move to a separate library?
@moduledoc """
Functions for Bitcoin transaction inputs manipulation.
"""
use Bitwise
@enforce_keys [:script_sig, :sequence]
@typedoc """
A Bitcoin transaction input.
"""
defstruct [:previous_transaction, :previous_output, :sc... | lib/bsv_rpc/transaction_input.ex | 0.598312 | 0.403273 | transaction_input.ex | starcoder |
defmodule AWS.Redshift do
@moduledoc """
Amazon Redshift
**Overview**
This is an interface reference for Amazon Redshift. It contains
documentation for one of the programming or command line interfaces you can
use to manage Amazon Redshift clusters. Note that Amazon Redshift is
asynchronous, which mean... | lib/aws/redshift.ex | 0.902177 | 0.593992 | redshift.ex | starcoder |
if Code.ensure_loaded?(Plug) do
defmodule DataSpecs.Plug.Loader do
@moduledoc """
DataSpecs Plug
NOTE: this module is available if you include the optional dependency ":plug".
This module can be used to plug a "Jason.decode! -> DataSpecs.load" pipeline in your routes.
For example:
defmo... | lib/dataspecs/plug/loader.ex | 0.760651 | 0.492127 | loader.ex | starcoder |
defmodule GitHelper do
@moduledoc """
Collection of lower-level functions for analyzing outputs from git command.
"""
@type contrib_count :: %{String.t() => integer}
@doc """
parse_diff/1: returns the relevant information contained in the last array position of a diff array
"""
@spec parse_diff([... | lib/git_helper.ex | 0.731251 | 0.483831 | git_helper.ex | starcoder |
defmodule BatchPlease.DynamicResolvers do
@moduledoc false
@definitely_not_a_module_doc """
This module provides dynamic function resolution for BatchPlease's `batch_*`
callbacks.
For example, a function `do_XXXX(state, batch)` in this module would do
the following:
1. If `state.config.XXXX` is defined... | lib/batch_please/dynamic_resolvers.ex | 0.750004 | 0.45042 | dynamic_resolvers.ex | starcoder |
defmodule DigitalOcean.VolumeAction do
alias DigitalOcean.{ Operation }
@doc """
Create an action for a volume.
## Example for attaching a volume to a droplet
iex> DigitalOcean.VolumeAction.create(
...> "7724db7c-e098-11e5-b522-000f53304e51",
...> type: "attach",
...> droplet_id... | lib/digital_ocean/volume_action.ex | 0.840079 | 0.433262 | volume_action.ex | starcoder |
defmodule Algae.Reader do
@moduledoc ~S"""
`Algae.Reader` allows you to pass some readable context around through actions.
This is useful in a number of situations, but the most common case is to weave
access to environment variables monadically.
For an illustrated guide to `Reader`s,
see [Thee Useful Mon... | lib/algae/reader.ex | 0.807878 | 0.485783 | reader.ex | starcoder |
defmodule ServerSentEventStage do
@moduledoc """
A GenStage producer which parses the ServerSentEvent (SSE) protocol.
SSEs are used in browsers via the EventSource API, but they can be used for
any kind of one-directional streaming.
For more information, see the [W3C](https://html.spec.whatwg.org/multipage/... | lib/server_sent_event_stage.ex | 0.750918 | 0.440229 | server_sent_event_stage.ex | starcoder |
defmodule Xlsxir.ParseStyle do
@moduledoc """
Holds the SAX event instructions for parsing style data via `Xlsxir.SaxParser.parse/2`
"""
# the following module attributes hold `numStyleId`s for standard number styles, grouping them between numbers and dates
@num [0,1,2,3,4,9,10,11,12,13,37,38,39,40,44,48,49... | lib/xlsxir/parse_style.ex | 0.726911 | 0.505981 | parse_style.ex | starcoder |
defmodule ExWire.DEVp2p do
@moduledoc """
Functions that deal directly with the DEVp2p Wire Protocol.
For more information, please see:
https://github.com/ethereum/wiki/wiki/%C3%90%CE%9EVp2p-Wire-Protocol
"""
alias ExWire.Config
alias ExWire.DEVp2p.Session
alias ExWire.Packet.Capability.Mana
alias E... | apps/ex_wire/lib/ex_wire/dev_p2p.ex | 0.680135 | 0.410372 | dev_p2p.ex | starcoder |
defmodule Mix.Config do
@moduledoc ~S"""
Module for defining, reading and merging app configurations.
Most commonly, this module is used to define your own configuration:
use Mix.Config
config :plug,
key1: "value1",
key2: "value2"
import_config "#{Mix.env}.exs"
All `config... | lib/mix/lib/mix/config.ex | 0.670069 | 0.438364 | config.ex | starcoder |
defmodule Azalea.Tree do
@moduledoc """
`Azalea.Tree` models a rose, or multi-way tree. A rose tree is an `n`-ary (with unbounded `n`) tree
where each branch of a node is itself a rose tree. For example:
iex> Azalea.Tree.new(:a, [:b, :c, Azalea.Tree.new(:d, [:e, :f])])
%Azalea.Tree{
value: :... | lib/azalea/tree.ex | 0.930474 | 0.737371 | tree.ex | starcoder |
defmodule ExYarn.Token do
@moduledoc """
A token is the building block of a lockfile (intended for internal use only)
This module takes a lockfile's contents as input and breaks it up into a list
of tokens, each of them representing a single discrete element of the lockfile.
Tokens represent every piece tha... | lib/ex_yarn/token.ex | 0.827201 | 0.606586 | token.ex | starcoder |
defmodule Json5 do
@moduledoc """
Convert Json5 to Elixir term and back
"""
@doc """
parse json5 input as elixir type.
To keep the precision of the given numbers the integers and floats are cast to `Decimal`
options:
- object_key_function: (binary) -> any
- use given function to format the object... | lib/json5.ex | 0.872007 | 0.862583 | json5.ex | starcoder |
defmodule Sanbase.Alert.Trigger.RawSignalTriggerSettings do
@moduledoc ~s"""
An alert based on the ClickHouse signals.
The signal we're following is configured via the 'signal' parameter
Example parameters:
```
%{
type: "raw_signal_data",
signal: "mvrv_usd_30d_lower_zone"
channel: "telegram",
... | lib/sanbase/alerts/trigger/settings/raw_signal_trigger_settings.ex | 0.814607 | 0.796649 | raw_signal_trigger_settings.ex | starcoder |
defmodule Imager.Store.S3 do
@behaviour Imager.Store
alias ExAws.S3
@moduledoc """
S3 compatible storage. It will try to stream files as much as possible
in both ways.
"""
require Logger
def retrieve(path, opts) do
{bucket, config} = Keyword.pop(opts, :bucket)
{chunk_size, config} = Keyword.... | lib/imager/store/s3.ex | 0.682045 | 0.411347 | s3.ex | starcoder |
defmodule RelaxLib.ImageMagick do
alias RelaxLib.ImageMagick.Image
@doc """
Opens image source
"""
def open(path) do
path = Path.expand(path)
unless File.regular?(path), do: raise(File.Error)
%Image{path: path, ext: Path.extname(path)}
end
@doc """
Saves modified image
## Options
* ... | lib/relax_lib/image_magick/image_magick.ex | 0.74008 | 0.506225 | image_magick.ex | starcoder |
defmodule Elastic.Bulk do
alias Elastic.Document
alias Elastic.HTTP
alias Elastic.ResponseHandler
@moduledoc ~S"""
Used to make requests to ElasticSearch's bulk API.
All of `index`, `create` and `update` take a list of tuples.
The order of elements in each tuple is this:
* Index
* Type
* ID (not... | lib/elastic/bulk.ex | 0.836688 | 0.807764 | bulk.ex | starcoder |
defmodule XUtil.Bitstring do
@moduledoc """
Simple utilities for working with bitstrings.
Elixir has amazing support for working with binaries (bitstrings whose size is divisible by 8)
"""
@doc """
Joins the enumerable bitstrings into a single bitstring.
Examples:
iex(1)> XUtil.Bitstring.join([<<... | lib/x_util/bitstring.ex | 0.641198 | 0.503479 | bitstring.ex | starcoder |
defmodule Bolt.Cogs.Role.Mute do
@moduledoc false
@behaviour Nosedrum.Command
alias Bolt.Converters
alias Bolt.Schema.MuteRole
alias Bolt.{ErrorFormatters, ModLog, Repo}
alias Nosedrum.Predicates
alias Nostrum.Api
alias Nostrum.Cache.GuildCache
alias Nostrum.Struct.User
@impl true
def usage, do:... | lib/bolt/cogs/role/mute.ex | 0.878262 | 0.600862 | mute.ex | starcoder |
defmodule Day09 do
@moduledoc """
Documentation for `Day09`.
"""
def part1(input) do
maxrows = Enum.count(input)
maxcols = Enum.count(Enum.at(input, 0))
input
|> to_map()
|> find_lows(maxrows, maxcols, :heights)
|> Enum.map(&(&1 + 1))
|> Enum.sum()
end
def part2(input) do
... | 2021/day09/lib/day09.ex | 0.698535 | 0.506591 | day09.ex | starcoder |
defmodule ScrapyCloudEx.HttpAdapter.RequestConfig do
@moduledoc """
Struct containing the configuration for an API call.
"""
@typedoc """
Contains the configuration relevant for an API request:
* `:api_key` - the API key as can be obtained [here](https://app.scrapinghub.com/account/apikey).
This mus... | lib/http_adapter/request_config.ex | 0.883532 | 0.563138 | request_config.ex | starcoder |
defmodule Proplist do
@moduledoc """
A proplist is a list of tuples where the first element
of the tuple is a binary and the second element can be
any value.
A proplist may have duplicated props so it is not strictly
a dictionary. However most of the functions in this module
behave exactly as a dictionar... | lib/proplist.ex | 0.872483 | 0.697979 | proplist.ex | starcoder |
defmodule Membrane.Core.Element.PadController do
@moduledoc false
# Module handling linking and unlinking pads.
alias Membrane.{Core, Event}
alias Core.{CallbackHandler, Message, PullBuffer}
alias Core.Element.{EventController, PadModel, State}
alias Membrane.Element.{CallbackContext, Pad}
alias Bunch.Ty... | lib/membrane/core/element/pad_controller.ex | 0.804098 | 0.434461 | pad_controller.ex | starcoder |
defmodule Blocked.Config do
@moduledoc """
Configuration for `Blocked`.
The simplest ways to configure `Blocked` is by:
- adding `config :blocked. [warn: true, project_owner: "YourName"]` to your Elixir configuration file.
(for older Elixir versions, this is `Mix.Config`; for newer versions, `Config`.)
... | lib/blocked/config.ex | 0.806434 | 0.490968 | config.ex | starcoder |
defmodule HXL do
@moduledoc File.read!(Path.join([__DIR__, "..", "README.md"]))
alias __MODULE__.{Parser, Eval}
@type opt ::
{:variables, map()}
| {:functions, map()}
| {:keys, :atoms | :string | (binary -> term())}
| {:evaluator, HXL.Evaluator.t()}
@type opts :: [opt()... | lib/hxl.ex | 0.870446 | 0.542439 | hxl.ex | starcoder |
defmodule ExWire.Packet.GetBlockHeaders do
@moduledoc """
Requests block headers starting from a given hash.
```
**GetBlockHeaders** [`+0x03`: `P`, `block`: { `P` , `B_32` }, `maxHeaders`: `P`, `skip`: `P`, `reverse`: `P` in { `0` , `1` } ]
Require peer to return a BlockHeaders message. Reply
must contain ... | apps/ex_wire/lib/ex_wire/packet/get_block_headers.ex | 0.915034 | 0.887838 | get_block_headers.ex | starcoder |
defmodule Geometry.MultiPolygonZM do
@moduledoc """
A set of polygons from type `Geometry.PolygonZM`
`MultiPointZM` implements the protocols `Enumerable` and `Collectable`.
## Examples
iex> Enum.map(
...> MultiPolygonZM.new([
...> PolygonZM.new([
...> LineStringZM.new([
... | lib/geometry/multi_polygon_zm.ex | 0.925483 | 0.619615 | multi_polygon_zm.ex | starcoder |
defmodule Mongo.Pool do
@moduledoc """
Defines a pool of MongoDB connections.
A pool can be defined as:
defmodule MyPool do
use Mongo.Pool,
adapter: Mongo.Pool.Poolboy,
hostname: "localhost"
end
Options will be passed to the pool adapter and to `Mongo.Connection`.
... | lib/mongo/pool.ex | 0.657098 | 0.408955 | pool.ex | starcoder |
defmodule Kronky.ChangesetParser do
@moduledoc """
Converts an ecto changeset into a list of validation errors structs.
Currently *does not* support nested errors
"""
import Ecto.Changeset, only: ["traverse_errors": 2]
alias Kronky.ValidationMessage
@doc "Extract a nested map of raw errors from a change... | lib/kronky/changeset_parser.ex | 0.90647 | 0.558447 | changeset_parser.ex | starcoder |
defmodule Contex.ContinuousLinearScale do
@moduledoc """
A linear scale to map continuous numberic data to a plotting coordinate system.
Implements the general aspects of scale setup and use defined in the `Contex.Scale` protocol
The `ContinuousLinearScale` is responsible for mapping to and from values in the... | lib/chart/scale/continuous_linear_scale.ex | 0.95104 | 0.980986 | continuous_linear_scale.ex | starcoder |
defmodule RDF.Star.Triple do
@moduledoc """
Helper functions for RDF-star triples.
An RDF-star triple is represented as a plain Elixir tuple consisting of three valid
RDF values for subject, predicate and object.
As opposed to an `RDF.Triple` the subject or object can be a triple itself.
"""
alias RDF.S... | lib/rdf/star/triple.ex | 0.909242 | 0.653286 | triple.ex | starcoder |
defmodule Kaffe.Consumer do
@moduledoc """
Consume messages from Kafka and pass to a given local module.
See `start_link/4` for details on how to start a Consumer process.
As messages are consumed from Kafka they will be sent to your
`handle_message/1` (sync) or `handle_message/2` (async) functions for
pr... | lib/kaffe/consumer.ex | 0.852153 | 0.777215 | consumer.ex | starcoder |
defmodule Wobserver2.Util.Metrics.Prometheus do
@moduledoc ~S"""
Prometheus formatter.
Formats metrics in a for Prometheus readable way.
See: [https://prometheus.io/docs/instrumenting/writing_exporters/](https://prometheus.io/docs/instrumenting/writing_exporters/)
"""
@behaviour Wobserver2.Util.Metrics.Fo... | lib/wobserver2/util/metrics/prometheus.ex | 0.908567 | 0.594051 | prometheus.ex | starcoder |
defmodule Google.Protobuf.FileDescriptorSet do
use Protobuf, syntax: :proto2
@type t :: %__MODULE__{
file: [Google.Protobuf.FileDescriptorProto.t]
}
defstruct [:file]
field :file, 1, repeated: true, type: Google.Protobuf.FileDescriptorProto
end
defmodule Google.Protobuf.FileDescriptorProto do
use Pro... | lib/protobuf/protoc/descriptor.pb.ex | 0.611382 | 0.444505 | descriptor.pb.ex | starcoder |
defmodule Zaryn.TransactionChain.Transaction do
@moduledoc """
Represents the main unit of the Zaryn network and its Transaction Chain.
Blocks are reduce to its unitary form to provide high scalability, avoiding double spending attack and chain integrity
"""
alias Zaryn.Crypto
alias __MODULE__.CrossValid... | lib/zaryn/transaction_chain/transaction.ex | 0.909055 | 0.467696 | transaction.ex | starcoder |
defmodule TimeZoneInfo.Downloader do
@moduledoc """
The behaviour for downloaders.
"""
@typedoc """
The `mode` to download the data.
Possible modes:
- `:iana` downloads the data as a zipped tar archive in IANA format.
- `:etf` downloads the data as a compressed file in the `TimeZoneInfo`
[External... | lib/time_zone_info/downloader.ex | 0.890735 | 0.602383 | downloader.ex | starcoder |
defmodule ShEx.NodeConstraint.NumericFacets do
@moduledoc false
defstruct ~w[mininclusive minexclusive maxinclusive maxexclusive totaldigits fractiondigits]a
alias RDF.{Literal, XSD}
def new(xs_facets) do
xs_facets_with_literals =
Map.new(xs_facets, fn
{key, value} when key in ~w[mininclusi... | lib/shex/shape_expressions/node_constraint/numeric_facets.ex | 0.5769 | 0.620521 | numeric_facets.ex | starcoder |
defmodule LivePhone.Countries do
@moduledoc """
The `LivePhone.Countries` module can be used to list all known countries and return
them ordered alphabetically, and optionally you can ensure your preferred countries
are prepended to the list instead of mixed in with the rest.
"""
alias ISO
alias LivePhon... | lib/live_phone/countries.ex | 0.827306 | 0.823719 | countries.ex | starcoder |
defmodule AoC.Day12 do
@moduledoc false
def part_1 do
initial_states =
"data/day12-input.txt"
|> File.stream!()
|> Enum.map(&String.trim/1)
|> parse_input_data()
|> Enum.map(&initialize_moon/1)
1..1000
|> Enum.reduce(initial_states, fn _, states -> step(states) end)
|... | lib/aoc/day_12.ex | 0.559892 | 0.423518 | day_12.ex | starcoder |
defmodule PageObject.Collections.Collection do
@moduledoc """
Collections are used to scope a CSS query to multiple page elements that follow the same html structure.
This allows you to interact with each element in a consistent and expressive manner in your tests.
Collections currently support all the ... | lib/collections/collection.ex | 0.835181 | 0.852752 | collection.ex | starcoder |
defmodule OMG.Utxo.Position do
@moduledoc """
Representation of a UTXO position in the child chain, providing encoding/decoding to/from formats digestible in `Eth`
and in the `OMG.DB`
"""
# these two offset constants are driven by the constants from the RootChain.sol contract
@block_offset 1_000_000_000
... | apps/omg/lib/omg/utxo/position.ex | 0.897002 | 0.439266 | position.ex | starcoder |
defmodule ElxValidation.Storage do
@moduledoc """
### File
- the field under validation must be a file and at leas 1 kilobyte size
- empty value return error unless field is under nullable validation
```
data = %{
logo: "LOGO FILE",
}
rules = [
%{
field: "logo",
valida... | lib/rules/storage.ex | 0.714429 | 0.766905 | storage.ex | starcoder |
defmodule Data.Parser do
@moduledoc """
Higher-order functions to create and modify parsers.
"""
alias FE.{Maybe, Result}
alias MapSet, as: Set
import Result, only: [ok: 1, error: 1]
import Maybe, only: [just: 1, nothing: 0]
defdelegate kv(fields), to: Data.Parser.KV, as: :new
@typedoc """
A pa... | lib/data/parser.ex | 0.839257 | 0.763153 | parser.ex | starcoder |
defmodule TflInterp do
@moduledoc """
Tensorflow lite intepreter for Elixir.
Deep Learning inference framework for embedded devices.
## Design policy (Features)
TflInterp is designed based on the following policy.
1. Provide only the Deep Learning inference. It aims to the poor-resource devices such as IO... | lib/tfl_interp.ex | 0.838382 | 0.896251 | tfl_interp.ex | starcoder |
defmodule TextDelta.Composition do
@moduledoc """
The composition of two non-concurrent deltas into a single delta.
The deltas are composed in such a way that the resulting delta has the same
effect on text state as applying one delta and then the other:
S ○ compose(Oa, Ob) = S ○ Oa ○ Ob
In more simple... | lib/text_delta/composition.ex | 0.791378 | 0.823896 | composition.ex | starcoder |
defmodule Daguex.Pipeline.Context do
@moduledoc """
This module defines the context for `Dageux.Processor` to process.
This module defines a `#{__MODULE__}` struct and the main functions for working with it.
* `image` - the image object that can be used for identifying specified image,
... | lib/daguex/pipeline/context.ex | 0.806052 | 0.731778 | context.ex | starcoder |
defmodule ExUnit.Filters do
@moduledoc """
Conveniences for parsing and evaluating filters.
"""
@type t :: list({atom, Regex.t | String.Chars.t} | atom)
@doc """
Parses filters out of a path.
Determines whether a given file path (supplied to ExUnit/Mix as arguments
on the command line) includes a lin... | lib/ex_unit/lib/ex_unit/filters.ex | 0.915922 | 0.626453 | filters.ex | starcoder |
defmodule AWS.CodeCommit do
@moduledoc """
AWS CodeCommit
This is the *AWS CodeCommit API Reference*.
This reference provides descriptions of the operations and data types for AWS
CodeCommit API along with usage examples.
You can use the AWS CodeCommit API to work with the following objects:
Reposito... | lib/aws/generated/code_commit.ex | 0.883676 | 0.601886 | code_commit.ex | starcoder |
defmodule Surface.Formatter do
@moduledoc "Functions for formatting Surface code snippets."
alias Surface.Formatter.Phases
@typedoc """
Options that can be passed to `Surface.Formatter.format_string!/2`.
- `:line_length` - Maximum line length before wrapping opening tags
- `:indent` - Starting indent... | lib/surface/formatter.ex | 0.934657 | 0.886076 | formatter.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.