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 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.832611 | 0.658949 | ssh_subsystem_fwup.ex | starcoder |
defmodule AWS.CloudSearch do
@moduledoc """
Amazon CloudSearch Configuration Service
You use the Amazon CloudSearch configuration service to create, configure,
and manage search domains. Configuration service requests are submitted
using the AWS Query protocol. AWS Query requests are HTTP or HTTPS requests
... | lib/aws/generated/cloud_search.ex | 0.852874 | 0.437223 | cloud_search.ex | starcoder |
defmodule Certbot.Certificate do
@moduledoc """
The module provides utility functions to deal with the serial and validity
timestamps of a certificate as well as being a struct to store certificate/keys
"""
@type t :: %__MODULE__{
cert: binary(),
key: {atom(), binary()}
}
defst... | lib/certbot/certificate.ex | 0.877556 | 0.865508 | certificate.ex | starcoder |
defmodule Yodlee.Account do
@moduledoc """
Functions for `accounts` endpoint.
"""
import Yodlee
alias Yodlee.Utils
defstruct id: nil, account_name: nil, account_number: nil, amount_due: nil, interest_rate_type: nil,
balance: nil, due_date: nil, interest_rate: nil, last_payment_amount: nil,
... | lib/yodlee/account.ex | 0.77569 | 0.426949 | account.ex | starcoder |
defmodule Sise do
# SPDX-License-Identifier: Apache-2.0
@moduledoc """
Sise is a library that implements the **si**mple **se**rvice
discovery protocol (SSDP).
Sise will listen on the network for announcements of available UPnP devices
and services. Additionally it will send out search requests from time t... | lib/sise/sise.ex | 0.842896 | 0.757077 | sise.ex | starcoder |
defmodule Tds.Date do
@moduledoc """
Struct for MSSQL date. https://msdn.microsoft.com/en-us/library/bb630352.aspx
## Fields
* `year`
* `month`
* `day`
"""
@type t :: %__MODULE__{year: 1..9999, month: 1..12, day: 1..31}
defstruct [
year: 1900,
month: 1,
day: 1
]
end
defmodule Tds... | lib/tds/date_time.ex | 0.877214 | 0.567068 | date_time.ex | starcoder |
defmodule BeerSong do
@doc ~S"""
Get a single verse of the beer song
## Examples
iex> BeerSong.verse(99)
"99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n"
iex> BeerSong.verse(1)
"1 bottle of beer on the wall, 1 bot... | beer-song/lib/beer_song.ex | 0.654674 | 0.512083 | beer_song.ex | starcoder |
defmodule OMG.State do
@moduledoc """
A GenServer serving the ledger, for functional core and more info see `OMG.State.Core`.
Keeps the state of the ledger, mainly the spendable UTXO set that can be employed in both `OMG.ChildChain` and
`OMG.Watcher`.
Maintains the state of the UTXO set by:
- recognizi... | apps/omg/lib/omg/state.ex | 0.867092 | 0.532 | state.ex | starcoder |
defmodule Validation.Rules.Tld do
@moduledoc false
# List extracted from https://data.iana.org/TLD/tlds-alpha-by-domain.txt
# Version 2019091200, Last Updated Thu Sep 12 07:07:02 2019 UTC
@tld_data [
"AAA",
"AARP",
"ABARTH",
"ABB",
"ABBOTT",
"ABBVIE",
"ABC",
"ABLE",
"ABOGADO... | lib/validation/rules/tld.ex | 0.512205 | 0.494873 | tld.ex | starcoder |
defmodule Serum.HeaderParser do
@moduledoc """
This module takes care of parsing headers of page (or post) source files.
Header is where all page or post metadata goes into, and has the following
format:
```
---
key: value
...
---
```
where `---` in the first and last line delimits the beginnin... | lib/serum/header_parser.ex | 0.846101 | 0.849035 | header_parser.ex | starcoder |
defmodule Cassandrax.Keyspace do
@moduledoc """
Defines a Keyspace.
A keyspace acts as a repository, wrapping an underlying keyspace in CassandraDB.
## Setup
test_conn_attrs = [
nodes: ["127.0.0.1:9043"],
username: "cassandra",
password: "<PASSWORD>"
]
child = Cassandrax.Supervisor.child_s... | lib/cassandrax/keyspace.ex | 0.903884 | 0.77389 | keyspace.ex | starcoder |
defmodule EventSerializer.SchemaRegistryCache do
@moduledoc """
This service is responsible to fetch the schemas from Schema Registry
and cache theirs names and ids.
That result will be saved in a cache so we can re utilize in the
EventSerializer.Publisher
We start the server using the start_link/0 functi... | lib/event_serializer/schema_registry_cache.ex | 0.776199 | 0.521167 | schema_registry_cache.ex | starcoder |
defmodule HXL.Eval do
@moduledoc false
alias HXL.Ast.Body
defstruct [:functions, :key_encoder, document: %{}, symbol_table: %{}]
@type t :: %__MODULE__{
document: map(),
functions: map(),
symbol_table: map(),
key_encoder: (binary -> term())
}
@doc """
Evalua... | lib/hxl/eval.ex | 0.73659 | 0.510313 | eval.ex | starcoder |
defmodule ValidatorsRo.CNP do
@moduledoc """
See `ValidatorsRo`
"""
defmacro __using__(_opts) do
quote location: :keep do
import ValidatorsRo.Utils, only: [control_sum: 2]
require Integer
@cnp_test_key 279146358279
|> Integer.digits
|> Enum.reverse
@cnp_regexp ~r"^\... | lib/cnp/cnp.ex | 0.60964 | 0.425963 | cnp.ex | starcoder |
defmodule Bacen.CCS.ACCS001 do
@moduledoc """
The ACCS001 message.
This message is responsible to register or deregister
persons from CCS system.
It has the following XML example:
```xml
<CCSArqAtlzDiaria>
<Repet_ACCS001_Pessoa>
<Grupo_ACCS001_Pessoa>
<TpOpCCS>I</TpOpCCS>
<Qua... | lib/bacen/ccs/accs001.ex | 0.72952 | 0.645092 | accs001.ex | starcoder |
defmodule BSV.Block do
@moduledoc """
Module for the construction, parsing and serialization of Bitcoin block headers.
"""
use Bitwise
alias BSV.Crypto.Hash
alias BSV.Util
alias BSV.Util.VarBin
alias BSV.Transaction
@enforce_keys [:version, :previous_block, :merkle_root, :timestamp, :bits, :nonce]
... | lib/bsv/block.ex | 0.91727 | 0.55447 | block.ex | starcoder |
defmodule ZeroMQ.FrameSplitter do
@moduledoc """
A GenServer which when fed a stream of binaries
will split out ZeroMQ frames and return the binary
blob (without parsing into a Command or Message).
"""
use GenServer
@doc """
Starts the splitter.
"""
def start_link do
GenServer.start_link(__MOD... | lib/util/frame_splitter.ex | 0.845113 | 0.542803 | frame_splitter.ex | starcoder |
defmodule Grizzly.ZWave.Commands.MultiChannelEndpointFindReport do
@moduledoc """
This command is used to advertise End Points that implement a given combination of Generic and
Specific Device Classes.
Params:
* `:reports_to_follow` - the number of reports to follow (required)
* `:generic_device_clas... | lib/grizzly/zwave/commands/multi_channel_endpoint_find_report.ex | 0.905348 | 0.436202 | multi_channel_endpoint_find_report.ex | starcoder |
defmodule Solana.SPL.AssociatedToken do
@moduledoc """
Functions for interacting with the [Associated Token Account
Program](https://spl.solana.com/associated-token-account).
An associated token account's address is derived from a user's main system
account and the token mint, which means each user can only ... | lib/solana/spl/associated_token.ex | 0.837836 | 0.475544 | associated_token.ex | starcoder |
defmodule Mix.Deps.Retriever do
@moduledoc false
@doc """
Gets all direct children of the current `Mix.Project`
as a `Mix.Dep` record. Umbrella project dependencies
are included as children.
"""
def children do
to_deps(Mix.project[:deps]) ++ Mix.Deps.Umbrella.children
end
@doc """
Gets all chi... | lib/mix/lib/mix/deps/retriever.ex | 0.703651 | 0.459925 | retriever.ex | starcoder |
defmodule Bencode do
@moduledoc ~S"""
A bencode implementation specified by the BEP 03.
## Examples
iex> Bencode.decode("d4:samplekeyi50ee")
{:error, :string, "keyi50ee"}
iex> Bencode.encode(%{"foobar" => 10, "baz" => [], "bar" => %{}})
"d3:barde3:bazle6:foobari10ee"
"""
@doc """
... | lib/bencode.ex | 0.834879 | 0.412323 | bencode.ex | starcoder |
defmodule OpenTelemetry.Tracer do
@moduledoc """
This module contains macros for Tracer operations around the lifecycle of the Spans within a Trace.
The Tracer is able to start a new Span as a child of the active Span of the current process, set
a different Span to be the current Span by passing the Span's con... | lib/open_telemetry/tracer.ex | 0.810066 | 0.543106 | tracer.ex | starcoder |
defmodule FirestormData.Category do
@moduledoc """
A `Category` is a grouping of related `Thread`s. Categories are modeled as a
Forest of Trees.
"""
defmodule TitleSlug do
@moduledoc """
A configuration for turning category titles into slugs.
"""
use EctoAutoslugField.Slug, from: :title, to:... | apps/firestorm_data/lib/firestorm_data/schema/category.ex | 0.782413 | 0.437523 | category.ex | starcoder |
defmodule Xipper do
@moduledoc """
An Elixir implementation of [Huet's Zipper](https://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/huet-zipper.pdf), with gratitude to <NAME>'s
[Clojure implementation](https://clojure.github.io/clojure/clojure.zip-api.html).
Zippers provide an elegant solution ... | lib/xipper.ex | 0.89662 | 0.709032 | xipper.ex | starcoder |
defmodule Absinthe.Schema.Notation.Scope do
@moduledoc false
@stack :absinthe_notation_scopes
defstruct name: nil, recordings: [], attrs: []
use Absinthe.Type.Fetch
def open(name, mod, attrs \\ []) do
Module.put_attribute(mod, @stack, [%__MODULE__{name: name, attrs: attrs} | on(mod)])
end
def clo... | lib/absinthe/schema/notation/scope.ex | 0.813535 | 0.808257 | scope.ex | starcoder |
defmodule FaktoryWorker.Batch do
@moduledoc """
Supports Faktory Batch operations
[Batch support](https://github.com/contribsys/faktory/wiki/Ent-Batches) is a
Faktory Enterprise feature. It allows jobs to pushed as part of a batch. When
all jobs in a batch have completed, Faktory will queue a callback job. T... | lib/faktory_worker/batch.ex | 0.871023 | 0.850282 | batch.ex | starcoder |
defmodule PromEx.Config do
@moduledoc """
This module defines a struct that contains all of the fields necessary to configure
an instance of PromEx.
While this module does not directly access your Application config, PromEx will call the
`PromEx.Config.build/1` function directly with the contents of `Applica... | lib/prom_ex/config.ex | 0.914343 | 0.711392 | config.ex | starcoder |
defmodule Elixium.Transaction do
alias Elixium.Transaction
alias Elixium.Utilities
alias Elixium.Utxo
@moduledoc """
Contains all the functions that pertain to creating valid transactions
"""
defstruct id: nil,
inputs: [],
outputs: [],
sigs: [],
# Most t... | lib/transaction.ex | 0.853898 | 0.492249 | transaction.ex | starcoder |
defmodule AWS.DocDB do
@moduledoc """
Amazon DocumentDB API documentation
"""
@doc """
Adds metadata tags to an Amazon DocumentDB resource.
You can use these tags with cost allocation reporting to track costs that are
associated with Amazon DocumentDB resources. or in a `Condition` statement in an
AW... | lib/aws/generated/doc_db.ex | 0.888463 | 0.481941 | doc_db.ex | starcoder |
defmodule LavaPotion.Struct.Player do
alias LavaPotion.Struct.Node
defstruct [:node, :guild_id, :session_id, :token, :endpoint, :track, :volume, :is_real, :paused, :raw_timestamp, :raw_position]
def initialize(player = %__MODULE__{node: %Node{address: address}}) do
WebSockex.cast(Node.pid(address), {:voice_... | lib/lavapotion/struct/player.ex | 0.650689 | 0.40157 | player.ex | starcoder |
defmodule Mop8.Bot.Message do
alias Mop8.Bot.Error.InvalidMessageError
@enforce_keys [
:text,
:event_at
]
defstruct [
:text,
:event_at
]
@type t :: %__MODULE__{
text: String.t(),
event_at: DateTime.t()
}
@spec new(String.t(), DateTime.t()) :: t()
def new(t... | lib/mop8/bot/message.ex | 0.776369 | 0.608071 | message.ex | starcoder |
defmodule Kino.Frame do
@moduledoc """
A placeholder for outputs.
A frame wraps outputs that can be dynamically updated at
any time.
Also see `Kino.animate/3` which offers a convenience on
top of this widget.
## Examples
widget = Kino.Frame.new() |> Kino.render()
for i <- 1..100 do
... | lib/kino/frame.ex | 0.878542 | 0.563468 | frame.ex | starcoder |
defprotocol Geocalc.Point do
@moduledoc """
The `Geocalc.Point` protocol is responsible for receiving latitude and
longitude from any Elixir data structure.
At this time it have implementations only for Map, Tuple and List, and Shape
defined inside this project.
Point values can be decimal degrees or DMS ... | lib/geocalc/point.ex | 0.920888 | 0.825238 | point.ex | starcoder |
defmodule OkThen.Result.Enum do
@moduledoc """
Functions for processing tagged tuples inside Enums.
"""
alias OkThen.Result
alias Result.Private
require Private
@doc """
Collects an Enum of results into a single result. If all results were tagged `:ok`, then a
result will be returned tagged with `:o... | lib/ok_then/result/enum.ex | 0.898643 | 0.573738 | enum.ex | starcoder |
defmodule Cortex do
@moduledoc"""
Cortex begins the network - it sends initiatory signals to sensors, receives output - which is relayed to the network - then terminates all nodes.
"""
defstruct id: nil, pid: nil, scape: nil, type: :ffnn
@doc"""
Used to in the genotyping stage. I guess, it's somewhat unim... | lib/cortex.ex | 0.540196 | 0.465934 | cortex.ex | starcoder |
defmodule Appsignal.Utils.MapFilter do
require Logger
@moduledoc """
Helper functions for filtering parameters to prevent sensitive data
to be submitted to AppSignal.
"""
@doc """
Filter parameters based on Appsignal and Phoenix configuration.
"""
def filter_parameters(values), do: filter_values(val... | lib/appsignal/utils/map_filter.ex | 0.72086 | 0.695467 | map_filter.ex | starcoder |
defmodule SMSFactor.AccountManaging do
@moduledoc """
Wrappers around **Account Managing** section of SMSFactor API.
"""
@typedoc """
Params to create account or sub-account.
- `email` **(required)** : The email of the account
- `password` **(required)** : The password must be at least 6 characters long... | lib/sms_factor/account_managing.ex | 0.870432 | 0.843831 | account_managing.ex | starcoder |
defmodule NiceTrie do
@doc ~S"""
Check for a word in the NiceTrie
## Examples
iex> NiceTrie.member?([], "a")
false
iex> NiceTrie.member?([{"a", []}, {"be", []}], "a")
true
iex> NiceTrie.member?([{"a", []}, {"be", []}], "be")
true
iex> NiceTrie.member?([{"be", [{"er"... | lib/nice_trie.ex | 0.538255 | 0.413536 | nice_trie.ex | starcoder |
defmodule Pbuf.Encoder do
import Bitwise, only: [bsr: 2, bsl: 2, bor: 2, band: 2]
defmodule Error do
defexception [:message, :value, :tag, :type]
end
@doc """
Generates a field prefix. This is the tag number + wire type
"""
@spec prefix(pos_integer, atom) :: binary
def prefix(tag, type) do
tag... | lib/pbuf/encoder.ex | 0.751375 | 0.432123 | encoder.ex | starcoder |
defmodule Exnoops.Pathbot do
@moduledoc """
Module to interact with Github's Noop: Pathbot
See the [official `noop` documentation](https://noopschallenge.com/challenges/pathbot) for API information including the accepted parameters.
"""
require Logger
import Exnoops.API
@noop "pathbot"
@doc """
St... | lib/exnoops/pathbot.ex | 0.727298 | 0.522507 | pathbot.ex | starcoder |
defmodule Lab42.SimpleStateMachine.Runner do
use Lab42.SimpleStateMachine.Types
@moduledoc false
@spec run( state_t(), list(), any(), map()) :: any()
def run(state, input, data, states)
def run(_state, [], data, states), do: _end_state(states, data)
def run(:halt, _, data, _), do: data.data
def run(:... | lib/lab42/simple_state_machine/runner.ex | 0.639624 | 0.63341 | runner.ex | starcoder |
defmodule Blockchain.BlockSetter do
@moduledoc """
This module is a utility module that performs setters on a block struct.
"""
alias Block.Header
alias Blockchain.Block
alias Blockchain.BlockGetter
alias Blockchain.Chain
alias MerklePatriciaTree.Trie
alias MerklePatriciaTree.TrieStorage
@doc """
... | apps/blockchain/lib/blockchain/block_setter.ex | 0.816772 | 0.460168 | block_setter.ex | starcoder |
defmodule ResxCSV.Decoder do
@moduledoc """
Decode CSV string resources into erlang terms.
### Media Types
Only CSV/TSV types are valid. This can either be a CSV/TSV subtype or suffix.
Valid: `text/csv`, `application/geo+csv`, `text/tab-separated-values`
If an error is being returne... | lib/resx_csv/decoder.ex | 0.914644 | 0.454956 | decoder.ex | starcoder |
defmodule AWS.EMR do
@moduledoc """
Amazon EMR is a web service that makes it easy to process large amounts of data
efficiently.
Amazon EMR uses Hadoop processing combined with several AWS products to do tasks
such as web indexing, data mining, log file analysis, machine learning,
scientific simulation, a... | lib/aws/generated/emr.ex | 0.878614 | 0.676119 | emr.ex | starcoder |
defmodule InteropProxy.Sanitize do
@moduledoc """
Translates the interop server responses to our own and vise-versa.
"""
# Aliasing the main messages.
alias InteropProxy.Message.Interop.{
Position, AerialPosition, InteropMission, Obstacles, InteropTelem, Odlc,
OdlcList, InteropMessage
}
# Aliasi... | services/interop-proxy/lib/interop_proxy/sanitize.ex | 0.759939 | 0.428712 | sanitize.ex | starcoder |
defmodule PhoenixLiveViewExt.MultiRender do
@moduledoc """
The module provides a @before_compile macro enabling multiple template files per live component or live view.
Each template file gets pre-compiled as a private render/2 function in its live component or live view module.
This in turn enables (conditiona... | lib/multi_render/multi_render.ex | 0.761804 | 0.552781 | multi_render.ex | starcoder |
defmodule PortAudio.StreamError do
defexception [:reason, :message]
end
defmodule PortAudio.Stream do
defstruct [:resource]
@type t :: %PortAudio.Stream{}
@type stream_params :: %{
device: PortAudio.Device.t(),
channel_count: non_neg_integer,
sample_format: PortAudio.Native.samp... | lib/portaudio/stream.ex | 0.666605 | 0.401923 | stream.ex | starcoder |
defmodule PassiveSupport.MapList do
@moduledoc """
\*\* Planned \*\*
**This moduledoc is speculative, meant inform the ideal
working shape of a MapList data structure. It is not yet implemented,
however, and there is no set timetable for completion as of now.**
Functions for interacting with a list of dat... | lib/passive_support/ext/map_list.ex | 0.765155 | 0.6565 | map_list.ex | starcoder |
defmodule Timex.Parse.DateTime.Parsers do
@moduledoc false
alias Timex.Parse.DateTime.Helpers
use Combine
def year4(opts \\ []) do
min_digits =
case Keyword.get(opts, :padding) do
:none ->
1
_ ->
get_in(opts, [:min]) || 1
end
max_digits = get_in(opts, [... | lib/parse/datetime/parsers.ex | 0.762954 | 0.577227 | parsers.ex | starcoder |
defmodule Absinthe.Type.Object do
@moduledoc """
Represents a non-leaf node in a GraphQL tree of information.
Objects represent a list of named fields, each of which yield a value of a
specific type. Object values are serialized as unordered maps, where the
queried field names (or aliases) are the keys and t... | lib/absinthe/type/object.ex | 0.919661 | 0.962988 | object.ex | starcoder |
defmodule CCSP.Chapter3.CSP do
alias CCSP.Chapter3.Constraint
alias __MODULE__, as: T
@moduledoc """
Corresponds to CCSP in Python, Section 3.1, titled "Building a constraint-satisfaction problem framework"
"""
@type t :: __MODULE__.t()
# variable type
@type v :: any
# domain type
@type d :: any
... | lib/ccsp/chapter3/csp.ex | 0.771413 | 0.422475 | csp.ex | starcoder |
defmodule Snake.Scene.Game3 do
use Scenic.Scene
import Scenic.Primitives, only: [rounded_rectangle: 3]
alias Scenic.ViewPort
alias Scenic.Graph
@graph Graph.build(clear_color: :dark_sea_green)
@tile_size 32
@tile_radius 8
@frame_ms 192
def init(_arg, opts) do
viewport = opts[:viewport]
{:... | lib/scenes/current/game3.ex | 0.707607 | 0.4575 | game3.ex | starcoder |
defmodule ArangoXEcto.Edge do
@moduledoc """
Defines an Arango Edge collection as an Ecto Schema Module.
Edge modules are dynamically created in the environment if they don't already exist.
This will define the required fields of an edge (`_from` and `_to`) and will define the default changeset.
Collections... | lib/arangox_ecto/edge.ex | 0.842313 | 0.591458 | edge.ex | starcoder |
defmodule Membrane.MPEG.TS.Demuxer.Parser do
@moduledoc false
# Based on:
# * https://en.wikipedia.org/wiki/MPEG_transport_stream
# * https://en.wikipedia.org/wiki/Packetized_elementary_stream
# * https://en.wikipedia.org/wiki/Program-specific_information
use Bunch
use Membrane.Log
@type mpegts_pid :: ... | lib/membrane_element_mpegts/demuxer/parser.ex | 0.769946 | 0.553505 | parser.ex | starcoder |
defmodule Expline.Matrix do
@moduledoc false
@enforce_keys [:n_rows, :m_cols, :internal]
defstruct [:n_rows, :m_cols, :internal]
@type t() :: %__MODULE__{ n_rows: pos_integer(),
m_cols: pos_integer(),
internal: internal() }
@type vector() :: Expline.V... | lib/expline/matrix.ex | 0.848062 | 0.622832 | matrix.ex | starcoder |
if Code.ensure_loaded?(Plug) do
defmodule Guardian.Plug.VerifyCookie do
@moduledoc """
Looks for and validates a token found in the request cookies.
In the case where:
a. The cookies are not loaded
b. A token is already found for `:key`
This plug will not do anything.
This, like all ot... | lib/guardian/plug/verify_cookie.ex | 0.780955 | 0.563978 | verify_cookie.ex | starcoder |
defmodule AWS.ManagedBlockchain do
@moduledoc """
Amazon Managed Blockchain is a fully managed service for creating and managing
blockchain networks using open-source frameworks.
Blockchain allows you to build applications where multiple parties can securely
and transparently run transactions and share da... | lib/aws/generated/managed_blockchain.ex | 0.79736 | 0.482551 | managed_blockchain.ex | starcoder |
defmodule QRCode.QR do
@moduledoc """
QR code data structure
"""
alias QRCode.ErrorCorrection
@type level() :: :low | :medium | :quartile | :high
@type version() :: 1..40
@type mode() :: :numeric | :alphanumeric | :byte | :kanji | :eci
@type mask_num() :: 0..7
@type groups() :: {[[], ...], [[]]}
@... | lib/qr_code/qr.ex | 0.830147 | 0.684323 | qr.ex | starcoder |
defimpl Timex.Protocol, for: Map do
@moduledoc """
This is an implementation of Timex.Protocol for plain maps,
which allows working directly with deserialized date/times
via the Timex API. It accepts date/time maps with either atom
or string keys, as long as those keys match current Calendar
types. It also ... | deps/timex/lib/datetime/map.ex | 0.778776 | 0.723944 | map.ex | starcoder |
defmodule Grizzly.ZWave.CommandClasses.ThermostatSetpoint do
@moduledoc """
"ThermostatSetpoint" Command Class
The Thermostat Setpoint Command Class is used to configure setpoints for the modes supported by a
thermostat.
What type of commands does this command class support?
"""
@type type ::
... | lib/grizzly/zwave/command_classes/thermostat_setpoint.ex | 0.909281 | 0.44348 | thermostat_setpoint.ex | starcoder |
require Record
defmodule File.Stat do
@moduledoc """
A struct that holds file information.
In Erlang, this struct is represented by a `:file_info` record.
Therefore this module also provides functions for converting
between the Erlang record and the Elixir struct.
Its fields are:
* `size` - size of ... | lib/elixir/lib/file/stat.ex | 0.790409 | 0.669698 | stat.ex | starcoder |
defmodule ExAlipay.Client do
@moduledoc """
ExAlipay Client that export API and perform request to alipay backend.
This module defined some common used api and you can easily add new api:
* `page_pay` - alipay.trade.page.pay
* `wap_pay` - alipay.trade.wap.pay
* `app_pay` - alipay.trade.app.pay
* ... | lib/client.ex | 0.868283 | 0.655873 | client.ex | starcoder |
defmodule Representer do
@moduledoc """
Implementation of the Representer pattern for the API
"""
defguard known_extension?(extension) when extension in [
"json",
"collection",
"hal",
"mason",
"siren"
]
defmodule Collection do
@moduledoc """
Struct for a collection of `Represen... | lib/representer.ex | 0.855429 | 0.521837 | representer.ex | starcoder |
defmodule Cldr.Date.Interval.Backend do
@moduledoc false
def define_date_interval_module(config) do
backend = config.backend
config = Macro.escape(config)
quote location: :keep, bind_quoted: [config: config, backend: backend] do
defmodule Date.Interval do
@moduledoc """
Interval ... | lib/cldr/backend/interval/date.ex | 0.912896 | 0.580679 | date.ex | starcoder |
defmodule Akin.Metaphone.Single do
@moduledoc """
Calculates the [Metaphone Phonetic Algorithm](http://en.wikipedia.org/wiki/
Metaphone) of a string.
"""
import String, only: [downcase: 1, first: 1, split_at: 2, last: 1, at: 2]
import Akin.Util, only: [len: 1, is_alphabetic?: 1, deduplicate: 1]
@doc """... | lib/akin/algorithms/phonetic/metaphone.ex | 0.750187 | 0.602939 | metaphone.ex | starcoder |
defmodule ExAliyunOts.PlainBuffer do
@moduledoc false
@header 0x75
# tag type
@tag_row_pk 0x1
@tag_row_data 0x2
@tag_cell 0x3
@tag_cell_name 0x4
@tag_cell_value 0x5
@tag_cell_type 0x6
@tag_cell_timestamp 0x7
@tag_delete_row_marker 0x8
@tag_row_checksum 0x9
@tag_cell_checksum 0x0A
# cell o... | lib/ex_aliyun_ots/plainbuffer/plainbuffer.ex | 0.50293 | 0.407451 | plainbuffer.ex | starcoder |
defmodule Commanded.Aggregates.AggregateStateBuilder do
alias Commanded.Aggregates.Aggregate
alias Commanded.EventStore
alias Commanded.EventStore.RecordedEvent
alias Commanded.EventStore.SnapshotData
alias Commanded.Snapshotting
@read_event_batch_size 100
@doc """
Populate the aggregate's state from... | lib/commanded/aggregates/aggregate_state_builder.ex | 0.747432 | 0.440349 | aggregate_state_builder.ex | starcoder |
defmodule Transformers.Concatenation do
@behaviour Transformation
alias Transformers.FieldFetcher
@impl Transformation
def transform(payload, parameters) do
with {:ok, [source_fields, separator, target_field]} <- validate(parameters),
{:ok, values} <- fetch_values(payload, source_fields),
... | apps/transformers/lib/transformations/concatenation.ex | 0.706798 | 0.441854 | concatenation.ex | starcoder |
defmodule ExVenture.Rooms.Room do
@moduledoc """
Schema for Rooms
"""
use Ecto.Schema
import Ecto.Changeset
alias ExVenture.Rooms
alias ExVenture.StagedChanges.StagedChange
alias ExVenture.Zones.Zone
@map_colors ["blue", "brown", "green", "yellow"]
def map_colors(), do: @map_colors
schema "r... | lib/ex_venture/rooms.ex | 0.693784 | 0.436022 | rooms.ex | starcoder |
defmodule RiakEcto3 do
@default_hostname "localhost"
@default_port 8087
@moduledoc """
Riak KV 2.0 adapter for Ecto 3.
Works by mapping Ecto Schemas to Riak Map-CRDTs.
**NOTE:** To use, ensure the following has been executed on your Riak database:
riak-admin bucket-type create your_database_name '{... | lib/riak_ecto3.ex | 0.792825 | 0.422147 | riak_ecto3.ex | starcoder |
defmodule Plaid.Income do
@moduledoc """
Functions for Plaid `income` endpoint.
"""
import Plaid, only: [make_request_with_cred: 4, get_cred: 0]
alias Plaid.Utils
@derive Jason.Encoder
defstruct item: nil, income: nil, request_id: nil
@type t :: %__MODULE__{
item: Plaid.Item.t(),
... | lib/plaid/income.ex | 0.794385 | 0.616272 | income.ex | starcoder |
defmodule Ipfinder do
use HTTPotion.Base
alias Ipfinder.Validation.Asnvalidation
alias Ipfinder.Validation.Domainvalidation
alias Ipfinder.Validation.Firewallvalidation
alias Ipfinder.Validation.Firewallvalidation
alias Ipfinder.Validation.Ipvalidation
# alias Ipfinder.Validation.Tokenvalidation
@modul... | lib/ipfinder.ex | 0.837188 | 0.557243 | ipfinder.ex | starcoder |
defmodule Segment.Analytics do
@moduledoc """
The `Segment.Analytics` module is the easiest way to send Segment events and provides convenience methods for `track`, `identify,` `screen`, `alias`, `group`, and `page` calls
The functions will then delegate the call to the configured service implementation whic... | lib/segment/analytics.ex | 0.892966 | 0.843766 | analytics.ex | starcoder |
defmodule RFC3986.Normalize do
@moduledoc """
Normalices a captured URI. Don't use this directly, it will be called after
matching an input.
Copyright 2015 <NAME> <<EMAIL>>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the L... | lib/ex_rfc3986/normalize.ex | 0.76908 | 0.453625 | normalize.ex | starcoder |
defmodule Ecto.Model.Dependent do
@moduledoc """
Defines callbacks for handling dependencies (associations).
Such callbacks are typically declared via the `has_many/3` macro
in your model's `schema` block. For example:
has_many :comments, MyApp.Comment, on_delete: :fetch_and_delete
## `:on_delete` op... | lib/ecto/model/dependent.ex | 0.865437 | 0.528777 | dependent.ex | starcoder |
defmodule JSONDiff do
@moduledoc ~S"""
JSONDiff is an Elixir implementation of the diffing element of the JSON Patch format,
described in [RFC 6902](http://tools.ietf.org/html/rfc6902).
This library only handles diffing. For patching, see the wonderful [JSONPatch library](https://github.com/gamache/json_patch_... | lib/json_diff.ex | 0.753648 | 0.577227 | json_diff.ex | starcoder |
defmodule Safira.Contest do
import Ecto.Query, warn: false
alias Safira.Repo
alias Safira.Contest.Redeem
alias Safira.Contest.Badge
alias Safira.Interaction
alias Ecto.Multi
alias Safira.Contest.DailyToken
def list_badges do
Repo.all(Badge)
end
def list_secret do
Repo.all(from r in Redeem... | lib/safira/contest/contest.ex | 0.519278 | 0.449272 | contest.ex | starcoder |
defmodule Ockam.Session.Pluggable.Responder do
@moduledoc """
Routing session responder
If :init_message is present in the options - processes the message,
otherwise waits for it in :handshake stage
On processing the handshake calls `handshake.handle_responder/1`, which
generates handshake response messag... | implementations/elixir/ockam/ockam/lib/ockam/session/pluggable/responder.ex | 0.691393 | 0.460653 | responder.ex | starcoder |
defmodule Tesla.Middleware.TimberLogger do
@moduledoc """
Tesla middleware for logging outgoing requests to Timber.io.
Using this middleware will log all requests and responses using Timber.io formatting and metadata.
### Example usage
```
defmodule MyClient do
use Tesla
plug Tesla.Middleware.Timb... | lib/tesla_timber_logger.ex | 0.901784 | 0.731514 | tesla_timber_logger.ex | starcoder |
defmodule ExSenml do
@moduledoc """
Toolset to Normalize SenML and other promises
SenML is an open ietf standard that defines a format for representing simple sensor
measurements and device parameters in Sensor Measurement Lists (SenML)
You can find the spec: https://tools.ietf.org/html/rfc8428
Becomin... | lib/ex_senml.ex | 0.616359 | 0.643476 | ex_senml.ex | starcoder |
defmodule Concentrate.Encoder.VehiclePositionsEnhanced do
@moduledoc """
Encodes a list of parsed data into a VehiclePositions.pb file.
"""
@behaviour Concentrate.Encoder
alias Concentrate.{TripDescriptor, VehiclePosition}
alias VehiclePosition.Consist, as: VehiclePositionConsist
import Concentrate.Encode... | lib/concentrate/encoder/vehicle_positions_enhanced.ex | 0.721841 | 0.498169 | vehicle_positions_enhanced.ex | starcoder |
defmodule AWS.IoTThingsGraph do
@moduledoc """
AWS IoT Things Graph
AWS IoT Things Graph provides an integrated set of tools that enable
developers to connect devices and services that use different standards,
such as units of measure and communication protocols. AWS IoT Things Graph
makes it possible to ... | lib/aws/iot_things_graph.ex | 0.841207 | 0.654812 | iot_things_graph.ex | starcoder |
defmodule Calendar do
@moduledoc """
This module defines the responsibilities for working with
calendars, dates, times and datetimes in Elixir.
Currently it defines types but may define the calendar
behaviour in future versions. For the actual date, time
and datetime structures, see `Date`, `Time`, `NaiveD... | lib/elixir/lib/calendar.ex | 0.763263 | 0.583085 | calendar.ex | starcoder |
defmodule IBMSpeechToText.Client do
@moduledoc """
A client process responsible for communication with Speech to Text API
"""
use GenServer
alias IBMSpeechToText.{Token, Util, Response}
alias IBMSpeechToText.Message.{Start, Stop}
@endpoint_path "/speech-to-text/api/v1/recognize"
@doc """
Starts a cl... | lib/ibm_speech_to_text/client.ex | 0.872252 | 0.548734 | client.ex | starcoder |
defmodule Glitchylicious do
@moduledoc """
Produces magnificent glitches,
by corrupting some jpg bytes.
Pretty much stolen from: georg @ http://fishnation.de/
Take a look at his js experiments, cool stuff!
Example:
alias Glitchylicious, as: G
def glitch do
G.glitch("./myimage.jpg"... | lib/glitchylicious.ex | 0.7011 | 0.471345 | glitchylicious.ex | starcoder |
defmodule MatrexNumerix.LinearAlgebra do
@moduledoc """
Linear algebra functions used for vector operations,
matrix factorization and matrix transformation.
"""
import Matrex
alias MatrexNumerix.Math
@doc """
The L1 norm of a vector, also known as Manhattan norm.
"""
@spec l1_norm(Common.maybe_ve... | lib/linear_algebra.ex | 0.838481 | 0.742748 | linear_algebra.ex | starcoder |
defmodule Timedot.IR do
@moduledoc """
Intermediate representation of a timedot file.
Result of parsing a file and can be serialized again in a consistent manner.
"""
@type t :: list(line_like())
@type line_like :: comment() | day()
@type comment :: {:comment, String.t()}
@type day ::
{:comme... | lib/timedot/i_r.ex | 0.820901 | 0.529689 | i_r.ex | starcoder |
defmodule RatError.Structure do
@moduledoc """
Specifies the Map structure of a RAT error.
This struct could be created from the specified options as below,
[
node: :error,
keys: %{
code: :code,
message: :message
}
]
References the 'RatError.Structure' configuration in 'config/*.e... | lib/rat_error/structure.ex | 0.854278 | 0.461866 | structure.ex | starcoder |
defmodule ElixirApiai.Query do
@moduledoc """
Query API wrapper [Api.ai Query](https://api.ai/docs/reference/agent/query)
"""
import ElixirApiai.Utils.Api
@doc """
Makes a `query` request to Api.ai
This method uses `POST /query` API method with JSON payload.
All parameters except `query` and `session... | lib/elixir_apiai/query.ex | 0.803444 | 0.690911 | query.ex | starcoder |
defmodule MailAddress do
@moduledoc """
Functions to handle RFC5321 Mail Addresses.
The library implements functions for handling email addresses as specified
mostly by RFC5321. A large chunk of the address syntax is implemented, with
a few exceptions:
* Handling of general address literals in domains... | lib/mail_address.ex | 0.889828 | 0.823009 | mail_address.ex | starcoder |
defmodule AdventOfCode.Day1 do
@input "R5, L2, L1, R1, R3, R3, L3, R3, R4, L2, R4, L4, R4, R3, L2, L1, L1, R2, R4, R4, L4, R3, L2, R1, L4, R1, R3, L5, L4, L5, R3, L3, L1, L1, R4, R2, R2, L1, L4, R191, R5, L2, R46, R3, L1, R74, L2, R2, R187, R3, R4, R1, L4, L4, L2, R4, L5, R4, R3, L2, L1, R3, R3, R3, R1, R1, L4, R4, ... | lib/advent_of_code/day1.ex | 0.582372 | 0.796292 | day1.ex | starcoder |
defmodule Hedwig.Robot do
@moduledoc """
Defines a robot.
Robots receive messages from a chat source (XMPP, Slack, Console, etc), and
dispatch them to matching responders. See the documentation for
`Hedwig.Responder` for details on responders.
When used, the robot expects the `:otp_app` as option. The `:o... | lib/hedwig/robot.ex | 0.836655 | 0.500549 | robot.ex | starcoder |
defmodule AWS.MarketplaceCommerceAnalytics do
@moduledoc """
Provides AWS Marketplace business intelligence data on-demand.
"""
@doc """
Given a data set type and data set publication date, asynchronously publishes
the requested data set to the specified S3 bucket and notifies the specified SNS
topic on... | lib/aws/generated/marketplace_commerce_analytics.ex | 0.833528 | 0.475971 | marketplace_commerce_analytics.ex | starcoder |
defmodule Yatzy.Sheet do
alias Yatzy.Roll
alias Yatzy.Scoring
alias Yatzy.Scoring.Score
@moduledoc """
Operations on a sheets used to keep track of player's
score
"""
@upper_section [:ones, :twos, :threes, :fours, :fives, :sixes]
@lower_section [
:one_pair,
:two_pairs,
:three_of_a_kind,
... | lib/yatzy/sheet.ex | 0.827131 | 0.433082 | sheet.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 De... | lib/aws/kms.ex | 0.890187 | 0.546859 | kms.ex | starcoder |
defmodule MlDHT do
@moduledoc ~S"""
Multinode - MlDHT is an Elixir package based off <NAME>'s mainline DHT package.
It allows creation of multiple DHT nodes for DHT indexing.
Number of DHT nodes defaults to 1, and can be set in config/config.exs like so:
```
config :mldht,
num_nodes: 2
```
"""
... | lib/mldht.ex | 0.768993 | 0.807802 | mldht.ex | starcoder |
defmodule GenTimer do
@moduledoc """
Extends GenServer to give a timer functionality.
There is a small folder of examples in this repo to guide you.
## Callbacks
Supports the same callbacks as `GenServer`. The only considerations are:
### There Is Required State For `init/1`
The state returned by `c:G... | lib/gen_timer.ex | 0.82741 | 0.567158 | gen_timer.ex | starcoder |
defmodule CPF do
@moduledoc """
CPF module that provides functions to verify if a CPF is valid.
"""
unless Version.match?(System.version(), ">= 1.7.0") do
IO.warn("""
You're running an old Elixir version. CPF will soon support Elixir versions
above 1.7.0.
""")
end
defstruct [:digits]
de... | lib/cpf/cpf.ex | 0.924726 | 0.459682 | cpf.ex | starcoder |
defmodule BbbLti.Validator do
@moduledoc """
Module to handle incoming HTTP requests from LTI Providers
Based on https://github.com/DefactoSoftware/lti
"""
@required_oauth_parameters [
"oauth_consumer_key",
"oauth_signature_method",
"oauth_timestamp",
"oauth_nonce",
"oauth_version"
]
... | lib/bbb_lti/validator.ex | 0.790004 | 0.42176 | validator.ex | starcoder |
defmodule ExAws.Boto.Shape.Structure do
@moduledoc false
defstruct [:name, :module, :required, :members, :documentation, :metadata]
end
defmodule ExAws.Boto.Shape.List do
@moduledoc false
defstruct [:name, :module, :member_name, :member, :documentation, :metadata, min: nil, max: nil]
end
defmodule ExAws.Boto.... | lib/ex_aws/boto/shape.ex | 0.550124 | 0.517388 | shape.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.