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 Pulsar.DashboardServer do
alias Pulsar.Dashboard, as: D
@moduledoc """
Responsible for managing a Dashboard, updating it based on received messages, and
periodically flushing it to output.
The `Pulsar` module is the client API for creating and updating jobs.
The `:pulsar` application defines t... | lib/pulsar/dashboard_server.ex | 0.53777 | 0.503601 | dashboard_server.ex | starcoder |
defmodule Timex.Parse.DateTime.Tokenizers.Directive do
@moduledoc false
alias Timex.Parse.DateTime.Parsers
alias Timex.Parse.DateTime.Tokenizers.Directive
defstruct type: :literal,
value: nil,
modifiers: [],
flags: [],
width: [min: -1, max: nil],
pars... | lib/parse/datetime/tokenizers/directive.ex | 0.869507 | 0.514156 | directive.ex | starcoder |
defmodule Contex.BarChart do
@moduledoc """
Draws a barchart from a `Contex.Dataset`.
`Contex.BarChart` will attempt to create reasonable output with minimal input. The defaults are as follows:
- Bars will be drawn vertically (use `orientation/2` to override - options are `:horizontal` and `:vertical`)
- The first col... | lib/chart/barchart.ex | 0.956002 | 0.930836 | barchart.ex | starcoder |
defmodule Queens do
@type t :: %Queens{white: {integer, integer}, black: {integer, integer}}
defstruct [:white, :black]
@board_range 0..7
defguardp is_coordinate(c)
when is_tuple(c) and tuple_size(c) == 2 and c |> elem(0) |> is_integer() and
c |> elem(1) |> is_integer()
defgua... | exercises/practice/queen-attack/.meta/example.ex | 0.808559 | 0.490724 | example.ex | starcoder |
defmodule Plymio.Vekil.Term do
@moduledoc ~S"""
This module implements the `Plymio.Vekil` protocol using a `Map` where the
*proxies* (`keys`) are atoms and the *foroms* (`values`) hold any valid term.
The default when creating a **term** *vekil* is to create a
`Plymio.Vekil.Forom.Term` *forom* but any *vekil... | lib/vekil/concrete/vekil/term.ex | 0.876806 | 0.585072 | term.ex | starcoder |
defmodule XmerlXmlIndent do
@moduledoc """
Erlang OTP's built-in `xmerl` library lacks functionality to print XML with indent.
This module fills the gap by providing a custom callback to print XML with indent.
This module is taken from https://github.com/erlang/otp/blob/master/lib/xmerl/src/xmerl_xml.erl,
co... | lib/xmerl_xml_indent.ex | 0.823328 | 0.794185 | xmerl_xml_indent.ex | starcoder |
defmodule LayoutOMatic.Button do
# Buttons size based on :button_font_size with 20 being the default; width/height override. Button position is based on the top left point.
@default_font_size 20
@default_font :roboto
@spec translate(%{
component: map,
starting_xy: {number, number},
... | lib/layouts/components/button.ex | 0.659076 | 0.463748 | button.ex | starcoder |
defmodule Flex.MembershipFun do
@moduledoc """
An interface to create Membership Functions reference.
"""
import :math
@doc """
Shoulder membership function.
"""
@spec shoulder([...]) :: {fun(), any}
def shoulder([a, b, c]) do
mu = fn x ->
cond do
# Left side
a != b and a < ... | lib/membership_fun.ex | 0.887339 | 0.621627 | membership_fun.ex | starcoder |
defmodule Crutches.Range do
@moduledoc ~s"""
Convenience functions for ranges.
"""
@doc ~S"""
Compare two ranges and see if they overlap each other
## Examples
iex> Range.overlaps?(1..5, 4..6)
true
iex> Range.overlaps?(1..5, 7..9)
false
iex> Range.overlaps?(-1..-5, -4..-6)
true
... | lib/crutches/range.ex | 0.841174 | 0.579966 | range.ex | starcoder |
defmodule Parse.Kyc do
@moduledoc """
synopsis:
This script is going to parse an html page from KYC. In order to collect the html, visit
https://edoc.identitymind.com/reference#kyc-1 and click in the target command. After,
press F12 to inspect the element in Google Chrome, copy the body and paste in a f... | lib/main.ex | 0.719285 | 0.451629 | main.ex | starcoder |
defmodule Jocker.CLI.Volume do
alias Jocker.CLI.Utils
alias Jocker.Engine.Volume
import Utils, only: [cell: 2, sp: 1, to_cli: 1, to_cli: 2, rpc: 1]
@doc """
Usage: jocker volume COMMAND
Manage volumes
Commands:
create Create a volume
ls List volumes
rm Remove one or ... | lib/jocker_cli/volume.ex | 0.599251 | 0.439266 | volume.ex | starcoder |
defmodule BinFormat.FieldType.Lookup do
defstruct name: nil, lookup_vals: nil, default: nil, type: nil, size: nil, options: nil
@moduledoc """
Lookup field type for defformat.
"""
@doc """
Add a Lookup field to the format structure in defformat.
A lookup field uses a list of values and labels to map a ... | lib/bin_format/field_type/lookup.ex | 0.749912 | 0.753603 | lookup.ex | starcoder |
defmodule CSSEx.Parser do
@moduledoc """
The parser module that generates or writes a CSS file based on an entry file.
"""
import CSSEx.Helpers.Shared,
only: [inc_col: 1, inc_col: 2, inc_line: 1, remove_last_from_chain: 1, inc_no_count: 2]
import CSSEx.Helpers.Interpolations, only: [maybe_replace_val: 2... | lib/parser.ex | 0.650356 | 0.620679 | parser.ex | starcoder |
defmodule Mongo.InsertOneResult do
@moduledoc """
The successful result struct of `Mongo.insert_one/4`. Its fields are:
* `:inserted_id` - The id of the inserted document
"""
@type t :: %__MODULE__{
inserted_id: nil | BSON.ObjectId.t
}
defstruct [:inserted_id]
end
defmodule Mongo.InsertManyResul... | lib/mongo/results.ex | 0.822439 | 0.579252 | results.ex | starcoder |
defmodule ExDoubleEntry.Transfer do
@type t() :: %__MODULE__{}
@enforce_keys [:money, :from, :to, :code]
defstruct [:money, :from, :to, :code, :metadata]
alias ExDoubleEntry.{Account, AccountBalance, Guard, Line, MoneyProxy, Transfer}
def perform!(%Transfer{} = transfer) do
perform!(transfer, ensure_ac... | lib/ex_double_entry/services/transfer.ex | 0.663342 | 0.428114 | transfer.ex | starcoder |
defmodule Wordza.GamePass do
@moduledoc """
This is a single pass on our Wordza Game
used to log that this player could not play
(grab a snapshot of the letters/board if you want to)
"""
defstruct [
player_key: nil,
board: nil, # currnet board not allowing a play (optional debug)
tiles_in_tray: ... | lib/game/game_play.ex | 0.786131 | 0.466603 | game_play.ex | starcoder |
defmodule Scenic.Primitive.Arc do
@moduledoc """
Draw an arc on the screen.
An arc is a segment that traces part of the outline of a circle. If you are
looking for something shaped like a piece of pie, then you want a segment.
Arcs are often drawn on top of a segment to get an affect where a piece of pie
... | lib/scenic/primitive/arc.ex | 0.935693 | 0.926037 | arc.ex | starcoder |
require SftpEx.Helpers, as: S
defmodule SFTP.TransferService do
@moduledoc """
Provides data transfer related functions
"""
@sftp Application.get_env(:sftp_ex, :sftp_service, SFTP.Service)
@doc """
Similar to IO.each_binstream this returns a tuple with the data
and the file handle if data is read from t... | lib/sftp/transfer_service.ex | 0.707101 | 0.415907 | transfer_service.ex | starcoder |
defmodule Kale.Macros do
# credo:disable-for-this-file Credo.Check.Warning.UnsafeToAtom
# credo:disable-for-this-file Credo.Check.Readability.Specs
@moduledoc """
Macros, automatically imported by `use Kale`.
"""
alias Kale.Utils
@doc """
Generate a feature block, which corresponds to an ExUnit `descr... | lib/kale/macros.ex | 0.869798 | 0.495972 | macros.ex | starcoder |
defmodule SnapFramework.Engine do
@moduledoc """
The EEx template engine.
# Overview
The SnapFramework Engine is responsible for parsing EEx templates and building graphs from them.
You should always start a template with the a graph, and then add any components and primitives immediately after it.
``` ... | lib/engine/engine.ex | 0.833358 | 0.8586 | engine.ex | starcoder |
defmodule Mix.Release do
@moduledoc """
Defines the release structure and convenience for assembling releases.
"""
@doc """
The Mix.Release struct has the following read-only fields:
* `:name` - the name of the release as an atom
* `:version` - the version of the release as a string
* `:path` - ... | lib/mix/lib/mix/release.ex | 0.786705 | 0.625152 | release.ex | starcoder |
defimpl Backpack.Moment.Calculator, for: Integer do
import Backpack.Moment.Numeric
def shift(term, opts) do
unit = Keyword.get(opts, :unit, :seconds)
term
|> Kernel.+(years(Keyword.get(opts, :years, 0), unit))
|> Kernel.+(months(Keyword.get(opts, :months, 0), unit))
|> Kernel.+(weeks(Keyword.g... | lib/backpack/moment/calculator/integer.ex | 0.543106 | 0.581778 | integer.ex | starcoder |
defmodule Membrane.Pipeline.Action do
@moduledoc """
This module contains type specifications of actions that can be returned
from pipeline callbacks.
Returning actions is a way of pipeline interaction with
other components and parts of framework. Each action may be returned by any
callback (except for `c:... | lib/membrane/pipeline/action.ex | 0.914668 | 0.567877 | action.ex | starcoder |
defmodule Interp.Environment do
defstruct range_variable: 0,
range_element: "",
recursive_environment: nil
end
defmodule Interp.RecursiveEnvironment do
defstruct subprogram: nil,
base_cases: nil,
popped: 0
end
defmodule Interp.Interpreter do
alias ... | lib/interp/interpreter.ex | 0.581065 | 0.638131 | interpreter.ex | starcoder |
defmodule AWS.Lightsail do
@moduledoc """
Amazon Lightsail is the easiest way to get started with Amazon Web Services
(AWS) for developers who need to build websites or web applications.
It includes everything you need to launch your project quickly - instances
(virtual private servers), container services,... | lib/aws/generated/lightsail.ex | 0.896523 | 0.528777 | lightsail.ex | starcoder |
defmodule RDF.LangString do
@moduledoc """
`RDF.Literal.Datatype` for `rdf:langString`s.
"""
defstruct [:value, :language]
use RDF.Literal.Datatype,
name: "langString",
id: RDF.Utils.Bootstrapping.rdf_iri("langString")
import RDF.Utils.Guards
alias RDF.Literal.Datatype
alias RDF.Literal
... | lib/rdf/literal/datatypes/lang_string.ex | 0.90203 | 0.516291 | lang_string.ex | starcoder |
defmodule VelocyPack.Codegen do
@moduledoc false
# Most of this code is basically a direct copy of the Codegen
# Module from https://github.com/michalmuskala/jason with some
# small modifications.
import Bitwise
defmacro __using__(_opts) do
funcs =
for i <- 1..4 do
name = "build_index_t... | lib/velocy_pack/codegen.ex | 0.569494 | 0.550849 | codegen.ex | starcoder |
defmodule ExDebugger.Tokenizer.Definition do
@moduledoc false
# Based on the tokens, chunk all the definitions appearing therein and
# take special note of where they `:end`. Below you can see an example
# of the various tokens that elixir generates.
@default_def_line 0
def default_def_line, do: @default_... | lib/ex_debugger/tokenizer/definition.ex | 0.763616 | 0.407569 | definition.ex | starcoder |
defmodule Hitbtc.Http.Trading do
alias Hitbtc.Util.Api
@moduledoc """
Set of trading API methods
This set of methods requires auth information.
You could configure it into `config.exs` file of your application
"""
@doc """
List of your current orders
## Example:
```elixir
iex(1)> Hitbtc.Trad... | lib/hitbtc/http/trading.ex | 0.888852 | 0.737725 | trading.ex | starcoder |
defmodule JOSE.JWA do
@moduledoc ~S"""
JWA stands for JSON Web Algorithms which is defined in [RFC 7518](https://tools.ietf.org/html/rfc7518).
## Cryptographic Algorithm Fallback
Native implementations of all cryptographic and public key algorithms
required by the JWA specifications are not present in curre... | lib/jose/jwa.ex | 0.874185 | 0.73017 | jwa.ex | starcoder |
defmodule ShipDesigner.FormatHelpers do
@moduledoc """
Conveniences for formatting common values.
"""
@doc """
Formats an amount of distance for display.
## Options
* `:with_unit` - Displays the distance with the given unit designation (defaults to `km`)
"""
def format_distance(distance, options \\... | web/views/format_helpers.ex | 0.898157 | 0.641521 | format_helpers.ex | starcoder |
defmodule Nebulex.Adapter do
@moduledoc """
Specifies the minimal API required from adapters.
"""
alias Nebulex.Telemetry
@typedoc "Adapter"
@type t :: module
@typedoc "Metadata type"
@type metadata :: %{optional(atom) => term}
@typedoc """
The metadata returned by the adapter `c:init/1`.
It ... | lib/nebulex/adapter.ex | 0.766818 | 0.433862 | adapter.ex | starcoder |
defmodule Spotify.AudioFeatures do
@moduledoc """
A complete audio features object.
[Spotify Docs](https://beta.developer.spotify.com/documentation/web-api/reference/object-model/#audio-features-object)
"""
@behaviour Spotify.ObjectModel
@typedoc """
A float measurement of Acousticness.
A co... | lib/spotify/models/audio_features.ex | 0.914185 | 0.88642 | audio_features.ex | starcoder |
defmodule Module.LocalsTracker do
@moduledoc false
@defmacros [:defmacro, :defmacrop]
@doc """
Adds and tracks defaults for a definition into the tracker.
"""
def add_defaults({_set, bag}, kind, {name, arity} = pair, defaults, meta) do
for i <- :lists.seq(arity - defaults, arity - 1) do
put_edge... | lib/elixir/lib/module/locals_tracker.ex | 0.729905 | 0.523177 | locals_tracker.ex | starcoder |
defmodule AWS.ServerlessApplicationRepository do
@moduledoc """
The AWS Serverless Application Repository makes it easy for developers and
enterprises to quickly find
and deploy serverless applications in the AWS Cloud.
For more information about serverless applications,
see Serverless Computing and Appli... | lib/aws/generated/serverless_application_repository.ex | 0.679285 | 0.495484 | serverless_application_repository.ex | starcoder |
defmodule Coxir.Struct.Member do
@moduledoc """
Defines methods used to interact with guild members.
Refer to [this](https://discordapp.com/developers/docs/resources/guild#guild-member-object)
for a list of fields and a broader documentation.
In addition, the following fields are also embedded.
- `user` -... | lib/coxir/struct/member.ex | 0.839059 | 0.423458 | member.ex | starcoder |
defmodule Chopsticks.AiPlay do
@moduledoc """
Play against the AI.
"""
alias Chopsticks.Random
alias Chopsticks.Learn
alias Chopsticks.Engine
alias Chopsticks.Play
@doc """
Kick off a game with the AI.
"""
def play do
learnings = Learn.learn
winner = Engine.play(
20,
get_mov... | lib/chopsticks/ai_play.ex | 0.706697 | 0.522141 | ai_play.ex | starcoder |
defmodule RDF.Query.BGP.Helper do
@moduledoc !"""
Shared functions between the `RDF.Query.BGP.Simple` and `RDF.Query.BGP.Stream` engines.
"""
import RDF.Guards
def solvable?(term) when is_tuple(term) and tuple_size(term) == 1, do: true
def solvable?({s, p, o}), do: solvable?(p) or so... | lib/rdf/query/bgp/helper.ex | 0.672654 | 0.665438 | helper.ex | starcoder |
defmodule Jaxon.Decoder do
alias Jaxon.{ParseError}
@moduledoc false
@type json_term() ::
nil
| true
| false
| list
| float
| integer
| String.t()
| map
| [json_term()]
@doc """
Takes a list of events and decodes them in... | lib/jaxon/decoder.ex | 0.758958 | 0.640601 | decoder.ex | starcoder |
defmodule Parser do
@moduledoc """
Contains the parser for lisir.
"""
@doc """
Turns the given expression into a list of tokens.
eg.
"(define x (* 2 3))" => ['(', 'define', 'x', '(', '*', '2', '3', ')', ')']
"""
def tokenize(s) do
tokenize(s, [], [])
end
def tokenize("", t_acc, acc) do
u... | lib/parser.ex | 0.501709 | 0.649509 | parser.ex | starcoder |
defmodule Intcode.Instruction do
@moduledoc """
Instructions used by the Intcode interpreter
"""
alias Intcode.State
@doc """
Evaluate a single instruction
"""
def evaluate(instruction, s = %State{}) do
parse(instruction)
|> eval(s)
end
defp parse(instruction), do: Integer.digits(instructi... | apps/util/lib/intcode/instruction.ex | 0.755096 | 0.442215 | instruction.ex | starcoder |
defmodule Grizzly do
@moduledoc """
Send commands to Z-Wave devices
Grizzly provides the `send_command` function as the way to send a command to
Z-Wave devices.
The `send_command` function takes the node id that you are trying to send a
command to, the command name, and optionally command arguments and co... | lib/grizzly.ex | 0.861057 | 0.889721 | grizzly.ex | starcoder |
defmodule Kalevala.Communication.Cache do
@moduledoc """
A local cache server for communication
Tracks which channels are registered to which PID and which pids
are subscribed to which channel.
"""
use GenServer
alias Kalevala.Communication.Channels
defstruct [:cache_name, :channels_name, :channel_e... | lib/kalevala/communication/cache.ex | 0.799794 | 0.401834 | cache.ex | starcoder |
defmodule Scenic.Primitive.Style.Paint do
@moduledoc """
Paint is used to "fill" the area of primitives.
When you apply the `:fill` style to a primitive, you must supply valid
paint data.
There are five types of paint.
* [`:color`](Scenic.Primitive.Style.Paint.Color.html) - Fill with a solid color. This ... | lib/scenic/primitive/style/paint.ex | 0.929816 | 0.687499 | paint.ex | starcoder |
defmodule Guardian.Phoenix.Socket do
@moduledoc """
Provides functions for managing authentication with sockets.
Usually you'd use this on the Socket to authenticate on connection on
the `connect` function.
There are two main ways to use this module.
1. use Guardian.Phoenix.Socket
2. import Guardian.Pho... | lib/guardian/phoenix/socket.ex | 0.798462 | 0.769817 | socket.ex | starcoder |
defmodule ExIcal.DateParser do
@moduledoc """
Responsible for parsing datestrings in predefined formats with `parse/1` and
`parse/2`.
"""
@doc """
Responsible for parsing datestrings in predefined formats into %DateTime{}
structs. Valid formats are defined by the "Internet Calendaring and Scheduling
Co... | lib/ex_ical/date_parser.ex | 0.870032 | 0.704402 | date_parser.ex | starcoder |
defmodule KaufmannEx.Schemas do
@moduledoc """
Handles registration, retrieval, validation and parsing of Avro Schemas.
Schemas are cached to ETS table using `Memoize`. Does not handle schema changes while running. Best practice is to redeploy all services using a message schema if the schema changes.
D... | lib/schemas.ex | 0.845958 | 0.468122 | schemas.ex | starcoder |
defmodule ShuntingYard do
@moduledoc """
Implementation of a basic [shunting-yard algorithm](https://en.wikipedia.org/wiki/Shunting-yard_algorithm)
for parsing algebraic expressions.
iex> ShuntingYard.to_rpn("(1+2)*(3+4)")
[1, 2, "+", 3, 4, "+", "*"]
iex> ShuntingYard.to_ast("(1+2)*(3+4)")
... | lib/shunting_yard.ex | 0.736401 | 0.651175 | shunting_yard.ex | starcoder |
defmodule BroadwayCloudPubSub.Producer do
@moduledoc """
A GenStage producer that continuously receives messages from a Google Cloud Pub/Sub
topic and acknowledges them after being successfully processed.
By default this producer uses `BroadwayCloudPubSub.GoogleApiClient` to talk to Cloud
Pub/Sub, but you ca... | lib/broadway_cloud_pub_sub/producer.ex | 0.921609 | 0.61115 | producer.ex | starcoder |
defmodule Erps do
@moduledoc """
Erps is an OTP-compliant remote protocol service
The general purpose of Erps is to extend the GenServer primitives over public
networks using two-way TLS authentication and encryption *without* using OTP
standard distribution, for cases when:
1. Latency, reliability, or n... | lib/erps.ex | 0.910065 | 0.872075 | erps.ex | starcoder |
defmodule Block.Header do
@moduledoc """
This structure codifies the header of a block in the blockchain.
For more information, see Section 4.3 of the Yellow Paper.
"""
alias ExthCrypto.Hash.Keccak
@empty_trie MerklePatriciaTree.Trie.empty_trie_root_hash()
@empty_keccak [] |> ExRLP.encode() |> Keccak.ke... | apps/evm/lib/block/header.ex | 0.69946 | 0.515559 | header.ex | starcoder |
defmodule Raxx.Stack do
alias Raxx.Server
alias Raxx.Middleware
@behaviour Server
@moduledoc """
A `Raxx.Stack` is a list of `Raxx.Middleware`s attached to a `Raxx.Server`.
It implements the `Raxx.Server` interface itself so it can be used anywhere
"normal" server can be.
"""
defmodule State do
... | lib/raxx/stack.ex | 0.892396 | 0.492066 | stack.ex | starcoder |
defmodule Bip39 do
@moduledoc """
#Bitcoin #BIP39 #Mnemonic #Elixir
"""
@doc """
Convert entropy to mnemonic.
##### Parameter
bit_size(entropy) in [128, 160, 192, 224, 256]
length(words) == 2048
##### Example
iex> Bip39.entropy_to_mnemonic(<<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... | lib/bip39.ex | 0.691914 | 0.518302 | bip39.ex | starcoder |
defmodule Tirexs.Bulk do
@moduledoc """
The Bulk API makes it possible to perform many index/delete operations in
single call.
This module provides DSL for building Bulk API `payload` which is ready to use
over `Tirexs.Resources.bump/1` or `Tirexs.HTTP.post/2` conveniences.
The `Tirexs.Resources.bump/1` e... | lib/tirexs/bulk.ex | 0.745213 | 0.446193 | bulk.ex | starcoder |
if Mix.env == :test do
defmodule ExDhcp.Snapshot.Client do
alias ExDhcp.Packet
alias ExDhcp.Utils
@moduledoc """
this module provides tools for developing snapshots for testing purposes.
"""
@doc """
sends a broadcast DHCP request and saves the resulting structure to `filepath`.
you should supply th... | lib/ex_dhcp/snapshot.ex | 0.710427 | 0.474388 | snapshot.ex | starcoder |
defmodule Circuits.UART.Framing.Line do
@behaviour Circuits.UART.Framing
@moduledoc """
Each message is one line. This framer appends and removes newline sequences
as part of the framing. Buffering is performed internally, so users can get
the complete messages under normal circumstances. Attention should be... | lib/uart/framing/line.ex | 0.850065 | 0.833121 | line.ex | starcoder |
defmodule Yml do
@moduledoc """
Module for reading/writing yml/yaml files
"""
@doc """
Read YML file to map
## Parameters
- path_to_file: path to file for locale detection
## Examples
iex> Yml.read_from_file("/path_to_file")
{:ok, %{}}
iex> Yml.read_from_file("/path_to_unexiste... | lib/yml.ex | 0.748536 | 0.430088 | yml.ex | starcoder |
defmodule Parse.StopTimes do
@moduledoc """
Parses the GTFS stop_times.txt file.
"""
@behaviour Parse
@compile :native
@compile {:hipe, [:o3]}
import :binary, only: [copy: 1]
alias Model.{Schedule, Trip}
require Logger
def parse(blob, trip_fn \\ nil) do
blob
|> BinaryLineSplit.stream!()
... | apps/parse/lib/parse/stop_times.ex | 0.722625 | 0.414217 | stop_times.ex | starcoder |
defmodule Crux.Structs.Invite do
@moduledoc """
Represents a Discord [Invite Object](https://discord.com/developers/docs/resources/invite#invite-object)
List of what property can be present fetched with what function:
| Property | `Rest.get_guild_vanity_invite/1` | `Rest.get_invite/1` | `Res... | lib/structs/invite.ex | 0.836788 | 0.450541 | invite.ex | starcoder |
defmodule Hive.Job do
@moduledoc """
This module is to encapsulate jobs. These functions are not meant to be run
directly, even though they are full capable of it. They are merely helper
functions for handling jobs.
"""
require Logger
@doc """
The `%Hive.Job{}` struct is to hold jobs with a user de... | lib/hive/job/job.ex | 0.521715 | 0.419648 | job.ex | starcoder |
defmodule Stripe.Charge do
@moduledoc """
## Attributes
- `id` - `String`
- `object` - `String` - value is "charge"
- `livemode` - `Boolean`
- `amount` - `Integer` - Amount charged in cents
- `captured` - `Boolean` - If the charge was created without capturing,
this boolean represents whether or n... | lib/stripe/charge.ex | 0.836421 | 0.585753 | charge.ex | starcoder |
defmodule Zaryn.SelfRepair.Sync.BeaconSummaryHandler do
@moduledoc false
alias Zaryn.BeaconChain
alias Zaryn.BeaconChain.Slot, as: BeaconSlot
alias Zaryn.BeaconChain.Summary, as: BeaconSummary
alias Zaryn.Crypto
alias Zaryn.DB
alias Zaryn.Election
alias Zaryn.P2P
alias Zaryn.P2P.Message.GetTransa... | lib/zaryn/self_repair/sync/beacon_summary_handler.ex | 0.796451 | 0.430028 | beacon_summary_handler.ex | starcoder |
defmodule Purely.BST do
@moduledoc """
A set of functions for a purely functional implementation of a
binary search tree (BST).
Each node in the binary tree stores a key and a value in a tuple.
Keys are compared with `<` and `>`.
"""
@empty {}
@type key :: any
@type value :: any
@type empty :: P... | lib/purely/bst.ex | 0.924968 | 0.739634 | bst.ex | starcoder |
defmodule FunLand.Reducable do
@moduledoc """
Anything that implements the Reducable behaviour, can be reduced to a single value, when given a combinable (or combining-function + base value).
This is enough information to convert any reducable to a List.
It even is enough information to implement most enumera... | lib/fun_land/reducable.ex | 0.80077 | 0.683076 | reducable.ex | starcoder |
defmodule UBootEnv.Config do
@moduledoc """
Utilities for reading the U-Boot's `fw_env.config` file.
"""
alias UBootEnv.Location
defstruct [:locations]
@type t() :: %__MODULE__{locations: [Location.t()]}
@doc """
Create a UBootEnv.Config from a file (`/etc/fw_env.config` by default)
This file shou... | lib/uboot_env/config.ex | 0.870322 | 0.683155 | config.ex | starcoder |
defmodule CSV.Parser do
alias CSV.Parser.SyntaxError
@moduledoc ~S"""
The CSV Parser module - parses tokens coming from the lexer and parses them
into a row of fields.
"""
@doc """
Parses tokens by receiving them from a sender / lexer and sending them to
the given receiver process (the decoder).
##... | data/web/deps/csv/lib/csv/parser.ex | 0.749729 | 0.500305 | parser.ex | starcoder |
defmodule AWS.Textract do
@moduledoc """
Amazon Textract detects and analyzes text in documents and converts it into
machine-readable text. This is the API reference documentation for Amazon
Textract.
"""
@doc """
Analyzes an input document for relationships between detected items.
The types of infor... | lib/aws/generated/textract.ex | 0.913571 | 0.793146 | textract.ex | starcoder |
defmodule Votr.Identity.Totp do
@moduledoc """
Time-based one-time passwords may be by election officials as a form of MFA to log in.
"""
@config Application.get_env(:votr, Votr.Identity.Totp)
@issuer @config[:issuer]
@algorithm @config[:algorithm]
@digits @config[:digits]
@period @config[:period]
@s... | lib/votr/identity/totp.ex | 0.610105 | 0.409634 | totp.ex | starcoder |
defmodule EnumTransform do
@moduledoc """
Transforms enums if the enum field extension is present. Accepted values are lowercase, deprefix,
and atomize. Atomize is an alias for deprefix and lowercase.
"""
require Protobuf.Decoder
require Logger
import Protobuf.Decoder, only: [decode_zigzag: 1]
@type t... | lib/protobuf/extype/enum_transform.ex | 0.608594 | 0.516413 | enum_transform.ex | starcoder |
defmodule Day8 do
alias Day8.Program
def from_file(path) do
File.read!(path)
end
def parse(input) do
input
|> String.split("\n", trim: true)
|> Enum.map(&String.split/1)
|> Enum.map(fn [op, arg] -> {op, String.to_integer(arg)} end)
|> Enum.zip(Stream.iterate(0, &(&1 + 1)))
|> Enum.... | lib/day8.ex | 0.53777 | 0.405625 | day8.ex | starcoder |
defmodule GverDiff.OptionComparer do
@spec compare?(Compares.t() | TypeAndCompares.t(), any) :: boolean
def compare?(%Compares{:base => base, :target => target}, nil) do
cond do
get_type(base) === get_type(target) -> base < target
true -> false
end
end
def compare?(%Compares{:base => base, ... | lib/gver_diff/option_comparer.ex | 0.58261 | 0.488649 | option_comparer.ex | starcoder |
defmodule Sanbase.Billing.Plan.CustomAccess do
@moduledoc ~s"""
Provide per-query custom access configuration.
Some queries have custom access logic. For example for Token Age Consumed
we're showing everything except the last 30 days for free users.
In order to add a new custom metric the description must b... | lib/sanbase/billing/plan/custom_access.ex | 0.88306 | 0.459743 | custom_access.ex | starcoder |
defmodule Base.Source do
alias Membrane.Buffer
alias Membrane.Time
@message :crypto.strong_rand_bytes(1000)
@interval 10
defmacro __using__(_opts) do
quote do
use Membrane.Source
import Base.Source, only: [def_options_with_default: 1, def_options_with_default: 0]
end
end
defmacro de... | lib/Base/Source.ex | 0.711732 | 0.419945 | Source.ex | starcoder |
defmodule Forth do
defstruct stack: [], words: %{}
defguard is_operator(x) when x in ["+", "-", "*", "/"]
@opaque evaluator :: %Forth{}
defp digit?(s), do: s =~ ~r/^[[:digit:]]+$/
@doc """
Create a new evaluator.
"""
@spec new() :: evaluator
def new, do: %Forth{}
@doc """
Evaluate an input stri... | elixir/forth/lib/forth.ex | 0.675872 | 0.539529 | forth.ex | starcoder |
defmodule FexrYahoo do
@moduledoc """
Documentation for FexrYahoo.
"""
@doc """
Gets the exchange rate.
an options is provided to select symbols, default is set to all available symbols
## Symbols
* if used only returns exchange rates for the selected symbols
## Examples
iex> FexrYahoo.rat... | lib/fexr_yahoo.ex | 0.712032 | 0.545709 | fexr_yahoo.ex | starcoder |
defmodule Disco.EventConsumer do
@moduledoc """
The event consumer specification.
An event consumer in `Disco` is a module that exposes a `process/1` function to handle
a given set of event types. The common use cases are _projections_ and _policies_.
### Projections
A projection is the component that bu... | lib/disco/event_consumer.ex | 0.854308 | 0.839142 | event_consumer.ex | starcoder |
defmodule TILEX.Benchmarking do
@moduledoc """
Understanding how to benchmark in Elixir with Beenchee:
A library for easy and nice (micro) benchmarking in Elixir
"""
@doc ~S"""
Returns the count of `str_char` items in the given `string`.
It uses a Regular Expression (`Regex.scan/3`) as the main algorith... | lib/benchmarking.ex | 0.860486 | 0.593374 | benchmarking.ex | starcoder |
defmodule ExContract.CompileState do
@moduledoc """
This module is not meant to be used directly by client code. This module holds compilation state
for `ExContract`. Stores each condition and optional message in corresponding requires or ensures
lists.
"""
alias ExContract.ConditionMsg
@spec append(ite... | lib/ex_contract/compile_state.ex | 0.858422 | 0.406155 | compile_state.ex | starcoder |
defmodule ExBencode do
@external_resource readme = "README.md"
@moduledoc readme
|> File.read!()
|> String.split("<!--MDOC !-->")
|> Enum.fetch!(1)
def encode!(t) do
case encode(t) do
{:ok, b} -> b
{:error, reason} -> raise reason
end
end
def decode... | lib/ex_bencode.ex | 0.751375 | 0.437824 | ex_bencode.ex | starcoder |
defmodule Cog.Events.PipelineEvent do
@moduledoc """
Encapsulates information about command pipeline execution
events. Each event is a map; all events share a core set of fields,
while each event sub-type will have an additional set of fields
particular to that sub-type.
# Common Fields
* `pipeline_id`:... | lib/cog/events/pipeline_event.ex | 0.910962 | 0.686278 | pipeline_event.ex | starcoder |
defmodule Absinthe.Type.BuiltIns.Scalars do
use Absinthe.Schema.Notation
@moduledoc false
alias Absinthe.Flag
scalar :integer, name: "Int" do
description """
The `Int` scalar type represents non-fractional signed whole numeric
values. Int can represent values between `-(2^53 - 1)` and `2^53 - 1` ... | lib/absinthe/type/built_ins/scalars.ex | 0.860457 | 0.719236 | scalars.ex | starcoder |
defmodule Dealer do
@moduledoc """
This will simulate the dealer in the war game
"""
@doc """
Starts the war game
"""
def start do
deck = Deck.build |> shuffle
{hand1, hand2} = Enum.split(deck, trunc(Enum.count(deck) / 2))
p1 = spawn(Player, :start, [hand1])
p2 = spawn(Player, :start, [ha... | chapter9/dealer.ex | 0.619011 | 0.524151 | dealer.ex | starcoder |
defmodule FCInventory.Transaction do
@moduledoc false
use TypedStruct
use FCBase, :aggregate
alias Decimal, as: D
alias FCInventory.{
TransactionDrafted,
TransactionPrepared,
TransactionUpdated,
TransactionDeleted,
TransactionPrepRequested,
TransactionPrepFailed,
TransactionCommi... | services/fc_inventory/lib/fc_inventory/aggregates/transaction.ex | 0.734881 | 0.452778 | transaction.ex | starcoder |
defmodule MatrixSDK.Client do
@moduledoc """
Provides functions to make HTTP requests to a Matrix homeserver using the
`MatrixSDK.Client.Request` and `MatrixSDK.HTTPClient` modules.
## 3PID API flows
See this [gist](https://gist.github.com/jryans/839a09bf0c5a70e2f36ed990d50ed928) for more details.
Flow 1... | lib/matrix_sdk/client.ex | 0.927417 | 0.487124 | client.ex | starcoder |
defmodule Hangman.Pass.Stub do
@moduledoc false
# Stub module to mimic `Pass` functionality
# Provides a scaffold implementation
# to provide simple, predictable behavior
alias Hangman.{Pass, Reduction, Counter}
@doc """
Stub Routine retrieves stub pass tally given game start pass key
"""
@spec ... | lib/hangman/pass_stub.ex | 0.735167 | 0.501221 | pass_stub.ex | starcoder |
defmodule OMG.ChildChain.FeeServer do
@moduledoc """
Maintains current fee rates and tokens in which fees may be paid.
Periodically updates fees information from an external source (defined in config
by fee_adapter).
Fee's file parsing and rules of transaction's fee validation are in `OMG.Fees`
"""
use... | apps/omg_child_chain/lib/omg_child_chain/fee_server.ex | 0.808899 | 0.407157 | fee_server.ex | starcoder |
defmodule ESpec.Let do
@moduledoc """
Defines 'let', 'let!' and 'subject' macros.
'let' and 'let!' macros define named functions with cached return values.
The 'let' evaluate block in runtime when called first time.
The 'let!' evaluates as a before block just after all 'befores' for example.
The 'subject' m... | lib/espec/let/let.ex | 0.742141 | 0.559892 | let.ex | starcoder |
defmodule Gettext.Plural do
@moduledoc """
Behaviour and default implementation for finding plural forms in given
locales.
This module both defines the `Gettext.Plural` behaviour and provides a default
implementation for it.
## Plural forms
> For a given language, there is a grammatical rule on how to ... | lib/gettext/plural.ex | 0.910002 | 0.623033 | plural.ex | starcoder |
defmodule Mix.SCM do
use Behaviour
@type opts :: Keyword.t
@moduledoc """
This module provides helper functions and defines the
behaviour required by any SCM used by mix.
"""
@doc """
Returns a boolean if the dependency can be fetched
or it is meant to be previously available in the filesystem.
"... | lib/mix/lib/mix/scm.ex | 0.87578 | 0.578389 | scm.ex | starcoder |
defmodule Distance.GreatCircle do
@moduledoc ~S"""
Calculate great circle distances (shortest travel distance on the surface of
a spherical Earth) given a two longitude-latitude pairs. This is an implementation
of the [Haversine formula](https://en.wikipedia.org/wiki/Haversine_formula)
and approximates using... | lib/distance/great_circle.ex | 0.950664 | 0.918151 | great_circle.ex | starcoder |
defmodule Docraptorx do
@moduledoc """
Docraptor API client for Elixir.
```elixir
Docraptorx.configure("your api key")
Docraptorx.create!(document_type: "pdf",
document_content: "<html><body>Hello World!</body></html>",
name: "hello.pdf",
async:... | lib/docraptorx.ex | 0.629661 | 0.574783 | docraptorx.ex | starcoder |
defmodule Engine.DB.Output do
@moduledoc """
Ecto schema for Outputs in the system. The Output can exist in two forms:
* Being built, as a new unspent output (Output). Since the blocks have not been formed, the full output position
information does not exist for the given Output. We only really know the oindex... | apps/engine/lib/engine/db/output.ex | 0.8586 | 0.733213 | output.ex | starcoder |
defmodule Prismic.SearchForm do
require Logger
@moduledoc """
a submittable form comprised of an api, a prismic form, and data (queries, ref)
"""
alias Prismic.{API, Form, Parser, Predicate, Ref, SearchForm}
defstruct [:api, :form, :data]
@type t :: %__MODULE__{
api: API.t(),
form: ... | lib/search_form.ex | 0.704668 | 0.401541 | search_form.ex | starcoder |
defmodule Datapio.Controller do
@moduledoc """
Behaviour used to implement a Kubernetes operator.
Example:
```elixir
defmodule MyApp.MyOperator do
use Datapio.Controller,
api_version: "v1"
kind: "Pod"
@impl true
def add(pod, _opts) do
:ok
end
@impl true
def modify... | apps/datapio_controller/lib/datapio_controller.ex | 0.916381 | 0.593609 | datapio_controller.ex | starcoder |
defmodule Livebook.FileSystem.Local do
@moduledoc false
# File system backed by local disk.
defstruct [:default_path]
alias Livebook.FileSystem
@type t :: %__MODULE__{
default_path: FileSystem.path()
}
@doc """
Returns a new file system struct.
## Options
* `:default_path` -... | lib/livebook/file_system/local.ex | 0.652684 | 0.412471 | local.ex | starcoder |
defmodule Mongo.BulkOps do
@moduledoc """
This module defines bulk operation for insert, update and delete. A bulk operation is a tupel of two elements
1. an atom, which specify the type `:insert`, `:update` and `:delete`
2. a document or another tupel which contains all parameters of the operation.
You us... | lib/mongo/bulk_ops.ex | 0.88662 | 0.919426 | bulk_ops.ex | starcoder |
defmodule ElixirRigidPhysics.Dynamics.Body do
@moduledoc """
Module to handle bodies, the fundamental unit of physics in ERP.
"""
alias Graphmath.Quatern
alias Graphmath.Vec3
alias ElixirRigidPhysics.Geometry
require Record
Record.defrecord(:body,
shape: nil,
mass: 0.0,
position: {0.0, 0.0... | lib/dynamics/body.ex | 0.905608 | 0.616921 | body.ex | starcoder |
import TypeClass
defclass Witchcraft.Semigroupoid do
@moduledoc """
A semigroupoid describes some way of composing morphisms on between some
collection of objects.
## Type Class
An instance of `Witchcraft.Semigroupoid` must define `Witchcraft.Semigroupoid.compose/2`.
Semigroupoid [compose/2]
"""
... | lib/witchcraft/semigroupoid.ex | 0.756987 | 0.577883 | semigroupoid.ex | starcoder |
defmodule JSON.LD.Utils do
alias RDF.IRI
@doc """
Resolves a relative IRI against a base IRI.
as specified in [section 5.1 Establishing a Base URI of RFC3986](http://tools.ietf.org/html/rfc3986#section-5.1).
Only the basic algorithm in [section 5.2 of RFC3986](http://tools.ietf.org/html/rfc3986#section-5.2)... | lib/json/ld/utils.ex | 0.826327 | 0.568206 | utils.ex | starcoder |
defmodule Pummpcomm.History.AlarmPump do
@moduledoc """
An alarm raised by the pump about its internal operations.
"""
alias Pummpcomm.DateDecoder
@behaviour Pummpcomm.History.Decoder
# Types
@typedoc """
An alarm raised by the pump about its internal operations.
* `:battery_out_limit_exceeded` -... | lib/pummpcomm/history/alarm_pump.ex | 0.816626 | 0.501709 | alarm_pump.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.