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 Surface do
@moduledoc """
Surface is component based library for **Phoenix LiveView**.
Built on top of the new `Phoenix.LiveComponent` API, Surface provides
a more declarative way to express and use components in Phoenix.
Full documentation and live examples can be found at [surface-demo.msaraiva.... | lib/surface.ex | 0.863464 | 0.563078 | surface.ex | starcoder |
defmodule AWS.Discovery do
@moduledoc """
AWS Application Discovery Service
AWS Application Discovery Service helps you plan application migration
projects by automatically identifying servers, virtual machines (VMs),
software, and software dependencies running in your on-premises data
centers. Applicatio... | lib/aws/discovery.ex | 0.885415 | 0.480601 | discovery.ex | starcoder |
defmodule EctoTestDSL.Variants.PhoenixGranular.Update do
use EctoTestDSL.Drink.Me
alias T.Variants.PhoenixGranular.Update, as: ThisVariant
alias T.Parse.Start
alias T.Parse.Callbacks
import FlowAssertions.Define.BodyParts
alias T.Variants.Common.DefaultFunctions
# ------------------- Workflows ----------... | lib/variants/phoenix_granular_update.ex | 0.522689 | 0.420362 | phoenix_granular_update.ex | starcoder |
defmodule Furlong.Row do
@moduledoc """
Row abstraction used internally by the Solver.
"""
import Furlong.Util, only: [near_zero?: 1]
alias Furlong.Row
alias Furlong.Symbol
defstruct constant: 0, cells: %{}
def new(), do: %Row{constant: 0, cells: %{}}
def new(constant) when is_number(constant), do:... | lib/furlong/row.ex | 0.754825 | 0.590779 | row.ex | starcoder |
defmodule Timex.Ecto.Time do
@moduledoc """
Support for using Timex with :time fields
"""
use Timex
@behaviour Ecto.Type
def type, do: :time
@doc """
Handle casting to Timex.Ecto.Time
"""
def cast(input) when is_binary(input) do
case Timex.parse(input, "{ISOtime}") do
{:ok, %NaiveDateTi... | lib/types/time.ex | 0.738292 | 0.447098 | time.ex | starcoder |
defmodule Maestro.Store do
@moduledoc """
Concise API for events and snapshots.
If you are using the `Maestro.Store.Postgres` adapter, an `Ecto.Repo` should
be provided.
"""
@default_options [max_sequence: 2_147_483_647]
@type id :: HLClock.Timestamp.t()
@type sequence :: non_neg_integer()
@type ... | lib/maestro/store.ex | 0.884364 | 0.436802 | store.ex | starcoder |
defmodule ChallengeGov.Security do
@moduledoc """
Application env parsing for security related data
"""
alias ChallengeGov.SecurityLogs
def challenge_manager_assumed_tlds do
var = Application.get_env(:challenge_gov, :challenge_manager_assumed_tlds)
case parse_list_env(var) do
nil ->
[... | lib/challenge_gov/security.ex | 0.57332 | 0.434281 | security.ex | starcoder |
defmodule Vial do
@moduledoc """
`Vial` is a library for staged processing and event handling.
## Hello world
defmodule MyVial do
import Vial.Cauldron
def init(options)
# Initialize options
options
end
def call(cauldron, options) do
update_da... | lib/vial.ex | 0.847574 | 0.927822 | vial.ex | starcoder |
defmodule Runlet.Cmd.TLS do
@moduledoc "Display information about a TLS server"
@doc """
Displays TLS protocol, cipher suite and certificate details
Args:
"1.1.1.1"
"1.1.1.1 1234"
"1.1.1.1:1234"
"""
@spec exec(binary) :: Enumerable.t()
def exec(address) do
{ip, port} =
case Regex.... | lib/runlet/cmd/tls.ex | 0.717012 | 0.449091 | tls.ex | starcoder |
defmodule Kitt.Message.SSM do
@moduledoc """
Defines the structure and instantiation function
for creating a J2735-compliant SignalStatusMessage
An `SSM` defines the message sent by DSRC-capable infrastructure
to relay to vehicles the status of current signals and collection
of pending or active pre-emptio... | lib/kitt/message/ssm.ex | 0.789437 | 0.525856 | ssm.ex | starcoder |
defmodule AWS.DataSync do
@moduledoc """
AWS DataSync
AWS DataSync is a managed data transfer service that makes it simpler for you to
automate moving data between on-premises storage and Amazon Simple Storage
Service (Amazon S3) or Amazon Elastic File System (Amazon EFS).
This API interface reference fo... | lib/aws/generated/data_sync.ex | 0.844633 | 0.715712 | data_sync.ex | starcoder |
defmodule Helloworld.Hello.Pet.Color do
@moduledoc false
use Protobuf, enum: true, syntax: :proto3
@type t :: integer | :BLACK | :WHITE | :BLUE | :RED | :YELLOW | :GREEN
field :BLACK, 0
field :WHITE, 1
field :BLUE, 2
field :RED, 3
field :YELLOW, 4
field :GREEN, 5
end
defmodule Helloworld.Hello.Pet ... | elixir_grpc_bench/lib/helloworld.pb.ex | 0.805441 | 0.474327 | helloworld.pb.ex | starcoder |
defmodule Timex.Helpers do
@moduledoc false
alias Timex.Time
use Timex.Constants
import Timex.Macros
def calendar_universal_time() do
{_, _, us} = ts = Time.now
{d,{h,min,sec}} = :calendar.now_to_universal_time(ts)
{d,{h,min,sec,round(us/1000)}}
end
def calendar_local_time() do
{_, _, us... | lib/timex/helpers.ex | 0.748076 | 0.482368 | helpers.ex | starcoder |
defmodule Umbra.Operations do
@moduledoc """
This modules is the facade for the `Umbra.CodeGenerator` module.
It defines all macros `definit/2`, `defcall/3`, `defcast/3`, `definfo/3` and `defcontinue/3`.
"""
alias Umbra.FunctionGenerator
@doc """
Generate the `GenServer` `c:GenServer.init/1` callback.
... | lib/umbra/operations.ex | 0.896016 | 0.590897 | operations.ex | starcoder |
defmodule SSHSubsystemFwup do
@moduledoc """
SSH subsystem for upgrading Nerves devices
This module provides an SSH subsystem for Erlang's `ssh` application. This
makes it possible to send firmware updates to Nerves devices using plain old
`ssh` like this:
```shell
cat $firmware | ssh -s $ip_address fwu... | lib/ssh_subsystem_fwup.ex | 0.821939 | 0.61973 | ssh_subsystem_fwup.ex | starcoder |
defmodule Ueberauth.Strategy.CAS.User do
@moduledoc """
Representation of a CAS user with their roles.
A [CAS serviceResponse][response] is either an error message or a success
message. In the success case, the response often contains various attributes
containing information about the user.
For example, ... | lib/ueberauth/strategy/cas/user.ex | 0.804175 | 0.709409 | user.ex | starcoder |
defmodule Listerine.Commands do
use Coxir.Commander
@prefix "$"
@man_pages [
study: [
description: "Permite a um aluno juntar-se às salas das cadeiras.",
synopse: "`#{@prefix}study [CADEIRA|ANO, ...]`",
options: :nil,
example: """
`#{@prefix}study Algebra PI`
Adiciona-te à... | lib/Listerine/commands.ex | 0.621656 | 0.625309 | commands.ex | starcoder |
defmodule RateTheDub.Locale do
@moduledoc """
Utility functions for dealing with i18n and l10n related things, used
alongside Gettext on the frontend.
This may eventually be replaced by
[Elixir CLDR](https://github.com/elixir-cldr/cldr)
"""
# Covers the English => language code for the most common langu... | lib/ratethedub/locale.ex | 0.68721 | 0.459197 | locale.ex | starcoder |
defmodule PhoenixBoilerplate.BoilerplateDataManagement do
@moduledoc """
The BoilerplateDataManagement context.
"""
import Ecto.Query, warn: false
alias PhoenixBoilerplate.Repo
alias PhoenixBoilerplate.BoilerplateDataManagement.BoilerplateData
@doc """
Returns the list of boiler_plate_datas.
## Ex... | lib/phoenix_boilerplate/boilerplate_data_management.ex | 0.885347 | 0.473901 | boilerplate_data_management.ex | starcoder |
defmodule ExACN.PDU do
defstruct vector: <<>>, header: <<>>, data: <<>>
@moduledoc """
Packet Data Unit encoding
Common functions for processing the PDU format used across the ACN
specification
"""
alias ExACN.PDU.Flags
@type t :: %ExACN.PDU{vector: binary(), header: binary(), data: binary()}
@spe... | lib/ex_acn/pdu.ex | 0.715026 | 0.557845 | pdu.ex | starcoder |
defmodule Membrane.RTP.Packet.PayloadType do
@moduledoc """
This module contains utility to translate numerical payload type into an atom value.
"""
alias Membrane.RTP
@doc """
Gets the name of used encoding from numerical payload type according to [RFC3551](https://tools.ietf.org/html/rfc3551#page-32).
... | lib/membrane/rtp/packet_payload_type.ex | 0.764672 | 0.503479 | packet_payload_type.ex | starcoder |
defprotocol Access do
@moduledoc """
The Access protocol is used by `foo[bar]` and also
empowers the nested update functions in Kernel.
For instance, `foo[bar]` translates `Access.get(foo, bar)`.
`Kernel.get_in/2`, `Kernel.put_in/3`, `Kernel.update_in/3` and
`Kernel.get_and_update_in/3` are also all powere... | lib/elixir/lib/access.ex | 0.898109 | 0.587144 | access.ex | starcoder |
defmodule ExRss.Entry do
use ExRssWeb, :model
alias ExRss.Feed
@derive {Jason.Encoder, only: [:id, :url, :title, :read, :posted_at]}
@timestamps_opts [type: :utc_datetime]
schema "entries" do
belongs_to :feed, Feed
field :url, :string
field :title, :string
field :raw_posted_at, :string
... | lib/ex_rss/entry.ex | 0.727589 | 0.456107 | entry.ex | starcoder |
defmodule Sanbase.Signal.Trigger.DailyActiveAddressesSettings do
@moduledoc ~s"""
Signals based on the unique number of daily active addresses.
The signal supports the following operations:
1. Daily Active Addresses get over or under a given number
2. Daily Active Addresses change by a given percent compared... | lib/sanbase/signals/trigger/settings/daily_active_addresses_settings.ex | 0.762336 | 0.45944 | daily_active_addresses_settings.ex | starcoder |
defmodule Bonbon.Model.Locale do
use Bonbon.Web, :model
@moduledoc """
A model representing the different languages using culture codes (ISO 3166-1
alpha-2 and ISO 639-1 code).
##Fields
The `:country` and `:language` fields are uniquely constrained.
###:id
Is the unique ref... | web/models/locale.ex | 0.861524 | 0.544256 | locale.ex | starcoder |
defmodule VirusTotal do
@moduledoc """
Documentation for VirusTotal.
Full API documentation can be found on the
[official site](https://www.virustotal.com/en/documentation/private-api)
As a note, this wrapper will convert HTTP-200 responses with a `response_code` of
0 to errors. Apparently VT considers to... | lib/virus_total.ex | 0.881213 | 0.521776 | virus_total.ex | starcoder |
defmodule AWS.KinesisVideoMedia do
@moduledoc """
"""
@doc """
Use this API to retrieve media content from a Kinesis video stream.
In the request, you identify the stream name or stream Amazon Resource Name
(ARN), and the starting chunk. Kinesis Video Streams then returns a stream of
chunks in order b... | lib/aws/generated/kinesis_video_media.ex | 0.844505 | 0.57687 | kinesis_video_media.ex | starcoder |
defmodule Premailex.CSSParser do
@moduledoc """
Module that handles CSS parsing with naive Regular Expression.
"""
@type rule :: %{directive: String.t(), value: String.t(), important?: boolean}
@type rule_set :: %{rules: [rule], selector: String.t(), specificity: number}
@css_selector_rules ~r/([\s\S]*?){... | lib/premailex/css_parser.ex | 0.775009 | 0.433562 | css_parser.ex | starcoder |
defmodule Binary.Queue do
@moduledoc """
Queue for binary data.
It resembles a pipeline: data is pushed on one end and pulled from the other.
The order by which bytes are pushed in is the same by which they are pulled out.
Internally, this queue implementation optimizes on the amount of copying of
binary ... | lib/binary/queue.ex | 0.838713 | 0.688141 | queue.ex | starcoder |
defmodule Geohash do
@geobase32 '0123456789bcdefghjkmnpqrstuvwxyz'
@doc ~S"""
Encodes given coordinates to a geohash of length `precision`
## Examples
iex> Geohash.encode(42.6, -5.6, 5)
"ezs42"
"""
def encode(lat, lon, precision \\ 11) do
encode_to_bits(lat, lon, precision * 5) |> to_geobase32
... | lib/geohash.ex | 0.783243 | 0.664144 | geohash.ex | starcoder |
defmodule FolderDiff do
@moduledoc false
# Split out as a separate package? Compare two folders. Assert if mismatched.
import ExUnit.Assertions
@spec assert_folders_are_equal(folder1 :: Path.t(), folder2 :: Path.t()) :: :ok
def assert_folders_are_equal(folder1, folder2) do
files1 = folder1 |> File.ls!(... | test/support/folder_diff.ex | 0.632162 | 0.59408 | folder_diff.ex | starcoder |
defmodule Rfx.Ops.Credo.MultiAlias do
@behaviour Rfx.Ops
@moduledoc """
Refactoring Operations to automatically apply the Credo `multi-alias`
recommendation.
Walks the source code and expands instances of multi-alias syntax.
## Examples
Basic transformation...
iex> source = "alias Foo.{Bar, B... | lib/rfx/ops/credo/multi_alias.ex | 0.816736 | 0.446314 | multi_alias.ex | starcoder |
defmodule Protobuf.JSON.DecodeError do
defexception [:message]
@type t :: %__MODULE__{message: String.t()}
def new({:unsupported_syntax, syntax}) do
%__MODULE__{message: "JSON encoding of '#{syntax}' syntax is unsupported, try proto3"}
end
def new(:no_json_lib) do
%__MODULE__{message: "JSON library... | lib/protobuf/json/decode_error.ex | 0.781622 | 0.458591 | decode_error.ex | starcoder |
defmodule Harald.HCI.Command.LEController.CreateConnection do
use Harald.HCI.Command.LEController, ocf: 0x000D
@moduledoc """
The HCI_LE_Create_Connection command is used to create an ACL connection to a
connectable advertiser
Bluetooth Core Version 5.2 | Vol 4, Part E, section 7.8.12
* OGF: `#{inspect(@... | lib/harald/hci/commands/le_controller/create_connection.ex | 0.803791 | 0.596139 | create_connection.ex | starcoder |
defmodule ServerSentEventStage do
@moduledoc """
A GenStage producer which parses the ServerSentEvent (SSE) protocol.
SSEs are used in browsers via the EventSource API, but they can be used for
any kind of one-directional streaming.
For more information, see the [W3C](https://html.spec.whatwg.org/multipage/... | lib/server_sent_event_stage.ex | 0.753285 | 0.461441 | server_sent_event_stage.ex | starcoder |
defmodule Tablespoon.Transport.FakeBtd do
@moduledoc """
Transport implementation which pretends to be Btd.
By default, it always replies to packets with a good response.
However, there are some configuration variables that can be set to change that.
- drop_rate: the percent of messages which are not sent ... | lib/tablespoon/transport/fake_btd.ex | 0.825203 | 0.474022 | fake_btd.ex | starcoder |
defmodule AFK.Scancode do
@moduledoc false
@keys [
{0x04, :a},
{0x05, :b},
{0x06, :c},
{0x07, :d},
{0x08, :e},
{0x09, :f},
{0x0A, :g},
{0x0B, :h},
{0x0C, :i},
{0x0D, :j},
{0x0E, :k},
{0x0F, :l},
{0x10, :m},
{0x11, :n},
{0x12, :o},
{0x13, :p},
{0x1... | lib/afk/scancode.ex | 0.52683 | 0.664431 | scancode.ex | starcoder |
defmodule Manic.JSONEnvelope do
@moduledoc """
Module implementing the Merchant API [JSON Envelope Specification](https://github.com/bitcoin-sv-specs/brfc-misc/tree/master/jsonenvelope).
Every response payload from the Merchant API is encapsualted in a parent JSON
object, which is signed by the miner's [Miner ... | lib/manic/json_envelope.ex | 0.887504 | 0.59134 | json_envelope.ex | starcoder |
defmodule FunLand.Appliable do
@doc """
Something is Appliable if you can _apply_ one of it (containing one or multiple functions) _with_ another.
Appliable is mostly born out of the needs to apply a function that is already wrapped in a Mappable:
- If you had a bare function, you could use `Mappable.map/2` t... | lib/fun_land/appliable.ex | 0.761405 | 0.738056 | appliable.ex | starcoder |
defmodule TelemetryMetricsPrometheus do
@moduledoc """
Prometheus Reporter for [`Telemetry.Metrics`](https://github.com/beam-telemetry/telemetry_metrics) definitions.
Provide a list of metric definitions to the `init/2` function. It's recommended to
run TelemetryMetricsPrometheus under a supervision tree, usua... | lib/telemetry_metrics_prometheus.ex | 0.899145 | 0.424233 | telemetry_metrics_prometheus.ex | starcoder |
defmodule Benchfella.Snapshot do
defstruct options: %{}, tests: []
@precision 2
alias __MODULE__
alias Benchfella.Json
def prepare(duration, mem_stats?, sys_mem_stats?, results) do
[
"duration:", to_string(duration), ";",
"mem stats:", to_string(mem_stats?), ";",
"sys mem stats:", to_... | lib/benchfella/snapshot.ex | 0.538741 | 0.431704 | snapshot.ex | starcoder |
defmodule HAP.CharacteristicDefinition do
@moduledoc """
A behaviour which encapsulates the functinos required to define a characteristic.
At runtime, characteristics are modeled via the `HAP.Characteristic` struct which
contains the runtime values for the characteristic itself, as well as metadata about
the... | lib/hap/characteristic_definition.ex | 0.894766 | 0.80871 | characteristic_definition.ex | starcoder |
defmodule Transmog do
@moduledoc """
`Transmog` is a module which provides the ability to map keys on nested maps,
lists and structs to new values. It is useful for when you have external data
that you want to convert into an internal format easily. This recursive
transformation is made using an internal conc... | lib/transmog.ex | 0.921247 | 0.540014 | transmog.ex | starcoder |
defmodule Application.Behaviour do
@moduledoc """
Default callbacks for applications.
In Erlang/OTP, an application is a component that can be started
and stopped as a unit, and which can be reused in other systems.
The first step in creating an application is to define an application specification.
For e... | lib/elixir/lib/application/behaviour.ex | 0.825343 | 0.493164 | behaviour.ex | starcoder |
defmodule Stats do
@moduledoc """
Stats Module
"""
@table :stats_table
def create(:counter, name, topic, partition) do
:ets.insert(@table, {key(:counter, name, topic, partition), empty(:counter)})
end
def create(:latency, name, topic, partition) do
key = key(:latency, name, topic, partition)
... | apps/stats/lib/stats.ex | 0.595493 | 0.484685 | stats.ex | starcoder |
defmodule Csvex.Parse do
@moduledoc """
Module for parsing CSV.
To reach higher performance, all the fold functions
support selecting which columns to be returned from the underlying NIF. See
CsvexParseTest for example.
"""
@type options :: [option]
@type option :: {:delimiter, :tab | :comma}
@type ... | lib/parse/parse.ex | 0.727685 | 0.520496 | parse.ex | starcoder |
defmodule Resourceful.Collection do
@moduledoc """
Provides a common interface for querying and retrieving collections.
Deligated modules designed to interact directly with the underlying data or
data sources must return alls of resources. For instance, when using `Ecto`,
this module should return alls of st... | lib/resourceful/collection.ex | 0.916142 | 0.538316 | collection.ex | starcoder |
defmodule Cldr.Calendar.Base.Week do
@moduledoc false
alias Cldr.Calendar.Config
alias Cldr.Calendar.Base.Month
alias Calendar.ISO
alias Cldr.Math
@days_in_week 7
@weeks_in_quarter 13
@months_in_quarter 3
@months_in_year 12
@weeks_in_long_year 53
@weeks_in_normal_year 52
@quarters_in_year 4
... | lib/cldr/calendar/base/week.ex | 0.660282 | 0.470189 | week.ex | starcoder |
defmodule ExUnited.Case do
@moduledoc """
This module makes it possible to seemlessly execute assertions and refutations
within spawned nodes.
You can setup your test module by either using `ExUnited.Case` instead of
`ExUnit.Case`:
defmodule MyNodesTest do
use ExUnited.Case
end
Or by ... | lib/ex_united/case.ex | 0.816077 | 0.754938 | case.ex | starcoder |
defmodule WHATWG.URL.URLSearchParams do
@moduledoc """
Functions to work with `URLSearchParams`.
See [URL Standard - URLSearchParams class](https://url.spec.whatwg.org/#interface-urlsearchparams).
"""
alias WHATWG.URL.WwwFormUrlencoded
@doc """
Gets the value of the first pair whose name is `name`.
... | lib/whatwg/url/url_search_params.ex | 0.80329 | 0.484136 | url_search_params.ex | starcoder |
defmodule Modbus.Model do
@moduledoc false
def apply(state, {:rc, slave, address, count}) do
reads(state, {slave, :c, address, count})
end
def apply(state, {:ri, slave, address, count}) do
reads(state, {slave, :i, address, count})
end
def apply(state, {:rhr, slave, address, count}) do
reads(s... | lib/model.ex | 0.524395 | 0.477737 | model.ex | starcoder |
defmodule ElixirRigidPhysics.Collision.Intersection.SphereCapsule do
@moduledoc """
Module for sphere-capsule intersection tests.
"""
require ElixirRigidPhysics.Dynamics.Body, as: Body
require ElixirRigidPhysics.Geometry.Sphere, as: Sphere
require ElixirRigidPhysics.Geometry.Capsule, as: Capsule
require ... | lib/collision/intersection/sphere_capsule.ex | 0.894651 | 0.484258 | sphere_capsule.ex | starcoder |
defmodule Raygun.Format do
@moduledoc """
This module builds payloads of error messages that Raygun will understand.
These functions return maps of data which will be encoding as JSON prior
to submission to Raygun.
"""
@raygun_version Mix.Project.config()[:version]
@doc """
Builds an error payload tha... | lib/raygun/format.ex | 0.799207 | 0.415284 | format.ex | starcoder |
defmodule GatherSubmissions.Config do
@moduledoc """
Provides the definition of the struct `t:t/0` that stores the configuration
options given to *GatherSubmissions*, and functions for reading it from a
YAML file.
The supported options are:
* `csv_file_name`: name of the CSV file containing students inf... | lib/config/config.ex | 0.823825 | 0.617498 | config.ex | starcoder |
defmodule Txbox.Transactions.Tx do
@moduledoc """
Transaction schema module.
Txbox adds a single table to your database containing all of the transaction,
channel and meta data.
For any transaction, the only required attribute is the `txid`. If no channel
is specified, the transaction will be added to the... | lib/txbox/transactions/tx.ex | 0.837487 | 0.569733 | tx.ex | starcoder |
use Bitwise
defmodule Day3 do
@moduledoc """
Find shortest distance in spiral matrix path
"""
@doc """
Get the Manhattan distance for a given number
## Examples
iex> Day3.get_distance(1)
0
iex> Day3.get_distance(12)
3
iex> Day3.get_distance(23)
2
iex> Day3... | lib/day3.ex | 0.885922 | 0.739728 | day3.ex | starcoder |
defmodule ChoreRunner do
@moduledoc """
A framework and library for productively writing and running code "Chores".
A "Chore" can really be anything, but most commonly it is just some infrequently, manually run code which achieve a business or development goal.
For example: updating a config value in a databa... | lib/chore_runner.ex | 0.848549 | 0.891717 | chore_runner.ex | starcoder |
defmodule Oli.Delivery.Evaluation.Rule do
alias Oli.Delivery.Evaluation.EvaluationContext
@doc """
Parses and evaluates a rule and returns `{:ok, result}` when succesful, where `result`
is is a boolean true or false indicating if the rule matched or not.
Returns `{:error, reason}` when it fails to parse or ... | lib/oli/delivery/evaluation/rule.ex | 0.879626 | 0.578478 | rule.ex | starcoder |
defmodule Day16 do
def part_one(file_reader \\ InputFile) do
[fields, _our_ticket, other_tickets] =
file_reader.contents_of(16, :stream)
|> Enum.map(&String.trim/1)
|> Enum.chunk_while([], &accum/2, &finish/1)
fields = Enum.map(fields, &Day16.Field.parse/1)
other_tickets
|> Enum.re... | year_2020/lib/day_16.ex | 0.518546 | 0.433442 | day_16.ex | starcoder |
defmodule Treex do
@moduledoc """
Convenient module for using the `gb_trees` from erlang's
standard library.
It reorders the arguments so the tree is always passed
first and therefore, it can be used with the pipe operators.
And therefore by using Treex instead, code can be written as:
```elixir
t = ... | lib/treex.ex | 0.942889 | 0.923489 | treex.ex | starcoder |
defmodule Statistics.Distributions.Normal do
@moduledoc """
The normal, or gaussian, distribution
"""
alias Statistics.Math
alias Statistics.Math.Functions
@doc """
Probability density function
get result of probability density function
## Examples
iex> Statistics.Distributions.Normal.... | lib/statistics/distributions/normal.ex | 0.933363 | 0.801004 | normal.ex | starcoder |
defmodule Chex.Move.SanParser do
@moduledoc false
@doc """
Parses the given `binary` as move.
Returns `{:ok, [token], rest, context, position, byte_offset}` or
`{:error, reason, rest, context, line, byte_offset}` where `position`
describes the location of the move (start position) as `{line, column_on_li... | lib/chex/move/san/san_parser.ex | 0.897107 | 0.44571 | san_parser.ex | starcoder |
defmodule Microscope do
@moduledoc """
**Microscope** is a simple static web server built using `cowboy`.
It's original purpose was to provide an easy way to test your static
websites, but it's also useful as a temporary server for file sharing over
HTTP.
## Getting started
Use `Microscope.start_link/2... | lib/microscope.ex | 0.90444 | 0.806967 | microscope.ex | starcoder |
defmodule GCPPS.Message do
@moduledoc """
Definition and functions to decode valid maps into Message structs.
"""
alias __MODULE__, as: Message
require Logger
@typedoc """
GooglePubSub Message struct.
"""
@type t :: %Message{}
defstruct attributes: %{},
data: %{},
message_i... | apps/airport/lib/gcpps/message.ex | 0.859649 | 0.476275 | message.ex | starcoder |
defmodule Rajska.QueryScopeAuthorization do
@moduledoc """
Absinthe middleware to perform query scoping.
## Usage
[Create your Authorization module and add it and QueryAuthorization to your Absinthe.Schema](https://hexdocs.pm/rajska/Rajska.html#module-usage). Since Scope Authorization middleware must be used ... | lib/middlewares/query_scope_authorization.ex | 0.824991 | 0.79657 | query_scope_authorization.ex | starcoder |
defmodule Toolshed.Unix do
@moduledoc """
Helpers for when your fingers are too used to typing Unix
commands.
Helpers include:
* `cat/1` - print out a file
* `date/0` - print out the current date and time
* `grep/2` - print out lines of a file that match a regular expression
* `tree/1` - prin... | lib/toolshed/unix.ex | 0.726523 | 0.505737 | unix.ex | starcoder |
defmodule Remedy.Embed do
@moduledoc """
Convenience functions for working with embeds.
Using the helpers in this module you can coneniently convert various objects into fields within an embed, allowing easier manipulation and more consistent embeds with less boilerplate.
Consider you wish to create an embed ... | lib/remedy/embed.ex | 0.826572 | 0.422177 | embed.ex | starcoder |
# alias Scenic.Graph
# alias Scenic.Primitive
# alias FloUI.Scrollable.Direction
# alias FloUI.Scrollable.Drag
# alias FloUI.Scrollable.Wheel
# alias FloUI.Scrollable.PositionCap
# alias Scenic.Primitive.Style.Theme
# alias Scenic.Math.Vector2
# @moduledoc """
# The scroll bar component can be use... | lib/scrollbar/scroll_bar.ex | 0.846863 | 0.480844 | scroll_bar.ex | starcoder |
defmodule Uplink do
@moduledoc """
A simple abstraction for standardized observability with telemetry and more.
Uplink provides a simple abstraction for configuring observability for libraries
and applications. The heart of Uplink is the `Uplink.Monitor` which provides a
standard template for common observab... | lib/uplink.ex | 0.927042 | 0.936807 | uplink.ex | starcoder |
defmodule Silicon do
@moduledoc """
Silicon is another wrapper of Elixir/Erlang crypto packages.
### Packages
We wrapped the packages below:
* `{:libdecaf, "~> 1.0"}` for Ed25519 and SHA3
* `{:keccakf1600, "~> 2.0", hex: :keccakf1600_orig}` for Keccak Origin
* `{:libsecp256k1, "~> 0.1.10"}` for Secp256k... | lib/silicon.ex | 0.826852 | 0.53279 | silicon.ex | starcoder |
defmodule Car5g do
use GenServer
require Logger
defstruct [
:signal_pid,
:recorded_file,
:name,
:tcp_connection,
signal_map: %{}
]
def start_link({name, tcp_server}) do
state = %__MODULE__{tcp_connection: tcp_server, name: name}
GenServer.start_link(__MODULE__, state, name: nam... | examples/grpc/elixir/car5g/lib/car5g.ex | 0.522446 | 0.414484 | car5g.ex | starcoder |
defmodule OptionParser do
@moduledoc """
This module contains functions to parse command line options.
"""
@type argv :: [String.t]
@type parsed :: Keyword.t
@type errors :: [{String.t, String.t | nil}]
@type options :: [switches: Keyword.t, strict: Keyword.t, aliases: Keyword.t]
defmodule ParseE... | lib/elixir/lib/option_parser.ex | 0.866005 | 0.631197 | option_parser.ex | starcoder |
defmodule Mix.Tasks.Hex.Package do
use Mix.Task
alias Hex.Registry.Server, as: Registry
@shortdoc "Fetches or diffs packages"
@default_diff_command "git diff --no-index __PATH1__ __PATH2__"
@doc false
def default_diff_command(), do: @default_diff_command
@moduledoc """
Fetches or diffs packages.
... | lib/mix/tasks/hex.package.ex | 0.800107 | 0.410047 | hex.package.ex | starcoder |
defmodule Sue.DB.Schema do
@moduledoc """
Used to define the types of elements (vertices) in our graph.
Some of these are connected by edges:
Chat <-> PlatformAccount <-> Chat
Account -> Definition
Chat -> Definition
Some of these are left disconnected, and function simply as normal table... | apps/sue/lib/sue/db/schema.ex | 0.739046 | 0.499695 | schema.ex | starcoder |
defmodule PromEx.DashboardUploader do
@moduledoc """
This GenServer is responsible for uploading the configured PromEx module
dashboards to Grafana. This is a transient process and will terminate after
the dashboards have been successfully uploaded. It requires the name of the
PromEx module as an option so th... | lib/prom_ex/dashboard_uploader.ex | 0.759761 | 0.554169 | dashboard_uploader.ex | starcoder |
defmodule ExGdax do
@moduledoc """
GDAX API client.
"""
@doc """
List known currencies.
## Examples
iex> ExGdax.list_currencies()
{:ok,
[%{"id" => "BTC", "min_size" => "0.00000001", "name" => "Bitcoin"},
%{"id" => "ETH", "min_size" => "0.00000001", "name" => "Ether"}, ...]}
"... | lib/ex_gdax.ex | 0.744563 | 0.407746 | ex_gdax.ex | starcoder |
defmodule Dynamo.Helpers.ContentFor do
@moduledoc """
This module exposes macros that allows a child
template to assign data which will eventually
be read and use by the parent.
## Examples
Imagine the following layout:
<html>
<head>
<title>
<%= content_for(:title) %>
... | lib/dynamo/helpers/content_for.ex | 0.835886 | 0.478651 | content_for.ex | starcoder |
defmodule ExAws.Boto.Protocol.Query do
require Logger
import SweetXml, only: [sigil_x: 2]
@behaviour ExAws.Boto.Protocol
@doc """
Converts an `ExAws.Boto.Operation`, which describes an API method invocation in terms of `ExAws.Boto`
into an `ExAws.Operation.Query`, which describes an HTTP request. This met... | lib/ex_aws/boto/protocol/query.ex | 0.735642 | 0.432723 | query.ex | starcoder |
defmodule Elixium.Utilities do
@moduledoc """
Various functions that don't need their own module, since theyre used in multiple
places for different things
"""
def sha256(data),
do: hash(data, :sha256)
defp hash(data, algorithm),
do: :crypto.hash(algorithm, data)
def sha_base16(input) do
... | lib/utilities.ex | 0.727879 | 0.443359 | utilities.ex | starcoder |
defmodule Rayray.Matrix do
alias Rayray.Tuple
defstruct impl: []
def new(rows) do
%__MODULE__{impl: rows}
end
def identity() do
%__MODULE__{impl: [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]}
end
def get(%__MODULE__{impl: impl}, {row, col}) do
impl
|> Enum.at(row)
|> En... | lib/rayray/matrix.ex | 0.753739 | 0.562357 | matrix.ex | starcoder |
defmodule Benchee.Scenario do
@moduledoc """
A Scenario in Benchee is a particular case of a whole benchmarking suite. That
is the combination of a particular function to benchmark (`job_name` and
`function`) in combination with a specific input (`input_name` and `input`).
It then gathers all data measured f... | lib/benchee/scenario.ex | 0.900573 | 0.772101 | scenario.ex | starcoder |
defmodule ExDns.Message.Answer do
@moduledoc """
Encodes and decodes Answer records
4.1.3. Resource record format
The answer, authority, and additional sections all share the same
format: a variable number of resource records, where the number of
records is specified in the corresponding count field in th... | lib/ex_dns/message/answer.ex | 0.544075 | 0.517327 | answer.ex | starcoder |
defmodule ExPesa.Mpesa.B2B do
@moduledoc """
This API enables Business to Business (B2B) transactions between a business and another business.
Use of this API requires a valid and verified B2B M-Pesa short code for the business initiating the transaction and the both businesses involved in the transaction.
"""
... | lib/ex_pesa/Mpesa/b2b.ex | 0.829146 | 0.865622 | b2b.ex | starcoder |
defmodule AWS.Connect do
@moduledoc """
Amazon Connect is a cloud-based contact center solution that you use to set up
and manage a customer contact center and provide reliable customer engagement at
any scale.
Amazon Connect provides metrics and real-time reporting that enable you to
optimize contact rou... | lib/aws/generated/connect.ex | 0.796649 | 0.423637 | connect.ex | starcoder |
defmodule Cldr.List do
@moduledoc """
`Cldr` incudes patterns that enable list to be catenated together
to form a grammatically correct language construct for a given locale.
If we have a list of days like `["Monday", "Tuesday", "Wednesday"]`
then we can format that list for a given locale by:
iex> Cl... | lib/cldr/list.ex | 0.907176 | 0.644505 | list.ex | starcoder |
defmodule Diceware do
@moduledoc """
A library that generates a [Diceware](https://theworld.com/~reinhold/diceware.html) passphrase.
A diceware passphrase builds a readable passphrase of 6 (or more) words from a list of 8,192 words.
Creating a passphrase combining readable words helps the user more easily mem... | lib/diceware.ex | 0.845081 | 0.529568 | diceware.ex | starcoder |
defmodule Site.ContentRewriters.LiquidObjects.Fare do
@moduledoc """
This module converts a string-based set of fare filters to a proper keyword list request
intended for Fares.Repo.all/1, and parses the price of the final result into a string.
IMPORTANT: Any atom changes in the Fares.Fare module need to also... | apps/site/lib/site/content_rewriters/liquid_objects/fare.ex | 0.733643 | 0.574514 | fare.ex | starcoder |
defmodule CodeCorps.Adapter.MapTransformer do
@moduledoc ~S"""
Module used to transform maps for the purposes of various adapters used by the
application.
"""
@typedoc ~S"""
A format representing how a single key should be mapped from a source. The
actual format is a 2 element tuple.
The first element... | lib/code_corps/adapter/map_transformer.ex | 0.890629 | 0.665256 | map_transformer.ex | starcoder |
defmodule AWS.Savingsplans do
@moduledoc """
Savings Plans are a pricing model that offer significant savings on AWS
usage (for example, on Amazon EC2 instances). You commit to a consistent
amount of usage, in USD per hour, for a term of 1 or 3 years, and receive a
lower price for that usage. For more inform... | lib/aws/savingsplans.ex | 0.710427 | 0.430506 | savingsplans.ex | starcoder |
defmodule Pow.Ecto.Schema.Changeset do
@moduledoc """
Handles changesets methods for Pow schema.
These methods should never be called directly, but instead the methods
build in macros in `Pow.Ecto.Schema` should be used. This is to ensure
that only compile time configuration is used.
## Configuration opti... | lib/pow/ecto/schema/changeset.ex | 0.861815 | 0.541954 | changeset.ex | starcoder |
defmodule <%= inspect value_context %> do
@moduledoc """
Module to allow better Value composition. With this module we're able to
compose complex structures faster and simpler.
A Value's base format can only be a List or a Map.
"""
def build(module, data, opts \\ []) do
data
|> module.build()
... | priv/templates/phx.gen.solid/value_context.ex | 0.804905 | 0.597667 | value_context.ex | starcoder |
defmodule Day15 do
def part1(file_name \\ "test.txt") do
file_name
|> parse()
|> min_cost()
end
def part2(file_name \\ "test.txt") do
file_name
|> parse()
|> add_mins()
|> add_direction()
|> add_final_step(24)
|> expand_grid()
end
def add_mins(%{grid: grid, target: {max_x... | jpcarver+elixir/day15/lib/day15.ex | 0.526586 | 0.639455 | day15.ex | starcoder |
defmodule Elixometer do
@moduledoc ~S"""
A light wrapper around [exometer](https://github.com/Feuerlabs/exometer).
Elixometer allows you to define metrics and subscribe them automatically
to the default reporter for your environment.
## Configuration
In one of your config files, set up an exometer report... | lib/elixometer.ex | 0.8815 | 0.424233 | elixometer.ex | starcoder |
defmodule GenFSMHelpers do
@moduledoc """
Helper library for GenFSM.
Add helper functions to eliminate returning those nasty tuples.
* next_state
* reply
"""
@doc """
Return next_state tuple, given a tuple.
## Examples
iex> GenFSMHelpers.next_state({:data, :idle})
{:next_state, :idle,... | lib/gen_fsm_helpers.ex | 0.849504 | 0.45532 | gen_fsm_helpers.ex | starcoder |
defmodule Tanx.Handoff.Impl do
require Logger
defmodule State do
@moduledoc false
defstruct name: nil,
nodes: MapSet.new(),
processes_updated_counter: 0,
processes_updated_at: 0,
ets_table: nil,
requests: %{}
end
@spec child_spec(op... | apps/tanx/lib/tanx/handoff/impl.ex | 0.674587 | 0.431225 | impl.ex | starcoder |
defmodule Ockam.Hub.Service.StaticForwarding do
@moduledoc """
Static forwarding service
Subscribes workers (by return route) to a string forwarding alias
Forwarding alias is parsed from the payload as a BARE `string` type
New subscriptions update the forwarding route in the same forwarding alias
Forwar... | implementations/elixir/ockam/ockam_hub/lib/hub/service/static_forwarding.ex | 0.83104 | 0.436802 | static_forwarding.ex | starcoder |
defmodule Clipboard do
@moduledoc """
Copy and paste from system clipboard.
Wraps ports to system-specific utilities responsible for clipboard access. It uses the default
clipboard utilities on macOS, Linux and Windows but can be configured to call any executable.
"""
@doc """
Copy `value` to system cli... | lib/clipboard.ex | 0.864454 | 0.498108 | clipboard.ex | starcoder |
defmodule Asteroid.ObjectStore.RefreshToken.Riak do
@moduledoc """
Riak implementation of the `Asteroid.ObjectStore.RefreshToken` behaviour
## Initializing a Riak bucket type
```console
$ sudo riak-admin bucket-type create token '{"props":{"datatype":"map", "backend":"bitcask_mult"}}'
token created
$ s... | lib/asteroid/object_store/refresh_token/riak.ex | 0.850608 | 0.709497 | riak.ex | starcoder |
defmodule Scenic.Primitive.Circle do
@moduledoc """
Draw a circle on the screen.
## Data
`radius`
The data for an arc is a single number.
* `radius` - the radius of the arc
## Styles
This primitive recognizes the following styles
* [`hidden`](Scenic.Primitive.Style.Hidden.html) - show or hide th... | lib/scenic/primitive/circle.ex | 0.938195 | 0.86988 | circle.ex | starcoder |
defmodule Bounds.Map do
import Bounds.Map.Records
alias Bounds.Map.Impl
defstruct [
size: 0,
priority_seq: 0,
offset: 0,
root: nil
]
def new, do: %__MODULE__{}
@doc false
def insert(%__MODULE__{root: tnode0, size: size0} = bset0, interval() = ival) do
{tnode1, size1} = Impl.insert(... | lib/bounds/map.ex | 0.649801 | 0.580501 | map.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.