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 Deckhub.Hearthstone.Card do
@moduledoc """
Represents an individual Hearthstone card.
* `armor` -- Armor value of the card, specific to [Hero cards][hero-cards]
* `artist` -- Name of the artist or artists that designed the card's art
* `attack` -- Amount of damage the card causes when used to attac... | lib/deckhub/hearthstone/card.ex | 0.850949 | 0.625924 | card.ex | starcoder |
defmodule Pastelli do
require Logger
@moduledoc """
Adapter interface to the Elli webserver.
## Options
* `:ip` - the ip to bind the server to.
Must be a tuple in the format `{x, y, z, w}`.
* `:port` - the port to run the server.
Defaults to 4000 (http)
* `:acceptors` - the number of acceptors... | lib/pastelli.ex | 0.815416 | 0.493714 | pastelli.ex | starcoder |
defmodule Day13.Redo do
def part1(file_name \\ "test.txt") do
file_name
|> parse()
|> grab_first_fold()
|> fold()
|> MapSet.size()
end
def part2(file_name \\ "test.txt") do
file_name
|> parse()
|> fold()
|> print_format()
|> IO.puts()
end
def print_format(coords) do
... | jpcarver+elixir/day13/lib/da13.redo.ex | 0.578329 | 0.453443 | da13.redo.ex | starcoder |
defmodule Artemis.Helpers.Schedule do
@moduledoc """
Helper functions for Schedules
Implemented using Cocktail: https://github.com/peek-travel/cocktail
Documentation: https://hexdocs.pm/cocktail/
"""
@doc """
Encode Cocktail.Schedule struct as iCal string
Takes an existing Cocktail.Schedule struct or... | apps/artemis/lib/artemis/helpers/schedule.ex | 0.881436 | 0.543469 | schedule.ex | starcoder |
defmodule AWS.WAFV2 do
@moduledoc """
This is the latest version of the **AWS WAF** API, released in November, 2019.
The names of the entities that you use to access this API, like endpoints and
namespaces, all have the versioning information added, like "V2" or "v2", to
distinguish from the prior version. ... | lib/aws/generated/waf_v2.ex | 0.887089 | 0.571587 | waf_v2.ex | starcoder |
defmodule EQRCode.Encode do
@moduledoc """
Data encoding in Byte Mode.
"""
import Bitwise
@byte_mode 0b0100
@pad <<236, 17>>
@capacity_l [0, 17, 32, 53, 78, 106, 134, 154]
@ecc_l %{
1 => 19,
2 => 34,
3 => 55,
4 => 80,
5 => 108,
6 => 136,
7 => 156
}
@mask0 <<0x9999999999... | lib/eqrcode/encode.ex | 0.6705 | 0.44559 | encode.ex | starcoder |
defmodule Sentry.Client do
@behaviour Sentry.HTTPClient
@moduledoc ~S"""
This module is the default client for sending an event to Sentry via HTTP.
It makes use of `Task.Supervisor` to allow sending tasks synchronously or asynchronously, and defaulting to asynchronous. See `Sentry.Client.send_event/2` for mor... | lib/sentry/client.ex | 0.876944 | 0.454835 | client.ex | starcoder |
defmodule SymbolicExpression.Parser do
alias SymbolicExpression.Parser.State
require Logger
@whitespace [?\n, ?\s, ?\t]
@end_comment [?\n]
@string_terminals [?"]
@escaped_characters [?"]
@doc """
Parses an s-expression held in a string. Returns `{:ok, result}` on success,
`{:error, reason}` when the... | lib/symbolic_expression/parser.ex | 0.752286 | 0.60542 | parser.ex | starcoder |
defmodule TheFuzz.Util do
@moduledoc """
Utilities for TheFuzz.
"""
@doc """
Finds the length of a string in a less verbose way.
## Example
iex> TheFuzz.Util.len("Jason")
5
"""
def len(value), do: String.length(value)
@doc """
Checks to see if a string is alphabetic.
## Example
... | lib/the_fuzz/util.ex | 0.747339 | 0.416174 | util.ex | starcoder |
defmodule CosmosDbEx.Response do
@moduledoc """
Formatted response from CosmosDb.
## Request Charge
This is the R/U (Request Unit) charge that the query cost to return the response from Cosmos Db.
In other words, this was the cost of all the database operations that had to happen in order
for CosmosDb to ... | lib/cosmos_db_ex/response.ex | 0.859487 | 0.423995 | response.ex | starcoder |
defmodule Edeliver.Relup.Instructions.ResumeChannels do
@moduledoc """
This upgrade instruction resumes the websocket processes
connected to phoenix channels when the upgrade is done
to continue handling channel events. Use this instruction
at the end of the upgrade modification if the
`Edeliver.R... | lib/edeliver/relup/instructions/resume_channels.ex | 0.696681 | 0.436742 | resume_channels.ex | starcoder |
defmodule Scenic.Primitive.Group do
@moduledoc """
A container to hold other primitives.
Any styles placed on a group will be inherited by the primitives in the
group. Any transforms placed on a group will be multiplied into the transforms
in the primitives in the group.
## Data
`uids`
The data fo... | lib/scenic/primitive/group.ex | 0.788217 | 0.442516 | group.ex | starcoder |
defmodule PixelFont.TableSource.Glyf.Item do
alias PixelFont.Glyph
alias PixelFont.Glyph.{BitmapData, CompositeData}
alias PixelFont.TableSource.Glyf.Simple
alias PixelFont.TableSource.Glyf.Composite
defstruct ~w(num_of_contours xmin ymin xmax ymax description)a
@type t :: %__MODULE__{
num_of_co... | lib/pixel_font/table_source/glyf/item.ex | 0.76555 | 0.403596 | item.ex | starcoder |
defmodule Plymio.Funcio.Index do
@moduledoc ~S"""
Utility Functions for Indices
## Documentation Terms
See also `Plymio.Funcio` for an overview and other documentation terms.
### *index*
An *index* is an integer
### *indices*
An *indices* is a list of *index*
### *index range*
An *index rang... | lib/funcio/index/index.ex | 0.906866 | 0.501404 | index.ex | starcoder |
defmodule Milkpotion.Request do
@moduledoc """
This module is the main entry point for issuing requests to the
_Remember the Milk_ service. It rate-limits any request (if necessary)
and also ensures a proper error handling.
"""
require Logger
alias Milkpotion.Base.RateLimiter
@doc """
Issues a GET re... | lib/milkpotion/request.ex | 0.827096 | 0.41938 | request.ex | starcoder |
defmodule ABCI.Types.Timestamp do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
seconds: integer,
nanos: integer
}
defstruct [:seconds, :nanos]
field :seconds, 1, type: :int64
field :nanos, 2, type: :int32
end
defmodule ABCI.Types.KVPair do
@moduledo... | lib/abci/types/types.pb.ex | 0.805135 | 0.491334 | types.pb.ex | starcoder |
defmodule Supervisor.Spec do
@moduledoc """
Convenience functions for defining a supervision specification.
## Example
By using the functions in this module one can define a supervisor
and start it with `Supervisor.start_link/2`:
import Supervisor.Spec
children = [
worker(MyWorker, [ar... | lib/elixir/lib/supervisor/spec.ex | 0.823151 | 0.672251 | spec.ex | starcoder |
defmodule Primes do
@moduledoc """
This module defines functions for working with prime numbers.
"""
def is_prime(n), do: is_prime(n, stream())
def is_prime(2, _primes), do: true
def is_prime(n, _primes) when n < 2, do: false
def is_prime(n, primes) do
Enum.find_value(primes, false, fn p ->
c... | lib/primes.ex | 0.770162 | 0.542621 | primes.ex | starcoder |
defmodule Resourceful.Error do
@moduledoc """
Errors in `Resourceful` follow a few conventions. This module contains
functions to help work with those conventions. Client-facing errors are
loosely inspired by and should be easily converted to [JSON:API-style
errors](https://jsonapi.org/format/#errors), howeve... | lib/resourceful/error.ex | 0.937204 | 0.665461 | error.ex | starcoder |
defmodule Exchange.Trade do
@moduledoc """
Placeholder to define trades
"""
alias Exchange.Order
defstruct trade_id: UUID.uuid1(),
ticker: nil,
currency: nil,
buyer_id: nil,
seller_id: nil,
buy_order_id: nil,
sell_order_id: nil,
... | lib/exchange/trade.ex | 0.810966 | 0.401306 | trade.ex | starcoder |
defmodule Ecto.Query.Util do
@moduledoc """
This module provide utility functions on queries.
"""
alias Ecto.Query
@doc """
Look up a source with a variable.
"""
def find_source(sources, {:&, _, [ix]}) when is_tuple(sources) do
elem(sources, ix)
end
def find_source(sources, {:&, _, [ix]}) whe... | lib/ecto/query/util.ex | 0.853303 | 0.486758 | util.ex | starcoder |
defmodule Leaderboard do
@moduledoc ~S"""
The implementation of leaderboard (rank table) based on ETS tables.
It associates a key with a score and orders these records according to the
score. The score can be any term.
The leaderboard provides an API for inserting and deleting records as well
as functions... | lib/leaderboard.ex | 0.811452 | 0.577793 | leaderboard.ex | starcoder |
defmodule Canvas.Resources.Courses do
@moduledoc """
Provides functions to interact with the
[course endpoints](https://canvas.instructure.com/doc/api/courses).
"""
alias Canvas.{Client, Response}
alias Canvas.Resources.{Account, Course, EnrollmentTerm}
def list_your_courses() do
end
def list_cours... | lib/canvas/resources/courses.ex | 0.812459 | 0.523359 | courses.ex | starcoder |
defmodule Comeonin.Pbkdf2 do
@moduledoc """
Pbkdf2 is a password-based key derivation function
that uses a password, a variable-length salt and an iteration
count and applies a pseudorandom function to these to
produce a key.
The original implementation used SHA-1 as the pseudorandom function,
but this v... | deps/comeonin/lib/comeonin/pbkdf2.ex | 0.809427 | 0.515498 | pbkdf2.ex | starcoder |
defmodule Prometheus.InvalidValueError do
@moduledoc """
Raised when given `value` is invalid i.e. when you pass a negative number to
`Prometheus.Metric.Counter.inc/2`.
"""
defexception [:value, :orig_message]
def message(%{value: value, orig_message: message}) do
"Invalid value: #{inspect(value)} (#{m... | astreu/deps/prometheus_ex/lib/prometheus/error.ex | 0.84412 | 0.479565 | error.ex | starcoder |
defmodule SanbaseWeb.Graphql.Resolvers.EtherbiResolver do
require Logger
alias Sanbase.Model.{Infrastructure, ExchangeAddress}
@doc ~S"""
Return the token age consumed for the given slug and time period.
"""
def token_age_consumed(
_root,
%{slug: _slug, from: _from, to: _to, interval: _int... | lib/sanbase_web/graphql/resolvers/etherbi_resolver.ex | 0.812161 | 0.429728 | etherbi_resolver.ex | starcoder |
defmodule Frame do
defstruct type: :scored, rolls: []
end
defmodule BowlingGame do
defstruct frames: []
end
defmodule BowlingKata do
def parse_input(""), do: []
def parse_input(:nil), do: []
def parse_input(rolls) do
rolls
|> String.upcase
|> String.graphemes
|> parse_frame(%BowlingGa... | lib/bowling_kata.ex | 0.545286 | 0.718965 | bowling_kata.ex | starcoder |
defmodule MangoPay.User do
@moduledoc """
Functions for MangoPay [client](https://docs.mangopay.com/endpoints/v2.01/users#e253_the-user-object).
"""
use MangoPay.Query.Base
set_path "users"
@doc """
Get a user.
## Examples
{:ok, user} = MangoPay.User.get(id)
"""
def get id do
_get id
... | lib/mango_pay/user.ex | 0.718989 | 0.439928 | user.ex | starcoder |
defmodule Phoenix.Logger do
@moduledoc """
Instrumenter to handle logging of various instrumentation events.
## Instrumentation
Phoenix uses the `:telemetry` library for instrumentation. The following events
are published by Phoenix with the following measurements and metadata:
* `[:phoenix, :endpoint,... | lib/phoenix/logger.ex | 0.876694 | 0.551151 | logger.ex | starcoder |
defmodule Lob do
require Chacha20
@moduledoc """
Length-Object-Binary (LOB) Packet Encoding
Data serialization, primarily in use by the [Telehash Project](http://telehash.org)
"""
@type maybe_binary :: binary | nil
@doc """
Decode a wire packet for consumption
The parts are returned in a struct c... | lib/lob.ex | 0.854126 | 0.457864 | lob.ex | starcoder |
defmodule Google.Protobuf.Api do
@moduledoc false
alias Pbuf.Decoder
import Bitwise, only: [bsr: 2, band: 2]
@derive Jason.Encoder
defstruct [
name: "",
methods: [],
options: [],
version: "",
source_context: nil,
mixins: [],
syntax: 0
]
@type t :: %__MODULE__{
name: String... | lib/protoc/google/protobuf/api.pb.ex | 0.748536 | 0.663955 | api.pb.ex | starcoder |
defmodule Membrane.RTP.H264.NAL.Header do
@moduledoc """
Defines a structure representing Network Abstraction Layer Unit Header
Defined in [RFC 6184](https://tools.ietf.org/html/rfc6184#section-5.3)
```
+---------------+
|0|1|2|3|4|5|6|7|
+-+-+-+-+-+-+-+-+
|F|NRI| Type |
+--------------... | lib/rtp_h264/nal_header.ex | 0.837786 | 0.932944 | nal_header.ex | starcoder |
defmodule Kino.Frame do
@moduledoc """
A widget wrapping a static output.
This widget serves as a placeholder for a regular output,
so that it can be dynamically replaced at any time.
Also see `Kino.animate/3` which offers a convenience on
top of this widget.
## Examples
widget = Kino.Frame.new(... | lib/kino/frame.ex | 0.890464 | 0.623076 | frame.ex | starcoder |
defmodule Tirexs.Resources do
@moduledoc """
The intend is to provide an abstraction for dealing with ES resources.
The interface of this module is aware about elasticsearch REST APIs conventions.
Meanwhile, a `Tirexs.HTTP` provides just a general interface.
"""
import Tirexs.HTTP
@doc "the same as `... | lib/tirexs/resources.ex | 0.742141 | 0.479016 | resources.ex | starcoder |
defmodule AWS.DynamoDB do
@moduledoc """
Amazon DynamoDB
Amazon DynamoDB is a fully managed NoSQL database service that provides fast and
predictable performance with seamless scalability.
DynamoDB lets you offload the administrative burdens of operating and scaling a
distributed database, so that you do... | lib/aws/generated/dynamodb.ex | 0.925638 | 0.568176 | dynamodb.ex | starcoder |
defmodule Snitch.Tools.Helper.Zone do
@moduledoc """
Test helpers to insert zones and zone members.
"""
alias Snitch.Data.Schema.{Country, CountryZoneMember, State, StateZoneMember, Zone}
alias Snitch.Core.Tools.MultiTenancy.Repo
@zone %{
name: nil,
description: nil,
zone_type: nil,
insert... | apps/snitch_core/lib/core/tools/helpers/zone.ex | 0.792062 | 0.593109 | zone.ex | starcoder |
defmodule Tirexs.Query do
#http://www.elasticsearch.org/guide/reference/query-dsl/
@moduledoc false
import Tirexs.DSL.Logic
import Tirexs.Query.Logic
import Tirexs.ElasticSearch
require Record
Record.defrecord :record_result, [count: 0, max_score: nil, facets: [], hits: [], _scroll_id: nil, aggregation... | lib/tirexs/query.ex | 0.545286 | 0.511046 | query.ex | starcoder |
defmodule Legend.Hook do
@moduledoc """
"""
alias Legend.{Event, Stage, Utils}
@typedoc """
"""
@type hook_state :: term
@typedoc """
"""
@type hook_result ::
:ok |
{:ok, hook_state} |
{:error, reason :: term} |
{:error, reason :: term, hook_state}
@typedoc """
"""
@type hook... | lib/legend/hook.ex | 0.718792 | 0.426859 | hook.ex | starcoder |
defimpl Timex.Protocol, for: Date do
@moduledoc """
This module represents all functions specific to creating/manipulating/comparing Dates (year/month/day)
"""
use Timex.Constants
import Timex.Macros
alias Timex.Types
@epoch_seconds :calendar.datetime_to_gregorian_seconds({{1970, 1, 1}, {0, 0, 0}})
@... | lib/date/date.ex | 0.8119 | 0.677161 | date.ex | starcoder |
defmodule Expublish.Options do
@moduledoc """
Validate and parse mix task arguments.
"""
require Logger
@defaults %{
allow_untracked: false,
as_major: false,
as_minor: false,
changelog_date_time: false,
disable_publish: false,
disable_push: false,
disable_test: false,
dry_run... | lib/expublish/options.ex | 0.72331 | 0.584775 | options.ex | starcoder |
defmodule State.Prediction do
@moduledoc "State for Predictions"
use State.Server,
indices: [:stop_id, :trip_id, :route_id, :route_pattern_id],
parser: Parse.TripUpdates,
recordable: Model.Prediction,
hibernate: false
@doc """
Selects a distinct group of Prediction state sources, with filtering... | apps/state/lib/state/prediction.ex | 0.730866 | 0.491273 | prediction.ex | starcoder |
defmodule Cloudinary.Format do
@moduledoc """
The cloudinary supported formats of images, videos and audios.
## Official documentation
* https://cloudinary.com/documentation/image_transformations#supported_image_formats
* https://cloudinary.com/documentation/video_manipulation_and_delivery#supported_video_for... | lib/cloudinary/format.ex | 0.780997 | 0.473353 | format.ex | starcoder |
defmodule Membrane.WAV.Serializer do
@moduledoc """
Element responsible for raw audio serialization to WAV format.
Creates WAV header (its description can be found with `Membrane.WAV.Parser`) from received caps
and puts it before audio samples. The element assumes that audio is in PCM format. `File length`
a... | lib/membrane_wav/serializer.ex | 0.911967 | 0.474327 | serializer.ex | starcoder |
defmodule VegaLite do
@moduledoc """
Elixir bindings to [Vega-Lite](https://vega.github.io/vega-lite).
Vega-Lite offers a high-level grammar for composing interactive graphics,
where every graphic is specified in a declarative fashion relying solely
on JSON syntax. To learn more about Vega-Lite please refer ... | lib/vega_lite.ex | 0.855429 | 0.715474 | vega_lite.ex | starcoder |
defmodule Bacen.CCS.Message do
@moduledoc """
The base message from CCS messages.
This part of a XML is required to any message,
requested or received from Bacen's system.
This message has the following XML example:
```xml
<?xml version="1.0"?>
<CCSDOC>
<BCARQ>
<IdentdEmissor>12345678</Iden... | lib/bacen/ccs/message.ex | 0.836955 | 0.495056 | message.ex | starcoder |
defmodule Ibanity.Sandbox.FinancialInstitutionAccount do
@moduledoc """
[Financial institution account](https://documentation.ibanity.com/xs2a/api#financial-institution-account) API wrapper
"""
use Ibanity.Resource
defstruct id: nil,
available_balance: nil,
currency: nil,
... | lib/ibanity/api/sandbox/financial_institution_account.ex | 0.831383 | 0.404802 | financial_institution_account.ex | starcoder |
defmodule Tablespoon.Communicator.Btd do
@moduledoc """
Communication with the Boston Transportation Department (BTD).
The communication is over NTCIP1211 Extended packets.
- group: passed-in
- id: always 0
- id in message: increases with each request, up to 255 where it wraps back to 1
- vehicle_id: th... | lib/tablespoon/communicator/btd.ex | 0.831074 | 0.406214 | btd.ex | starcoder |
alias Graphqexl.Schema
alias Graphqexl.Utils.FakeData
defmodule Graphqexl.Schema.Executable do
@moduledoc """
Establishes a `GenServer` to cache the loadedGraphQL schema.
Future improvement: use the GenServer as a basis for hot-reloading
"""
require Logger
use GenServer
# TODO: pull schema_path from th... | lib/graphqexl/schema/executable.ex | 0.663451 | 0.418548 | executable.ex | starcoder |
defmodule VectorClock do
@moduledoc """
Elixir implementation of vector clocks.
## About
Vector clocks are used in distributed systems as a way of maintaining a
logical ordering of events. A vector clock consists of a list of dots,
which each dot representing a node in a distributed system. A dot consists... | lib/vector_clock.ex | 0.922058 | 0.790207 | vector_clock.ex | starcoder |
defmodule BroadwayRabbitMQ.AmqpClient do
@moduledoc false
alias AMQP.{
Connection,
Channel,
Basic,
Queue
}
require Logger
@behaviour BroadwayRabbitMQ.RabbitmqClient
@connection_opts_schema [
username: [type: :any],
password: [type: :any],
virtual_host: [type: :any],
host:... | lib/broadway_rabbitmq/amqp_client.ex | 0.850344 | 0.521288 | amqp_client.ex | starcoder |
defmodule ExRabbitMQ.Producer do
@moduledoc """
A behaviour module that abstracts away the handling of RabbitMQ connections and channels.
It also provides hooks to allow the programmer to publish a message without having to directly
access the AMPQ interfaces.
For a connection configuration example see `ExR... | lib/ex_rabbit_m_q/producer.ex | 0.91339 | 0.83622 | producer.ex | starcoder |
defmodule RIG.Session do
@moduledoc """
A session is defined by a user's JWT.
Client connections with the same JWT are associated to the same session. That is, if
a user uses the same JWT to connect to RIG multiple times (e.g., using multiple
devices), all of those connections are associated to the same sess... | lib/rig/session.ex | 0.810366 | 0.537102 | session.ex | starcoder |
defmodule Solid.Tag do
@moduledoc """
Control flow tags can change the information Liquid shows using programming logic.
More info: https://shopify.github.io/liquid/tags/control-flow/
"""
alias Solid.{Expression, Argument, Context}
@doc """
Evaluate a tag and return the condition that succeeded or nil
... | lib/solid/tag.ex | 0.69946 | 0.451085 | tag.ex | starcoder |
defmodule Formex.Ecto.ChangesetValidator do
@behaviour Formex.Validator
alias Formex.Form
alias Formex.Field
alias Ecto.Changeset
@moduledoc """
Changeset validator adapter for Formex.
It was created to make use of validation functions included in `Ecto.Changeset`. This module
creates a fake changeset... | lib/changeset_validator.ex | 0.846514 | 0.444444 | changeset_validator.ex | starcoder |
defmodule GGity.Shapes do
@moduledoc false
alias GGity.Draw
@shape_names %{
square_open: 0,
circle_open: 1,
triangle_open: 2,
plus: 3,
cross: 4,
diamond_open: 5,
triangle_down_open: 6,
square_cross: 7,
asterisk: 8,
diamond_plus: 9,
circle_plus: 10,
star: 11,
sq... | lib/ggity/shapes.ex | 0.812272 | 0.401658 | shapes.ex | starcoder |
defmodule GenUtil.KeyVal do
@moduledoc """
Helpers collections of key-value pairs.
"""
@compile {:inline, fetch: 2, fetch!: 2, get: 2, put: 3, delete: 2, has_key?: 2, replace!: 3}
@type key :: term()
@type value :: term()
@typedoc """
A pair of values in a 2-tuple.
"""
@type pair() :: {key(), val... | lib/gen_util/key_val.ex | 0.889102 | 0.592018 | key_val.ex | starcoder |
defmodule Day23 do
def part1(input) do
boot_nics(input) |> simple_nat
end
def part2(input) do
boot_nics(input) |> nat
end
defp boot_nics(input) do
0..49
|> Enum.map(fn address ->
nic = Intcode.new(input)
Intcode.set_sink(nic, self())
send(nic, [address])
Intcode.go(ni... | day23/lib/day23.ex | 0.569733 | 0.447823 | day23.ex | starcoder |
defmodule EWallet.TransactionConsumptionFetcher do
@moduledoc """
Handles any kind of retrieval/fetching for the TransactionConsumptionGate.
All functions here are only meant to load and format data related to
transaction consumptions.
"""
alias EWalletDB.{Transaction, TransactionConsumption}
@spec get... | apps/ewallet/lib/ewallet/fetchers/transaction_consumption_fetcher.ex | 0.817611 | 0.416886 | transaction_consumption_fetcher.ex | starcoder |
defmodule Ctrl do
@tag_op :|
# We will simply transform the AST in the form of a regular `with` call.
defmacro ctrl([{:do, do_block} | else_catch_rescue] = _input) do
# IO.inspect _input
{main_block, meta} =
case do_block do
{:__block__, meta, exprs} when is_list(exprs) ->
{exprs... | lib/ctrl.ex | 0.62395 | 0.500916 | ctrl.ex | starcoder |
defmodule Membrane.Hackney.Sink do
@moduledoc """
An element uploading data over HTTP(S) based on Hackney
"""
use Membrane.Sink
use Membrane.Log, tags: :membrane_hackney_sink
alias Membrane.Buffer
import Mockery.Macro
def_input_pad :input, caps: :any, demand_unit: :bytes
def_options location: [
... | lib/membrane_hackney_plugin/sink.ex | 0.879923 | 0.447641 | sink.ex | starcoder |
defmodule Membrane.Audiometer.Peakmeter do
@moduledoc """
This element computes peaks in each channel of the given signal at
regular time intervals, regardless if it receives data or not.
It uses erlang's `:timer.send_interval/2` which might not provide
perfect accuracy.
It accepts audio samples in any fo... | lib/membrane_element_audiometer/peakmeter.ex | 0.912787 | 0.556008 | peakmeter.ex | starcoder |
defmodule Beamchmark.Suite.Measurements.SchedulerInfo do
@moduledoc """
Module representing different statistics about scheduler usage.
"""
use Bunch.Access
alias Beamchmark.Math
@type sched_usage_t :: %{
(sched_id :: integer()) =>
{util :: float(), percent :: Math.percent_t() | Mat... | lib/beamchmark/suite/measurements/scheduler_info.ex | 0.820541 | 0.530236 | scheduler_info.ex | starcoder |
defmodule Stripe.Account do
@moduledoc """
Work with Stripe account objects.
You can:
- Retrieve your own account
- Retrieve an account with a specified `id`
This module does not yet support managed accounts.
Does not yet render lists or take options.
Stripe API reference: https://stripe.com/docs/a... | lib/stripe/account.ex | 0.548069 | 0.603815 | account.ex | starcoder |
defmodule Geometry.MultiLineStringZ do
@moduledoc """
A set of line-strings from type `Geometry.LineStringZ`
`MultiLineStringMZ` implements the protocols `Enumerable` and `Collectable`.
## Examples
iex> Enum.map(
...> MultiLineStringZ.new([
...> LineStringZ.new([
...> Poin... | lib/geometry/multi_line_string_z.ex | 0.930126 | 0.568775 | multi_line_string_z.ex | starcoder |
defmodule ListToCsv do
@moduledoc """
`ListToCsv` is main module of this library.
"""
alias ListToCsv.Key
alias ListToCsv.Option
@type target() :: map() | struct() | keyword()
@doc """
Returns a list with header and body rows
## Options
See `ListToCsv.Option` for details.
- `:headers` - (list... | lib/list_to_csv.ex | 0.819893 | 0.472866 | list_to_csv.ex | starcoder |
defmodule ForgeAbi.Direction do
@moduledoc false
use Protobuf, enum: true, syntax: :proto3
@type t :: integer | :mutual | :one_way | :union
field :mutual, 0
field :one_way, 1
field :union, 2
end
defmodule ForgeAbi.Validity do
@moduledoc false
use Protobuf, enum: true, syntax: :proto3
@type t :: in... | lib/protobuf/gen/trace_type.pb.ex | 0.821331 | 0.635194 | trace_type.pb.ex | starcoder |
defmodule Patch.Macro do
@doc """
Utility function that acts like `inspect/1` but prints out the Macro as code.
"""
@spec debug(ast :: Macro.t()) :: Macro.t()
def debug(ast) do
ast
|> Macro.to_string()
|> IO.puts()
ast
end
@doc """
Performs an non-hygienic match.
If the match succee... | lib/patch/macro.ex | 0.720958 | 0.514583 | macro.ex | starcoder |
defmodule Radixir.Core.Request.BuildTransaction.Operation.DataObject.TokenData do
@moduledoc false
# @moduledoc """
# Methods to create each map in `TokenData` map.
# """
alias Radixir.StitchPlan
@type stitch_plans :: list(keyword)
@type params :: keyword
@doc """
Generates stitch plan for `type` ma... | lib/radixir/core/request/build_transaction/operation/data_object/token_data.ex | 0.896668 | 0.482673 | token_data.ex | starcoder |
defmodule Chronos do
import Chronos.Validation
@datetime1970 {{1970, 1, 1}, {0, 0, 0}}
@doc """
Chronos is an Elixir library for working with dates and times.
iex(1)> Chronos.today
{2013, 8, 21}
"""
def today, do: :erlang.date
def now, do: :calendar.now_to_datetime(:erlang.timestamp)
@do... | lib/chronos.ex | 0.684791 | 0.652435 | chronos.ex | starcoder |
defmodule EctoBootMigration do
@moduledoc """
Helper module that can be used to easily ensure that Ecto database was
migrated before rest of the application was started.
## Rationale
There are many strategies how to deal with this issue,
e.g. see https://hexdocs.pm/distillery/guides/running_migrations.htm... | lib/ecto_boot_migration.ex | 0.72331 | 0.692135 | ecto_boot_migration.ex | starcoder |
defmodule Expwd.Hashed do
@type t :: %__MODULE__{
alg: atom(),
hash: binary()
}
@enforce_keys [:alg, :hash]
defstruct [:alg, :hash]
@doc """
Securely and randomly generates a new application password
Returns a 2-element tuple containing:
- the plaintext password
- the hashed password encap... | lib/expwd/hashed.ex | 0.927108 | 0.793426 | hashed.ex | starcoder |
defmodule GenRMQ.Consumer.Telemetry do
@moduledoc """
GenRMQ emits [Telemetry][telemetry] events for consumers. It exposes several events for RabbitMQ connections, and message
publishing.
### Connection events
- `[:gen_rmq, :consumer, :connection, :start]` - Dispatched by a GenRMQ consumer when a connection... | lib/gen_rmq/consumer/telemetry.ex | 0.859987 | 0.46721 | telemetry.ex | starcoder |
defmodule ATECC508A.Transport do
@moduledoc """
ATECC508A transport behaviour
"""
@type t :: {module(), any()}
@callback init(args :: any()) :: {:ok, t()} | {:error, atom()}
@callback request(
id :: any(),
payload :: binary(),
timeout :: non_neg_integer(),
... | lib/atecc508a/transport.ex | 0.891448 | 0.402656 | transport.ex | starcoder |
defmodule Neotomex.PEG do
@moduledoc """
# Neotomex.PEG
Implements a PEG specification parser using the internal PEG
specification, and functions for parsing PEG grammars. There
are separate functions for parsing entire grammars or
only expressions.
Neotomex's expressions add onto <NAME>'s original PEG
... | lib/neotomex/peg.ex | 0.671686 | 0.54583 | peg.ex | starcoder |
defmodule Telegex.Marked.Rule do
@moduledoc false
# Node matching and parsing rules.
@type match_status :: :match | :nomatch
@type state :: Telegex.Marked.InlineState.t() | Telegex.Marked.BlockState.t()
defmacro __using__(options) do
makrup = options |> Keyword.get(:mark)
node_type = options |> Keyw... | lib/telegex/marked/rule.ex | 0.656988 | 0.463566 | rule.ex | starcoder |
defmodule Inky.RpiIO do
@moduledoc """
An `Inky.InkyIO` implementation intended for use with raspberry pis and relies on
Circuits.GPIO and Cirtuits.SPI.
"""
@behaviour Inky.InkyIO
alias Inky.InkyIO
defmodule State do
@moduledoc false
@state_fields [
:gpio_mod,
:spi_mod,
:busy... | lib/hal/rpiio.ex | 0.753648 | 0.540499 | rpiio.ex | starcoder |
defmodule GoogleFit.Dataset.Point do
@moduledoc """
This struct represents a datapoint in a dataset
"""
alias GoogleFit.Dataset.{Nutrition, ActivitySummary, NumberSummary, ValueFormatError}
alias GoogleFit.ActivityType
import GoogleFit.Util
@enforce_keys ~w[data_type_name start_time end_time modified_... | lib/google_fit/dataset/point.ex | 0.782704 | 0.54577 | point.ex | starcoder |
defmodule ForgeSdk.Rpc.Stub do
@moduledoc """
Aggregate all RPCs
"""
defdelegate send_tx(chan, req, opts \\ []), to: ForgeAbi.ChainRpc.Stub
defdelegate get_tx(chan, opts \\ []), to: ForgeAbi.ChainRpc.Stub
defdelegate get_unconfirmed_txs(chan, req, opts \\ []), to: ForgeAbi.ChainRpc.Stub
defdelegate get_b... | lib/forge_sdk/rpc/stub.ex | 0.617974 | 0.63696 | stub.ex | starcoder |
defmodule Hypex.Array do
@moduledoc """
This module provides a Hypex register implementation using an Erlang Array under
the hood.
Using an Array switches out the memory efficiency of the Bitstring implementation
for performance, operating at 10x the throughput of Bitstring on updates.
Even though this im... | lib/hypex/array.ex | 0.850794 | 0.816187 | array.ex | starcoder |
defmodule Sherbet.Service.Contact.Communication.Method do
@moduledoc """
Manages the interactions with communication methods.
Communication implementations will implement the given callbacks to handle the
specific communication method.
##Implementing a communication method
Communica... | apps/sherbet_service/lib/sherbet.service/contact/communication/method.ex | 0.917626 | 0.488954 | method.ex | starcoder |
defmodule FlowAssertions.Ecto do
@moduledoc """
This is a library of assertions for code that works with Ecto schemas or changesets. It is built on top of `FlowAssertions`.
1. Making tests easier to scan by capturing frequently-used assertions in
functions that can be used in a pipeline.
This library will ap... | lib/ecto.ex | 0.872741 | 0.925365 | ecto.ex | starcoder |
defmodule Snitch.Domain.Order.DefaultMachine do
@moduledoc """
The (default) Order state machine.
The state machine is describe using DSL provided by `BeepBop`.
Features:
* handle both cash-on-delivery and credit/debit card payments
## Customizing the state machine
There is no DSL or API to change the ... | apps/snitch_core/lib/core/domain/order/default_machine.ex | 0.804175 | 0.950457 | default_machine.ex | starcoder |
defmodule Plaid.LinkToken do
@moduledoc """
[Pliad link token API](https://plaid.com/docs/api/tokens/) calls and schema.
"""
alias Plaid.Castable
alias Plaid.LinkToken.{
DepositSwitch,
Metadata,
PaymentInitiation,
User
}
defmodule CreateResponse do
@moduledoc """
[Plaid API /lin... | lib/plaid/link_token.ex | 0.86009 | 0.4231 | link_token.ex | starcoder |
defmodule Hawk.Client do
@moduledoc """
This module provides functions to create request headers and authenticate response.
## Examples
defmodule Myapp.Hawk do
def request_and_authenticate(uri, credentials) do
result = Hawk.Client.header(uri, :get, credentials)
case :httpc.req... | lib/hawk/client.ex | 0.861261 | 0.41182 | client.ex | starcoder |
defmodule Csvto.Reader do
@type column_def :: nil | Csvto.Field.t
@type context :: %{path: String.t, columns: [column_def], column_count: integer, aggregate_column: column_def, schema: Csvto.Schema.t, fields: %{String.t => Csvto.Field.t}, aggregate_fields: %{String.t => Csvto.Field.t}, unspecified: [Csvto.Field.t... | lib/csvto/reader.ex | 0.720762 | 0.514339 | reader.ex | starcoder |
defmodule Ockam.Channel.XX do
@moduledoc """
Defines the XX Key Agreement protocol.
"""
alias Ockam.Message
alias Ockam.Router
alias Ockam.Vault
defstruct [:vault, :e, :s, :rs, :re, :ck, :k, :n, :h, :prologue]
@protocol_name "Noise_XX_25519_AESGCM_SHA256"
defmacro zero_padded_protocol_name do
q... | implementations/elixir/lib/ockam/channel/xx.ex | 0.776411 | 0.467818 | xx.ex | starcoder |
defmodule Dayron.Model do
@moduledoc """
Defines the functions to convert a module into a Dayron Model.
A Model provides a set of functionalities around mapping the external data
into local structures.
In order to convert an Elixir module into a Model, Dayron provides a
`Dayron.Model` mixin, that requires... | lib/dayron/model.ex | 0.84481 | 0.667193 | model.ex | starcoder |
defmodule Raft.Server do
@moduledoc """
"""
alias Raft.Server.State
@type ref :: atom | {atom, atom} | pid
@doc """
Invoked by leader to replicate log entries (§5.3); also used
as heartbeat (§5.2).
## Arguments
- `ref` - a reference to a Raft server
- `term` - leader’s term
- `leader_id` - so... | lib/raft/server.ex | 0.852291 | 0.673202 | server.ex | starcoder |
defmodule Grizzly.Command do
@moduledoc """
Command is a server managing the overall lifecycle of the execution of a command,
from start to completion or timeout.
When starting the execution of a command, the state of the network is checked to see if it is
in one of the allowed states for executing this part... | lib/grizzly/command.ex | 0.832747 | 0.457985 | command.ex | starcoder |
defmodule Graph.Pathfindings.BellmanFord do
@spec call(Graph.t(), Graph.vertex()) ::
%{
optional(Graph.vertex()) => [Graph.vertex()]
}
| nil
def call(%Graph{vertices: vs, edges: edges} = graph, root) do
predecessors = Map.new()
distances = %{root => 0}
{predece... | lib/graph/pathfindings/bellman_ford.ex | 0.66628 | 0.566019 | bellman_ford.ex | starcoder |
defmodule Asteroid.Token.AccessToken do
import Asteroid.Utils
alias Asteroid.Context
alias Asteroid.Client
alias Asteroid.Crypto
alias Asteroid.Token
@moduledoc """
Access token structure
## Field naming
The `data` field holds the token data. The following field names are standard and are used
by... | lib/asteroid/token/access_token.ex | 0.913235 | 0.48499 | access_token.ex | starcoder |
defmodule Retrieval do
alias Retrieval.Trie
alias Retrieval.PatternParser
@moduledoc """
Provides an interface for creating and collecting data from the trie data structure.
"""
@doc """
Returns a new trie. Providing no arguments creates an empty trie. Optionally a binary or
list of binaries can be p... | lib/retrieval.ex | 0.934035 | 0.699396 | retrieval.ex | starcoder |
defmodule AWS.Rekognition do
@moduledoc """
This is the Amazon Rekognition API reference.
"""
@doc """
Compares a face in the *source* input image with each of the 100 largest faces
detected in the *target* input image.
If the source image contains multiple faces, the service detects the largest
face... | lib/aws/generated/rekognition.ex | 0.960961 | 0.932207 | rekognition.ex | starcoder |
defmodule Plymio.Codi.Pattern.Bang do
@moduledoc ~S"""
The *bang* patterns builds bang functions
(e.g. `myfun!(arg)`) using existing base functions (e.g. `myfun(arg)`).
When the base function returns `{:ok, value}`, the bang
function returns `value`.
If the base function returns `{:error, error}`, the `er... | lib/codi/pattern/bang/bang.ex | 0.894683 | 0.728483 | bang.ex | starcoder |
defmodule Alchemy.Message do
import Alchemy.Structs
alias Alchemy.{User, Attachment, Embed, Reaction, Reaction.Emoji}
@moduledoc """
This module contains the types and functions related to messages in discord.
"""
@type snowflake :: String.t()
@typedoc """
Represents an iso8601 timestamp.
"""
@typ... | lib/Structs/Messages/message.ex | 0.831793 | 0.469034 | message.ex | starcoder |
defmodule Brex.Result.Helpers do
@moduledoc """
Tools for modifying the reason in `error` tuples.
"""
import Brex.Result.Base
alias Brex.Result.Base
require Logger
@type s(x) :: Base.s(x)
@type t(x) :: Base.t(x)
@type p() :: Base.p()
@type s() :: Base.s()
@type t() :: Base.t()
@doc """
Wr... | lib/result/helpers.ex | 0.850065 | 0.511656 | helpers.ex | starcoder |
defmodule Behaviour do
@moduledoc """
Utilities for defining behaviour interfaces.
Behaviours can be referenced by other modules
to ensure they implement required callbacks.
For example, you can specify the `URI.Parser`
behaviour as follows:
defmodule URI.Parser do
use Behaviour
@d... | lib/elixir/lib/behaviour.ex | 0.782787 | 0.436862 | behaviour.ex | starcoder |
defmodule Plaid.Transactions do
@moduledoc """
Functions for Plaid `transactions` endpoint.
"""
import Plaid, only: [make_request_with_cred: 4, validate_cred: 1]
alias Plaid.Utils
@derive Jason.Encoder
defstruct accounts: [], item: nil, total_transactions: nil, transactions: [], request_id: nil
@typ... | lib/plaid/transactions.ex | 0.835886 | 0.466785 | transactions.ex | starcoder |
defmodule Steve.Storage.Ecto do
@moduledoc """
A storage adapter that uses Ecto to interact with a database.
### Configuration
The application must be configured as shown below.
```elixir
config :steve,
[
storage: Steve.Storage.Ecto,
repository: Example.Repo
]
```
... | lib/steve/storage/ecto.ex | 0.854323 | 0.799521 | ecto.ex | starcoder |
defmodule JPMarc.Record do
@moduledoc """
Tools for working with JPMARC Record
"""
import XmlBuilder
alias JPMarc.Leader
alias JPMarc.ControlField
alias JPMarc.DataField
alias JPMarc.SubField
@rs "\x1d" # Record separator
@fs "\x1e" # Field separator
@ss "\x1f" # Subfield separator
@lea... | lib/jpmarc/record.ex | 0.836955 | 0.483953 | record.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.