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 Oban.Crontab.Parser do
@moduledoc false
@doc """
Parses the given `binary` as cron.
Returns `{:ok, [token], rest, context, position, byte_offset}` or
`{:error, reason, rest, context, line, byte_offset}` where `position`
describes the location of the cron (start position) as `{line, column_on_li... | lib/oban/crontab/parser.ex | 0.878822 | 0.472318 | parser.ex | starcoder |
defmodule Modbus.Model do
@moduledoc false
def apply(state, {:rc, slave, address, count}) when is_integer(address) and is_integer(count) do
reads(state, {slave, :c, address, count})
end
def apply(state, {:ri, slave, address, count}) when is_integer(address) and is_integer(count) do
reads(state, {slave... | lib/model.ex | 0.688678 | 0.557604 | model.ex | starcoder |
defmodule Firenest.PubSub do
@moduledoc """
A distributed pubsub implementation.
The PubSub implementation runs on top of a `Firenest.Topology`
and uses Elixir's `Registry` to provide a scalable dispatch
implementation.
## Example
PubSub is typically set up as part of your supervision tree
alongside ... | lib/firenest/pub_sub.ex | 0.926199 | 0.646795 | pub_sub.ex | starcoder |
defmodule Day14B do
def solveB(input) do
# load_grid("day14test.in")
Day14.get_grid(input)
|> used_squares(0, 0, MapSet.new)
|> visit(0)
end
def load_grid(filename) do
# Convenience function to restore a map from a previous computation.
File.stream!(filename, [:utf8], :line)
|> Enum.... | 2017/elixir/day14/lib/day14b.ex | 0.750278 | 0.53783 | day14b.ex | starcoder |
defmodule Zigler.Parser.Imports do
@moduledoc """
For parsing, looking for imports, cimports, and usingnamespace directives.
To be completed later
"""
import NimbleParsec
defstruct imports: [], identifier: nil, pub: false
@typep identifier_t :: :usingnamespace | String.t
@type t :: %__MODULE__{
... | lib/zigler/parser/imports.ex | 0.599016 | 0.430506 | imports.ex | starcoder |
defmodule Spell do
@moduledoc """
Spell Corrector
Inspired by <NAME>'s essay: http://norvig.com/spell-correct.html
"""
@file_path "lib/big.txt"
@external_resource @file_path
@pattern Regex.compile!("\\w+")
@letters ?a..?z
@words @file_path
|> File.stream!()
|> Stream.flat_map(fn l... | lib/spell.ex | 0.75037 | 0.435421 | spell.ex | starcoder |
defmodule Caravan.Cluster.Config do
@moduledoc """
Config for `Caravan.Cluster.DnsStrategy.`
- topology: topology name passed to `Cluster.Strategy.connect_nodes/4`
- query: The name to query for SRV records. Something like: `prod-likes-service-dist-consul`
- dns_client: module implementing `Caravan.Dn... | lib/caravan/cluster/config.ex | 0.890056 | 0.413566 | config.ex | starcoder |
defmodule AmqpOne.TypeManager.XML do
@moduledoc """
This module provides access to the XML specification of AMQP and provides
the type definitions.
It used during compilation to generate various functions, modules,
type and struct definitions. Many functions cannot be used properly after
the compilation, ... | lib/type_xml.ex | 0.627495 | 0.459925 | type_xml.ex | starcoder |
defmodule Genex.Tools.Mutation do
use Bitwise
alias Genex.Types.Chromosome
@moduledoc """
Implementation of several population mutation methods.
Mutation takes place according to some rate. Mutation is useful for introducing novelty into the population. This ensures your solutions don't prematurely converge... | lib/genex/tools/mutation.ex | 0.942334 | 0.688455 | mutation.ex | starcoder |
defmodule GatherSubmissions.Student.Reader do
@moduledoc """
Provides a function for reading students' information from a CSV file.
"""
alias GatherSubmissions.Student
defmodule DuplicateHeaderError do
defexception message: "Duplicate headers in input CSV file"
end
defmodule MissingHeaderError do
... | lib/student/reader.ex | 0.784979 | 0.560162 | reader.ex | starcoder |
defmodule Ada.Metrics.Reporter do
@moduledoc false
use GenServer
require Logger
def start_link(opts) do
GenServer.start_link(__MODULE__, opts, name: __MODULE__)
end
@impl true
def init(opts) do
state = Enum.into(opts, default_state())
case state.engine.connect() do
:ok ->
att... | lib/ada/metrics/reporter.ex | 0.686055 | 0.405508 | reporter.ex | starcoder |
defmodule VexValidators.Type do
@types [:integer, :float, :boolean, :atom, :string, :binary, :list, :map, :tuple]
@tests %{
1 => [:integer],
1.0 => [:float],
true => [:boolean, :atom],
:atom => [:atom],
"string" => [:binary, :string],
<<0>> => [:binary, :string],
[] => [:list]... | lib/vex_validators/type.ex | 0.79799 | 0.776919 | type.ex | starcoder |
defmodule Etop.Utils do
@moduledoc """
Utility helpers for Etop.
"""
@kb 1024
@mb @kb * @kb
@gb @mb * @kb
@tb @gb * @kb
@pb @tb * @kb
@doc """
Center a string in the given length.
Return a string of length >= the given length with the given string centered.
The returned string is padded (lead... | lib/etop/utils.ex | 0.893292 | 0.495484 | utils.ex | starcoder |
defmodule DeltaCrdt.AWLWWMap do
@opaque crdt_state :: CausalDotMap.t()
@opaque crdt_delta :: CausalDotMap.t()
@type key :: term()
@type value :: term()
@type node_id :: term()
@moduledoc """
An add-wins last-write-wins map.
This CRDT is an add-wins last-write-wins map. This means:
* The data structu... | lib/delta_crdt/aw_lww_map.ex | 0.871037 | 0.850965 | aw_lww_map.ex | starcoder |
defmodule HNLive.Watcher do
@moduledoc """
`HNLive.Watcher` is a long-running `GenServer`, which should be started as
part of the application supervision tree.
`HNLive.Watcher` provides updates via `Phoenix.PubSub`
when the top stories change. Subscribe to the updates via `subscribe/1`.
These updates are ... | lib/hnlive/watcher.ex | 0.876238 | 0.563438 | watcher.ex | starcoder |
defmodule Xandra.RetryStrategy do
@moduledoc """
A behaviour that handles how to retry failed queries.
This behaviour makes it possible to customize the strategy that Xandra uses to
retry failed queries. By default, Xandra does not retry failed queries, and
does not provide any default retry strategy since r... | lib/xandra/retry_strategy.ex | 0.928132 | 0.651313 | retry_strategy.ex | starcoder |
defmodule Elixirdo.Instance.MonadTrans.Reader do
alias Elixirdo.Instance.MonadTrans.Reader, as: ReaderT
use Elixirdo.Base
use Elixirdo.Typeclass.Monad.Trans, import_typeclasses: true
use Elixirdo.Typeclass.Monad.Reader, import_monad_reader: true
defstruct [:data]
deftype reader_t(r, m, a) :: %ReaderT{da... | lib/elixirdo/instance/monad_trans/reader.ex | 0.581541 | 0.480905 | reader.ex | starcoder |
defmodule LiveViewStudio.Donations do
@moduledoc """
The Donations context.
"""
import Ecto.Query, warn: false
alias LiveViewStudio.Repo
alias LiveViewStudio.Donations.Donation
def almost_expired?(donation) do
donation.days_until_expires <= 10
end
@doc """
Returns the list of donations.
#... | live_view_studio/lib/live_view_studio/donations.ex | 0.804713 | 0.451206 | donations.ex | starcoder |
defmodule Rummage.Ecto.Hooks.Search do
@moduledoc """
`Rummage.Ecto.Hooks.Search` is the default search hook that comes shipped
with `Rummage.Ecto`.
This module can be overridden with a custom module while using `Rummage.Ecto`
in `Ecto` struct module.
Usage:
For a regular search:
This returns a `quer... | lib/rummage_ecto/hooks/search.ex | 0.808937 | 0.879406 | search.ex | starcoder |
defmodule OMG.Output do
@moduledoc """
`OMG.Output` and `OMG.Output.Protocol` represent the outputs of transactions, i.e. the valuables or other pieces of
data spendable via transactions on the child chain, and/or exitable to the root chain.
This module specificially dispatches generic calls to the various sp... | apps/omg/lib/omg/output.ex | 0.80038 | 0.575141 | output.ex | starcoder |
defmodule ElixirKeeb.Representation do
alias ElixirKeeb.Structs.KeycodeBehavior
@moduledoc """
This module exists to get a string representation that
can be used by the `simple_keyboard` Javascript library
in the web dashboard provided by the `poncho` `elixir_keeb_ui`
project.
"""
alias ElixirKeeb.Util... | lib/representation.ex | 0.808937 | 0.402921 | representation.ex | starcoder |
defmodule Firenest.Topology do
@moduledoc """
Defines and interacts with Firenest topologies.
The topology is the building block in Firenest. It specifies:
* How failures are handled (temporary and permanent)
* How messages are sent across nodes
* How messages are broadcast in the cluster
The top... | lib/firenest/topology.ex | 0.931072 | 0.73557 | topology.ex | starcoder |
defmodule WebSocket do
@moduledoc """
An exploration into a stand-alone library for
Plug applications to easily adopt WebSockets.
## Integrating with Plug
If you're looking to try this in your own test
application, do something like this:
```elixir
defmodule MyApp.Router do
use Plug.Router
us... | lib/web_socket.ex | 0.800497 | 0.6515 | web_socket.ex | starcoder |
defmodule Number.SI do
@moduledoc """
Provides functions for formatting numbers using SI notation.
"""
@prefixes [
# yotta
{8, "Y"},
# zetta
{7, "Z"},
# exa
{6, "E"},
# peta
{5, "P"},
# tera
{4, "T"},
# giga
{3, "G"},
# mega
{2, "M"},
# kilo
{1, "... | lib/number/si.ex | 0.79999 | 0.439266 | si.ex | starcoder |
defmodule Inky.RpiIO do
@moduledoc """
An `Inky.InkyIO` implementation intended for use with raspberry pis and relies on
Circuits.GPIO and Cirtuits.SPI.
"""
@behaviour Inky.InkyIO
alias Circuits.GPIO
alias Circuits.SPI
alias Inky.InkyIO
defmodule State do
@moduledoc false
@state_fields [:d... | lib/hal/rpiio.ex | 0.820326 | 0.527499 | rpiio.ex | starcoder |
defmodule GoodTimes.Boundary do
@vsn GoodTimes.version
@moduledoc """
Return the first or last second of a unit of time.
Find the boundaries of a unit of time, i.e. the first/last second of a minute,
an hour, day, week, month or year.
Find the first second with `beginning_of_<time unit>/1` and the last s... | lib/good_times/boundary.ex | 0.90842 | 0.777807 | boundary.ex | starcoder |
defmodule Google.Datastore.V1.PartitionId do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
project_id: String.t(),
namespace_id: String.t()
}
defstruct [:project_id, :namespace_id]
field :project_id, 2, type: :string
field :namespace_id, 4, type: :strin... | lib/google/datastore/v1/entity.pb.ex | 0.696784 | 0.572364 | entity.pb.ex | starcoder |
defmodule Aecore.Sync.Task do
@moduledoc """
Each sync task holds information about a syncing process with multiple peers
where each peer is recognized as a worker with peer_id and pid of a separate process doing the work.
A sync task works on a specific chain, meaning there is one sync task per chain.
If a ... | apps/aecore/lib/aecore/sync/task.ex | 0.744935 | 0.449997 | task.ex | starcoder |
defmodule Burette.Calendar do
@moduledoc """
Generator for dates and times
"""
@typep erl_date :: {Calendar.year, Calendar.month, Calendar.day}
@typep erl_time :: {Calendar.hour, Calendar.minute, Calendar.second}
@spec date(Keyword.t) :: Date.t
def date(params \\ []) do
{year, month, day} = make_dat... | lib/burette/calendar.ex | 0.775902 | 0.557905 | calendar.ex | starcoder |
defmodule DarkMatter.Decimals do
@moduledoc """
Decimal Utils
"""
@moduledoc since: "1.0.0"
alias DarkMatter.Decimals.Arithmetic
alias DarkMatter.Decimals.Comparison
alias DarkMatter.Decimals.Conversion
alias DarkMatter.Decimals.Variance
@type decimal_map() :: %{sign: -1 | 1, coef: non_neg_integer()... | lib/dark_matter/decimals.ex | 0.952574 | 0.468 | decimals.ex | starcoder |
defmodule FusionAuth.JWT do
@moduledoc """
The `FusionAuth.JWT` module provides access functions to the [FusionAuth JWT API](https://fusionauth.io/docs/v1/tech/apis/jwt).
Most functions require a Tesla Client struct created with `FusionAuth.client(base_url, api_key, tenant_id)`.
Those that use JWT Authenticati... | lib/fusion_auth/jwt.ex | 0.881831 | 0.496277 | jwt.ex | starcoder |
defmodule Harald.HCI.SynchronousData do
@moduledoc """
Reference: version 5.2, vol 4, part E, 5.4.3.
"""
@enforce_keys [
:connection_handle,
:packet_status_flag,
:rfu,
:data_total_length,
:data
]
defstruct [
:connection_handle,
:packet_status_flag,
:rfu,
:data_total_len... | lib/harald/hci/synchronous_data.ex | 0.668664 | 0.426172 | synchronous_data.ex | starcoder |
defmodule Juice do
@moduledoc """
Reduce in memory data structures using a lightweight query language
"""
alias Juice.Expression
def squeeze(source, query) when is_bitstring(query) do
expression = Expression.parse(query)
squeeze(source, expression)
end
def squeeze(source, expression) when is_li... | lib/juice.ex | 0.794783 | 0.589155 | juice.ex | starcoder |
defprotocol Brook.Serializer.Protocol do
@moduledoc """
The protocol for standard serialization of Elixir structs to
an in-transit encoding format before sending on the Brook event stream.
Brook drivers are expected to implement a default serializer for
converting to the given encoding, leaving the client th... | lib/brook/serializer.ex | 0.82151 | 0.430536 | serializer.ex | starcoder |
defmodule WordSearch.State do
def new(alpahbet, words, size, directions) do
%{
alpahbet: alpahbet,
words: words,
placed_words: [],
grid: %{}, # 1d "array"
size: size, # size of one side
available_positions: generate_positions(size),
directions: WordSearch.Directions.conve... | lib/word_search/state.ex | 0.506836 | 0.544801 | state.ex | starcoder |
defmodule Logger.Utils do
@moduledoc false
@doc """
Truncates a char data into n bytes.
There is a chance we truncate in the middle of a grapheme
cluster but we never truncate in the middle of a binary
codepoint. For this reason, truncation is not exact.
"""
@spec truncate(IO.chardata, non_neg_integer... | lib/logger/lib/logger/utils.ex | 0.774541 | 0.539469 | utils.ex | starcoder |
defmodule Shipstation.RequestLimit do
@moduledoc ~s"""
This module is designed to record and handle the [backpressure
obligations](https://www.shipstation.com/developer-api/#/introduction/shipstation-api-requirements/api-rate-limits)
the API client has against the API.
When a request is made, the response he... | lib/request_limit.ex | 0.791982 | 0.406833 | request_limit.ex | starcoder |
defmodule Queue do
@moduledoc File.read!("README.md")
defstruct front: [], rear: []
@type t :: %Queue{front: list, rear: list}
@doc "Returns a new empty queue"
@spec new :: t
def new do
%Queue{}
end
@doc "Puts the given value at the end the queue"
@spec put(t, term) :: t
def put(%Queue{front:... | lib/queue.ex | 0.876549 | 0.525004 | queue.ex | starcoder |
defmodule Ueberauth.Strategy.FreeAgent do
@moduledoc """
FreeAgent OAuth2 strategy for Überauth.
## Configuration
Add `freeagent` to your Überauth configuration:
```elixir
config :ueberauth, Ueberauth,
providers: [
freeagent: {Ueberauth.Strategy.FreeAgent, []}
]
```
Update your provide... | lib/ueberauth/strategy/freeagent.ex | 0.81841 | 0.751124 | freeagent.ex | starcoder |
defmodule ExUnit.CaptureLog do
@moduledoc ~S"""
Functionality to capture logs for testing.
## Examples
defmodule AssertionTest do
use ExUnit.Case
import ExUnit.CaptureLog
test "example" do
assert capture_log(fn ->
Logger.error "log msg"
end) =~ "lo... | lib/ex_unit/lib/ex_unit/capture_log.ex | 0.784526 | 0.621799 | capture_log.ex | starcoder |
defmodule ExKdl.Parser do
@moduledoc false
alias ExKdl.DecodeError
alias ExKdl.Node
alias ExKdl.Token
alias ExKdl.Value
import ExKdl.Token, only: [is_type: 2]
import ExKdl.Parser.Utils
defguardp is_whitespace(token)
when is_type(token, :whitespace) or
is_type(token, :m... | lib/ex_kdl/parser.ex | 0.739986 | 0.555978 | parser.ex | starcoder |
defmodule Curvy do
@moduledoc """


Signatures and Bitcoin flavoured crypto written in pure Elixir. Curvy is an
implementation of `secp256k1`, an elliptic cu... | lib/curvy.ex | 0.918651 | 0.609902 | curvy.ex | starcoder |
defmodule BitwiseNif do
@moduledoc """
BitwiseNif: NIF example module showing different NIF scheduling issues
This is an Elixir and Rust port of
The oricinal C and Erlang code were originally written by <NAME>
for bitwise at https://github.com/vinoski/bitwise.
This code was originally presented at Chicag... | bitwise.ex | 0.590897 | 0.720491 | bitwise.ex | starcoder |
defmodule Money.Currency do
@moduledoc """
Provides currency support to `Money`
Some useful helper methods include:
- `get/1`
- `get!/1`
- `exists?/1`
- `to_atom/1`
- `name/1`
- `name!/1`
- `symbol/1`
- `symbol!/1`
- `all/0`
A helper function exists for each currency using the lowercase thre... | lib/money/currency.ex | 0.855293 | 0.513729 | currency.ex | starcoder |
defmodule Exzeitable.Database do
@moduledoc "Database interactions"
import Ecto.Query
@doc "Get the data using query"
@spec get_records(map) :: [map]
def get_records(%{query: query} = assigns) do
query
|> order_query(assigns)
|> search_query(assigns)
|> paginate_query(assigns)
|> get_quer... | lib/exzeitable/database.ex | 0.745954 | 0.465448 | database.ex | starcoder |
defmodule Grizzly.ZIPGateway.Config do
@moduledoc false
# This module is for making the `zipgateway.cfg` file
require Logger
alias Grizzly.Supervisor
@type t :: %__MODULE__{
ca_cert: Path.t(),
cert: Path.t(),
priv_key: Path.t(),
eeprom_file: Path.t() | nil,
... | lib/grizzly/zipgateway/config.ex | 0.820721 | 0.420481 | config.ex | starcoder |
defmodule Mix.Tasks.Release do
@moduledoc """
Build a release for the current mix application.
## Command line options
* `--name` - selects a specific release to build
* `--env` - selects a specific release environment to build with
* `--profile` - selects both a release and environment, synt... | lib/distillery/tasks/release.ex | 0.82828 | 0.53692 | release.ex | starcoder |
defmodule Nx.Defn.Evaluator do
@moduledoc """
The default implementation of a `Nx.Defn.Compiler`
that evaluates the expression tree against the
tensor backend.
"""
@behaviour Nx.Defn.Compiler
alias Nx.Defn.{Expr, Tree}
@creation_ops [:tensor, :eye, :iota, :random_normal, :random_uniform, :from_binary]... | lib/nx/defn/evaluator.ex | 0.808483 | 0.497864 | evaluator.ex | starcoder |
defmodule DebounceAndThrottle.Debounce do
defstruct([:timer_ref, :scheduled_at, :debounced_count, :extra_data])
alias DebounceAndThrottle.Debounce
@type t :: %Debounce{
timer_ref: reference(),
scheduled_at: DateTime.t(),
debounced_count: non_neg_integer(),
extra_data: map(... | lib/debounce_and_throttle/debounce.ex | 0.788705 | 0.417865 | debounce.ex | starcoder |
defmodule Radixir.Crypto.PublicKey.RSAPrivateKey do
@moduledoc false
defstruct version: nil,
public_modulus: nil,
public_exponent: nil,
private_exponent: nil,
prime_one: nil,
prime_two: nil,
exponent_one: nil,
exponent_two: nil,
... | lib/radixir/crypto/rsa_private_key.ex | 0.7413 | 0.528351 | rsa_private_key.ex | starcoder |
defmodule Mix.Tasks.Surface.Init.Patches do
@moduledoc false
alias Mix.Tasks.Surface.Init.Patchers
# Common patches
def add_surface_live_reload_pattern_to_endpoint_config(context_app, web_module, web_path) do
%{
name: "Update patterns in :reload_patterns",
patch:
&Patchers.Phoenix.rep... | lib/mix/tasks/surface/surface.init/patches.ex | 0.860061 | 0.634119 | patches.ex | starcoder |
defmodule ExRabbitMQ do
@version Mix.Project.config()[:version]
|> Version.parse()
|> elem(1)
|> Map.take([:major, :minor])
|> (fn %{major: major, minor: minor} -> "#{major}.#{minor}" end).()
@moduledoc """
A project providing the following abstractions:
1. Connecti... | lib/ex_rabbit_m_q.ex | 0.808937 | 0.551996 | ex_rabbit_m_q.ex | starcoder |
defmodule TripPlan.Leg do
@moduledoc """
A single-mode part of an Itinerary
An Itinerary can take multiple modes of transportation (walk, bus,
train, &c). Leg represents a single mode of travel during journey.
"""
alias TripPlan.{PersonalDetail, TransitDetail, NamedPosition}
defstruct start: DateTime.fr... | apps/trip_plan/lib/trip_plan/leg.ex | 0.877929 | 0.466116 | leg.ex | starcoder |
defmodule NashvilleZoneLookup.Zoning.LandUse do
@moduledoc ~S"""
An arrangement, activity, or input that might be undertaken on a property
For example, a Land Use might be a class of business ("Bed and breakfast
inn"), an agricultural activity ("Domestic hens"), or an institution
("Correctional facility").
... | lib/nashville_zone_lookup/zoning/land_use.ex | 0.666497 | 0.46041 | land_use.ex | starcoder |
defmodule Duration.Parser do
@moduledoc false
@doc """
Parses the given `binary` as parse.
Returns `{:ok, [token], rest, context, position, byte_offset}` or
`{:error, reason, rest, context, line, byte_offset}` where `position`
describes the location of the parse (start position) as `{line, column_on_line... | lib/duration/parser.ex | 0.922434 | 0.530845 | parser.ex | starcoder |
defmodule RDF.Quad do
@moduledoc """
Helper functions for RDF quads.
An RDF Quad is represented as a plain Elixir tuple consisting of four valid
RDF values for subject, predicate, object and a graph name.
"""
alias RDF.{Statement, PropertyMap}
@type t :: {
Statement.subject(),
State... | lib/rdf/quad.ex | 0.925002 | 0.698379 | quad.ex | starcoder |
defmodule FusionDsl do
@moduledoc """
Fusion DSL main API.
This module is a standard interface for the following.
- Managing packages.
- Compiling Fusion Code (Lexing, AstProccess).
- Configuring runtime enviornment.
- Code execution.
"""
require FusionDsl.Kernel
require FusionDsl.Logger
req... | lib/fusion_dsl.ex | 0.821689 | 0.446374 | fusion_dsl.ex | starcoder |
defmodule Serum.Result do
@moduledoc """
This module defines types for positive results or errors returned by
functions in this project.
"""
import Serum.IOProxy, only: [put_err: 2]
alias Serum.Error
alias Serum.Error.Format
alias Serum.Error.SimpleMessage
@type t(type) :: {:ok, type} | {:error, Err... | lib/serum/result.ex | 0.854809 | 0.499878 | result.ex | starcoder |
defmodule Pelemay do
import SumMag
alias Pelemay.Generator
alias Pelemay.Db
@moduledoc """
## Pelemay: The Penta (Five) “Elemental Way”: Freedom, Insight, Beauty, Efficiency and Robustness
For example, the following code of the function `map_square` will be compiled to native code using SIMD instructions... | lib/pelemay.ex | 0.766206 | 0.66034 | pelemay.ex | starcoder |
defmodule Exdis.IoData do
use Bitwise
require Record
## ------------------------------------------------------------------
## Record and Type Definitions
## ------------------------------------------------------------------
Record.defrecord(:io_data,
bytes: nil,
size: nil,
fragments: nil
)
... | lib/exdis/io_data.ex | 0.506103 | 0.614914 | io_data.ex | starcoder |
defmodule Talib.MACD do
alias Talib.EMA
require OK
@moduledoc ~S"""
Defines a Moving Average Convergence/Divergence index.
## History
Version: 1.0
Source: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_average_convergence_divergence_macd
Audited by:
| Name ... | lib/talib/macd.ex | 0.889978 | 0.733523 | macd.ex | starcoder |
defmodule CLI do
@moduledoc """
Interface for launching a command line application.
The CLI application receives JSON input and, depending on command line options, launches the application in one of the following modes:
- a one_shot mode which accepts JSON from the standard input, interprets it
into com... | apps/imposc/lib/cli/cli.ex | 0.719384 | 0.501465 | cli.ex | starcoder |
defmodule Terminus.Planaria do
@moduledoc """
A behaviour module for implementing [Planaria](https://neon.planaria.network)-like
state machines in Elixir.
A module using `Terminus.Planaria` is a GenStage consumer process that will
automatically mangage its own producer processes to crawl and listen to Bitcoi... | lib/terminus/planaria.ex | 0.918667 | 0.63385 | planaria.ex | starcoder |
defmodule ExUnitFixtures do
@moduledoc """
A library for declaring & using test fixtures in ExUnit.
For an overview of it's purpose see the [README](README.html).
To use ExUnitFixtures we need to start it. Add the following code to your
`test_helpers.exs`:
ExUnitFixtures.start
This starts the ExUn... | lib/ex_unit_fixtures.ex | 0.877903 | 0.701138 | ex_unit_fixtures.ex | starcoder |
defmodule Custodian.Bots do
@moduledoc """
The Bots context provides a boundary into the `Custodian.Bots.Bot` schema. It
provides functions for listing, creating, updating, and deleting bots.
"""
import Ecto.Query, warn: false
alias Custodian.Repo
alias Custodian.Bots.Bot
@doc """
Returns the list ... | lib/custodian/bots/bots.ex | 0.85738 | 0.4953 | bots.ex | starcoder |
defmodule SPARQL.Client do
@moduledoc """
A SPARQL protocol client.
The [SPARQL Protocol](https://www.w3.org/TR/sparql11-protocol/) defines how the operations
specified in the SPARQL query and update specs can be requested by a client from a
SPARQL service via HTTP.
This modules provides dedicated functio... | lib/sparql_client.ex | 0.888831 | 0.84607 | sparql_client.ex | starcoder |
defmodule Remedy.Snowflake do
@moduledoc """
`Ecto.Type` compatible Discord Snowflake type.
Discord utilizes Twitter's snowflake format for uniquely identifiable descriptors (IDs). These IDs are guaranteed to be unique across all of Discord, except in some unique scenarios in which child objects share their pare... | lib/remedy/types/snowflake.ex | 0.850546 | 0.526465 | snowflake.ex | starcoder |
defmodule SimpleGraphqlClient do
import SimpleGraphqlClient.HttpClient
import SimpleGraphqlClient.Parser
import SimpleGraphqlClient.Subscriber
alias SimpleGraphqlClient.Response
@moduledoc """
SimpleGraphqlClient is a graphql client, focused on simplicity and ease of use.
## Usage
### Query/Mutation e... | lib/simple_graphql_client.ex | 0.723798 | 0.572185 | simple_graphql_client.ex | starcoder |
defmodule Axon.Initializers do
@moduledoc """
Parameter initializers.
Parameter initializers are used to initialize the weights
and biases of a neural network. Because most deep learning
optimization algorithms are iterative, they require an initial
point to iterate from.
Sometimes the initialization of... | lib/axon/initializers.ex | 0.870652 | 0.805058 | initializers.ex | starcoder |
defmodule Nectar.Variant do
use Nectar.Web, :model
use Arc.Ecto.Schema
schema "variants" do
field :is_master, :boolean, default: false
field :sku, :string
field :weight, :decimal
field :height, :decimal
field :width, :decimal
field :depth, :decimal
field :discontinue_on, Ecto.Date
... | web/models/variant.ex | 0.725843 | 0.42662 | variant.ex | starcoder |
defmodule AWS.GlobalAccelerator do
@moduledoc """
AWS Global Accelerator
This is the *AWS Global Accelerator API Reference*. This guide is for
developers who need detailed information about AWS Global Accelerator API
actions, data types, and errors. For more information about Global
Accelerator features, ... | lib/aws/generated/global_accelerator.ex | 0.894375 | 0.573858 | global_accelerator.ex | starcoder |
defmodule Redix.PubSub do
@moduledoc """
Interface for the Redis pub/sub functionality.
The rest of this documentation will assume the reader knows how pub/sub works
in Redis and knows the meaning of the following Redis commands:
* `SUBSCRIBE` and `UNSUBSCRIBE`
* `PSUBSCRIBE` and `PUNSUBSCRIBE`
* ... | lib/redix/pubsub.ex | 0.882599 | 0.655515 | pubsub.ex | starcoder |
defmodule Ecto.Adapters.Poolboy do
@moduledoc """
Start a pool of connections using `poolboy`.
### Options
* `:size` - The number of connections to keep in the pool (default: 10)
* `:lazy` - When true, connections to the repo are lazily started (default: true)
* `:max_overflow` - The maximum overflo... | lib/ecto/adapters/poolboy.ex | 0.771413 | 0.49048 | poolboy.ex | starcoder |
defmodule ExDns.Message.Header do
@moduledoc """
Manages the header of a DNS message
4.1.1. Header section format
The header contains the following fields:
1 1 1 1 1 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+--+--+--+--+--+--+--+--+--+--+--+--+... | lib/ex_dns/message/header.ex | 0.780328 | 0.438304 | header.ex | starcoder |
defmodule Helios.Registry.Distribution.Strategy do
@moduledoc """
This module implements the interface for custom distribution strategies.
The default strategy used by Helios.Registry is a consistent hash ring implemented
via the `libring` library.
Custom strategies are expected to return a datastructure or ... | lib/helios/registry/distribution/strategy.ex | 0.892369 | 0.613468 | strategy.ex | starcoder |
defmodule Vox.Transform do
@moduledoc """
The transform struct represents a coordinate transformation. Transforms
can be stacked.
"""
defstruct [:origin, :data]
@type t :: %__MODULE__{ data: Vox.Data.t, origin: Vox.Data.origin }
@side_x [:left, :right]
@side_y [:bottom, :top]
@... | lib/vox/transform.ex | 0.83924 | 0.815233 | transform.ex | starcoder |
defmodule MeshxConsul do
@readme File.read!("docs/README.md") |> String.split("<!-- MDOC !-->") |> Enum.fetch!(1)
@moduledoc """
#{@readme}
## Configuration options
#### Consul Agent
`MeshxConsul` requires Consul Agent API endpoint address and ACL token to manage services and upstreams. Additionally envir... | lib/mesh_consul.ex | 0.860911 | 0.856392 | mesh_consul.ex | starcoder |
defmodule ShEx.ShapeMap do
@moduledoc """
A finite set of `ShEx.ShapeMap.Association`s used to specify the nodes on which validations should be performed and for the result of validations.
A ShapeMap can be either created with `ShEx.ShapeMap.new/1` or loaded from a
string representation in the standard ShapeMa... | lib/shex/shape_map.ex | 0.879961 | 0.849097 | shape_map.ex | starcoder |
defmodule Timex.DateFormat do
@moduledoc """
Date formatting and parsing.
This module provides an interface and core implementation for converting date
values into strings (formatting) or the other way around (parsing) according
to the specified template.
Multiple template formats are supported, each one ... | lib/dateformat/dateformat.ex | 0.921596 | 0.630287 | dateformat.ex | starcoder |
defmodule Re.Addresses.Neighborhoods do
@moduledoc """
Context for neighborhoods.
"""
import Ecto.Query
alias Re.{
Address,
Addresses.District,
Listing,
Repo,
Slugs
}
@all_query from(
a in Address,
join: l in Listing,
where: l.address_id ... | apps/re/lib/addresses/neighborhoods.ex | 0.675015 | 0.546617 | neighborhoods.ex | starcoder |
defmodule Definject.Check do
@moduledoc false
@uninjectable [:erlang, Kernel, Kernel.Utils]
def validate_deps(deps, {used_captures, used_mods}, {mod, name, arity}) do
outer_function = "#{mod}.#{name}/#{arity}"
used_captures = used_captures |> Enum.uniq()
used_mods = used_mods |> Enum.uniq()
str... | lib/definject/check.ex | 0.606032 | 0.42051 | check.ex | starcoder |
defmodule GGity.Geom.Bar do
@moduledoc false
alias GGity.{Draw, Geom, Plot}
@type t() :: %__MODULE__{}
@type record() :: map()
@type mapping() :: map()
defstruct data: nil,
mapping: nil,
stat: :count,
position: :stack,
key_glyph: :rect,
fill: "b... | lib/ggity/geom/bar.ex | 0.883964 | 0.579966 | bar.ex | starcoder |
defmodule Meeple.FogOfWar do
@moduledoc """
Fog of war, shows only the parts of the territory to the player, that are visible to him/her.
It also combines information from the territory with player specific informations.
state:
territory: module/pid of Territory
fog: visability
grid: combined information... | apps/meeple/lib/meeple/board/fog_of_war.ex | 0.633183 | 0.63696 | fog_of_war.ex | starcoder |
defmodule DOMSegServer.Datasets do
@moduledoc """
The Datasets context.
"""
import Ecto.Query, warn: false
import DOMSegServer.Guards
alias DOMSegServer.Repo
alias DOMSegServer.Datasets.Dataset
@doc """
Returns the list of datasets.
## Examples
iex> list_datasets()
[%Dataset{}, ...]... | server/lib/domsegserver/datasets.ex | 0.841256 | 0.490419 | datasets.ex | starcoder |
defmodule ShEx.EachOf do
@moduledoc false
defstruct [
# tripleExprLabel?
:id,
# [tripleExpr{2,}]
:expressions,
# INTEGER?
:min,
# INTEGER?
:max,
# [SemAct+]?
:sem_acts,
# [Annotation+]?
:annotations
]
import ShEx.TripleExpression.Shared
def matches(each_of, t... | lib/shex/shape_expressions/each_of.ex | 0.579638 | 0.453141 | each_of.ex | starcoder |
defmodule Dogma.Reporter.JSON do
@moduledoc """
A machine readable format in JSON.
The JSON structure is like the following example:
{
"metadata": {
"dogma_version": "0.3.0",
"elixir_version": "1.0.5",
"erlang_version": "Erlang/OTP 10 [erts-7.0.3] [64-bit]",
... | lib/dogma/reporter/json.ex | 0.746139 | 0.445168 | json.ex | starcoder |
defmodule Penelope.NLP.POSTagger do
@moduledoc """
The part-of-speech tagger transforms a tokenized sentence into a list of
`{token, pos_tag}` tuples. The tagger takes no responsibility for
tokenization; this means that callers must be careful to maintain the same
tokenization scheme between training and eval... | lib/penelope/nlp/pos_tagger.ex | 0.925626 | 0.766468 | pos_tagger.ex | starcoder |
defmodule Projare.Project do
use Projare.Web, :model
@url_regex ~r"^(https?://)?([\da-z\.-]+)\.([a-z\.]{2,6})([/\w \.-]*)*/?$"
schema "projects" do
field :url, :string
field :title, :string
field :description, :string
field :stars_count, :integer, default: 0
field :comments_count, :integer, ... | web/models/project.ex | 0.54698 | 0.433202 | project.ex | starcoder |
defmodule Membrane.MP4.Muxer.CMAF do
@moduledoc """
Puts payloaded stream into [Common Media Application Format](https://www.wowza.com/blog/what-is-cmaf),
an MP4-based container commonly used in adaptive streaming over HTTP.
Multiple input streams are supported. If that is the case, they will be muxed into a s... | lib/membrane_mp4/muxer/cmaf.ex | 0.876317 | 0.443359 | cmaf.ex | starcoder |
defmodule Imagism.Image do
@moduledoc """
A loaded image that can be processed and encoded.
"""
@type t() :: %Imagism.Image{}
defstruct resource: nil,
reference: nil
@doc """
Wraps an image returned from the NIF with a reference.
"""
@spec wrap_resource(any) :: Imagism.Image.t()
def wr... | lib/imagism/image.ex | 0.907374 | 0.429968 | image.ex | starcoder |
defmodule ElixirRigidPhysics.Geometry.Triangle do
@moduledoc """
Module for handling queries related to planar 3D triangles
"""
alias Graphmath.Vec3
require Record
Record.defrecord(:triangle, a: {0.0, 0.0, 0.0}, b: {0.0, 1.0, 0.0}, c: {0.0, 0.0, 1.0})
@type triangle :: record(:triangle, a: Vec3.vec3(), b... | lib/geometry/triangle.ex | 0.888318 | 0.674252 | triangle.ex | starcoder |
defmodule Pilot do
require Logger
@moduledoc """
Defines a Pilot api endpoint
When used, the endpoint expects `:otp_app` as an option. The `:otp_app`
should point to an OTP application that has the endpoint configuration.
For example, the endpoint:
defmodule Example.Pilot do
use Pilot, otp_app: ... | lib/pilot.ex | 0.855941 | 0.441974 | pilot.ex | starcoder |
defmodule GetGeocode.Apis.Nominatim do
@moduledoc """
Nominatim API.
"""
@url "https://nominatim.openstreetmap.org/search?q=<QUERY>&format=json"
@doc """
Gets data from an `addr`ess.
Results in a list with the data, or a tuple `{:ok, "No result"}`.
## Examples
```
iex> GetGeocode.Apis.Nominat... | lib/get_geocode/apis/nominatim.ex | 0.810629 | 0.826292 | nominatim.ex | starcoder |
defmodule TinkoffInvest.Api do
@moduledoc """
This module provides two simple requests: GET and POST
`payload` map converted to query string on request
You will need to define your custom `TinkoffInvest.Model` to make this work or use existing one.
Examples:
```
TinkoffInvest.Api.request("/orders", ... | lib/tinkoff_invest/api.ex | 0.834306 | 0.515071 | api.ex | starcoder |
defmodule AWS.CloudHSM do
@moduledoc """
AWS CloudHSM Service
"""
@doc """
Adds or overwrites one or more tags for the specified AWS CloudHSM
resource.
Each tag consists of a key and a value. Tag keys must be unique to each
resource.
"""
def add_tags_to_resource(client, input, options \\ []) do
... | lib/aws/cloud_hsm.ex | 0.827689 | 0.500793 | cloud_hsm.ex | starcoder |
defmodule DiscordBot.Entity.Guilds do
@moduledoc """
Provides a cache of guild information, backed by ETS.
"""
use GenServer
alias DiscordBot.Broker
alias DiscordBot.Broker.Event
alias DiscordBot.Entity.GuildRecord
alias DiscordBot.Model.Guild
@doc """
Starts the guild registry.
- `opts` - a k... | apps/discordbot/lib/discordbot/entity/guilds.ex | 0.848675 | 0.404566 | guilds.ex | starcoder |
defmodule Elsa.Topic do
@moduledoc """
Provides functions for managing and interacting with topics in the Kafka cluster.
"""
import Elsa.Util, only: [with_connection: 3, reformat_endpoints: 1]
import Record, only: [defrecord: 2, extract: 2]
defrecord :kpro_rsp, extract(:kpro_rsp, from_lib: "kafka_protocol/... | deps/elsa/lib/elsa/topic.ex | 0.862974 | 0.563738 | topic.ex | starcoder |
defmodule ESpec.AssertReceive do
@moduledoc """
Defines `assert_receive` and `assert_received` helper macros
"""
@default_timeout 100
defmodule AssertReceiveError do
defexception message: nil
end
alias ESpec.ExpectTo
alias ESpec.Assertions.AssertReceive
@doc "Asserts that a message matching `pa... | lib/espec/assert_receive.ex | 0.783119 | 0.658284 | assert_receive.ex | starcoder |
defmodule Currencyconverter.Convert do
require Logger
alias Currencyconverter.CurrencyEndpoints.Exchangeratesapi.GetCurrencies
@moduledoc """
this module connects to the external currency conversion api (https://exchangeratesapi.io/documentation/).
"""
@doc """
converts the amount of a certain currenc... | lib/currencyconverter/convert.ex | 0.892469 | 0.513485 | convert.ex | starcoder |
defmodule Inspect.Opts do
@moduledoc """
Defines the Inspect.Opts used by the Inspect protocol.
The following fields are available:
* `:structs` - when `false`, structs are not formatted by the inspect
protocol, they are instead printed as maps, defaults to `true`.
* `:binaries` - when `:as_strin... | lib/elixir/lib/inspect/algebra.ex | 0.827759 | 0.603377 | algebra.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.