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 Curve25519 do
import Bitwise
@moduledoc """
Curve25519 Diffie-Hellman functions
"""
@typedoc """
public or secret key
"""
@type key :: binary
@p 57_896_044_618_658_097_711_785_492_504_343_953_926_634_992_332_820_282_019_728_792_003_956_564_819_949
@a 486_662
defp clamp(c) do
c
... | lib/curve25519.ex | 0.839339 | 0.452294 | curve25519.ex | starcoder |
defmodule Exred.Node.GrpcTwin do
@moduledoc """
Represents an external node that connects to Exred via gRPC.
It needs the gRPC Daemon Node running in the flow.
External nodes can connect to Exred using the gRPC protocol.
The external client needs to implement the exredrpc protocol
(see the exredrpc.proto f... | lib/exred_node_grpc_twin.ex | 0.666931 | 0.469095 | exred_node_grpc_twin.ex | starcoder |
defmodule GroupManager do
@moduledoc """
`GroupManager` is the top level wrapper over the group management
services provided by other modules:
- `Chatter` is responsible for network communication
- `Chatter.PeerDB` is a wrapper over the Chatter's knowledge about peers, stored in ETS
- `GroupManager.Topolo... | lib/group_manager.ex | 0.866909 | 0.517388 | group_manager.ex | starcoder |
defmodule Benchee.Conversion.Count do
@moduledoc """
Unit scaling for counts, such that 1000000 can be converted to 1 Million.
Only benchee plugins should use this code.
"""
alias Benchee.Conversion.{Format, Scale, Unit}
@behaviour Scale
@behaviour Format
@one_billion 1_000_000_000
@one_million 1_... | lib/benchee/conversion/count.ex | 0.881946 | 0.634345 | count.ex | starcoder |
defmodule Quark.FixedPoint do
@moduledoc ~S"""
Fixed point combinators generalize the idea of a recursive function. This can
be used to great effect, simplifying many definitions.
For example, here is the factorial function written in terms of `y/1`:
iex> fac = fn fac ->
...> fn
...> 0... | lib/quark/fixed_point.ex | 0.853134 | 0.592283 | fixed_point.ex | starcoder |
defmodule Ockam.Bare.Union do
@moduledoc """
Extension for BARE schema
Support simple tags for union types,
Union type can be defined as [type1: schema, type2: schema]
and can be encoded and decoded from/to {:type1, data} or {:type2, data}
"""
@type schema() :: :bare.spec()
@type extended_schema() ::... | implementations/elixir/ockam/ockam/lib/ockam/protocol/bare_extended.ex | 0.637595 | 0.540439 | bare_extended.ex | starcoder |
defmodule Graphvix.Subgraph do
@moduledoc """
[Internal] Models a subgraph or cluster for inclusion in a graph.
The functions included in this module are for internal use only. See
* `Graphvix.Graph.add_subgraph/3`
* `Graphvix.Graph.add_cluster/3`
for the public interface for creating and including subgr... | lib/graphvix/subgraph.ex | 0.750873 | 0.490358 | subgraph.ex | starcoder |
import TypeClass
defclass Witchcraft.Extend do
@moduledoc """
`Extend` is essentially "co`Chain`", meaning that it reverses the relationships
in `Chain`.
Instead of a flattening operation, we have `nest` which wraps the data in
an additional layer of itsef.
Instead of a `chain`ing function that acts on r... | lib/witchcraft/extend.ex | 0.834272 | 0.604107 | extend.ex | starcoder |
defmodule ShittyLinqEx do
@moduledoc """
Documentation for `ShittyLinqEx`.
"""
@doc """
Inverts the order of the elements in a sequence.
## Parameters
- `list`: A sequence of values to reverse.
## Returns
A sequence whose elements correspond to those of the input sequence in reverse order.
## E... | lib/shitty_linq_ex.ex | 0.820793 | 0.669348 | shitty_linq_ex.ex | starcoder |
defmodule Owl.Data do
@moduledoc """
A set of functions for `t:iodata/0` with tags.
"""
@typedoc """
A recursive data type that is similar to `t:iodata/0`, but additionally supports `t:Owl.Tag.t/1`.
Can be written to stdout using `Owl.IO.puts/2`.
"""
# improper lists are not here, just because they w... | lib/owl/data.ex | 0.894784 | 0.633439 | data.ex | starcoder |
defmodule Specter.PeerConnection do
@moduledoc """
Represents an RTCPeerConnection managed in the NIF. A running Specter instance may
have 0 or more peer connections at any time.
Users of Specter might choose between different topologies based on their use cases:
a Specter might be initialized per connection... | lib/specter/peer_connection.ex | 0.922032 | 0.601535 | peer_connection.ex | starcoder |
defmodule Alchemy.User do
@moduledoc """
This module contains functions and types related to discord users.
"""
alias Alchemy.UserGuild
use Alchemy.Discord.Types
@typedoc """
Represents a discord User. The default values exist to cover missing fields.
- `id`
represents a unique user id
- `userna... | lib/Structs/Users/user.ex | 0.845033 | 0.716119 | user.ex | starcoder |
defmodule Massex do
@moduledoc """
Defines a whole value pattern container for masses, and utility methods for
working with them to improve handling within your applications.
"""
@gram_to_ounce_rate Decimal.from_float(28.3495)
@zero Decimal.new(0)
@enforce_keys [:unit, :amount]
defstruct [:unit, :amou... | lib/massex.ex | 0.95253 | 0.757077 | massex.ex | starcoder |
defmodule Day10.ParseResult.TargetAddress do
@moduledoc """
`%TargetAddress{}` describes the type and identifier of a target node
in the system.
"""
alias __MODULE__
@type target_identifier() :: String.t()
@type target_type() :: :bot | :output
@type t :: %__MODULE__{identifier: target_identifier(), typ... | advent-of-code-2016/day_10/lib/parser.ex | 0.87787 | 0.430925 | parser.ex | starcoder |
defmodule Joken.Hooks do
@moduledoc """
Behaviour for defining hooks into Joken's lifecycle.
Hooks are passed to `Joken` functions or added to `Joken.Config` through the
`Joken.Config.add_hook/2` macro. They can change the execution flow of a token configuration.
There are 2 kinds of hooks: before and after... | lib/joken/hooks.ex | 0.903805 | 0.689433 | hooks.ex | starcoder |
defmodule OffBroadwayRedisStream.Producer do
@moduledoc """
A GenStage Producer for Redis Stream.
It acts as a consumer in the specified Redis consumer group. Introduction to Redis Stream can be found at: https://redis.io/topics/streams-intro.
Support failover by automatically claiming pending messages of a d... | lib/producer.ex | 0.897302 | 0.802594 | producer.ex | starcoder |
defmodule ElasticsearchElixirBulkProcessor.Helpers.BulkResponse do
@doc ~S"""
Given a list of items from a bulk response and the data sent as a list of requests return the items that match the error.
## Examples
iex> items = [%{"index" => %{}}, %{"update" => %{"error" => %{}}}, %{"create" => %{}}, %{"delet... | lib/elasticsearch_elixir_bulk_processor/helpers/bulk_response.ex | 0.636918 | 0.523116 | bulk_response.ex | starcoder |
defmodule Machinist do
@moduledoc """
`Machinist` is a small library that allows you to implement finite state machines
in a simple way. It provides a simple DSL to write combinations of
transitions based on events.
A good example is how we would implement the functioning of a door. With `machinist` would be... | lib/machinist.ex | 0.802246 | 0.740292 | machinist.ex | starcoder |
defmodule Mix.Tasks.Repeatex.Readme do
use Mix.Task
require EEx
@readme_eex "README.eex.md"
@readme "README.md"
@shortdoc "Generate internal README from current code state"
@examples [
"every other day",
"every other monday",
"each tues",
"mon-sat every week",
"every 3rd of the mo... | lib/tasks/readme.ex | 0.621885 | 0.67392 | readme.ex | starcoder |
defmodule ExlasticSearch.Repo do
@moduledoc """
API executor for elasticsearch. The generate pattern is to define a `ExlasticSearch.Model`
on an ecto model, then call any of these functions to manage the model.
To configure the url the repo points to, do:
```
config :exlasticsearch, ExlasticSearch.Repo,
... | lib/exlasticsearch/repo.ex | 0.839865 | 0.73954 | repo.ex | starcoder |
defmodule SimpleMarkdownExtensionBlueprint do
@moduledoc """
Adds syntax for issuing a blueprint command and embedding
the resulting SVG.
The command takes the form of `@blueprint[]` or `@blueprint()`.
Where inside the brackets are the arguments that can be
passed to a `blueprint` esc... | lib/simple_markdown_extension_blueprint.ex | 0.864754 | 0.528047 | simple_markdown_extension_blueprint.ex | starcoder |
defmodule Rondo.Tree do
defstruct [:descriptor, :root, :children, :actions]
alias Rondo.Path
alias Rondo.Component.Pointer
alias Rondo.Store.Reference
def init(nil, descriptor, component_path, state, store) do
tree = %__MODULE__{children: %{}, actions: MapSet.new()}
init(tree, descriptor, component_... | lib/rondo/tree.ex | 0.675872 | 0.567967 | tree.ex | starcoder |
defmodule AWS.RUM do
@moduledoc """
With Amazon CloudWatch RUM, you can perform real-user monitoring to collect
client-side data about your web application performance from actual user
sessions in real time.
The data collected includes page load times, client-side errors, and user
behavior. When you view ... | lib/aws/generated/rum.ex | 0.788176 | 0.450118 | rum.ex | starcoder |
defmodule ICouch.Changes do
@moduledoc """
Module to handle changes feeds in CouchDB.
Changes structs should not be created or manipulated directly, please use
`ICouch.open_changes/2`.
Similar to a view, a changes feed can be in a "fetched" state or in an
"unfetched" state which can be tested with the `f... | lib/icouch/changes.ex | 0.864253 | 0.469155 | changes.ex | starcoder |
defmodule LevelWeb.Schema.InputObjects do
@moduledoc false
use Absinthe.Schema.Notation
@desc "The field and direction to sort users."
input_object :user_order do
@desc "The field by which to sort."
field :field, non_null(:user_order_field)
@desc "The sort direction."
field :direction, non_nu... | lib/level_web/schema/input_objects.ex | 0.811601 | 0.47859 | input_objects.ex | starcoder |
defmodule Easing do
@moduledoc """
Easing function calculations
Cribbed from: https://easings.net/
"""
alias Easing.Range
@type easing_tuple :: {atom(), atom()}
@type range :: %Easing.Range{first: number(), last: number(), step: number()}
@type easing_function :: function()
@type easing_function_or... | lib/easing.ex | 0.917626 | 0.502441 | easing.ex | starcoder |
defmodule CSV.Decoding.Preprocessing.Lines do
use CSV.Defaults
@moduledoc ~S"""
The CSV lines preprocessor 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 separator.
## Options
Options g... | lib/csv/decoding/preprocessing/lines.ex | 0.800107 | 0.485112 | lines.ex | starcoder |
defmodule Stargate.Producer do
@moduledoc """
Provides a producer websocket process and functions for producing
messages to the cluster.
Pass a keyword list of configuration options to the `start_link/1`
function or simply call `produce/2` passing a valid
Pulsar producer URL in place of a producer process.... | lib/stargate/producer.ex | 0.856812 | 0.461138 | producer.ex | starcoder |
defmodule Roll35Core.Data.Agent do
@moduledoc """
A general interface for our various data agents.
Each agent represents one data table and provides functions to roll
against that table.
Individual agents are expected to `use Roll35Core.Data.Agent` as well
as defining the expected callbacks.
The implem... | apps/roll35_core/lib/roll35_core/data/agent.ex | 0.885724 | 0.401512 | agent.ex | starcoder |
defmodule Ecto.ReplaceableString do
@moduledoc """
A custom type that replace some terms for strings.
`#{inspect(__MODULE__)}` can be used when you want to replace some terms on dump/load
a field, or even both included, for example:
Before a field persisted to the database, `#{inspect(__MODULE__)}` replaces... | lib/ecto/replaceable_string.ex | 0.85318 | 0.470189 | replaceable_string.ex | starcoder |
defmodule FishermanServer.Utils do
@moduledoc """
Utils provides module-agnostic convenience functions
"""
@datetime_defaults [
year: 0,
month: 1,
day: 1,
zone_abbr: "EST",
hour: 0,
minute: 0,
second: 0,
microsecond: {0, 0},
utc_offset: 0,
std_offset: 0,
time_zone: "E... | fisherman_server/lib/fisherman_server/utils.ex | 0.823541 | 0.570451 | utils.ex | starcoder |
defmodule Kino.SmartCell do
@moduledoc ~S'''
An interface for defining custom smart cells.
A smart cell is a UI wizard designed for producing a piece of code
that accomplishes a specific task. In other words, a smart cell is
like a code template parameterized through UI interactions.
This module builds on... | lib/kino/smart_cell.ex | 0.907303 | 0.563498 | smart_cell.ex | starcoder |
defmodule SieveOfEratosthenes do
@moduledoc """
Implements Sieve of Eratosthenes algorithm for finding all prime numbers up to the given limit.
Uses Elixir Map to store the list of odd integers for sieving.
Taken from: https://github.com/ybod/elixir_primes
"""
alias Helper.Sequence
@doc """
Returns th... | elixir/plug-cowboy/lib/plug_cowboy_app/utils/eratostenes.ex | 0.854156 | 0.559591 | eratostenes.ex | starcoder |
defmodule Dayron.Adapter do
@moduledoc ~S"""
Behaviour for creating Dayron Adapters
Adapters are wrappers around client libraries, responsible to send HTTP
requests and parse the response status and body.
## Example
defmodule Dayron.CustomAdapter do
@behaviour Dayron.Adapter
def get(... | lib/dayron/adapter.ex | 0.953416 | 0.576125 | adapter.ex | starcoder |
defmodule Discovergy.Measurements do
@moduledoc """
The Measurements endpoint
"""
use Discovergy
alias Discovergy.Measurement
@doc """
Return the measurements for the specified meter in the specified time interval.
## Options
* `:fields` - list of measurement fields to return in the result (use... | lib/discovergy/measurements.ex | 0.951369 | 0.687827 | measurements.ex | starcoder |
defmodule Magic do
@moduledoc """
The `Magic` module provides convenience [sigil](https://elixir-lang.org/getting-started/sigils.html) wrapper for Port cmd
"""
@doc """
The macros catch all error and exception,
transform them to normal output
Note: There are may have some performance issues
## Exampl... | lib/magic.ex | 0.75037 | 0.431824 | magic.ex | starcoder |
defmodule Tournament do
defmodule Tally do
alias __MODULE__, as: Tally
defstruct draws: 0, losses: 0, wins: 0
@draw_points 1
@win_points 3
def init_wins, do: %Tally{wins: 1}
def init_losses, do: %Tally{losses: 1}
def init_draws, do: %Tally{draws: 1}
def wins(%Tally{wins: wins}), do... | elixir/tournament/lib/tournament.ex | 0.756088 | 0.663328 | tournament.ex | starcoder |
defmodule Arrow.Array do
defstruct [:reference]
alias Arrow.Conversion
alias Arrow.Native
@behaviour Access
@type t :: %Arrow.Array{}
@spec sum(t()) :: number() | nil
def sum(%Arrow.Array{} = array) do
Native.array_sum(array)
end
@spec min(t()) :: number() | nil
def min(%Arrow.Array{} = arr... | lib/arrow/array.ex | 0.841403 | 0.586316 | array.ex | starcoder |
defmodule Univrse.Alg.ECDH_AES do
@moduledoc """
ECDH_AES algorithm module.
Implements ECDH-ES+AES_GCM encryption and decryption.
https://tools.ietf.org/html/rfc7518#section-4.6
"""
alias Univrse.Key
alias Univrse.Alg.AES_GCM
@doc """
Decrypts the cyphertext with the key using the specified algorit... | lib/univrse/alg/ecdh_aes.ex | 0.696475 | 0.401072 | ecdh_aes.ex | starcoder |
defmodule Imagineer.Image.PNG.Palette do
alias Imagineer.Image.PNG
@moduledoc """
Packing and unpacking palettes.
PNGs can optionally store all colors that they
use in a palette, then have their pixels simply reference one of those colors
instead of encoding them all individually.
Sometimes this can re... | lib/imagineer/image/png/palette.ex | 0.837121 | 0.639835 | palette.ex | starcoder |
defmodule Timex.Date do
@moduledoc """
Module for working with dates.
Functions that produce time intervals use UNIX epoch (or simly Epoch) as the
default reference date. Epoch is defined as UTC midnight of January 1, 1970.
Time intervals in this module don't account for leap seconds.
Supported tasks:
... | lib/date/date.ex | 0.915646 | 0.577257 | date.ex | starcoder |
defmodule Membrane.Demo.SimpleElement.Counter do
@moduledoc """
Membrane element counting incoming buffers.
Count of buffers divided by `divisor` (passed via `:input` pad options)
is sent as a `{:counter, number}` notification once every `interval`
(passed via element options).
"""
use Membrane.Filter
... | simple_element/lib/membrane_demo/simple_element/counter.ex | 0.885049 | 0.548432 | counter.ex | starcoder |
defmodule Conrex.ContourBuilder do
@moduledoc false
@typep point :: {number, number}
@typep segment :: {point, point}
@typep sequence :: [point] # list of connected points
@typep sequence_list :: [sequence] # collection of disconnected sequences
@spec build_rings([segment]) :: sequence_list
def build_ri... | lib/conrex/contour_builder.ex | 0.827932 | 0.628977 | contour_builder.ex | starcoder |
defmodule SMPPEX.ESME.Sync do
@moduledoc """
`SMPPEX.ESME.Sync` is an implementation of `SMPPEX.ESME`. It allows to send PDUs
to SMSCs in a syncronous way, i.e. blocking till the response PDU comes.
`SMPPEX.ESME.Sync` is an `SMPPEX.ESME`, so one can use with `SMPPEX.ESME.Sync` all
methods provided by `SMPPEX... | lib/smppex/esme/sync.ex | 0.70619 | 0.453383 | sync.ex | starcoder |
defmodule Q do
@moduledoc """
Documentation for `Q`.
"""
alias __MODULE__
defstruct operations: [], names: MapSet.new()
@type changes :: map
@type run :: (changes -> {:ok | :error, any}) | {module, atom, [any]}
@typep operation :: {:run, run} | {:put, any} | {:inspect, Keyword.t()}
@typep operations ... | lib/q.ex | 0.86337 | 0.486454 | q.ex | starcoder |
defmodule DealerScrapingRobot do
@moduledoc """
Gets the ***"overly positive reviews"*** of the informed dealer and by default returns the first three results from the five first review pages.
"""
@default_pages 5
@default_count 3
@doc """
Main function that scrapes the overly positive reviews from a de... | lib/dealer_scraping_robot.ex | 0.722233 | 0.448426 | dealer_scraping_robot.ex | starcoder |
defmodule Day20 do
@moduledoc """
Documentation for Day20.
"""
def part1 do
Day20.read_input("input.txt")
|> Day20.derive_all_edges()
|> Day20.pair_up()
|> Day20.tile_connections()
|> Day20.corners()
|> Day20.multiply()
|> IO.puts()
end
def read_input(filename) do
File.stre... | day20/lib/day20.ex | 0.663015 | 0.510069 | day20.ex | starcoder |
defmodule Txpost.Payload do
@moduledoc """
Request payload module, implements BRFC `c9a2975b3d19` ([CBOR Tx Payload](cbor-tx-payload.md)).
BRFC `c9a2975b3d19` defines a simple structure for encoding a raw Bitcoin transaction
alongside arbitrary data attributes and meta data in a CBOR encoded binary.
The `:d... | lib/txpost/payload.ex | 0.901442 | 0.524577 | payload.ex | starcoder |
defmodule Day7 do
@moduledoc """
Documentation for Day7.
"""
@doc """
Read the puzzle input.
Returns a list of maps of the form %{"lhs" => lhs, "rhs" => rhs, "weight" => weight}
One such map per line in input file
"""
def read_input(source) do
source
|> File.stream!
|> Enum.map(fn line ->... | 2017/day_07/elixir/lib/day7.ex | 0.828384 | 0.459986 | day7.ex | starcoder |
defmodule Chex.Board do
@moduledoc false
@type value :: {Chex.name(), Chex.color(), Chex.square()}
@files [:a, :b, :c, :d, :e, :f, :g, :h]
# @ranks 1..8
@starting_position %{
{:a, 1} => {:rook, :white, {:a, 1}},
{:a, 2} => {:pawn, :white, {:a, 2}},
{:a, 7} => {:pawn, :black, {:a, 7}},
{:a, ... | lib/chex/board.ex | 0.826537 | 0.531757 | board.ex | starcoder |
defmodule BlockBox.BlockElements do
@moduledoc """
Defines generator functions for all [block elements](https://api.slack.com/reference/block-kit/block-elements).
"""
alias BlockBox.CompositionObjects, as: CO
alias BlockBox.Utils, as: Utils
@type select_menu_type ::
:static_select
| :e... | lib/block_elements.ex | 0.851922 | 0.445107 | block_elements.ex | starcoder |
defmodule Plymio.Codi.Pattern.Query do
# @moduledoc false
@moduledoc ~S"""
The *query* patterns build query functions
(e.g. `myfun?(arg)`) using existing base functions (e.g. `myfun(arg)`).
When the base function returns `{:ok, value}`, the query
function returns `true`. Otherwise `false` is returned.
... | lib/codi/pattern/query/query.ex | 0.903377 | 0.721069 | query.ex | starcoder |
defmodule Raxx.Router do
@moduledoc """
Routing for Raxx applications.
Routes are defined as a match and an action module.
Standard Elixir pattern matching is used to apply the match to an incoming request.
An action module another implementation of `Raxx.Server`
Sections group routes that all have the sa... | lib/raxx/router.ex | 0.844665 | 0.499268 | router.ex | starcoder |
defmodule Nebulex.Adapters.Multilevel do
@moduledoc ~S"""
Adapter module for Multi-level Cache.
This is just a simple layer on top of local or distributed cache
implementations that enables to have a cache hierarchy by levels.
Multi-level caches generally operate by checking the fastest,
level 1 (L1) cache... | lib/nebulex/adapters/multilevel.ex | 0.88054 | 0.623234 | multilevel.ex | starcoder |
defmodule Day12.NBody2 do
def part2 do
# puzzle input
positions = %{
:a => {-1, 7, 3},
:b => {12, 2, -13},
:c => {14, 18, -8},
:d => {17, 4, -4}
}
# example 1
# positions = %{
# :a => {-1, 0, 2},
# :b => {2, -10, -7},
# :c => {4, -8, 8},
# :d => {3,... | lib/day12/n_body2.ex | 0.68763 | 0.61568 | n_body2.ex | starcoder |
defmodule Ash.Type do
@list_constraints [
min_length: [
type: :non_neg_integer,
doc: "A minimum length for the items"
],
max_length: [
type: :non_neg_integer,
doc: "A maximum length for the items"
],
nil_items?: [
type: :boolean,
doc: "Whether or not the list ca... | lib/ash/type/type.ex | 0.841077 | 0.499268 | type.ex | starcoder |
defmodule Example.Todo do
use Ecto.Schema
schema "todos" do
field :title, :string
field :completed, :boolean
timestamps [
type: :naive_datetime_usec
]
end
@doc """
Creates a Todo in the database
"""
def create(%Ecto.Changeset{} = changeset) do
result = Example.Repo.insert(cha... | lib/example/todo.ex | 0.609989 | 0.447158 | todo.ex | starcoder |
defmodule GN.Evolution do
import GN.Gluon
@layer_types %{
dense: &dense/3,
activation: &activation/2,
dropout: &dropout/2,
batch_norm: &batch_norm/1,
leaky_relu: &leaky_relu/2,
flatten: &flatten/1
}
def layer_types() do
@layer_types
end
@mutation_rate 0.25
@std_dev 2
def ... | lib/galapagos_nao/evolution.ex | 0.691706 | 0.565269 | evolution.ex | starcoder |
defmodule EventStore.AdvisoryLocks do
@moduledoc false
# PostgreSQL provides a means for creating locks that have application-defined
# meanings. Advisory locks are faster, avoid table bloat, and are
# automatically cleaned up by the server at the end of the session.
use GenServer
defmodule State do
... | lib/event_store/advisory_locks.ex | 0.706393 | 0.408011 | advisory_locks.ex | starcoder |
defmodule ChallengeGov.Challenges do
@moduledoc """
Context for Challenges
"""
@behaviour Stein.Filter
import Ecto.Query
alias ChallengeGov.Accounts
alias ChallengeGov.Challenges.Challenge
alias ChallengeGov.Challenges.ChallengeOwner
alias ChallengeGov.Challenges.FederalPartner
alias ChallengeGov... | lib/challenge_gov/challenges.ex | 0.674908 | 0.422445 | challenges.ex | starcoder |
defmodule Rajska do
@moduledoc """
Rajska is an elixir authorization library for [Absinthe](https://github.com/absinthe-graphql/absinthe).
It provides the following middlewares:
- `Rajska.QueryAuthorization`
- `Rajska.QueryScopeAuthorization`
- `Rajska.ObjectAuthorization`
- `Rajska.ObjectScopeAuthorizat... | lib/rajska.ex | 0.851181 | 0.85446 | rajska.ex | starcoder |
defmodule Noizu.Scaffolding.EntityBehaviour do
@moduledoc """
This Behaviour provides some callbacks needed for the Noizu.ERP (EntityReferenceProtocol) to work smoothly.
Note the following naming conventions (where Path.To.Entity is the same path in each following case)
- Entities MyApp.(Path.To.Entity).MyF... | lib/scaffolding/behaviours/entity_behaviour.ex | 0.864996 | 0.59249 | entity_behaviour.ex | starcoder |
defmodule LineBot.Message do
@moduledoc """
Represents any of the possible [Message objects](https://developers.line.biz/en/reference/messaging-api/#message-objects).
"""
@type t ::
LineBot.Message.Text.t()
| LineBot.Message.Sticker.t()
| LineBot.Message.Image.t()
| LineB... | lib/line_bot/message.ex | 0.806358 | 0.45175 | message.ex | starcoder |
defmodule Clova.Response.SpeechInfoObject do
@moduledoc """
A struct that represents a `SpeechInfoObject` entry of the clova response. For the representation
of the entire response see `Clova.Response`.
"""
defstruct lang: "ja", type: "PlainText", value: nil
end
defmodule Clova.Response.OutputSpeech do
@mo... | lib/clova/response.ex | 0.929744 | 0.540681 | response.ex | starcoder |
defmodule Sneex.Cpu do
@moduledoc """
This module defines a structure that represents the CPU's current state, and defines functions for
interacting with that state (getting it, updating it, etc.).
Design thoughts:
- CPU should have 2 functions:
- tick: this will act as a clock tick
- step: this ... | lib/sneex/cpu.ex | 0.816991 | 0.567277 | cpu.ex | starcoder |
defmodule Commanded.PubSub do
@moduledoc """
Pub/sub behaviour for use by Commanded to subcribe to and broadcast messages.
"""
@doc """
Return an optional supervisor spec for pub/sub.
"""
@callback child_spec() :: [:supervisor.child_spec()]
@doc """
Subscribes the caller to the PubSub adapter's topi... | lib/commanded/pubsub.ex | 0.859354 | 0.405979 | pubsub.ex | starcoder |
defmodule Ecto.Query.Builder.From do
@moduledoc false
alias Ecto.Query.Builder
@doc """
Handles from expressions.
The expressions may either contain an `in` expression or not.
The right side is always expected to Queryable.
## Examples
iex> escape(quote do: MySchema)
{quote(do: MySchema),... | data/web/deps/ecto/lib/ecto/query/builder/from.ex | 0.899548 | 0.511534 | from.ex | starcoder |
defmodule Tesla.Middleware.Retry do
@moduledoc """
Retry using exponential backoff and full jitter. This middleware only retries in the
case of connection errors (`nxdomain`, `connrefused` etc). Application error
checking for retry can be customized through `:should_retry` option by
providing a function in re... | lib/tesla/middleware/retry.ex | 0.931921 | 0.852935 | retry.ex | starcoder |
defmodule StbImage do
@moduledoc """
Tiny image encoding and decoding.
The following formats are supported and have type u8:
* JPEG baseline & progressive (12 bpc/arithmetic not supported, same as stock IJG lib)
* PNG 1/2/4/8/16-bit-per-channel
* TGA
* BMP non-1bpp, non-RLE
* PSD (composited... | lib/stb_image.ex | 0.939975 | 0.668021 | stb_image.ex | starcoder |
import Kernel, except: [to_binary: 1]
defmodule Macro do
@moduledoc """
This module provides conveniences for working with macros.
"""
@doc """
Returns a list of binary operators. This is available
as a macro so it can be used in guard clauses.
"""
defmacro binary_ops do
[
:===, :!==,
... | lib/elixir/lib/macro.ex | 0.75392 | 0.66609 | macro.ex | starcoder |
defmodule Cforum.MessagesUsers do
import Ecto.Query, warn: false
alias Cforum.Repo
alias Cforum.Messages.Message
alias Cforum.MessagesTags.MessageTag
alias Cforum.Tags.Tag
alias Cforum.Votes.Vote
alias Cforum.Scores.Score
alias Cforum.Users.User
@doc """
Returns a list of messages for a user, limi... | lib/cforum/messages_users.ex | 0.606498 | 0.434641 | messages_users.ex | starcoder |
defmodule Protobuf.JSON.Decode do
@moduledoc false
import Bitwise, only: [bsl: 2]
alias Protobuf.JSON.Utils
@compile {:inline,
fetch_field_value: 2,
decode_map: 2,
decode_repeated: 2,
decode_integer: 1,
decode_float: 1,
parse_float: 1,
... | lib/protobuf/json/decode.ex | 0.842086 | 0.545104 | decode.ex | starcoder |
defmodule TodoList do
@moduledoc """
"""
defstruct auto_id: 1, entries: %{}
@doc """
Creates a new TodoList
"""
def new(), do: %TodoList{}
@doc """
Add a new entry to a todo list
"""
def add_entry(todo_list, entry) do
entry = Map.put(entry, :id, todo_list.auto_id)
new_entries =
Ma... | ch4/todo_list/lib/todo_list.ex | 0.500732 | 0.412501 | todo_list.ex | starcoder |
defmodule Artemis.Helpers do
require Logger
@doc """
Generate a random string
"""
def random_string(string_length) do
string_length
|> :crypto.strong_rand_bytes()
|> Base.url_encode64()
|> binary_part(0, string_length)
end
@doc """
Detect if value is truthy
"""
def present?(nil), d... | apps/artemis/lib/artemis/helpers.ex | 0.863435 | 0.511107 | helpers.ex | starcoder |
defmodule RefInspector do
@moduledoc """
Referer parser library.
## Preparation
1. Verify your supervision setup according to `RefInspector.Supervisor`
2. Revise the default configuration values of `RefInspector.Config` and
adjust to your project/environment where necessary
3. Download a copy of the ... | lib/ref_inspector.ex | 0.888514 | 0.629291 | ref_inspector.ex | starcoder |
defmodule FlowAssertions.Ecto.ChangesetA do
use FlowAssertions.Define
alias FlowAssertions.Ecto.Messages
use FlowAssertions
alias Ecto.Changeset
alias FlowAssertions.MapA
@moduledoc """
Assertions for `Ecto.Changeset` structures.
"""
# ----------------------------------------------------------... | lib/changeset_a.ex | 0.846292 | 0.512937 | changeset_a.ex | starcoder |
defmodule MdnsLite do
@moduledoc """
MdnsLite is a simple, limited, no frills mDNS implementation
Advertising hostnames and services is generally done using the application
config. See `MdnsLite.Options` for documentation.
To change the advertised hostnames or services at runtime, see `set_host/1`,
`add_... | lib/mdns_lite.ex | 0.874171 | 0.792585 | mdns_lite.ex | starcoder |
defmodule ExDjango.Pbkdf2 do
@moduledoc """
Module to handle django pbkdf2_sha256 and pbkdf2_sha512 authentication.
Comeonin didn't want to support pbkdf2_sha256 so copied to here.
Comeonin password hashes start with $ it will work with both Django and Comeonin password hashes.
To generate a password hash,... | lib/pbkdf2.ex | 0.763528 | 0.640945 | pbkdf2.ex | starcoder |
defmodule Golos.WitnessApi do
def call(method, params) do
Golos.call(["witness_api", method, params])
end
@doc """
Get witnesses by ids
## Example response
```
[%{"created" => "2016-10-18T11:21:18",
"hardfork_time_vote" => "2016-10-18T11:00:00",
"hardfork_version_vote" => "0.0.0", "id" => ... | lib/apis/witness_api.ex | 0.812012 | 0.606528 | witness_api.ex | starcoder |
defmodule Cluster.Strategy.Kubernetes do
@moduledoc """
This clustering strategy works by loading all endpoints in the current Kubernetes
namespace with the configured label. It will fetch the addresses of all endpoints with
that label and attempt to connect. It will continually monitor and update its
connect... | lib/strategy/kubernetes.ex | 0.824214 | 0.500793 | kubernetes.ex | starcoder |
defmodule MoroxiteServer.Providers.Reddit.Fetcher do
@moduledoc """
This module is going to download the json from the reddit api and parse it
"""
@valid_listings ["new", "hot", "rising", "top", "controversial"]
@behaviour Fetcher
@doc """
Build the link based on a ```reddit_name```
`listing_type` i... | apps/moroxite_server/lib/moroxite_server/providers/reddit/fetcher.ex | 0.767123 | 0.80329 | fetcher.ex | starcoder |
defmodule Artour.ImageView do
use Artour.Web, :view
@doc """
How single image instance should be represented in views
"""
def display_name(image) do
image.title
end
@doc """
Renders page to create new image
"""
def render("new.html", assigns) do
assigns = Map.merge(assigns, %{action: image... | apps/artour/web/views/image_view.ex | 0.779196 | 0.505249 | image_view.ex | starcoder |
defmodule AWS.Forecast do
@moduledoc """
Provides APIs for creating and managing Amazon Forecast resources.
"""
alias AWS.Client
alias AWS.Request
def metadata do
%AWS.ServiceMetadata{
abbreviation: nil,
api_version: "2018-06-26",
content_type: "application/x-amz-json-1.1",
cr... | lib/aws/generated/forecast.ex | 0.937968 | 0.612585 | forecast.ex | starcoder |
defmodule CTE.Utils do
@moduledoc """
Basic utilities for helping developing functionality about the `CTE` data structures
"""
@doc """
render a path hierarchy as a .dot string that you could use for drawing your results, using graphviz. w⦿‿⦿t!
Upon receiving something like this:
%{
nodes:... | lib/cte/utils.ex | 0.807499 | 0.532607 | utils.ex | starcoder |
defmodule Sneex.Ops.Decrement do
@moduledoc """
This represents the op codes for decrementing a value (DEC, DEX, and DEY).
"""
defstruct [:disasm_override, :bit_size, :cycle_mods, :address_mode]
alias Sneex.Address.{Absolute, CycleCalculator, DirectPage, Indexed, Mode, Register}
alias Sneex.{Cpu, CpuHelper... | lib/sneex/ops/decrement.ex | 0.819677 | 0.415966 | decrement.ex | starcoder |
defmodule PromEx.Plugins.Application do
@moduledoc """
This plugin captures metrics regarding your application, and its dependencies. Specifically,
it captures the versions of your application and the application dependencies and also
how many modules each dependency is bringing into the project.
This plugin... | lib/prom_ex/plugins/application.ex | 0.888075 | 0.712107 | application.ex | starcoder |
defmodule Nostrum.Struct.ApplicationCommand do
@moduledoc """
Typespecs for creating Application Commands
Official reference:
https://discord.com/developers/docs/interactions/application-commands
"""
@moduledoc since: "0.5.0"
alias Nostrum.Snowflake
@typedoc """
The name of the command, subcommand,... | lib/nostrum/struct/application_command.ex | 0.845544 | 0.464659 | application_command.ex | starcoder |
defmodule Toml.Transform do
@moduledoc """
Defines the behavior for custom transformations of decoded TOML values.
See the documentation for `c:transform/2` for more details.
"""
@type t :: module
@type key :: binary | atom | term
@type keypath :: [binary] | [atom] | [term]
@type value ::
%{... | lib/transform.ex | 0.931711 | 0.740831 | transform.ex | starcoder |
defmodule Advent20.Ferry do
@moduledoc """
Rain Risk
"""
def parse(input) do
input
|> String.split("\n", trim: true)
|> Stream.map(&parse_instruction/1)
end
defp parse_instruction("N" <> fields), do: {:vert, String.to_integer(fields)}
defp parse_instruction("S" <> fields), do: {:vert, -Strin... | lib/advent20/12_ferry.ex | 0.810329 | 0.675755 | 12_ferry.ex | starcoder |
defmodule Co2Offset.Calculators.Calculator do
use Ecto.Schema
import Ecto.Changeset
alias Co2Offset.Calculators.Calculator
alias Co2Offset.Geo
schema "calculators" do
field :iata_from, :string
field :iata_to, :string
field :city_from, :string
field :city_to, :string
field :original_distan... | lib/co2_offset/calculators/calculator.ex | 0.61173 | 0.41401 | calculator.ex | starcoder |
defmodule Alchemy.Experiment do
defstruct [
name: "",
uuid: nil,
behaviors: [],
result: nil,
publisher: nil,
compare: nil,
cleaner: nil,
ignores: [],
]
alias __MODULE__
alias Alchemy.Observation
alias Alchemy.Result
require Logger
@doc """
Generates a new experiment. A... | lib/alchemy/experiment.ex | 0.835416 | 0.864196 | experiment.ex | starcoder |
defmodule Sanbase.Signal.Trigger.WalletTriggerSettings do
@moduledoc ~s"""
The wallet signal is triggered when the balance of a wallet or set of wallets
changes by a predefined amount for a specified asset (Ethereum, SAN tokens, Bitcoin, etc.)
The signal can follow a single address, a list of addresses
or a ... | lib/sanbase/signals/trigger/settings/wallet_trigger_settings.ex | 0.837653 | 0.40486 | wallet_trigger_settings.ex | starcoder |
defmodule Advent.Y2021.D13 do
@moduledoc """
https://adventofcode.com/2021/day/13
"""
@typep fold :: {:x | :y, non_neg_integer()}
@doc """
How many dots are visible after completing just the first fold instruction on
your transparent paper?
"""
@spec part_one(Enumerable.t()) :: non_neg_integer()
d... | lib/advent/y2021/d13.ex | 0.783575 | 0.540439 | d13.ex | starcoder |
defmodule ExCypher do
@moduledoc """
A DSL to build Cypher queries using elixir syntax
Use a simple macro to build your queries without any kind of string
interpolation.
### Example
Import `ExCypher` into your module, as follows, and feel free to build
your queries.
iex> defmodule SomeQuery do
... | lib/ex_cypher.ex | 0.849191 | 0.50116 | ex_cypher.ex | starcoder |
defmodule SpaceApi.JsonParser do
alias SpaceApi.Space
@moduledoc """
The decoded JSON-String will be transferred into a SpaceApi.Space-struct here.
There is only one accessible function: _parse_json/2_
"""
@doc """
This function takes a JSON-String which was already transfered into a map
(like from ""P... | lib/json_parser.ex | 0.743913 | 0.420957 | json_parser.ex | starcoder |
defmodule OptionParser do
@doc """
Parses the argv and returns one tuple with parsed options
and the arguments.
## Examples
OptionParser.parse(["--debug"])
#=> { [debug: true], [] }
OptionParser.parse(["--source", "lib"])
#=> { [source: "lib"], [] }
OptionParser.parse(["--sourc... | lib/elixir/lib/option_parser.ex | 0.599016 | 0.427217 | option_parser.ex | starcoder |
import Kernel, except: [inspect: 1]
defprotocol Binary.Inspect do
@moduledoc """
The `Binary.Inspect` protocol is responsible for
converting any structure to a Binary for textual
representation. All basic data structures (tuple,
list, function, pid, etc) implement the inspect
protocol. Other structures are... | lib/elixir/lib/binary/inspect.ex | 0.767646 | 0.565539 | inspect.ex | starcoder |
defmodule ExWire.Handler do
@moduledoc """
Defines a behavior for all message handlers of RLPx messages.
Message handlers tell us how we should respond to a given incoming transmission,
after it has been decoded.
"""
alias ExWire.Message
alias ExWire.Crypto
require Logger
@handlers %{
0x01 => ... | apps/ex_wire/lib/ex_wire/handler.ex | 0.757794 | 0.406597 | handler.ex | starcoder |
defmodule Nosedrum.Storage.ETS do
@moduledoc """
An implementation of the `Nosedrum.Storage` behaviour based on ETS tables.
This module needs to be configured as part of your supervision tree as it
spins up a `GenServer` which owns the command table. If you want to obtain
the table ID of the internal ETS tab... | lib/nosedrum/storage/ets.ex | 0.76856 | 0.434701 | ets.ex | starcoder |
defmodule BsonJson do
@moduledoc """
Converts a Bson document into a JSON document.
"""
@doc """
Returns a json representation of set of Bson documents
transcodeing the following element type:
* int32 -> number
* int64 -> number (capped at js maximum)
* float -> number
* string -> string (utf8)
... | hello_elixir/deps/bson/lib/bsonjson.ex | 0.712332 | 0.542621 | bsonjson.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.