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 UniversalOrbitMap do
@moduledoc """
Day 6 — https://adventofcode.com/2019/day/6
"""
@doc """
iex> ["COM)B", "B)C", "C)D", "D)E", "E)F", "B)G", "G)H", "D)I", "E)J", "J)K", "K)L"]
iex> |> UniversalOrbitMap.part1()
42
"""
@spec part1(Enumerable.t()) :: integer()
def part1(in_stream) do
i... | lib/advent_of_code_2019/day06.ex | 0.81257 | 0.602354 | day06.ex | starcoder |
defmodule Harald.HCI.Event.CommandStatus do
@moduledoc """
The HCI_Command_Status event is used to indicate that the command described by
the Command_Opcode parameter has been received, and that the Controller is
currently performing the task for this command.
This event is needed to provide mechanisms for a... | lib/harald/hci/event/command_status.ex | 0.75183 | 0.520618 | command_status.ex | starcoder |
defmodule Serum.File do
@moduledoc """
Defines a struct representing a file to be read or written.
## Fields
* `src`: Source path
* `dest`: Destination path
* `in_data`: Data read from a file
* `out_data`: Data to be written to a file
"""
require Serum.Result, as: Result
import Serum.IOProxy, onl... | lib/serum/file.ex | 0.757525 | 0.560824 | file.ex | starcoder |
defmodule AMQPX.Receiver.Standard.Retry do
defstruct [
:table,
:limit,
:identity,
:delay
]
@doc """
Retry options.
`identity` specifies the list of methods to generate a unique term for a
message. The first non-`nil` result is used. If all methods evaluate to
`nil`, retry tracking is not... | lib/amqpx/receiver/standard/retry.ex | 0.810629 | 0.47384 | retry.ex | starcoder |
defmodule Alchemy.AuditLog do
@moduledoc """
This module contains functions and types related to audit logs.
"""
alias Alchemy.{Guild.Role, OverWrite, User, Webhook}
alias Alchemy.Discord.Guilds
import Alchemy.Discord.RateManager, only: [send_req: 2]
import Alchemy.Structs
@type snowflake :: String.t()... | lib/Structs/audit_log.ex | 0.794505 | 0.470493 | audit_log.ex | starcoder |
defmodule RisteysWeb.PhenocodeView do
use RisteysWeb, :view
require Integer
def render("assocs.json", %{
phenocode: phenocode,
assocs: assocs,
hr_prior_distribs: hr_prior_distribs,
hr_outcome_distribs: hr_outcome_distribs
}) do
%{
"plot" => data_assocs_plot(phenoco... | web_finngen_r8/lib/risteys_web/views/phenocode_view.ex | 0.550366 | 0.431584 | phenocode_view.ex | starcoder |
defmodule Easing.Range do
@moduledoc """
Range struct for Easing
This struct is basically a reimplementation of Elixir's `Range` struct
but removing the limitations on only working with `Integer` constraints and steps
"""
defstruct first: nil, last: nil, step: nil
@one_second 1_000
@type range :: %Ea... | lib/easing/range.ex | 0.853608 | 0.864597 | range.ex | starcoder |
--- Part Two ---
You notice that the device repeats the same frequency change list over and over. To calibrate the device, you need to find the first frequency it reaches twice.
For example, using the same list of changes above, the device would loop as follows:
Current frequency 0, change of +1; resulting frequency... | 2018/lib/day1.ex | 0.893143 | 0.928797 | day1.ex | starcoder |
defmodule Telnet.MSSP do
@moduledoc """
Parse MSSP data
Telnet option or plaintext
"""
@se 240
@iac 255
@mssp_var 1
@mssp_val 2
@doc """
Parse MSSP subnegotiation options
"""
def parse(data) do
case mssp(data, :start, []) do
:error ->
:error
data ->
data =
... | lib/telnet/mssp.ex | 0.546496 | 0.477493 | mssp.ex | starcoder |
defmodule Robotica.Plugins.HDMI do
@moduledoc """
HDMI matrix plugin
"""
use GenServer
use Robotica.Plugin
require Logger
alias Robotica.Devices.HDMI
defmodule Config do
@moduledoc false
@type t :: %__MODULE__{}
defstruct [:host, :destination]
end
## Server Callbacks
def init(plug... | robotica/lib/robotica/plugins/hdmi.ex | 0.710226 | 0.412234 | hdmi.ex | starcoder |
defmodule Resx.Producer do
@moduledoc """
A producer is an interface for working with a referenceable resource.
This could be anything from a type of storage or networking protocol, to
generation of content (e.g. you might expose some procedural generation
algorithm as a producer), to manip... | lib/resx/producer.ex | 0.893978 | 0.498779 | producer.ex | starcoder |
defmodule Graph.Directed do
@moduledoc false
@compile {:inline, [in_neighbors: 2, in_neighbors: 3, out_neighbors: 2, out_neighbors: 3]}
import Graph.Utils, only: [vertex_id: 1]
def topsort(%Graph{vertices: vs} = g) do
l = reverse_postorder(g)
if length(forest(g, &in_neighbors/3, l)) == map_size(vs) d... | lib/graph/directed.ex | 0.602412 | 0.609757 | directed.ex | starcoder |
# simple functions to load a file, following the hashing rules
defmodule Scenic.Cache.Hash do
# import IEx
@hash_types [:sha, :sha224, :sha256, :sha384, :sha512, :ripemd160]
@default_hash :sha
# ===========================================================================
defmodule Error do
defexceptio... | lib/scenic/cache/hash.ex | 0.628863 | 0.406921 | hash.ex | starcoder |
defmodule Csp.CLI do
@moduledoc """
Command line interface for constraint satisfaction.
"""
alias Csp
alias Csp.Problems
alias Csp.AC3
@doc """
Usage:
```
$ mix escript.build
$ ./csp
```
"""
def main(_args) do
IO.puts("Let's try out some example constraint satisfaction problems.")
... | lib/csp/cli.ex | 0.874921 | 0.783699 | cli.ex | starcoder |
defmodule Strukt.Validator.Builder do
@moduledoc """
This module compiles a validator pipeline.
It is largely based on `Plug.Builder`, with minimal changes.
"""
@doc """
Compiles the pipeline.
Each pipeline element should be a tuple of `{validator_name, options, guards}`
This function expects a reve... | lib/validator/builder.ex | 0.828072 | 0.497803 | builder.ex | starcoder |
defmodule Yams.Query do
require Logger
defmodule State do
defstruct range: {:none, :none}, stream: nil
end
defmodule Bucket do
defstruct start_t: nil, end_t: nil, data: [], aggregations: []
end
defmodule Aggregate do
defstruct start_t: nil, end_t: nil, aggregations: %{}
end
def bucket(st... | lib/yams/query.ex | 0.564939 | 0.498962 | query.ex | starcoder |
defmodule MssqlEcto.Connection do
alias Mssqlex.Query
alias MssqlEcto.Query, as: SQL
@typedoc "The prepared query which is an SQL command"
@type prepared :: String.t()
@typedoc "The cache query which is a DBConnection Query"
@type cached :: map
@doc """
Receives options and returns `DBConnection` sup... | lib/mssql_ecto/connection.ex | 0.850049 | 0.413714 | connection.ex | starcoder |
defmodule Litelist.Discussions do
@moduledoc """
The Discussions context.
"""
import Ecto.Query, warn: false
alias Litelist.Repo
alias Litelist.Discussions.Discussion
@doc """
Returns the list of discussions.
## Examples
iex> list_discussions()
[%Discussion{}, ...]
"""
def list_d... | lib/litelist/discussions/discussions.ex | 0.716318 | 0.478346 | discussions.ex | starcoder |
defmodule Fares.OneWay do
@moduledoc """
Calculates the lowest, highest and reduced one-way fares for a particular trip for the given mode.
Commuter rail and ferry fares distinguish between the possible sets of stops.
Bus fares for express buses do not distinguish between the local and express portions;
the e... | apps/fares/lib/one_way.ex | 0.763175 | 0.509703 | one_way.ex | starcoder |
defmodule GenStage.DemandDispatcher do
@moduledoc """
A dispatcher that sends batches to the highest demand.
This is the default dispatcher used by `GenStage`. In order
to avoid greedy consumers, it is recommended that all consumers
have exactly the same maximum demand.
"""
@behaviour GenStage.Dispatche... | deps/gen_stage/lib/gen_stage/dispatchers/demand_dispatcher.ex | 0.759493 | 0.577138 | demand_dispatcher.ex | starcoder |
defmodule Fly.Postgres.LSN do
@moduledoc """
Data structure that represents a PostgreSQL LSN or Log Sequence Number.
Two LSN values can be compared using the `replicated?/2` function. An LSN
associated with the DB modification has a `source` of `:insert`. On a replica
instance, that can be used to see when t... | lib/lsn/lsn.ex | 0.900325 | 0.564219 | lsn.ex | starcoder |
defmodule Seedex do
@moduledoc """
Functions to populate database with seed data.
"""
require Logger
@doc """
`seed/3` inserts data in the given table
## Arguments
* `module` - The module containing the Ecto schema.
* `contraints` - The fields used to idenfity a record. The record will be upda... | lib/seedex.ex | 0.897531 | 0.88578 | seedex.ex | starcoder |
defmodule CucumberExpressions.ParameterType.Transformer do
@moduledoc false
alias CucumberExpressions.ParameterType.SyntaxError
@stages [:pre, :post]
defstruct paradigm: {:atom, :atom, :integer},
stage: @stages
def new(a, stage \\ :pre)
def new(nil, _), do: %{pre: nil, post: nil}
def new(mo... | apps/cucumber_expressions/lib/cucumber_expressions/parameter_type/lib/transformer.ex | 0.736874 | 0.533094 | transformer.ex | starcoder |
defmodule Square.Catalog do
alias Tesla.Multipart
@moduledoc """
Documentation for `Square.Catalog`.
"""
@doc """
Deletes a set of [CatalogItem](#type-catalogitem)s based on the
provided list of target IDs and returns a set of successfully deleted IDs in
the response. Deletion is a cascading event suc... | lib/api/catalog_api.ex | 0.943595 | 0.806796 | catalog_api.ex | starcoder |
defmodule Helper.QueryBuilder do
@moduledoc """
handle common query pices across the project
"""
import Ecto.Query, warn: false
alias GroupherServer.CMS
alias CMS.Model.Repo, as: CMSRepo
@audit_illegal CMS.Constant.pending(:illegal)
@audit_failed CMS.Constant.pending(:audit_failed)
@doc """
load ... | lib/helper/query_builder.ex | 0.744192 | 0.528594 | query_builder.ex | starcoder |
defmodule Scenic.Primitive.SceneRef do
@moduledoc """
A reference to another graph or component.
When rendering a graph, the SceneRef primmitive causes the render to stop
what it is doing, render another graph, then continue on where it left off.
The SceneRef primitive is usually added for you when you use... | lib/scenic/primitive/scene_ref.ex | 0.863536 | 0.564579 | scene_ref.ex | starcoder |
use Croma
defmodule DistAgent.Config do
@default_tick_interval (if Mix.env() == :test, do: 1_000, else: 60_000)
@default_quota_collection_interval (if Mix.env() == :test, do: 1_000, else: 5 * 60_000)
@moduledoc """
`dist_agent` defines the following application configs:
- `:tick_interval`
... | lib/dist_agent/config.ex | 0.835484 | 0.47171 | config.ex | starcoder |
defmodule Surface.Catalogue do
@moduledoc """
A behaviour to provide additional information about the catalogue.
Optional for local catalogues. Usually required if you want to share
your components as a library.
"""
@doc """
Returns a keyword list of config options to be used by the catalogue tool.
A... | lib/surface/catalogue.ex | 0.857141 | 0.408542 | catalogue.ex | starcoder |
defmodule Poly1305 do
require Chacha20
import Bitwise
@moduledoc """
Poly1305 message authentication
https://tools.ietf.org/html/rfc7539
"""
@typedoc """
Encryption key
"""
@type key :: binary
@typedoc """
Per-message nonce
By convention, the first 4 bytes should be sender-specific.
The t... | lib/poly1305.ex | 0.830628 | 0.51129 | poly1305.ex | starcoder |
alias Subtitle.Frame
defmodule Subtitle.SubRip.Parser do
@moduledoc """
Parse a single Frame. The parser is defined as a finite state machine where
each line of text contains a fraction of a Frame (index or time or caption).
The Frame struct is returned once it's completely parsed, it returns an
intermediat... | lib/subtitle/sub_rip/parser.ex | 0.869417 | 0.694782 | parser.ex | starcoder |
defmodule Platformsh do
alias Platformsh.Get, as: Get
defmodule Config do
@moduledoc """
Reads Platform.sh configuration from environment variables.
See: https://docs.platform.sh/development/variables.html
The following are 'magic' properties that may exist on a Config object. Before accessing a... | lib/platformshconfig.ex | 0.897535 | 0.646376 | platformshconfig.ex | starcoder |
defmodule RDF.IRI do
@moduledoc """
A structure for IRIs.
This structure just wraps a plain IRI string and doesn't bother with the
components of the IRI, since in the context of RDF there are usually very many
IRIs and parsing them isn't needed in most cases. For these reasons we don't
use Elixirs built-in... | lib/rdf/iri.ex | 0.831212 | 0.608332 | iri.ex | starcoder |
defmodule FutureMadeConcerts.Duration do
@moduledoc """
Provides functions to convert millisecond durations to different formats.
"""
@minute :timer.minutes(1)
@hour :timer.hours(1)
import FutureMadeConcerts.Gettext
@type milliseconds :: pos_integer()
@doc """
Given a duration in milliseconds, ret... | lib/future_made_concerts/duration.ex | 0.779867 | 0.459743 | duration.ex | starcoder |
defmodule ExCell.Base do
@moduledoc false
defmacro __using__(opts \\ []) do
quote do
import ExCell.View
@adapter unquote(opts[:adapter])
@namespace unquote(opts[:namespace])
@doc """
Returns the name of the module as a string. Module namespaces are replaced
by a dash.
... | lib/ex_cell/base.ex | 0.85817 | 0.41185 | base.ex | starcoder |
defmodule Annex.Layer.Dropout do
@moduledoc """
Given a `frequency` the dropout layer randomly drops an input at the `frequency`.
"""
use Annex.Debug, debug: true
alias Annex.{
Data,
Layer,
Layer.Backprop,
Layer.Dropout,
Utils
}
use Layer
@type t :: %__MODULE__{
frequenc... | lib/annex/layer/dropout.ex | 0.925281 | 0.599749 | dropout.ex | starcoder |
defmodule AWS.Transcoder do
@moduledoc """
AWS Elastic Transcoder Service
The AWS Elastic Transcoder Service.
"""
@doc """
The CancelJob operation cancels an unfinished job.
<note> You can only cancel a job that has a status of `Submitted`. To
prevent a pipeline from starting to process a job while ... | lib/aws/transcoder.ex | 0.843815 | 0.416025 | transcoder.ex | starcoder |
defmodule Kazan.Codegen.Models do
@moduledoc false
# Macros for generating client code from OAI specs.
require EEx
alias Kazan.Codegen.Models.ModelDesc
@doc """
Generates structs for all the data definitions in an OAPI spec.
This will read the provided file at compile time and use it to generate a
st... | lib/kazan/codegen/models.ex | 0.762026 | 0.442697 | models.ex | starcoder |
defmodule IslandsEngine.Island do
@moduledoc """
An island is a set of coordinates that can be placed in a board
"""
@doc """
A struct that wraps all the data of an island: its coordinates and its hit_coordinates
"""
@enforce_keys [:coordinates, :hit_coordinates]
defstruct [:coordinates, :hit_coordinat... | lib/islands_engine/island.ex | 0.927174 | 0.814717 | island.ex | starcoder |
defmodule Poker do
@moduledoc """
An Elixir library to work with Poker hands.
Source: <https://github.com/wojtekmach/poker_elixir>
Documentation: <http://hexdocs.pm/poker/>
## Example
```elixir
hand1 = "As Ks Qs Js Ts"
hand2 = "Ac Ad Ah As Kc"
Poker.hand_rank(hand1) # => {:straight_flush, :A}
P... | lib/poker.ex | 0.867078 | 0.781122 | poker.ex | starcoder |
defmodule DayTwelve do
def solve(input) do
{_, dx, dy} =
input
|> String.split("\n", trim: true)
|> Enum.map(fn
x ->
[cmd, c] = String.split(x, "", trim: true, parts: 2)
c = String.to_integer(c)
case cmd do
"R" -> {:turn, "R", c}
"L"... | adv_2020/lib/day_12.ex | 0.601945 | 0.6687 | day_12.ex | starcoder |
defmodule Jiffy do
@moduledoc """
A JSON parser as a NIF.
# Data Format
| Elixir | -> JSON | -> Elixir |
| ---------------------------- | ---------------- | ------- |
| `nil` | `null` | `nil` |
| `true` | `t... | src/jiffy.ex | 0.925752 | 0.815306 | jiffy.ex | starcoder |
defmodule ForgeAbi.RequestSendTx do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
tx: ForgeAbi.Transaction.t() | nil,
wallet: ForgeAbi.WalletInfo.t() | nil,
token: String.t(),
commit: boolean
}
defstruct [:tx, :wallet, :token, :commit]
... | lib/protobuf/gen/rpc.pb.ex | 0.732305 | 0.588564 | rpc.pb.ex | starcoder |
if Code.ensure_loaded?(Plug) do
defmodule WeChat.Plug.EventHandler do
@moduledoc """
微信推送消息处理器
## Usage
将下面的代码加到 `router` 里面:
- 单一应用的情况:
```elixir
forward "/wx/event", WeChat.Plug.EventHandler, client: WxOfficialAccount, handler: &Module.handle_event/2
```
- 多个应用的情况:
... | lib/wechat/plug/event_handler.ex | 0.551091 | 0.474753 | event_handler.ex | starcoder |
defmodule Petrovich.Detector do
@moduledoc """
Guesses the gender by person's name.
"""
alias Petrovich.GenderStore
alias Petrovich.Utils.ResultJoiner
@doc """
Detects a gender by name.
This function receives two arguments:
1. `name` raw person's name in nomenative case
2. `type` which shows... | lib/petrovich/detector.ex | 0.840799 | 0.559982 | detector.ex | starcoder |
defmodule Majudge do
@moduledoc """
Majudge keeps the contexts that define your domain
and business logic.
Contexts are also responsible for managing your data, regardless
if it comes from the database, an external API or others.
"""
@default_ratings [:excellent, :verygood, :good, :average, :fair, :poor... | lib/majudge.ex | 0.747063 | 0.61396 | majudge.ex | starcoder |
defmodule Reactivity.DSL.SignalObs do
@moduledoc false
alias Observables.Obs
alias Reactivity.Quality.Context
@doc """
Turns a plain Observable into a Signal Observable
Wraps each of its Values v into a tuple `{v, []}`,
the empty list being a list of potential Contexts.
"""
def from_plain_obs(obs) d... | lib/reactivity/dsl/signal_obs.ex | 0.845257 | 0.561095 | signal_obs.ex | starcoder |
defmodule NcsaHmac.Signer do
@default_hash :sha512
@service_name "NCSA.HMAC"
@moduledoc """
The Signer module provides functions for generating a cryptographic hash based on the details of a web request.
"""
@doc """
Generate the complete signature for the request details
Required paramters:
* `:r... | lib/ncsa_hmac/signer.ex | 0.88275 | 0.57818 | signer.ex | starcoder |
defmodule ExAws.AutoScaling do
@moduledoc """
Operations on AWS EC2 Auto Scaling
A work-in-progress selection of operations from the
[Amazon EC2 Auto Scaling API](https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_Operations_List.html).
Examples of how to use this:
```elixir
ExAws.AutoScaling.... | lib/ex_aws/auto_scaling.ex | 0.843847 | 0.710025 | auto_scaling.ex | starcoder |
defmodule Eecrit.AnimalUseReportTxs do
@moduledoc """
Flow:
[... {animal_id, procedure_id, count} ... ]
[... [animal_id, {procedure_id, count}, {procedure_id, count}...] ...
[... [animal, {procedure, count}, {procedure, count}...] ...
[... [animal-view, procedure-view, procedure-view...... | web/txs/animal_use_report_txs.ex | 0.627381 | 0.410195 | animal_use_report_txs.ex | starcoder |
Code.require_file("../util/util.ex", __DIR__)
Code.require_file("../day02/el.ex", __DIR__)
defmodule Day05 do
def parameter_mode_immediate(index) do
fn
(%{memory: memory, pc: pointer}, :get) ->
:array.get(pointer + index, memory)
end
end
def fetch_instruction(%{memory: memory, pc: pointer}... | day05/el.ex | 0.507324 | 0.471892 | el.ex | starcoder |
defmodule ShopDeed.DecodeError do
@type t :: %__MODULE__{message: String.t()}
defexception [:message]
def message(%{message: message}), do: message
end
defmodule ShopDeed.Decoder do
use Bitwise
alias ShopDeed.{Card, Constants, Deck, DecodeError, Hero}
@spec decode(String.t()) :: {:error, ShopDeed.Decod... | lib/decoder.ex | 0.71413 | 0.492005 | decoder.ex | starcoder |
defmodule AWS.KMS do
@moduledoc """
AWS Key Management Service
AWS Key Management Service (AWS KMS) is an encryption and key management
web service. This guide describes the AWS KMS operations that you can call
programmatically. For general information about AWS KMS, see the [ *AWS Key
Management Service ... | lib/aws/kms.ex | 0.877556 | 0.444505 | kms.ex | starcoder |
defmodule ExPool.Manager do
@moduledoc """
Module to start a pool, and check-in and check-out workers.
When a worker is available, it can be checked-out from the pool.
In case there are no available workers it will respond `{:waiting, state}`
and enqueue the pending request.
When a worker is checked-in wi... | lib/ex_pool/manager.ex | 0.789599 | 0.871748 | manager.ex | starcoder |
defmodule LibJudge.Filter do
@moduledoc """
A collection of filters to do common searches on rules.
Each filter returns a single-argument function designed to be
used with `Enum.filter/2`.
"""
alias LibJudge.Rule
alias LibJudge.Tokenizer
require Logger
@type filter :: (Tokenizer.rule() -> boolean)
... | lib/lib_judge/filter.ex | 0.847195 | 0.487063 | filter.ex | starcoder |
defmodule Adventofcode.Day14DockingData do
use Adventofcode
alias __MODULE__.{Part1, Part2}
def part_1(input) do
input
|> parse
|> Part1.solve()
end
def part_2(input) do
input
|> parse
|> Part2.solve()
end
defmodule Part1 do
defstruct mask: String.duplicate("x", 36), mem: %... | lib/day_14_docking_data.ex | 0.7237 | 0.559651 | day_14_docking_data.ex | starcoder |
defmodule Chalk do
@moduledoc """
`Chalk` is a client to make your life easy when you need to request GraphQL API's
"""
alias __MODULE__.{GraphQLResponse, Request}
@doc """
Make a GrahpQL query to a client and returns %GraphQLResponse{} struct
## Arguments
* request_params, a keyword that could ... | lib/chalk.ex | 0.81372 | 0.446615 | chalk.ex | starcoder |
defmodule GitGud.Web.ReactComponents do
@moduledoc """
Functions to make rendering React components.
"""
import Phoenix.HTML.Tag
@doc """
Generates a div containing the named React component with no props or attrs.
Returns safe html: `{:safe, [60, "div", ...]}`.
You can utilize this in your Phoenix v... | apps/gitgud_web/lib/gitgud_web/react_components.ex | 0.858363 | 0.76432 | react_components.ex | starcoder |
defmodule Robotica.Plugins.SonOff do
@moduledoc """
Sonoff plugin
"""
use GenServer
use Robotica.Plugin
require Logger
defmodule Config do
@moduledoc false
@type t :: %__MODULE__{topic: String.t(), postfix: String.t()}
defstruct [:topic, :postfix]
end
defmodule State do
@moduledoc fa... | robotica/lib/robotica/plugins/sonoff.ex | 0.633864 | 0.460713 | sonoff.ex | starcoder |
defmodule ExBitstamp do
@moduledoc """
Wraps Bitstamp HTTP API into functions respective of public and private API endpoints.
The `currency_pair` parameter in functions is expected to be an `ExBitstamp.CurrencyPair` struct. See module
documentation for more info on all available convenience functions, but in s... | lib/ex_bitstamp.ex | 0.898438 | 0.64058 | ex_bitstamp.ex | starcoder |
defmodule Octicons do
@moduledoc """
Octicons are a scalable set of icons handcrafted with <3 by GitHub.
See [the website][octicons] for an up-to-date reference of all of the available icons.
[octicons]: https://octicons.github.com/
"""
alias Octicons.Storage
@type octicon_name :: String.t() | atom
... | lib/octicons.ex | 0.912526 | 0.752843 | octicons.ex | starcoder |
# Scrolling layout modal component. Great for displaying content within a modal that needs to scroll.
# data is a tuple in the form of ` elixir {label, component, component_data, component_opts}`
# style opts
# `width: :integer`
# `height: :integer`
# `frame_width: :integer`
# `frame_height: :i... | lib/modal/scroll_layout.ex | 0.690246 | 0.664568 | scroll_layout.ex | starcoder |
defmodule BMP280 do
use GenServer
require Logger
alias BMP280.{Calc, Comm, Measurement, Transport}
@sea_level_pa 100_000
@default_bmp280_bus_address 0x77
@polling_interval 1000
@typedoc """
The type of sensor in use
If the sensor is unknown, then number in the parts ID register is used.
"""
@t... | lib/bmp280.ex | 0.919667 | 0.555496 | bmp280.ex | starcoder |
defmodule Eventually do
@moduledoc """
Macros to support assertions/refutations that might not be correct immediately
but will eventually become so due to, say, eventual consistency.
"""
@default_timeout 1000
@default_interval 10
@doc """
Assert that the passed clause eventually returns a truthy value... | lib/eventually.ex | 0.80271 | 0.547283 | eventually.ex | starcoder |
defmodule Map.Parser do
@default_map_path "data/map.osm"
def default_map_path, do: @default_map_path
def load_default, do: load(default_map_path())
def load(map_path) when is_binary(map_path) do
raw = File.read!(map_path)
parsed = Saxy.SimpleForm.parse_string(raw)
{:ok, {"osm", _attr, children}} ... | lib/map/parser.ex | 0.66628 | 0.486514 | parser.ex | starcoder |
defmodule Meeseeks.CSS do
@moduledoc """
Compile CSS selector syntax into `Meeseeks.Selector`s.
## Supported Syntax
| Pattern | Example | Notes |
| --- | --- | --- |
| **Basic Selectors** | --- | --- |
| `*` | `*` | Matches any for `ns` or `tag` |
| `tag` | `div` | |
| `ns\\|tag` | `foo\\|div` | |
... | lib/meeseeks/css.ex | 0.864811 | 0.676002 | css.ex | starcoder |
defmodule Unicode.String do
@moduledoc """
This module provides functions that implement somee
of the [Unicode](https://unicode.org) stanards:
* The [Unicode Case Folding](https://www.unicode.org/versions/Unicode13.0.0/ch03.pdf) algorithm
to provide case-independent equality checking irrespective of langua... | lib/unicode/string.ex | 0.941318 | 0.757481 | string.ex | starcoder |
defmodule Mix.Tasks.Run do
use Mix.Task
@shortdoc "Run the given file or expression"
@moduledoc """
Runs the given file or expression in the context of the application.
Before running the code, it invokes the `app.start` task which compiles
and loads your project.
It is the goal of this task to provid... | lib/mix/lib/mix/tasks/run.ex | 0.789112 | 0.507202 | run.ex | starcoder |
defmodule Mix.Tasks.Escript.Build do
use Mix.Task
use Bitwise, only_operators: true
@shortdoc "Builds an escript for the project"
@moduledoc ~S"""
Builds an escript for the project.
An escript is an executable that can be invoked from the
command line. An escript can run on any machine that has
Erlan... | lib/mix/lib/mix/tasks/escript.build.ex | 0.784732 | 0.473718 | escript.build.ex | starcoder |
defmodule SiteEncrypt.Acme.Client.API do
@moduledoc """
Low level API for interacting with an ACME CA server.
This module is a very incomplete implementation of the ACME client, as described in
[RFC8555](https://tools.ietf.org/html/rfc8555). Internally, the module uses `Mint.HTTP` to
communicate with the ser... | lib/site_encrypt/acme/client/api.ex | 0.911145 | 0.489259 | api.ex | starcoder |
defmodule Mix.Shell.Process do
@moduledoc """
This is Mix shell that uses the current process mailbox
for communication instead of IO.
When a developer calls `info("hello")`, the following
message will be sent to the current process:
{ :mix_shell, :info, ["hello"] }
This is mainly useful in tests, ... | lib/mix/lib/mix/shell/process.ex | 0.778439 | 0.446676 | process.ex | starcoder |
defmodule Statistics.Distributions.Exponential do
@moduledoc """
Exponential distribution.
`lambda` is the rate parameter and must be greater than zero.
"""
alias Statistics.Math
@doc """
The probability density function
## Examples
iex> Statistics.Distributions.Exponential.pdf().(1)
0.... | lib/statistics/distributions/exponential.ex | 0.915606 | 0.668679 | exponential.ex | starcoder |
defmodule Util.Cache do
@moduledoc false
# Simple LRU cache, with optional persistence to disk.
@doc """
Start the cache service for a collection
"""
def start(frame, size \\ 50) do
{ets_name, dets_name, dets_path} = expand(frame)
unless Process.whereis(ets_name) do
alias Searchex.Command.Cmd... | lib/util/cache.ex | 0.526586 | 0.429848 | cache.ex | starcoder |
defmodule EventStore.Notifications.Listener do
@moduledoc false
# Listener subscribes to event notifications using PostgreSQL's `LISTEN`
# command. Whenever events are appended to storage a `NOTIFY` command is
# executed by a trigger. The notification payload contains the first and last
# event number of the... | lib/event_store/notifications/listener.ex | 0.813757 | 0.428592 | listener.ex | starcoder |
defmodule HashDict do
@moduledoc """
WARNING: this module is deprecated.
Use the `Map` module instead.
"""
use Dict
@node_bitmap 0b111
@node_shift 3
@node_size 8
@node_template :erlang.make_tuple(@node_size, [])
@opaque t :: %__MODULE__{size: non_neg_integer, root: term}
@doc false
defstruct... | lib/elixir/lib/hash_dict.ex | 0.72086 | 0.483405 | hash_dict.ex | starcoder |
defmodule AWS.LexModelBuilding do
@moduledoc """
Amazon Lex Build-Time Actions
Amazon Lex is an AWS service for building conversational voice and text
interfaces. Use these actions to create, update, and delete conversational
bots for new and existing client applications.
"""
@doc """
Creates a new v... | lib/aws/generated/lex_model_building.ex | 0.866175 | 0.492615 | lex_model_building.ex | starcoder |
defmodule HttpApi.Database do
@moduledoc """
GenServer that owns a ETS table to store and retrieve the football results.
The data is loaded on application start and the results are saved as Protobuf
Structs, so it will be easy to encode them afterwards either to json (with
poison) or protobuf (with exprotobuf... | lib/http_api/database.ex | 0.702224 | 0.413033 | database.ex | starcoder |
defmodule Phoenix.Socket do
@moduledoc """
Holds state for every channel, pointing to its transport,
pubsub server and more.
## Socket Fields
* `assigns` - The map of socket assigns, default: `%{}`
* `channel` - The channel module where this socket originated
* `channel_pid` - The channel pid
* `endpo... | lib/phoenix/socket.ex | 0.837321 | 0.409368 | socket.ex | starcoder |
defmodule Msgpax.Ext do
@moduledoc """
A struct used to represent the MessagePack [Extension
type](https://github.com/msgpack/msgpack/blob/master/spec.md#formats-ext).
## Examples
Let's say we want to be able to serialize a custom type that consists of a
byte `data` repeated `reps` times. We could represe... | lib/msgpax/ext.ex | 0.873633 | 0.662943 | ext.ex | starcoder |
defmodule BSV.Contract.PushTxHelpers do
@moduledoc """
Helper module for implementing the technique known as `OP_PUSH_TX` in
`BSV.Contract` modules.
`OP_PUSH_TX` is a technique that enables true "smart contracts" to be deployed
on Bitcoin. The technique can be defined as:
* Push the transaction preimage... | lib/bsv/contract/push_tx_helpers.ex | 0.836388 | 0.563138 | push_tx_helpers.ex | starcoder |
defmodule Radixir.Crypto.RSAPublicKey do
@moduledoc false
defstruct version: nil,
public_modulus: nil,
public_exponent: nil
@type t :: %Radixir.Crypto.RSAPublicKey{
version: atom,
public_modulus: integer,
public_exponent: integer
}
def from_sequenc... | lib/radixir/crypto/rsa_public_key.ex | 0.780662 | 0.490236 | rsa_public_key.ex | starcoder |
defmodule Ueberauth.Strategy do
@moduledoc """
The Strategy is the work-horse of the system.
Strategies are implemented outside this library to meet your needs, the
strategy provides a consistent API and behaviour.
Each strategy operates through two phases.
1. `request phase`
2. `callback phase`
The... | lib/ueberauth/strategy.ex | 0.863017 | 0.548613 | strategy.ex | starcoder |
defmodule Maru.Validations do
defmodule Regexp do
@moduledoc """
Param Validator: check whether param and regexp matched.
"""
@doc false
def validate_param!(attr_name, values, option) when is_list(values) do
for value <- values do
validate_param!(attr_name, value, option)
end
... | lib/maru/validations.ex | 0.795499 | 0.510924 | validations.ex | starcoder |
use Croma
defmodule Antikythera.Cron do
@moduledoc """
Calculate time schedules based on cron format strings.
`parse/1` recognizes the [POSIX specifications of crontab format](http://www.unix.com/man-page/posix/1posix/crontab)
with the extension of "step values" (explained below).
The parsed object can be ... | lib/util/cron.ex | 0.853699 | 0.536981 | cron.ex | starcoder |
defmodule Advent2019Web.Day07Controller do
use Advent2019Web, :controller
alias Advent2019Web.Day05Controller, as: Day05
@doc """
Given a program like the ones defined in day 5 and an input list,
runs it and return the output.
This time the history and the final result are ignored, to make it simpler
t... | lib/advent2019_web/controllers/day07_controller.ex | 0.605799 | 0.559079 | day07_controller.ex | starcoder |
defmodule PhoenixMTM.Helpers do
@moduledoc """
Provides HTML helpers for Phoenix.
"""
import Phoenix.HTML, only: [html_escape: 1]
import Phoenix.HTML.Form, only: [input_name: 2, input_id: 2, hidden_input: 3 ]
@doc ~S"""
Generates a list of checkboxes and labels to update a Phoenix
many_to_many relatio... | lib/phoenix_mtm/helpers.ex | 0.77223 | 0.533094 | helpers.ex | starcoder |
defmodule TaiShang.Gene.Generator do
@moduledoc """
NFT-Base Generator
"""
alias TaiShang.Gene.Rules
alias Utils.TypeTranslator
require Logger
@doc """
generate gene by params.
8 Bit Gene Example:
```
init_rules_base2 = TaiShang.Rules.gen_init_rule(16, 4, 4) # 16 b = 2 bit
limits_b... | lib/tai_shang/gene/generator.ex | 0.77518 | 0.52476 | generator.ex | starcoder |
defmodule Oban.Plugins.Lifeline do
@moduledoc """
Naively transition jobs stuck `executing` back to `available`.
The `Lifeline` plugin periodically rescues orphaned jobs, i.e. jobs that are stuck in the
`executing` state because the node was shut down before the job could finish. Rescuing is
purely based on ... | lib/oban/plugins/lifeline.ex | 0.876456 | 0.643882 | lifeline.ex | starcoder |
defmodule Nostrum.Struct.Channel do
@moduledoc """
Struct and helper functions for working with channels.
## Channel Struct
The channel struct is used by Nostrum to represent a _Discord Channel Object_. More information can be found on the [Discord API Channel Documentation](https://discord.com/developers/doc... | lib/nostrum/struct/channel.ex | 0.926827 | 0.848408 | channel.ex | starcoder |
defmodule HTTPDate.Formatter do
@moduledoc false
defp integer_to_month(1), do: "Jan"
defp integer_to_month(2), do: "Feb"
defp integer_to_month(3), do: "Mar"
defp integer_to_month(4), do: "Apr"
defp integer_to_month(5), do: "May"
defp integer_to_month(6), do: "Jun"
defp integer_to_month(... | lib/http_date/formatter.ex | 0.638948 | 0.539954 | formatter.ex | starcoder |
defmodule Confex do
@moduledoc """
Confex simplifies reading configuration at run-time with adapter-based system for resolvers.
# Configuration tuples
Whenever there is a configuration that should be resolved at run-time you need to replace it's value in `config.exs`
by Confex configuration type. Common str... | lib/confex.ex | 0.932668 | 0.787931 | confex.ex | starcoder |
defmodule Data.Opportunities do
@moduledoc """
The public API for `opportunity` resources
"""
alias Data.{Opportunity, Repo}
import Ecto.Query, except: [update: 2]
@defaults %{filters: %{}, include: [], sort_by: :updated_at, page: 1, page_size: 15}
def all(opts \\ %{}) do
opts = Map.merge(@defaults... | apps/data/lib/data/opportunities.ex | 0.724578 | 0.470372 | opportunities.ex | starcoder |
defmodule Sqlitex.Query do
alias Sqlitex.Statement
@doc """
Runs a query and returns the results.
## Parameters
* `db` - A sqlite database.
* `sql` - The query to run as a string.
* `opts` - Options to pass into the query. See below for details.
## Options
* `bind` - If your query has parameters... | deps/sqlitex/lib/sqlitex/query.ex | 0.886248 | 0.547525 | query.ex | starcoder |
defmodule Modbux.Response do
@moduledoc """
Response helper, functions that handles Server & Slave response messages.
"""
alias Modbux.Helper
@exceptions %{
1 => :efun,
2 => :eaddr,
3 => :einval,
4 => :edevice,
5 => :ack,
6 => :sbusy,
7 => :nack,
8 => :ememp,
9 => :error,
... | lib/helpers/response.ex | 0.647575 | 0.560764 | response.ex | starcoder |
defmodule ExAws.Comprehend do
@moduledoc """
Operations on the AWS Comprehend service.
## Basic usage
```elixir
alias ExAws.Comprehend
# Detect dominant language
ExAws.Comprehend.detect_dominant_language("Amazon.com, Inc. is located in Seattle, WA and was founded July 5th, 1994 by <NAME>, allowing cu... | lib/ex_aws/comprehend.ex | 0.789964 | 0.875946 | comprehend.ex | starcoder |
defmodule TripPlan.PersonalDetail do
@moduledoc """
Additional information for legs which are taken on personal transportation
"""
defstruct distance: 0.0,
steps: []
@type t :: %__MODULE__{
distance: float,
steps: [__MODULE__.Step.t()]
}
end
defmodule TripPlan.Persona... | apps/trip_plan/lib/trip_plan/personal_detail.ex | 0.853303 | 0.5592 | personal_detail.ex | starcoder |
defmodule DarkEcto.Types.CFAbsoluteTime do
@moduledoc """
Representation for a datetime stored as a unix epoch integer
"""
alias DarkMatter.DateTimes
@typedoc """
Stored as an `t:pos_integer/0` in the database but used at runtime as a `t:DateTime.t/0`.
"""
@type t() :: DateTime.t()
@type t_db() :: p... | lib/dark_ecto/types/cf_absolute_time.ex | 0.900605 | 0.457258 | cf_absolute_time.ex | starcoder |
defmodule Mix.Shell.Process do
@moduledoc """
Mix shell that uses the current process mailbox for communication.
This module provides a Mix shell implementation that uses
the current process mailbox for communication instead of IO.
As an example, when `Mix.shell.info("hello")` is called,
the following me... | lib/mix/lib/mix/shell/process.ex | 0.717111 | 0.441312 | process.ex | starcoder |
defmodule Chain.Transaction do
alias Chain.TransactionReceipt
@enforce_keys [:chain_id]
defstruct nonce: 1,
gasPrice: 0,
gasLimit: 0,
to: nil,
value: 0,
chain_id: nil,
signature: nil,
init: nil,
data: nil
@type t :... | lib/chain/transaction.ex | 0.767603 | 0.632673 | transaction.ex | starcoder |
defmodule CSV.LineAggregator do
use CSV.Defaults
alias CSV.LineAggregator.CorruptStreamError
@moduledoc ~S"""
The CSV LineAggregator module - aggregates lines in a stream that are part
of a common escape sequence.
"""
@doc """
Aggregates the common escape sequences of a stream with the given separato... | data/web/deps/csv/lib/csv/line_aggregator.ex | 0.711732 | 0.456107 | line_aggregator.ex | starcoder |
defmodule AWS.CodeBuild do
@moduledoc """
AWS CodeBuild
AWS CodeBuild is a fully managed build service in the cloud. AWS CodeBuild
compiles your source code, runs unit tests, and produces artifacts that are
ready to deploy. AWS CodeBuild eliminates the need to provision, manage,
and scale your own build s... | lib/aws/code_build.ex | 0.851073 | 0.636367 | code_build.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.