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 Pummpcomm.Monitor.BloodGlucoseMonitor do
@moduledoc """
This module provides high-level continuous glucose monitor functions, such as the ability to retrieve a specific
number of historical minutes of cgm data. It manages the process of pulling the right number of cgm pages from the
insulin pump, alon... | lib/pummpcomm/monitor/blood_glucose_monitor.ex | 0.768473 | 0.622273 | blood_glucose_monitor.ex | starcoder |
defmodule Gettext.Interpolation do
@moduledoc false
@interpolation_regex ~r/
(?<left>) # Start, available through :left
%{ # Literal '%{'
[^}]+ # One or more non-} characters
} # Literal '}'
(?<right>) # End, available through :right
/x
@doc """
Extracts interpolat... | data/web/deps/gettext/lib/gettext/interpolation.ex | 0.881168 | 0.527986 | interpolation.ex | starcoder |
defmodule Tesla.Middleware.Cacher do
@behaviour Tesla.Middleware
@moduledoc """
Cache the result in redis.
### Example
```elixir
defmodule MyClient do
use Tesla
plug Tesla.Middleware.Cacher,
redix: :redix,
expiry: :timer.seconds(2),
timeout: :timer.seconds(5),
prefix: :tes... | lib/tesla_cacher.ex | 0.851506 | 0.703957 | tesla_cacher.ex | starcoder |
defmodule Feedistiller.Feeder do
@moduledoc """
Elixir encapsulation over the `feeder` module, allowing full usage
of the stream API. This is a very straightforward encapsulation with
direct mapping to `feeder` functions and minimal sugar over `feeder`
records to map them to structs.
"""
alias Feedistil... | lib/feedistiller/feeder.ex | 0.834811 | 0.499817 | feeder.ex | starcoder |
defmodule Scribe.Formatter.Index do
@moduledoc false
defstruct row: 0, row_max: 0, col: 0, col_max: 0
end
defmodule Scribe.Formatter.Line do
@moduledoc false
defstruct data: [], widths: [], style: nil, opts: [], index: nil
alias Scribe.Formatter.{Index, Line}
def format(%Line{index: %Index{row: 0}} = lin... | lib/formatter.ex | 0.691289 | 0.590336 | formatter.ex | starcoder |
defmodule Quarto do
@external_resource "./README.md"
@moduledoc """
#{File.read!(@external_resource) |> String.split("---", parts: 2) |> List.last()}
"""
defmacro __using__(opts) do
quote do
@defaults unquote(opts)
def paginate(queryable, opts \\ [], repo_opts \\ []) do
opts = Keywor... | lib/quarto.ex | 0.757794 | 0.492005 | quarto.ex | starcoder |
defmodule Dispenser.Demands do
@moduledoc """
Tracks the demands of subscribers.
Keeps a constant-time `total/1` of the overall demand.
Used by `Buffer` to keep track of demand for events.
Used by implementations of `Dispenser.AssignmentStrategy`
to determine which subscribers to send to.
"""
@typed... | lib/dispenser/demands.ex | 0.885102 | 0.612368 | demands.ex | starcoder |
defmodule Scenic.Primitive.Text do
@moduledoc """
Draw text on the screen.
## Data
`text`
The data for a Text primitive is a bitstring
* `text` - the text to draw
## Styles
This primitive recognizes the following styles
* [`hidden`](Scenic.Primitive.Style.Hidden.html) - show or hide the primitiv... | lib/scenic/primitive/text.ex | 0.930561 | 0.755412 | text.ex | starcoder |
defmodule Bricks.Connector.Unix do
@moduledoc """
Connector for unix domain sockets, using `:gen_tcp`
## Create Options
### All
Ordering: Required first, then alphabetical
Option | Type(s) | Default | Raw `gen_tcp` option
:--------------------- | :---------------- | :... | bricks/lib/connectors/unix.ex | 0.879768 | 0.797911 | unix.ex | starcoder |
defmodule Liquor do
@moduledoc """
Liquor is a search filter helper, it provides:
* whitelisting
* transformation
* filtering
"""
@type op ::
:match |
:unmatch |
:== |
:!= |
:>= |
:<= |
:> |
:<
@type search_spec :: %{
whitelist: Liquor.Whitelist.filter(),
t... | lib/liquor.ex | 0.55266 | 0.654967 | liquor.ex | starcoder |
defmodule Csp.Searcher do
@moduledoc """
Search strategies for CSP.
"""
require Logger
@doc """
Performs a brute force search on `csp`.
**NOTE:** don't use it for real stuff. This is provided only for comparison with backtracking.
Use backtracking instead!
If solution is found, returned `{:solved, ... | lib/csp/searcher.ex | 0.824037 | 0.496216 | searcher.ex | starcoder |
defmodule Votr.Blt do
@doc """
Parses a BLT file `stream`.
The BLT file format is described here: https://www.opavote.com/help/overview#blt-file-format
Returns a map containing:
* `seats`: the number of seats to be elected
* `ballots`: a list of ballots that can be passed to `eval/3`
* `candidates`: a li... | lib/votr/blt.ex | 0.764848 | 0.670156 | blt.ex | starcoder |
defmodule Cldr.Calendar.Sigils do
@moduledoc """
Implements the `~d` sigils to produce
dates, datetimes and naive datetimes.
"""
alias Cldr.Config
@doc """
Implements a ~d sigil for expressing dates.
Dates can be expressed in the following formats:
* `~d[yyyy-mm-dd]` which produces a date in the ... | lib/cldr/calendar/sigils.ex | 0.869327 | 0.658321 | sigils.ex | starcoder |
defmodule Herald.Pipeline do
@moduledoc """
Pipeline is where messages are processed.
All message processing is started by function `run/2`.
When `run/2` receives a message, it runs the following steps:
* **pre_processing** - Will convert the message to a struct, using
the schema defined in route for th... | lib/herald/pipeline.ex | 0.836605 | 0.474936 | pipeline.ex | starcoder |
defmodule Clickhousex.Codec.RowBinary do
alias Clickhousex.{Codec, Codec.Binary, Type}
@behaviour Codec
@impl Codec
def response_format do
"RowBinaryWithNamesAndTypes"
end
@impl Codec
def request_format do
"Values"
end
@impl Codec
def encode(query, replacements, params) do
params =
... | lib/clickhousex/codec/row_binary.ex | 0.861101 | 0.407982 | row_binary.ex | starcoder |
defmodule QMI do
@moduledoc """
Qualcomm MSM Interface in Elixir
This module lets you send and receive messages from a QMI-enabled cellular
modem.
To use it, start a `QMI.Supervisor` in the supervision tree of your choosing
and pass it a name and interface. After that, use the service modules to send
it... | lib/qmi.ex | 0.763484 | 0.77535 | qmi.ex | starcoder |
defmodule Enums do
use Koans
@intro "Enums"
koan "Knowing how many elements are in a list is important for book-keeping" do
assert Enum.count([1, 2, 3]) == 3
end
koan "Depending on the type, it counts pairs" do
assert Enum.count(%{a: :foo, b: :bar}) == 2
end
def less_than_five?(n), do: n < 5
... | lib/koans/14_enums.ex | 0.760562 | 0.728 | 14_enums.ex | starcoder |
defmodule List do
@moduledoc """
Functions that work on (linked) lists.
Many of the functions provided for lists, which implement
the `Enumerable` protocol, are found in the `Enum` module.
Additionally, the following functions and operators for lists are
found in `Kernel`:
* `++/2`
* `--/2`
*... | lib/elixir/lib/list.ex | 0.887625 | 0.790692 | list.ex | starcoder |
defmodule Keyword do
@moduledoc """
A set of functions for working with keywords.
A keyword is a list of two-element tuples where the first
element of the tuple is an atom and the second element
can be any value.
A keyword may have duplicated keys so it is not strictly
a key-value store. However most of... | lib/elixir/lib/keyword.ex | 0.898907 | 0.657291 | keyword.ex | starcoder |
defmodule Finch.MockHTTP2Server do
@moduledoc false
import ExUnit.Assertions
alias Mint.{HTTP2.Frame, HTTP2.HPACK}
defstruct [:socket, :encode_table, :decode_table]
@fixtures_dir Path.expand("../fixtures", __DIR__)
@ssl_opts [
mode: :binary,
packet: :raw,
active: false,
reuseaddr: true,
... | test/support/mock_http2_server.ex | 0.658747 | 0.456955 | mock_http2_server.ex | starcoder |
defmodule GraphQL.Lang.AST do
defprotocol Visitor do
@moduledoc """
Implementations of Visitor are used by the ASTReducer to transform a GraphQL AST
into an arbitrary value.
The value can be the result of validations, or a transformation of the AST into
a new AST, for example.
The fallback i... | lib/graphql/lang/ast/visitor.ex | 0.842345 | 0.692499 | visitor.ex | starcoder |
defmodule GenRegistry do
@moduledoc """
GenRegistry provides a `Registry` like interface for managing processes.
"""
@behaviour GenRegistry.Behaviour
use GenServer
alias :ets, as: ETS
alias GenRegistry.Types
defstruct [:worker_module, :worker_type, :workers]
@typedoc """
GenRegistry State.
-... | lib/gen_registry.ex | 0.8488 | 0.404537 | gen_registry.ex | starcoder |
defmodule Sanbase.Billing.Plan.AccessChecker do
@moduledoc """
Module that contains functions for determining access based on the subscription
plan.
Adding new queries or updating the subscription plan does not require this
module to be changed.
The subscription plan needed for a given query is given in t... | lib/sanbase/billing/plan/access_checker.ex | 0.897318 | 0.763087 | access_checker.ex | starcoder |
defmodule Resx.Resource.Reference.Integrity do
@moduledoc """
The integrity of a resource.
%Resx.Resource.Reference.Integrity{
checksum: { :crc32, 3829359344 },
timestamp: DateTime.utc_now
}
"""
alias Resx.Resource.Reference.Integrity
@enforce_keys [:time... | lib/resx/resource/reference/integrity.ex | 0.910202 | 0.468547 | integrity.ex | starcoder |
defmodule Mix.Tasks.Alice.New.Handler do
@moduledoc ~S"""
Generates a new Alice handler.
This is the easiest way to set up a new Alice handler.
## Install `alice.new`
```bash
mix archive.install hex alice_new
```
## Build a Handler
First, navigate the command-line to the directory where you want ... | lib/mix/tasks/alice.new.handler.ex | 0.791418 | 0.728941 | alice.new.handler.ex | starcoder |
defmodule Ueberauth.Strategy.Todoist do
@moduledoc """
"""
use Ueberauth.Strategy,
uid_field: :id,
default_scope: "",
oauth2_module: Ueberauth.Strategy.Todoist.OAuth
alias Ueberauth.Auth.Info
alias Ueberauth.Auth.Credentials
alias Ueberauth.Auth.Extra
@doc """
Handles the initial redirect... | lib/ueberauth/strategy/todoist.ex | 0.628863 | 0.431165 | todoist.ex | starcoder |
defmodule EvictionOperator.Pod do
@moduledoc """
Finds pods that are candidates for eviction.
"""
@default_max_lifetime 600
alias K8s.{Client, Operation, Selector}
alias EvictionOperator.{Node, Event}
@doc """
Gets all pods with eviction enabled.
"""
@spec candidates(map()) :: {:ok, Enumerable.t(... | lib/eviction_operator/pod.ex | 0.869105 | 0.453867 | pod.ex | starcoder |
defmodule LetItGo.Application do
@moduledoc """
Under the application supervisor, we spin up processes for reading from, writing to, and
managing Kafka topics. See `LetItGo.TopicCreator` and `LetItGo.KafkaWriter` module docs
to learn more about writing to and managing topics.
We spin up group consumer proces... | lib/let_it_go/application.ex | 0.785802 | 0.693953 | application.ex | starcoder |
defmodule Config.Reader do
@moduledoc """
API for reading config files defined with `Config`.
## As a provider
`Config.Reader` can also be used as a `Config.Provider`. When used
as a provider, it expects a single argument: the configuration path
(as outlined in `t:Config.Provider.config_path/0`) for the f... | lib/elixir/lib/config/reader.ex | 0.887616 | 0.414425 | reader.ex | starcoder |
defprotocol Presence do
@moduledoc ~S"""
The `Presence` protocol is responsible for
checking the presence of a value.
The functions required to be implemented are
`is_blank/1`, `is_present/1` and `presence/1`.
These functions are not automatically imported
by `Kernel`.
Currently, these modules impleme... | lib/presence.ex | 0.912099 | 0.630998 | presence.ex | starcoder |
defmodule Ash.Dsl.Entity do
@moduledoc """
Declares a DSL entity.
A dsl entity represents a dsl constructor who's resulting value is a struct.
This lets the user create complex objects with arbitrary(mostly) validation rules.
The lifecycle of creating entities is complex, happening as Elixir is compiling
... | lib/ash/dsl/entity.ex | 0.865551 | 0.783492 | entity.ex | starcoder |
defmodule Plug.UploadError do
defexception [:message]
end
defmodule Plug.Upload do
@moduledoc """
A server (a `GenServer` specifically) that manages uploaded files.
Uploaded files are stored in a temporary directory
and removed from that directory after the process that
requested the file dies.
During ... | lib/plug/upload.ex | 0.730482 | 0.482063 | upload.ex | starcoder |
defmodule Crux.Structs.Permissions do
@moduledoc """
Custom non discord api module to help with working with [permissions](https://discord.com/developers/docs/topics/permissions).
"""
@moduledoc since: "0.1.3"
alias Crux.Structs
use Bitwise
permissions = %{
create_instant_invite: 1 <<< 0,
kick_... | lib/structs/permissions.ex | 0.848596 | 0.503601 | permissions.ex | starcoder |
defmodule Benchee.Profile do
alias Benchee.Output.ProfilePrinter, as: Printer
alias Benchee.Suite
@default_profiler :eprof
@builtin_profilers [:cprof, :eprof, :fprof]
defmodule Benchee.UnknownProfilerError do
defexception message: "error"
end
@moduledoc """
Profiles each scenario after benchmarki... | lib/benchee/profile.ex | 0.814164 | 0.47384 | profile.ex | starcoder |
defmodule CoderRing.GenRing do
@moduledoc """
GenServer wrapper for a CoderRing.
Keeping memo state in memory with a process means some database reads can
be skipped. State is, however, always synced to the database so it can be
restored properly on app restart.
Take care to only have one GenRing proc run... | lib/coder_ring/gen_ring.ex | 0.789396 | 0.686908 | gen_ring.ex | starcoder |
defmodule AWS.CodeDeploy do
@moduledoc """
AWS CodeDeploy
**Overview**
This reference guide provides descriptions of the AWS CodeDeploy APIs. For
more information about AWS CodeDeploy, see the [AWS CodeDeploy User
Guide](http://docs.aws.amazon.com/codedeploy/latest/userguide).
**Using the APIs**
Yo... | lib/aws/code_deploy.ex | 0.802594 | 0.44571 | code_deploy.ex | starcoder |
defmodule Cldr.Print do
@moduledoc """
Implements `printf/3`, `sprintf/3` and `lprintf/3` in a manner
largely compatible with the standard `C` language implementations.
"""
alias Cldr.Print.Parser
import Cldr.Print.Splice
@doc """
Formats and prints its arguments under control of a format.
The form... | lib/cldr_print.ex | 0.885928 | 0.948632 | cldr_print.ex | starcoder |
defmodule CssColors.RGB do
@moduledoc false
defstruct [
red: 0.0, # 0-255
green: 0.0, # 0-255
blue: 0.0, # 0-255
alpha: 1.0 # 0-1
]
def rgb(red, green, blue, alpha\\1.0)
def rgb({red, :percent}, {green, :percent}, {blue, :percent}, alpha) do
rgb(red * 255, green * 2... | lib/CssColors/rgb.ex | 0.772788 | 0.510374 | rgb.ex | starcoder |
defmodule ExSlackBot.TravisCIBot do
@moduldoc ~s"""
`TravisCIBot` is a generic bot to trigger builds on Travis CI using [the REST API](https://docs.travis-ci.com/user/triggering-builds).
This bot responds to commands as messages or as comments on a file snippet. If sending the bot a message by mention or directl... | lib/exslackbot/traviscibot.ex | 0.785884 | 0.882529 | traviscibot.ex | starcoder |
defmodule Iyzico.Payment do
@moduledoc """
A module representing information for successful payment returned from the platform.
"""
@enforce_keys ~w(basket_id bin_id card_ref conversation_id currency
fraud_status installment transactions commission_fee commission_amount paid_price id
... | lib/model/payment.ex | 0.848612 | 0.625552 | payment.ex | starcoder |
defmodule LoggerMulticastBackend do
@moduledoc """
A backend for `Logger` that delivers messages over multicast UDP.
Designed for headless embedded applications, it allows watching the log over the local network.
## Easy Defaults
In your logger config, simply do something like this:
```elixir
config ... | lib/logger_multicast_backend.ex | 0.818592 | 0.651743 | logger_multicast_backend.ex | starcoder |
defmodule Mix.Tasks.Plumbapius.GetDocs do
@moduledoc """
Clones and updates git repo with apib docs
#Usage
```
mix plumbapius.get_docs -c ssh://git@git.funbox.ru/gc/ghetto-auth-apib.git -d ./path/to/put/repo -b branch-name
```
"""
@shortdoc "Clones and updates git repo with apib docs"
... | lib/mix/get_docs.ex | 0.602296 | 0.596609 | get_docs.ex | starcoder |
defmodule Trento.AggregateCase do
@moduledoc """
This module defines the test case to be used by aggregate tests.
Derived from Commanded.AggregateCase
"""
use ExUnit.CaseTemplate
alias Commanded.Aggregate.Multi
# credo:disable-for-this-file
using opts do
quote do
@aggregate Keyword.fetch!(u... | test/support/aggregate_case.ex | 0.805785 | 0.749958 | aggregate_case.ex | starcoder |
defmodule BSV.Contract.OpCodeHelpers do
@moduledoc """
Helper module for using Op Codes in `BSV.Contract` modules.
All known Op Codes are available as a function which simply pushes the Op Code
word onto the Contract Script. Refer to `BSV.VM` for descriptions of each
Op Code.
In addition, `op_if/2` and `o... | lib/bsv/contract/op_code_helpers.ex | 0.776708 | 0.526038 | op_code_helpers.ex | starcoder |
defmodule SudokuSolver.Recursive do
@moduledoc """
Implementes SudokuSolver using recursion
"""
@behaviour SudokuSolver
@doc """
Implements a sudoku solver using recursion
"""
@impl SudokuSolver
@spec solve(SudokuBoard.t()) :: SudokuBoard.t() | nil
def solve(%SudokuBoard{size: size} = board) do
... | lib/sudoku_solver/recursive.ex | 0.694821 | 0.551393 | recursive.ex | starcoder |
defmodule Gmail.Label do
@moduledoc"""
Labels are used to categorize messages and threads within the user's mailbox.
"""
alias __MODULE__
import Gmail.Base
@doc """
> Gmail API documentation: https://developers.google.com/gmail/api/v1/reference/users/labels#resource
"""
defstruct id: nil,
name:... | lib/gmail/label.ex | 0.73307 | 0.408454 | label.ex | starcoder |
defmodule Essence.Readability do
@moduledoc """
The Readbility module contains several methods for
calculating the readability scores of a text.
"""
alias Essence.{Document, Token}
@doc """
The `ari_score` method calculates the Automated Readability Index (ARI)
of a given `Essence.Document`.
## Deta... | lib/essence/readability.ex | 0.861553 | 0.761006 | readability.ex | starcoder |
defmodule Saxy do
@moduledoc ~S"""
Saxy is an XML SAX parser and encoder.
Saxy provides functions to parse XML file in both binary and streaming way in compliant
with [Extensible Markup Language (XML) 1.0 (Fifth Edition)](https://www.w3.org/TR/xml/).
Saxy also offers DSL and API to build, compose and encode... | lib/saxy.ex | 0.933317 | 0.853913 | saxy.ex | starcoder |
defmodule ExCrypto do
@moduledoc """
The ExCrypto module exposes a subset of functionality from the Erlang `crypto`
module with the goal of making it easier to include strong cryptography in your
Elixir applications.
This module provides functions for symmetric-key cryptographic operations using
AES in GCM... | lib/ex_crypto.ex | 0.909068 | 0.630628 | ex_crypto.ex | starcoder |
defmodule SudokuBoard do
@moduledoc """
Implements a Sudoku board
"""
defstruct size: 9, grid: List.duplicate(0, 81)
@type t :: %SudokuBoard{size: non_neg_integer(), grid: list(non_neg_integer())}
@spec equals?(SudokuBoard.t(), SudokuBoard.t()) :: boolean
def equals?(board1, board2) do
board1.size ==... | lib/sudoku_board.ex | 0.848345 | 0.68177 | sudoku_board.ex | starcoder |
defmodule AWS.Kinesis.Firehose do
@moduledoc """
Amazon Kinesis Firehose API Reference
Amazon Kinesis Firehose is a fully-managed service that delivers real-time
streaming data to destinations such as Amazon Simple Storage Service
(Amazon S3), Amazon Elasticsearch Service (Amazon ES), and Amazon Redshift.
... | lib/aws/kinesis_firehose.ex | 0.925158 | 0.678666 | kinesis_firehose.ex | starcoder |
defmodule RDF.Dataset do
@moduledoc """
A set of `RDF.Graph`s.
It may have multiple named graphs and at most one unnamed ("default") graph.
`RDF.Dataset` implements:
- Elixir's `Access` behaviour
- Elixir's `Enumerable` protocol
- Elixir's `Inspect` protocol
- the `RDF.Data` protocol
"""
defstr... | lib/rdf/dataset.ex | 0.908992 | 0.678939 | dataset.ex | starcoder |
defmodule Rabbit.SerializerError do
@moduledoc false
defexception [:message]
end
defmodule Rabbit.Serializer do
@moduledoc """
A behaviour to implement serializers.
To create a serializer, you just need to implement the `c:encode/1` and `c:decode/1`
callbacks,
## Example
defmodule MySerializer... | lib/rabbit/serializer.ex | 0.919552 | 0.432303 | serializer.ex | starcoder |
defmodule TemperatureLogger do
@moduledoc """
Client/Server implementation that allows the client to log temperature via
temperature-sensing hardware. The client can customize...
* the UART port.
* the frequency of readings.
* the destination log file.
Additionally, the client can enumerate the UART port... | temperature_logger_umbrella/apps/temperature_logger/lib/temperature_logger.ex | 0.794425 | 0.425904 | temperature_logger.ex | starcoder |
defmodule Ecto.Validator do
@moduledoc """
Validates a given struct or dict given a set of predicates.
Ecto.Validator.struct(user,
name: present() when on_create?(user),
age: present(message: "must be present"),
age: greater_than(18),
also: validate_other
)
Validation... | lib/ecto/validator.ex | 0.921145 | 0.589835 | validator.ex | starcoder |
defmodule Shared.Ecto.Interval do
@behaviour Ecto.Type
def type, do: :interval
def cast(%Timex.Duration{} = duration) do
{:ok, duration}
end
def cast(duration_as_binary) when is_binary(duration_as_binary) do
case Float.parse(duration_as_binary) do
{duration, ""} -> cast(duration)
_ -> ca... | lib/ecto/interval.ex | 0.59843 | 0.435001 | interval.ex | starcoder |
defmodule Grizzly.ZWave.NodeIdList do
@moduledoc false
# This module contains helpers for parsing and encoding a list of node ids
# into a binary with bytes that are bitmasks of the node ids contained in the
# list. This is common in network commands that contain a list of node ids in
# the Z-Wave network.
... | lib/grizzly/zwave/node_id_list.ex | 0.639061 | 0.438184 | node_id_list.ex | starcoder |
defmodule Video.Timestamp do
@second_in_ms 1000
@minute_in_ms 60 * @second_in_ms
@hour_in_ms 60 * @minute_in_ms
@expected_length 12
defguardp looks_valid(str) when is_binary(str) and byte_size(str) == @expected_length
# 12*8=96
@type t :: <<_::96>>
def valid?(str) do
looks_valid(str) && Regex.mat... | lib/video/timestamp.ex | 0.827166 | 0.472988 | timestamp.ex | starcoder |
defmodule KittenBlue.JWT do
@moduledoc """
This module provides JWT Claims handling functions.
* verify_claims : Verify claims in Payload
"""
@doc """
Claims verification in Payload
This function validates the basic claims defined in RFC7519.
```
valid_claims = %{iss: "https://accounts.google.com"... | lib/kitten_blue/jwt.ex | 0.826257 | 0.915997 | jwt.ex | starcoder |
defmodule Ello.V2.ImageView do
use Ello.V2.Web, :view
@moduledoc """
Serializes an image and image metadata.
Usage:
render(Ello.V2.ImageView, :image, [
image: user.avatar_struct, # An %Ello.Core.Image{} struct
conn: conn # The conn - for determining pixelation.
])
... | apps/ello_v2/web/views/image_view.ex | 0.705988 | 0.439326 | image_view.ex | starcoder |
defmodule Cashtrail.Banking.Institution do
@moduledoc """
This is an `Ecto.Schema` struct that represents a financial institution of the entity.
## Definition
According with [Investopedia](https://www.investopedia.com/terms/f/financialinstitution.asp),
the financial institution is a company engaged in the bu... | apps/cashtrail/lib/cashtrail/banking/institution.ex | 0.810028 | 0.683056 | institution.ex | starcoder |
defmodule Elastic.HTTP do
@moduledoc ~S"""
Used to make raw calls to Elastic Search.
Each function returns a tuple indicating whether or not the request
succeeded or failed (`:ok` or `:error`), the status code of the response,
and then the processed body of the response.
For example, a request like this:
... | lib/elastic/http.ex | 0.906439 | 0.772187 | http.ex | starcoder |
defmodule Decimal.Context do
import Decimal.Macros
alias Decimal.Context
@moduledoc """
The context is kept in the process dictionary. It can be accessed with
`get/0` and `set/1`.
The default context has a precision of 28, the rounding algorithm is
`:half_up`. The set trap enablers are `:invalid_operati... | lib/decimal/context.ex | 0.801159 | 0.789964 | context.ex | starcoder |
defmodule ExPlasma.Transaction.Type.PaymentV1.Validator do
@moduledoc """
Contain stateless validation logic for Payment V1 transactions
"""
alias ExPlasma.Output
alias ExPlasma.Transaction.TypeMapper
@empty_tx_data 0
@output_limit 4
@output_type TypeMapper.output_type_for(:output_payment_v1)
@typ... | lib/ex_plasma/transaction/type/payment_v1/payment_v1_validator.ex | 0.829112 | 0.40389 | payment_v1_validator.ex | starcoder |
defmodule DataMiner.Eclat do
@moduledoc """
Documentation for `Eclat` Algorithm Implementation.
"""
@transactions_file Path.expand("../data/transactions_items.txt")
@result_save_file Path.expand("../results/eclat_frequents.txt")
@doc """
Main function for run algorithm with minimum support.
This funct... | data_miner/lib/eclat.ex | 0.834609 | 0.592637 | eclat.ex | starcoder |
defmodule Conversion.Time do
@moduledoc """
This module is in charge of converting from one time value to another, e.g. seconds to minutes
"""
@year_const 365.25
@typedoc """
- `:value` - Atom representation of time measurement. e.g. :seconds, :minutes, :hours, :days, :weeks, :years
"""
@type value :... | lib/conversion/time.ex | 0.908303 | 0.864939 | time.ex | starcoder |
require Logger
defmodule FileSystem.Backends.FSMac do
@moduledoc """
File system backend for MacOS.
The built-in executable file will be compile upon first use.
This file is a fork from https://github.com/synrc/fs.
## Backend Options
* `:latency` (float, default: 0.5), latency period.
* `:no_def... | lib/file_system/backends/fs_mac.ex | 0.713831 | 0.731155 | fs_mac.ex | starcoder |
defmodule Bella.Controller do
@moduledoc """
`Bella.Controller` defines controller behaviours and generates boilerplate for generating Kubernetes manifests.
> A custom controller is a controller that users can deploy and update on a running cluster, independently of the cluster’s own lifecycle. Custom controller... | lib/bella/controller.ex | 0.891221 | 0.444203 | controller.ex | starcoder |
defmodule PixelFont.GlyphSource do
require PixelFont.RectilinearShape, as: RectilinearShape
require PixelFont.RectilinearShape.Path, as: Path
import PixelFont.DSL.MacroHelper
alias PixelFont.Glyph
alias PixelFont.Glyph.{BitmapData, CompositeData, VariationSequence}
@type source_options :: [based_on: module... | lib/pixel_font/glyph_source.ex | 0.816516 | 0.501526 | glyph_source.ex | starcoder |
defmodule Automaton.Types.DECPOMDP do
@moduledoc """
Implements the Decentralized Partially Observable Markov Decision Process
(DEC-POMDP) state space representation for multi-agent control and prediction.
Each agent is goal-oriented, i.e. associated with a distinct, high-level goal
which it attempts to achie... | lib/automata/automaton_types/reinforcement_learning/decpomdp/decpomdp.ex | 0.811825 | 0.888807 | decpomdp.ex | starcoder |
defmodule Cldr.LocaleDisplay do
@moduledoc """
Implements the [CLDR locale display name algorithm](https://unicode-org.github.io/cldr/ldml/tr35-general.html#locale_display_name_algorithm) to format
a `t:Cldr.LanguageTag` structs for presentation uses.
"""
@doc false
def cldr_backend_provider(config) do
... | lib/cldr/locale_display.ex | 0.895443 | 0.590248 | locale_display.ex | starcoder |
defmodule Vault.Engine.Generic do
@moduledoc """
A generic Vault.Engine adapter. Most of the vault secret engines don't use a
wildly different API, and can be handled with a single adapter.
## Request Details
By default, `read` runs a GET request, `write` does a POST, `list` does a GET
with an appended `?l... | lib/vault/engine/generic.ex | 0.891274 | 0.720762 | generic.ex | starcoder |
defmodule Faker.Lorem do
import Faker, only: [sampler: 2]
alias Faker.Util
@moduledoc """
Functions for generating Lorem Ipsum data
"""
@doc """
Returns a random word from @data
## Examples
iex> Faker.Lorem.word()
"aliquam"
iex> Faker.Lorem.word()
"ut"
iex> Faker.Lorem... | lib/faker/lorem.ex | 0.623835 | 0.461805 | lorem.ex | starcoder |
defmodule ExRabbitMQ.Connection do
@moduledoc """
A `GenServer` implementing a long running connection to a RabbitMQ server.
Consumers and producers share connections and when a connection reaches the limit of
`65535` channels, a new connection is established.
To correctly monitor the open channels, users m... | lib/ex_rabbit_m_q/connection.ex | 0.837088 | 0.567997 | connection.ex | starcoder |
defmodule Sebex.ElixirAnalyzer.SourceAnalysis.Dependency do
alias Sebex.ElixirAnalyzer.SourceAnalysis.Parser
alias Sebex.ElixirAnalyzer.Span
@type t :: %__MODULE__{
name: atom,
version_spec: String.t() | map(),
version_spec_span: Span.t()
}
@derive Jason.Encoder
@enforc... | sebex_elixir_analyzer/lib/sebex_elixir_analyzer/source_analysis/dependency.ex | 0.6973 | 0.44083 | dependency.ex | starcoder |
defmodule ExAmp.Provision.Readme do
@moduledoc false
use ExAmp.Task
alias ExAmp.Project
alias ExAmp.Provision.CI
@path "README.md"
embed_template(:content, """
# <%= @name %>
**<%= @description %>**
<% if @package? do %>
## Installation
Add `<%= @app %>` to your list of dependencies in `mix.... | lib/ex_amp/provision/readme.ex | 0.604165 | 0.726668 | readme.ex | starcoder |
defmodule EmojiMap.TwitterStream do
@moduledoc """
We get a Twitter Stream from locations within a bounding box. The
bounding box is so large that the tweets can come from all over the world.
This way we make sure that we only receive geo-tagged tweets. The reason for
this is: It isn't possible to search for ... | backend/lib/emoji_map/twitter_stream.ex | 0.853898 | 0.502075 | twitter_stream.ex | starcoder |
defprotocol ICalendar.Value do
@fallback_to_any true
def to_ics(data)
end
alias ICalendar.Value
defimpl Value, for: BitString do
def to_ics(x) do
x
|> String.replace(~S"\n", ~S"\\n")
|> String.replace("\n", ~S"\n")
end
end
defimpl Value, for: Tuple do
defmacro elem2(x, i1, i2) do
quote do
... | lib/icalendar/value.ex | 0.732687 | 0.429968 | value.ex | starcoder |
defmodule GrowthBook.Context do
@moduledoc """
Stores feature and experiment context.
Holds the state of features, experiment overrides, attributes and other "global" state. The
context works similar to `%Plug.Conn{}`, as it is created for each request and passed along
when working with features and experime... | lib/growth_book/context.ex | 0.919769 | 0.844794 | context.ex | starcoder |
defmodule InvoiceTracker do
@moduledoc """
Track invoices and payments.
"""
alias InvoiceTracker.{Invoice, Repo, TimeSummary, TimeTracker}
@doc """
Return a list of all invoices
"""
@spec all() :: [Invoice.t()]
def all, do: Repo.all()
@doc """
Return a list of all unpaid invoices
"""
@spec ... | lib/invoice_tracker.ex | 0.790854 | 0.410018 | invoice_tracker.ex | starcoder |
defmodule DateTimeParser.Parser.Epoch do
@moduledoc """
Parses a Unix Epoch timestamp. This is gated by the number of present digits. It must contain 10
or 11 seconds, with an optional subsecond up to 10 digits. Negative epoch timestamps are
supported.
"""
@behaviour DateTimeParser.Parser
@max_subsecond_... | lib/parser/epoch.ex | 0.886473 | 0.551876 | epoch.ex | starcoder |
defmodule Chacha20 do
@moduledoc """
Chacha20 symmetric stream cipher
https://tools.ietf.org/html/rfc7539
The calling semantics are still sub-optimal and no performance tuning has been done.
"""
import Bitwise
defp rotl(x, r), do: rem(x <<< r ||| x >>> (32 - r), 0x100000000)
defp sum(x, y), do: rem(x... | lib/chacha20.ex | 0.848847 | 0.769903 | chacha20.ex | starcoder |
defmodule AWS.Marketplace.Metering do
@moduledoc """
AWS Marketplace Metering Service
This reference provides descriptions of the low-level AWS Marketplace
Metering Service API.
AWS Marketplace sellers can use this API to submit usage data for custom
usage dimensions.
**Submitting Metering Records**
... | lib/aws/marketplace_metering.ex | 0.812198 | 0.522263 | marketplace_metering.ex | starcoder |
defmodule Category do
@typedoc """
Functor dictionary
intuitive type: fmap : (a -> b) -> f a -> f b
* `map`: (f a, a -> b) -> f b # params are swapped to facilitate piping, mandatory
* `lift_left`: a -> f b -> f a # default implementation provided, optional
"""
@type t :: %__MODULE__{
id: any,
}
... | typeclassopedia/lib/category.ex | 0.771026 | 0.464962 | category.ex | starcoder |
defmodule Quetzal.LiveView do
@moduledoc """
Quetzal Live View provides easy interface to handle events, components and
messages into Quetzal architechture in a fast and fashion way. It uses Phoenix Live View
to render components and their upgrades.
In order to use set the Quetzal.LiveView instead Phoenix.Li... | lib/quetzal_live_view.ex | 0.880245 | 0.567098 | quetzal_live_view.ex | starcoder |
defmodule Oli.Qa do
@moduledoc """
Qa uses two tables:
1) Reviews
2) Warnings
The reviews table links a project to a high-level review "type," for example accessibility, content, or pedagogy.
Reviews are marked completed when all of the warnings for that type are finished processing and created.
Revi... | lib/oli/qa.ex | 0.760028 | 0.565839 | qa.ex | starcoder |
defmodule Jabbax.Serializer do
@moduledoc false
use Jabbax.Document
alias Jabbax.StructureError
def call(doc = %Document{}) do
doc
|> dig_and_serialize_data
|> dig_and_serialize_included
|> dig_and_serialize_meta
|> dig_and_serialize_errors
|> dig_and_serialize_links
|> struct_to_m... | lib/jabbax/serializer.ex | 0.686895 | 0.468851 | serializer.ex | starcoder |
defmodule DarkMatter.Modules do
@moduledoc """
Utils for working with modules.
"""
@moduledoc since: "1.0.5"
import DarkMatter.Guards, only: [is_module: 1]
import DarkMatter.Mfas, only: [is_mfa: 1]
alias DarkMatter.Structs
@type path() :: String.t()
@doc """
Determine if a given module contains ... | lib/dark_matter/modules.ex | 0.888414 | 0.455744 | modules.ex | starcoder |
defmodule Adventofcode.Day07RecursiveCircus do
defstruct name: nil, weight: nil, children: [], parent: nil, total_weight: 0
def bottom_program(input) do
input
|> parse()
|> start_programs()
|> connect_programs()
|> find_bottom_and_stop_programs()
end
def unbalanced_weight(input) do
inp... | lib/day_07_recursive_circus.ex | 0.630116 | 0.462048 | day_07_recursive_circus.ex | starcoder |
defmodule Roadtrip.Garage.Measurement do
@moduledoc """
Describes an odometer measurement for a vehicle.
Measurements are always odometer/timestamp pairs. They may be extended with
additional information in the future.
"""
use Roadtrip.Schema
import Ecto.Changeset
alias Roadtrip.Garage.{Vehicle, Refue... | apps/roadtrip/lib/roadtrip/garage/measurement.ex | 0.626581 | 0.558929 | measurement.ex | starcoder |
defmodule Mix.Tasks.Run do
use Mix.Task
@shortdoc "Starts and runs the current application"
@moduledoc """
Starts the current application and runs code.
`mix run` can be used to start the current application dependencies,
the application itself, and optionally run some code in its context.
For long run... | lib/mix/lib/mix/tasks/run.ex | 0.75505 | 0.406656 | run.ex | starcoder |
defmodule Polyglot.Interpreter do
alias Polyglot.Parser
import Polyglot.Plural
def interpret(lang, str, args \\ %{}) do
{:ok, ast} = Parser.parse(str)
interpret_ast(ast, %{lang: lang, printer: nil}, args)
end
def interpret_ast({:select, arg, m}, env, args) do
v = Map.get(args, arg)
case Map.... | lib/polyglot/interpreter.ex | 0.513425 | 0.465813 | interpreter.ex | starcoder |
defmodule AWS.EFS do
@moduledoc """
Amazon Elastic File System
Amazon Elastic File System (Amazon EFS) provides simple, scalable file storage
for use with Amazon EC2 Linux and Mac instances in the Amazon Web Services
Cloud.
With Amazon EFS, storage capacity is elastic, growing and shrinking
automatical... | lib/aws/generated/efs.ex | 0.907066 | 0.503906 | efs.ex | starcoder |
defmodule Bamboo.SentEmail do
@moduledoc """
Used for storing and retrieving sent emails when used with Bamboo.LocalAdapter
When emails are sent with the Bamboo.LocalAdapter, they are stored in
Bamboo.SentEmail. Use the functions in this module to store and retrieve the emails.
Remember to start the Bamboo ... | lib/bamboo/sent_email.ex | 0.675765 | 0.596698 | sent_email.ex | starcoder |
defmodule OMG.Watcher.ExitProcessor.Finalizations do
@moduledoc """
Encapsulates managing and executing the behaviors related to treating exits by the child chain and watchers
Keeps a state of exits that are in progress, updates it with news from the root chain, compares to the
state of the ledger (`OMG.State`... | apps/omg_watcher/lib/omg_watcher/exit_processor/finalizations.ex | 0.742888 | 0.581541 | finalizations.ex | starcoder |
defmodule Pummpcomm.Session.Exchange.ReadInsulinSensitivities do
@moduledoc """
Reads insulin sensitivities throughout the day.
"""
use Bitwise
alias Pummpcomm.Insulin
alias Pummpcomm.Session.{Command, Response}
# Constants
@max_count 8
@mgdl 1
@mmol 2
@opcode 0x8B
# Functions
@doc """... | lib/pummpcomm/session/exchange/read_insulin_sensitivities.ex | 0.830937 | 0.417212 | read_insulin_sensitivities.ex | starcoder |
defmodule Upload do
@moduledoc """
An opinionated file uploader.
"""
@enforce_keys [:key, :path, :filename]
defstruct [:key, :path, :filename, status: :pending]
@type t :: %Upload{
key: String.t(),
filename: String.t(),
path: String.t()
}
@type transferred :: %Uplo... | lib/upload.ex | 0.834171 | 0.406155 | upload.ex | starcoder |
defmodule Credo.Check.Warning.MapGetUnsafePass do
@moduledoc false
@checkdoc """
`Map.get/2` can lead into runtime errors if the result is passed into a pipe
without a proper default value. This happens when the next function in the
pipe cannot handle `nil` values correctly.
Example:
%{foo: [1, 2... | lib/credo/check/warning/map_get_unsafe_pass.ex | 0.827759 | 0.422386 | map_get_unsafe_pass.ex | starcoder |
defmodule AWS.DeviceFarm do
@moduledoc """
Welcome to the AWS Device Farm API documentation, which contains APIs for:
<ul> <li> 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 ... | lib/aws/device_farm.ex | 0.770162 | 0.545346 | device_farm.ex | starcoder |
defmodule Hangman.Reduction.Engine.Worker do
@moduledoc """
Module implements workers that handle `Hangman` words reduction.
Used primarily by `Reduction.Engine` through `reduce_and_store/4` to perform
a series of steps:
* Retrieves `pass` data from `Pass.Cache`.
* Reduces word set based on `reduce_ke... | lib/hangman/reduction_engine_worker.ex | 0.827793 | 0.487673 | reduction_engine_worker.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.